]> git.cworth.org Git - apitrace/commitdiff
glProgramStringARB
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 24 Nov 2010 08:42:22 +0000 (08:42 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 24 Nov 2010 08:42:22 +0000 (08:42 +0000)
base.py
d3d8types.py
d3d9types.py
ddraw.py
glapi.py
glxtrace.py
log.cpp
log.hpp
wglapi.py
windows.py

diff --git a/base.py b/base.py
index 6b49009c4b505f4bc70ec389828fd3c3f70b4764..c99d065e54086c1c1c6fe6982ca0f1aefd769db7 100644 (file)
--- a/base.py
+++ b/base.py
@@ -415,15 +415,16 @@ def WrapPointer(type):
     return Pointer(type)
 
 
-class _String(Type):
+class String(Type):
 
-    def __init__(self):
+    def __init__(self, length = None):
         Type.__init__(self, "char *")
+        self.length = length
 
     def visit(self, visitor, *args, **kwargs):
         return visitor.visit_string(self, *args, **kwargs)
 
-String = _String()
+CString = String()
 
 
 class Opaque(Type):
index ad8b35b71ab75fca55ebdba5bbd90875612506dd..9f87b8255652e5eae09ee3b47edaf63bb6d72d8b 100644 (file)
@@ -999,8 +999,8 @@ D3DTRIPATCH_INFO = Struct("D3DTRIPATCH_INFO", [
 ])
 
 D3DADAPTER_IDENTIFIER8 = Struct("D3DADAPTER_IDENTIFIER8", [
-    (String, "Driver"),
-    (String, "Description"),
+    (CString, "Driver"),
+    (CString, "Description"),
     (LARGE_INTEGER, "DriverVersion"),
     (DWORD, "VendorId"),
     (DWORD, "DeviceId"),
index e9e128099d8237aef066905c71d388bd5e3d2cab..cef8bd73a840ecb3a63dc49b62f8276da6389b9b 100644 (file)
@@ -1171,9 +1171,9 @@ D3DTRIPATCH_INFO = Struct("D3DTRIPATCH_INFO", [
 ])
 
 D3DADAPTER_IDENTIFIER9 = Struct("D3DADAPTER_IDENTIFIER9", [
-    (String, "Driver"),
-    (String, "Description"),
-    (String, "DeviceName"),
+    (CString, "Driver"),
+    (CString, "Description"),
+    (CString, "DeviceName"),
     (LARGE_INTEGER, "DriverVersion"),
     (DWORD, "VendorId"),
     (DWORD, "DeviceId"),
index bc2065b5fce7c9c14a9268eaa9c094e696e3738a..d04ae90217cb382d00d94e0d49804a1aa7c98732 100644 (file)
--- a/ddraw.py
+++ b/ddraw.py
@@ -485,8 +485,8 @@ DDGAMMARAMP = Struct("DDGAMMARAMP", [
 LPDDGAMMARAMP = Pointer(DDGAMMARAMP)
 
 DDDEVICEIDENTIFIER = Struct("DDDEVICEIDENTIFIER", [
-    (String, "szDriver"),
-    (String, "szDescription"),
+    (CString, "szDriver"),
+    (CString, "szDescription"),
     (LARGE_INTEGER, "liDriverVersion"),
     (DWORD, "dwVendorId"),
     (DWORD, "dwDeviceId"),
@@ -497,8 +497,8 @@ DDDEVICEIDENTIFIER = Struct("DDDEVICEIDENTIFIER", [
 LPDDDEVICEIDENTIFIER = Pointer(DDDEVICEIDENTIFIER)
 
 DDDEVICEIDENTIFIER2 = Struct("DDDEVICEIDENTIFIER2", [
-    (String, "szDriver[MAX_DDDEVICEID_STRING]"),
-    (String, "szDescription[MAX_DDDEVICEID_STRING]"),
+    (CString, "szDriver[MAX_DDDEVICEID_STRING]"),
+    (CString, "szDescription[MAX_DDDEVICEID_STRING]"),
     (LARGE_INTEGER, "liDriverVersion"),
     (DWORD, "dwVendorId"),
     (DWORD, "dwDeviceId"),
index 3d787557c08d14fb23b836907405429408ae5213..a19c412f9302c09463ac828df24032a14ce519dc 100644 (file)
--- a/glapi.py
+++ b/glapi.py
@@ -54,8 +54,8 @@ GLhalfNV = Alias("GLhalfNV", UShort)
 GLint64EXT = Alias("GLint64EXT", LongLong)
 GLuint64EXT = Alias("GLuint64EXT", ULongLong)
 
-GLstring = Alias("const GLchar *", String)
-GLstringARB = Alias("const GLcharARB *", String)
+GLstring = Alias("const GLchar *", CString)
+GLstringARB = Alias("const GLcharARB *", CString)
 
 GLenum = Enum("GLenum", [
     #"GL_NO_ERROR",                       # 0x0
@@ -2807,7 +2807,7 @@ def basic_functions(Function):
         F(Void, "glGetPixelMapuiv", [(GLenum, "map"), Out(Pointer(GLuint), "values")], sideeffects=False),
         F(Void, "glGetPixelMapusv", [(GLenum, "map"), Out(Pointer(GLushort), "values")], sideeffects=False),
         F(Void, "glGetPolygonStipple", [Out(Pointer(GLubyte), "mask")], sideeffects=False),
-        F(Alias("const GLubyte *", String), "glGetString", [(GLenum, "name")], sideeffects=False),
+        F(Alias("const GLubyte *", CString), "glGetString", [(GLenum, "name")], sideeffects=False),
         F(Void, "glGetTexEnvfv", [(GLenum, "target"), (GLenum, "pname"), Out(Pointer(GLfloat), "params")], sideeffects=False),
         F(Void, "glGetTexEnviv", [(GLenum, "target"), (GLenum, "pname"), Out(Pointer(GLint), "params")], sideeffects=False),
         F(Void, "glGetTexGendv", [(GLenum, "coord"), (GLenum, "pname"), Out(Pointer(GLdouble), "params")], sideeffects=False),
@@ -3004,7 +3004,7 @@ def extended_functions(Function):
         F(Void, "glProgramLocalParameter4dvARB", [(GLenum, "target"), (GLuint, "index"), (OpaquePointer(Const(GLdouble)), "params")]),
         F(Void, "glProgramLocalParameter4fARB", [(GLenum, "target"), (GLuint, "index"), (GLfloat, "x"), (GLfloat, "y"), (GLfloat, "z"), (GLfloat, "w")]),
         F(Void, "glProgramLocalParameter4fvARB", [(GLenum, "target"), (GLuint, "index"), (OpaquePointer(Const(GLfloat)), "params")]),
-        F(Void, "glProgramStringARB", [(GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (OpaquePointer(Const(GLvoid)), "string")]),
+        F(Void, "glProgramStringARB", [(GLenum, "target"), (GLenum, "format"), (GLsizei, "len"), (Alias("const void *", String("len")), "string")]),
         F(Void, "glVertexAttrib1dARB", [(GLuint, "index"), (GLdouble, "x")]),
         F(Void, "glVertexAttrib1dvARB", [(GLuint, "index"), (Array(Const(GLdouble), "1"), "v")]),
         F(Void, "glVertexAttrib1fARB", [(GLuint, "index"), (GLfloat, "x")]),
index 1b9aeac76ea670c5f5245c130bca00b37ccfd95f..2fa5ae50b85d3c216005d58a5c4409a97defe7c7 100644 (file)
@@ -35,8 +35,8 @@ PROC = Opaque("__GLXextFuncPtr")
 
 glxapi.add_functions(glapi.functions)
 glxapi.add_functions([
-    Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", String), "procName")]),
-    Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", String), "procName")]),
+    Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]),
+    Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]),
 ])
 
 
diff --git a/log.cpp b/log.cpp
index 7a5911add321da9b3498fcf9a80e0f75a9fcc5b8..3d5d545870bc20d7a92f5bef528d7952dbdbe2c7 100644 (file)
--- a/log.cpp
+++ b/log.cpp
@@ -266,6 +266,16 @@ void LiteralString(const char *str) {
    WriteString(str);
 }
 
+void LiteralString(const char *str, size_t len) {
+   if (!str) {
+      LiteralNull();
+      return;
+   }
+   WriteByte(Trace::TYPE_STRING);
+   WriteUInt(len);
+   Write(str, len);
+}
+
 void LiteralWString(const wchar_t *str) {
    if (!str) {
       LiteralNull();
diff --git a/log.hpp b/log.hpp
index 7d03e645857c1ec7ca739db04c430d4bc0b5e73a..56df8c2eba282a0cce073351c04839a5abe01604 100644 (file)
--- a/log.hpp
+++ b/log.hpp
@@ -64,6 +64,7 @@ namespace Log {
     void LiteralFloat(float value);
     void LiteralFloat(double value);
     void LiteralString(const char *str);
+    void LiteralString(const char *str, size_t size);
     void LiteralWString(const wchar_t *str);
     void LiteralBlob(const void *data, size_t size);
     void LiteralNamedConstant(const char *name, long long value);
index 4f05e6bdaeec74d0bb297895a86d451a05f4d5ba..099c89886230da45b74790fbdbe5889bf1220754 100644 (file)
--- a/wglapi.py
+++ b/wglapi.py
@@ -212,7 +212,7 @@ wglapi.add_functions([
     StdFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]),
     
     # WGL_ARB_extensions_string
-    StdFunction(Const(String), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False),
+    StdFunction(Const(CString), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False),
     
     # WGL_ARB_pbuffer
     StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Pointer(Const(Int)), "piAttribList")]), 
@@ -227,7 +227,7 @@ wglapi.add_functions([
     StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
     
     # WGL_EXT_extensions_string
-    StdFunction(Const(String), "wglGetExtensionsStringEXT", [], sideeffects=False),
+    StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False),
 
     # WGL_EXT_pixel_format
     StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
index 9c6b96f3693d813e06483f6727cb1bbfc57ce70d..001d8dd90b2c8b56beafdeabd9c1b9365bc4686c 100644 (file)
@@ -51,8 +51,8 @@ LPDWORD = Pointer(DWORD)
 LPBOOL = Pointer(BOOL)
 LPSIZE = LPDWORD
 
-LPSTR = String
-LPCSTR = Const(String)
+LPSTR = CString
+LPCSTR = Const(CString)
 LPWSTR = WString
 LPCWSTR = Const(WString)