struct dd_function_table driver_functions;
struct gl_context share_list;
struct gl_context ctx;
+ _glapi_proc *nop_table;
};
void
memset(&ctx, 0, sizeof(ctx));
_mesa_init_driver_functions(&driver_functions);
+
+ const unsigned size = _glapi_get_dispatch_table_size();
+ nop_table = (_glapi_proc *) _glapi_new_nop_table(size);
}
void
* _glapi_proc *table exist.
*/
static void
-validate_functions(struct gl_context *ctx, const struct function *function_table)
+validate_functions(struct gl_context *ctx, const struct function *function_table,
+ const _glapi_proc *nop_table)
{
_glapi_proc *table = (_glapi_proc *) ctx->Exec;
for (unsigned i = 0; function_table[i].name != NULL; i++) {
+ /* The context version is >= the GL version where the function was
+ * introduced. Therefore, the function cannot be set to the nop
+ * function.
+ */
+ const bool cant_be_nop = ctx->Version >= function_table[i].Version;
+
const int offset = (function_table[i].offset != -1)
? function_table[i].offset
: _glapi_get_proc_offset(function_table[i].name);
ASSERT_EQ(offset,
_glapi_get_proc_offset(function_table[i].name))
<< "Function: " << function_table[i].name;
+ if (cant_be_nop) {
+ EXPECT_NE(nop_table[offset], table[offset])
+ << "Function: " << function_table[i].name
+ << " at offset " << offset;
+ }
+
+ table[offset] = nop_table[offset];
+ }
+}
+
+/* Scan through the table and ensure that there is nothing except
+ * nop functions (as set by validate_functions().
+ */
+static void
+validate_nops(struct gl_context *ctx, const _glapi_proc *nop_table)
+{
+ _glapi_proc *table = (_glapi_proc *) ctx->Exec;
+
+ const unsigned size = _glapi_get_dispatch_table_size();
+ for (unsigned i = 0; i < size; i++) {
+ EXPECT_EQ(nop_table[i], table[i])
+ << "i = " << i << " (" << offset_to_proc_name_safe(i) << ")";
}
}
TEST_F(DispatchSanity_test, GL31_CORE)
{
SetUpCtx(API_OPENGL_CORE, 31);
- validate_functions(&ctx, gl_core_functions_possible);
+ validate_functions(&ctx, gl_core_functions_possible, nop_table);
+ validate_nops(&ctx, nop_table);
}
TEST_F(DispatchSanity_test, GLES11)
{
SetUpCtx(API_OPENGLES, 11);
- validate_functions(&ctx, gles11_functions_possible);
+ validate_functions(&ctx, gles11_functions_possible, nop_table);
+ validate_nops(&ctx, nop_table);
}
TEST_F(DispatchSanity_test, GLES2)
{
SetUpCtx(API_OPENGLES2, 20);
- validate_functions(&ctx, gles2_functions_possible);
+ validate_functions(&ctx, gles2_functions_possible, nop_table);
+ validate_nops(&ctx, nop_table);
}
TEST_F(DispatchSanity_test, GLES3)
{
SetUpCtx(API_OPENGLES2, 30);
- validate_functions(&ctx, gles2_functions_possible);
- validate_functions(&ctx, gles3_functions_possible);
+ validate_functions(&ctx, gles2_functions_possible, nop_table);
+ validate_functions(&ctx, gles3_functions_possible, nop_table);
+ validate_nops(&ctx, nop_table);
}
const struct function gl_core_functions_possible[] = {
{ "glProgramUniformMatrix4x3dv", 40, -1 },
{ "glValidateProgramPipeline", 43, -1 },
{ "glGetProgramPipelineInfoLog", 43, -1 },
-// { "glVertexAttribL1d", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribL2d", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribL3d", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribL4d", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribL1dv", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribL2dv", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribL3dv", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribL4dv", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribLPointer", 43, -1 }, // XXX: Add to xml
-// { "glGetVertexAttribLdv", 43, -1 }, // XXX: Add to xml
+ { "glVertexAttribL1d", 41, -1 },
+ { "glVertexAttribL2d", 41, -1 },
+ { "glVertexAttribL3d", 41, -1 },
+ { "glVertexAttribL4d", 41, -1 },
+ { "glVertexAttribL1dv", 41, -1 },
+ { "glVertexAttribL2dv", 41, -1 },
+ { "glVertexAttribL3dv", 41, -1 },
+ { "glVertexAttribL4dv", 41, -1 },
+ { "glVertexAttribLPointer", 41, -1 },
+ { "glGetVertexAttribLdv", 41, -1 },
{ "glViewportArrayv", 43, -1 },
{ "glViewportIndexedf", 43, -1 },
{ "glViewportIndexedfv", 43, -1 },
{ "glInvalidateSubFramebuffer", 43, -1 },
{ "glMultiDrawArraysIndirect", 43, -1 },
{ "glMultiDrawElementsIndirect", 43, -1 },
-// { "glGetProgramInterfaceiv", 43, -1 }, // XXX: Add to xml
-// { "glGetProgramResourceIndex", 43, -1 }, // XXX: Add to xml
-// { "glGetProgramResourceName", 43, -1 }, // XXX: Add to xml
-// { "glGetProgramResourceiv", 43, -1 }, // XXX: Add to xml
-// { "glGetProgramResourceLocation", 43, -1 }, // XXX: Add to xml
-// { "glGetProgramResourceLocationIndex", 43, -1 }, // XXX: Add to xml
+ { "glGetProgramInterfaceiv", 43, -1 },
+ { "glGetProgramResourceIndex", 43, -1 },
+ { "glGetProgramResourceName", 43, -1 },
+ { "glGetProgramResourceiv", 43, -1 },
+ { "glGetProgramResourceLocation", 43, -1 },
+ { "glGetProgramResourceLocationIndex", 43, -1 },
// { "glShaderStorageBlockBinding", 43, -1 }, // XXX: Add to xml
{ "glTexBufferRange", 43, -1 },
// { "glTextureBufferRangeEXT", 43, -1 }, // XXX: Add to xml
/* GL_ARB_direct_state_access */
{ "glCreateTransformFeedbacks", 45, -1 },
{ "glTransformFeedbackBufferBase", 45, -1 },
+ { "glTransformFeedbackBufferRange", 45, -1 },
+ { "glGetTransformFeedbackiv", 45, -1 },
+ { "glGetTransformFeedbacki_v", 45, -1 },
+ { "glGetTransformFeedbacki64_v", 45, -1 },
{ "glCreateBuffers", 45, -1 },
{ "glNamedBufferStorage", 45, -1 },
{ "glNamedBufferData", 45, -1 },
{ "glGetNamedBufferParameteri64v", 45, -1 },
{ "glGetNamedBufferPointerv", 45, -1 },
{ "glGetNamedBufferSubData", 45, -1 },
+ { "glCreateFramebuffers", 45, -1 },
+ { "glNamedFramebufferRenderbuffer", 45, -1 },
+ { "glCreateRenderbuffers", 45, -1 },
+ { "glNamedRenderbufferStorage", 45, -1 },
+ { "glNamedRenderbufferStorageMultisample", 45, -1 },
+ { "glGetNamedRenderbufferParameteriv", 45, -1 },
{ "glCreateTextures", 45, -1 },
{ "glTextureStorage1D", 45, -1 },
{ "glTextureStorage2D", 45, -1 },
{ "glTextureStorage3DMultisample", 45, -1 },
{ "glTextureBuffer", 45, -1 },
{ "glTextureBufferRange", 45, -1 },
+ { "glCreateVertexArrays", 45, -1 },
+ { "glDisableVertexArrayAttrib", 45, -1 },
+ { "glEnableVertexArrayAttrib", 45, -1 },
+ { "glVertexArrayElementBuffer", 45, -1 },
+ { "glVertexArrayVertexBuffer", 45, -1 },
+ { "glVertexArrayVertexBuffers", 45, -1 },
+ { "glVertexArrayAttribFormat", 45, -1 },
+ { "glVertexArrayAttribIFormat", 45, -1 },
+ { "glVertexArrayAttribLFormat", 45, -1 },
+ { "glVertexArrayAttribBinding", 45, -1 },
+ { "glVertexArrayBindingDivisor", 45, -1 },
+ { "glGetVertexArrayiv", 45, -1 },
+ { "glGetVertexArrayIndexediv", 45, -1 },
+ { "glGetVertexArrayIndexed64iv", 45, -1 },
+ { "glCreateSamplers", 45, -1 },
+ { "glCreateProgramPipelines", 45, -1 },
+ { "glCreateQueries", 45, -1 },
+ { "glGetQueryBufferObjectiv", 45, -1 },
+ { "glGetQueryBufferObjectuiv", 45, -1 },
+ { "glGetQueryBufferObjecti64v", 45, -1 },
+ { "glGetQueryBufferObjectui64v", 45, -1 },
/* GL_EXT_polygon_offset_clamp */
{ "glPolygonOffsetClampEXT", 11, -1 },