X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftests%2Fdispatch_sanity.cpp;h=c50f40b812fd7dc2a4834eab7dc878f6c8af4e77;hb=355f507f2a7082f28d98cb29b2a34b77fb45e031;hp=ca753b3ca3918228f17a7f3f4c44ccbdfb00ba72;hpb=762d9ace6b02e792b2efe69e81c6c5b81069e43b;p=mesa.git diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index ca753b3ca39..c50f40b812f 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -43,8 +43,6 @@ extern "C" { #include "main/mfeatures.h" } -#if FEATURE_ES2 - #include extern "C" { @@ -76,6 +74,11 @@ struct function { extern const struct function gles2_functions_possible[]; +#if FEATURE_ES1 +extern "C" _glapi_table *_mesa_create_exec_table_es1(void); +extern const struct function gles11_functions_possible[]; +#endif /* FEATURE_ES1 */ + class DispatchSanity_test : public ::testing::Test { public: virtual void SetUp(); @@ -97,6 +100,16 @@ DispatchSanity_test::SetUp() _mesa_init_driver_functions(&driver_functions); } +static const char * +offset_to_proc_name_safe(unsigned offset) +{ + const char *name = _glapi_get_proc_name(offset); + return name ? name : "???"; +} + +/* Scan through the dispatch table and check that all the functions in + * _glapi_proc *table exist. When found, set their pointers in the table + * to _mesa_generic_nop. */ static void validate_functions(_glapi_proc *table, const struct function *function_table) { @@ -116,13 +129,29 @@ validate_functions(_glapi_proc *table, const struct function *function_table) table[offset] = (_glapi_proc) _mesa_generic_nop; } +} +/* Scan through the table and ensure that there is nothing except + * _mesa_generic_nop (as set by validate_functions(). */ +static void +validate_nops(const _glapi_proc *table) +{ const unsigned size = _glapi_get_dispatch_table_size(); for (unsigned i = 0; i < size; i++) { - EXPECT_EQ((_glapi_proc) _mesa_generic_nop, table[i]) << "i = " << i; + EXPECT_EQ((_glapi_proc) _mesa_generic_nop, table[i]) + << "i = " << i << " (" << offset_to_proc_name_safe(i) << ")"; } } +#if FEATURE_ES1 +TEST_F(DispatchSanity_test, GLES11) +{ + _glapi_proc *exec = (_glapi_proc *) _mesa_create_exec_table_es1(); + validate_functions(exec, gles11_functions_possible); + validate_nops(exec); +} +#endif /* FEATURE_ES1 */ + TEST_F(DispatchSanity_test, GLES2) { ctx.Version = 20; @@ -138,8 +167,203 @@ TEST_F(DispatchSanity_test, GLES2) _swsetup_CreateContext(&ctx); validate_functions((_glapi_proc *) ctx.Exec, gles2_functions_possible); + validate_nops((_glapi_proc *) ctx.Exec); } +#if FEATURE_ES1 +const struct function gles11_functions_possible[] = { + { "glActiveTexture", _gloffset_ActiveTextureARB }, + { "glAlphaFunc", _gloffset_AlphaFunc }, + { "glAlphaFuncx", -1 }, + { "glBindBuffer", -1 }, + { "glBindFramebufferOES", -1 }, + { "glBindRenderbufferOES", -1 }, + { "glBindTexture", _gloffset_BindTexture }, + { "glBlendEquationOES", _gloffset_BlendEquation }, + { "glBlendEquationSeparateOES", -1 }, + { "glBlendFunc", _gloffset_BlendFunc }, + { "glBlendFuncSeparateOES", -1 }, + { "glBufferData", -1 }, + { "glBufferSubData", -1 }, + { "glCheckFramebufferStatusOES", -1 }, + { "glClear", _gloffset_Clear }, + { "glClearColor", _gloffset_ClearColor }, + { "glClearColorx", -1 }, + { "glClearDepthf", -1 }, + { "glClearDepthx", -1 }, + { "glClearStencil", _gloffset_ClearStencil }, + { "glClientActiveTexture", _gloffset_ClientActiveTextureARB }, + { "glClipPlanef", -1 }, + { "glClipPlanex", -1 }, + { "glColor4f", _gloffset_Color4f }, + { "glColor4ub", _gloffset_Color4ub }, + { "glColor4x", -1 }, + { "glColorMask", _gloffset_ColorMask }, + { "glColorPointer", _gloffset_ColorPointer }, + { "glCompressedTexImage2D", -1 }, + { "glCompressedTexSubImage2D", -1 }, + { "glCopyTexImage2D", _gloffset_CopyTexImage2D }, + { "glCopyTexSubImage2D", _gloffset_CopyTexSubImage2D }, + { "glCullFace", _gloffset_CullFace }, + { "glDeleteBuffers", -1 }, + { "glDeleteFramebuffersOES", -1 }, + { "glDeleteRenderbuffersOES", -1 }, + { "glDeleteTextures", _gloffset_DeleteTextures }, + { "glDepthFunc", _gloffset_DepthFunc }, + { "glDepthMask", _gloffset_DepthMask }, + { "glDepthRangef", -1 }, + { "glDepthRangex", -1 }, + { "glDisable", _gloffset_Disable }, + { "glDisableClientState", _gloffset_DisableClientState }, + { "glDrawArrays", _gloffset_DrawArrays }, + { "glDrawElements", _gloffset_DrawElements }, + { "glDrawTexfOES", -1 }, + { "glDrawTexfvOES", -1 }, + { "glDrawTexiOES", -1 }, + { "glDrawTexivOES", -1 }, + { "glDrawTexsOES", -1 }, + { "glDrawTexsvOES", -1 }, + { "glDrawTexxOES", -1 }, + { "glDrawTexxvOES", -1 }, + { "glEGLImageTargetRenderbufferStorageOES", -1 }, + { "glEGLImageTargetTexture2DOES", -1 }, + { "glEnable", _gloffset_Enable }, + { "glEnableClientState", _gloffset_EnableClientState }, + { "glFinish", _gloffset_Finish }, + { "glFlush", _gloffset_Flush }, + { "glFogf", _gloffset_Fogf }, + { "glFogfv", _gloffset_Fogfv }, + { "glFogx", -1 }, + { "glFogxv", -1 }, + { "glFramebufferRenderbufferOES", -1 }, + { "glFramebufferTexture2DOES", -1 }, + { "glFrontFace", _gloffset_FrontFace }, + { "glFrustumf", -1 }, + { "glFrustumx", -1 }, + { "glGenBuffers", -1 }, + { "glGenFramebuffersOES", -1 }, + { "glGenRenderbuffersOES", -1 }, + { "glGenTextures", _gloffset_GenTextures }, + { "glGenerateMipmapOES", -1 }, + { "glGetBooleanv", _gloffset_GetBooleanv }, + { "glGetBufferParameteriv", -1 }, + { "glGetBufferPointervOES", -1 }, + { "glGetClipPlanef", -1 }, + { "glGetClipPlanex", -1 }, + { "glGetError", _gloffset_GetError }, + { "glGetFixedv", -1 }, + { "glGetFloatv", _gloffset_GetFloatv }, + { "glGetFramebufferAttachmentParameterivOES", -1 }, + { "glGetIntegerv", _gloffset_GetIntegerv }, + { "glGetLightfv", _gloffset_GetLightfv }, + { "glGetLightxv", -1 }, + { "glGetMaterialfv", _gloffset_GetMaterialfv }, + { "glGetMaterialxv", -1 }, + { "glGetPointerv", _gloffset_GetPointerv }, + { "glGetRenderbufferParameterivOES", -1 }, + { "glGetString", _gloffset_GetString }, + { "glGetTexEnvfv", _gloffset_GetTexEnvfv }, + { "glGetTexEnviv", _gloffset_GetTexEnviv }, + { "glGetTexEnvxv", -1 }, + { "glGetTexGenfvOES", _gloffset_GetTexGenfv }, + { "glGetTexGenivOES", _gloffset_GetTexGeniv }, + { "glGetTexGenxvOES", -1 }, + { "glGetTexParameterfv", _gloffset_GetTexParameterfv }, + { "glGetTexParameteriv", _gloffset_GetTexParameteriv }, + { "glGetTexParameterxv", -1 }, + { "glHint", _gloffset_Hint }, + { "glIsBuffer", -1 }, + { "glIsEnabled", _gloffset_IsEnabled }, + { "glIsFramebufferOES", -1 }, + { "glIsRenderbufferOES", -1 }, + { "glIsTexture", _gloffset_IsTexture }, + { "glLightModelf", _gloffset_LightModelf }, + { "glLightModelfv", _gloffset_LightModelfv }, + { "glLightModelx", -1 }, + { "glLightModelxv", -1 }, + { "glLightf", _gloffset_Lightf }, + { "glLightfv", _gloffset_Lightfv }, + { "glLightx", -1 }, + { "glLightxv", -1 }, + { "glLineWidth", _gloffset_LineWidth }, + { "glLineWidthx", -1 }, + { "glLoadIdentity", _gloffset_LoadIdentity }, + { "glLoadMatrixf", _gloffset_LoadMatrixf }, + { "glLoadMatrixx", -1 }, + { "glLogicOp", _gloffset_LogicOp }, + { "glMapBufferOES", -1 }, + { "glMaterialf", _gloffset_Materialf }, + { "glMaterialfv", _gloffset_Materialfv }, + { "glMaterialx", -1 }, + { "glMaterialxv", -1 }, + { "glMatrixMode", _gloffset_MatrixMode }, + { "glMultMatrixf", _gloffset_MultMatrixf }, + { "glMultMatrixx", -1 }, + { "glMultiDrawArraysEXT", -1 }, + { "glMultiDrawElementsEXT", -1 }, + { "glMultiTexCoord4f", _gloffset_MultiTexCoord4fARB }, + { "glMultiTexCoord4x", -1 }, + { "glNormal3f", _gloffset_Normal3f }, + { "glNormal3x", -1 }, + { "glNormalPointer", _gloffset_NormalPointer }, + { "glOrthof", -1 }, + { "glOrthox", -1 }, + { "glPixelStorei", _gloffset_PixelStorei }, + { "glPointParameterf", -1 }, + { "glPointParameterfv", -1 }, + { "glPointParameterx", -1 }, + { "glPointParameterxv", -1 }, + { "glPointSize", _gloffset_PointSize }, + { "glPointSizePointerOES", -1 }, + { "glPointSizex", -1 }, + { "glPolygonOffset", _gloffset_PolygonOffset }, + { "glPolygonOffsetx", -1 }, + { "glPopMatrix", _gloffset_PopMatrix }, + { "glPushMatrix", _gloffset_PushMatrix }, + { "glQueryMatrixxOES", -1 }, + { "glReadPixels", _gloffset_ReadPixels }, + { "glRenderbufferStorageOES", -1 }, + { "glRotatef", _gloffset_Rotatef }, + { "glRotatex", -1 }, + { "glSampleCoverage", -1 }, + { "glSampleCoveragex", -1 }, + { "glScalef", _gloffset_Scalef }, + { "glScalex", -1 }, + { "glScissor", _gloffset_Scissor }, + { "glShadeModel", _gloffset_ShadeModel }, + { "glStencilFunc", _gloffset_StencilFunc }, + { "glStencilMask", _gloffset_StencilMask }, + { "glStencilOp", _gloffset_StencilOp }, + { "glTexCoordPointer", _gloffset_TexCoordPointer }, + { "glTexEnvf", _gloffset_TexEnvf }, + { "glTexEnvfv", _gloffset_TexEnvfv }, + { "glTexEnvi", _gloffset_TexEnvi }, + { "glTexEnviv", _gloffset_TexEnviv }, + { "glTexEnvx", -1 }, + { "glTexEnvxv", -1 }, + { "glTexGenfOES", _gloffset_TexGenf }, + { "glTexGenfvOES", _gloffset_TexGenfv }, + { "glTexGeniOES", _gloffset_TexGeni }, + { "glTexGenivOES", _gloffset_TexGeniv }, + { "glTexGenxOES", -1 }, + { "glTexGenxvOES", -1 }, + { "glTexImage2D", _gloffset_TexImage2D }, + { "glTexParameterf", _gloffset_TexParameterf }, + { "glTexParameterfv", _gloffset_TexParameterfv }, + { "glTexParameteri", _gloffset_TexParameteri }, + { "glTexParameteriv", _gloffset_TexParameteriv }, + { "glTexParameterx", -1 }, + { "glTexParameterxv", -1 }, + { "glTexSubImage2D", _gloffset_TexSubImage2D }, + { "glTranslatef", _gloffset_Translatef }, + { "glTranslatex", -1 }, + { "glUnmapBufferOES", -1 }, + { "glVertexPointer", _gloffset_VertexPointer }, + { "glViewport", _gloffset_Viewport }, + { NULL, -1 } +}; +#endif /* FEATURE_ES1 */ + const struct function gles2_functions_possible[] = { { "glActiveTexture", _gloffset_ActiveTextureARB }, { "glAttachShader", -1 }, @@ -306,5 +530,3 @@ const struct function gles2_functions_possible[] = { { "glViewport", _gloffset_Viewport }, { NULL, -1 } }; - -#endif /* FEATURE_ES2 */