Add better logging for indexed state queries.
authorMika Isojärvi <misojarvi@google.com>
Fri, 27 Feb 2015 22:41:20 +0000 (14:41 -0800)
committerMika Isojärvi <misojarvi@google.com>
Mon, 2 Mar 2015 21:42:45 +0000 (13:42 -0800)
Change-Id: Ib666a09e9dbb25b210af80e35d23e689e1353db6

framework/opengl/gluCallLogWrapper.inl
framework/opengl/gluQueryUtil.inl
scripts/opengl/gen_call_log_wrapper.py
scripts/opengl/gen_query_util.py

index ab362fe..2e433e0 100644 (file)
@@ -1438,7 +1438,7 @@ void CallLogWrapper::glGetBooleani_v (glw::GLenum target, glw::GLuint index, glw
                m_log << TestLog::Message << "glGetBooleani_v(" << getGettableIndexedStateStr(target) << ", " << index << ", " << static_cast<const void*>(data) << ");" << TestLog::EndMessage;
        m_gl.getBooleani_v(target, index, data);
        if (m_enableLog)
-               m_log << TestLog::Message << "// data = " << getBooleanPointerStr(data, 1) << TestLog::EndMessage;
+               m_log << TestLog::Message << "// data = " << getBooleanPointerStr(data, getIndexedQueryNumArgsOut(target)) << TestLog::EndMessage;
 }
 
 void CallLogWrapper::glGetBooleanv (glw::GLenum pname, glw::GLboolean *data)
@@ -1603,7 +1603,7 @@ void CallLogWrapper::glGetInteger64i_v (glw::GLenum target, glw::GLuint index, g
                m_log << TestLog::Message << "glGetInteger64i_v(" << getGettableIndexedStateStr(target) << ", " << index << ", " << data << ");" << TestLog::EndMessage;
        m_gl.getInteger64i_v(target, index, data);
        if (m_enableLog)
-               m_log << TestLog::Message << "// data = " << getPointerStr(data, 1) << TestLog::EndMessage;
+               m_log << TestLog::Message << "// data = " << getPointerStr(data, getIndexedQueryNumArgsOut(target)) << TestLog::EndMessage;
 }
 
 void CallLogWrapper::glGetInteger64v (glw::GLenum pname, glw::GLint64 *data)
@@ -1621,7 +1621,7 @@ void CallLogWrapper::glGetIntegeri_v (glw::GLenum target, glw::GLuint index, glw
                m_log << TestLog::Message << "glGetIntegeri_v(" << getGettableIndexedStateStr(target) << ", " << index << ", " << data << ");" << TestLog::EndMessage;
        m_gl.getIntegeri_v(target, index, data);
        if (m_enableLog)
-               m_log << TestLog::Message << "// data = " << getPointerStr(data, 1) << TestLog::EndMessage;
+               m_log << TestLog::Message << "// data = " << getPointerStr(data, getIndexedQueryNumArgsOut(target)) << TestLog::EndMessage;
 }
 
 void CallLogWrapper::glGetIntegerv (glw::GLenum pname, glw::GLint *data)
index 1c8a6e9..13eb620 100644 (file)
@@ -22,6 +22,15 @@ int getBasicQueryNumArgsOut (int pname)
        }
 }
 
+int getIndexedQueryNumArgsOut (int pname)
+{
+       switch(pname)
+       {
+               case GL_COLOR_WRITEMASK:        return 4;
+               default:                                        return 1;
+       }
+}
+
 int getAttributeQueryNumArgsOut (int pname)
 {
        switch(pname)
index b6ea95e..f13d7bb 100644 (file)
@@ -153,8 +153,8 @@ CALL_LOG_SPECS = {
        "glGetFramebufferParameteriv":                  LogSpec({0: enum("FramebufferTarget"), 1: enum("FramebufferParameter")}, argOutPrints = {2: pointer(size = "1")}),
        "glGetIntegerv":                                                LogSpec({0: enum("GettableState")}, argOutPrints = {1: pointer(size = "getBasicQueryNumArgsOut(pname)")}),
        "glGetInteger64v":                                              LogSpec({0: enum("GettableState")}, argOutPrints = {1: pointer(size = "getBasicQueryNumArgsOut(pname)")}),
-       "glGetIntegeri_v":                                              LogSpec({0: enum("GettableIndexedState")}, argOutPrints = {2: pointer(size = "1")}),
-       "glGetInteger64i_v":                                    LogSpec({0: enum("GettableIndexedState")}, argOutPrints = {2: pointer(size = "1")}),
+       "glGetIntegeri_v":                                              LogSpec({0: enum("GettableIndexedState")}, argOutPrints = {2:pointer(size = "getIndexedQueryNumArgsOut(target)")}),
+       "glGetInteger64i_v":                                            LogSpec({0: enum("GettableIndexedState")}, argOutPrints = {2: pointer(size = "getIndexedQueryNumArgsOut(target)")}),
        "glGetBooleani_v":
                LogSpec(
                        {
@@ -162,7 +162,7 @@ CALL_LOG_SPECS = {
                                2: voidPointer                                  # last argument has type of GLboolean* (aka. char*). Prevent
                                                                                                # wrapper from attempting to print the argument as a C string.
                        },
-                       argOutPrints = {2: booleanPointer(size = "1")}),
+                       argOutPrints = {2: booleanPointer(size = "getIndexedQueryNumArgsOut(target)")}),
        "glGetInternalformativ":                                LogSpec({0: enum("InternalFormatTarget"), 1: enum("PixelFormat"), 2: enum("InternalFormatParameter")}, argOutPrints = {4: pointer(size = "bufSize")}),
        "glGetMultisamplefv":                                   LogSpec({0: enum("MultisampleParameter")}, argOutPrints = {2: pointer(size = "2")}),
        "glGetPointerv":                                                LogSpec({0: enum("PointerState")}, argOutPrints = {1: pointer(size = "1")}),
index e9c1c5b..36f41ec 100644 (file)
@@ -38,6 +38,10 @@ QUERY_NUM_OUT_ARGUMENTS = [
                ("PRIMITIVE_BOUNDING_BOX_EXT",          8),
                ]),
 
+       ("Indexed", [
+               ("COLOR_WRITEMASK",                             4),
+               ]),
+
        ("Attribute", [
                ("CURRENT_VERTEX_ATTRIB",               4),
                ]),