[Mesa-dev] [PATCH 5/5] _mesa_create_exec_table: GLES3 fixes.

Paul Berry stereotype441 at gmail.com
Mon Oct 22 09:35:08 PDT 2012


This patch sets up the dispatch table for the following GLES3
functions when a GLES3 context is in use:

- BeginQuery
- BeginTransformFeedback
- BindSampler
- BindTransformFeedback
- BlitFramebuffer
- ClearBufferfi
- ClearBufferfv
- ClearBufferiv
- ClearBufferuiv
- ClientWaitSync
- CopyBufferSubData
- DeleteQueries
- DeleteSamplers
- DeleteSync
- DeleteTransformFeedbacks
- EndQuery
- EndTransformFeedback
- FenceSync
- FramebufferTextureLayer
- GenQueries
- GenSamplers
- GenTransformFeedbacks
- GetInteger64v
- GetQueryObjectuiv
- GetQueryiv
- GetSamplerParameterfv
- GetSamplerParameteriv
- GetStringi
- GetSynciv
- GetTransformFeedbackVarying
- GetVertexAttribIiv
- GetVertexAttribIuiv
- IsQuery
- IsSampler
- IsSync
- IsTransformFeedback
- PauseTransformFeedback
- RenderbufferStorageMultisample
- ResumeTransformFeedback
- SamplerParameterf
- SamplerParameterfv
- SamplerParameteri
- SamplerParameteriv
- TransformFeedbackVaryings
- VertexAttribIPointer
- WaitSync

And it avoids setting up the dispatch table for these non-GLES3
functions:

- ColorMaski
- GetBooleani_v
- Enablei
- Disablei
- IsEnabledi
- ClearColorIiEXT
- ClearColorIuiEXT
- TextureStorage2DEXT
- TextureStorage3DEXT

Cc: Matt Turner <mattst88 at gmail.com>
---
 src/mesa/main/api_exec.c          | 34 +++++++++++++++++++---------------
 src/mesa/main/dlist.c             |  4 ++--
 src/mesa/main/queryobj.c          | 20 ++++++++++++--------
 src/mesa/main/queryobj.h          |  3 ++-
 src/mesa/main/samplerobj.c        | 14 +++++++++-----
 src/mesa/main/samplerobj.h        |  3 ++-
 src/mesa/main/transformfeedback.c |  7 +++++--
 src/mesa/main/transformfeedback.h |  3 ++-
 8 files changed, 53 insertions(+), 35 deletions(-)

diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 7a000e7..058cdad 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -492,8 +492,8 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    /* 352. GL_EXT_transform_feedback */
    /* ARB 93. GL_ARB_transform_feedback2 */
-   if (ctx->API != API_OPENGLES2) {
-      _mesa_init_transform_feedback_dispatch(exec);
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+      _mesa_init_transform_feedback_dispatch(ctx, exec);
    }
 
    /* 364. GL_EXT_provoking_vertex */
@@ -614,15 +614,15 @@ _mesa_create_exec_table(struct gl_context *ctx)
    _mesa_init_bufferobj_dispatch(ctx, exec);
 
    /* ARB 29. GL_ARB_occlusion_query */
-   if (ctx->API != API_OPENGLES2) {
-      _mesa_init_queryobj_dispatch(exec);
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+      _mesa_init_queryobj_dispatch(ctx, exec);
    }
 
    /* ARB 37. GL_ARB_draw_buffers */
    SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
 
    /* ARB 66. GL_ARB_sync */
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
       _mesa_init_sync_dispatch(exec);
    }
 
@@ -672,7 +672,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT);
    SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);
 
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
       SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
    }
 
@@ -683,7 +683,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_MESA_texture_array / GL_EXT_texture_array */
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
       SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
    }
 
@@ -695,7 +695,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    /* The ARB_fbo functions are the union of
     * GL_EXT_fbo, GL_EXT_framebuffer_blit, GL_EXT_texture_array
     */
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
       SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
    }
 
@@ -704,7 +704,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
 
    /* GL_ARB_copy_buffer */
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
       SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData);
    }
 
@@ -714,9 +714,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    /* GL_EXT_draw_buffers2 */
    if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+      SET_GetIntegerIndexedvEXT(exec, _mesa_GetIntegerIndexedv);
+   }
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_ColorMaskIndexedEXT(exec, _mesa_ColorMaskIndexed);
       SET_GetBooleanIndexedvEXT(exec, _mesa_GetBooleanIndexedv);
-      SET_GetIntegerIndexedvEXT(exec, _mesa_GetIntegerIndexedv);
       SET_EnableIndexedEXT(exec, _mesa_EnableIndexed);
       SET_DisableIndexedEXT(exec, _mesa_DisableIndexed);
       SET_IsEnabledIndexedEXT(exec, _mesa_IsEnabledIndexed);
@@ -747,7 +749,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_EXT_texture_integer */
-   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
       SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
    }
@@ -759,14 +761,14 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_EXT_gpu_shader4 / OpenGL 3.0 */
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
       SET_GetVertexAttribIivEXT(exec, _mesa_GetVertexAttribIiv);
       SET_GetVertexAttribIuivEXT(exec, _mesa_GetVertexAttribIuiv);
       SET_VertexAttribIPointerEXT(exec, _mesa_VertexAttribIPointer);
    }
 
    /* GL 3.0 (functions not covered by other extensions) */
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
       SET_ClearBufferiv(exec, _mesa_ClearBufferiv);
       SET_ClearBufferuiv(exec, _mesa_ClearBufferuiv);
       SET_ClearBufferfv(exec, _mesa_ClearBufferfv);
@@ -805,12 +807,14 @@ _mesa_create_exec_table(struct gl_context *ctx)
    if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_TexStorage2D(exec, _mesa_TexStorage2D);
       SET_TexStorage3D(exec, _mesa_TexStorage3D);
+   }
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT);
       SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
    }
 
-   if (ctx->API != API_OPENGLES2) {
-      _mesa_init_sampler_object_dispatch(exec);
+   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+      _mesa_init_sampler_object_dispatch(ctx, exec);
    }
 
    if (_mesa_is_desktop_gl(ctx)) {
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 1948bff..d53879e 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -10060,7 +10060,7 @@ _mesa_create_save_table(const struct gl_context *ctx)
    SET_MapBufferARB(table, _mesa_MapBufferARB);
    SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
 
-   _mesa_init_queryobj_dispatch(table); /* glGetQuery, etc */
+   _mesa_init_queryobj_dispatch(ctx, table); /* glGetQuery, etc */
    SET_BeginQueryARB(table, save_BeginQueryARB);
    SET_EndQueryARB(table, save_EndQueryARB);
    SET_QueryCounter(table, save_QueryCounter);
@@ -10196,7 +10196,7 @@ _mesa_create_save_table(const struct gl_context *ctx)
    SET_TextureBarrierNV(table, save_TextureBarrierNV);
 
    /* GL_ARB_sampler_objects */
-   _mesa_init_sampler_object_dispatch(table); /* plug in Gen/Get/etc functions */
+   _mesa_init_sampler_object_dispatch(ctx, table); /* plug in Gen/Get/etc functions */
    SET_BindSampler(table, save_BindSampler);
    SET_SamplerParameteri(table, save_SamplerParameteri);
    SET_SamplerParameterf(table, save_SamplerParameterf);
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 18792cf..ba4e3a2 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -708,7 +708,8 @@ _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params)
 
 
 void
-_mesa_init_queryobj_dispatch(struct _glapi_table *disp)
+_mesa_init_queryobj_dispatch(const struct gl_context *ctx,
+                             struct _glapi_table *disp)
 {
    SET_GenQueriesARB(disp, _mesa_GenQueriesARB);
    SET_DeleteQueriesARB(disp, _mesa_DeleteQueriesARB);
@@ -716,16 +717,19 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp)
    SET_BeginQueryARB(disp, _mesa_BeginQueryARB);
    SET_EndQueryARB(disp, _mesa_EndQueryARB);
    SET_GetQueryivARB(disp, _mesa_GetQueryivARB);
-   SET_GetQueryObjectivARB(disp, _mesa_GetQueryObjectivARB);
    SET_GetQueryObjectuivARB(disp, _mesa_GetQueryObjectuivARB);
-   SET_QueryCounter(disp, _mesa_QueryCounter);
 
-   SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT);
-   SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT);
+   if (_mesa_is_desktop_gl(ctx)) {
+      SET_GetQueryObjectivARB(disp, _mesa_GetQueryObjectivARB);
+      SET_QueryCounter(disp, _mesa_QueryCounter);
 
-   SET_BeginQueryIndexed(disp, _mesa_BeginQueryIndexed);
-   SET_EndQueryIndexed(disp, _mesa_EndQueryIndexed);
-   SET_GetQueryIndexediv(disp, _mesa_GetQueryIndexediv);
+      SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT);
+      SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT);
+
+      SET_BeginQueryIndexed(disp, _mesa_BeginQueryIndexed);
+      SET_EndQueryIndexed(disp, _mesa_EndQueryIndexed);
+      SET_GetQueryIndexediv(disp, _mesa_GetQueryIndexediv);
+   }
 }
 
 
diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h
index 0f662fb..1e35185 100644
--- a/src/mesa/main/queryobj.h
+++ b/src/mesa/main/queryobj.h
@@ -44,7 +44,8 @@ extern void
 _mesa_init_query_object_functions(struct dd_function_table *driver);
 
 extern void
-_mesa_init_queryobj_dispatch(struct _glapi_table *disp);
+_mesa_init_queryobj_dispatch(const struct gl_context *ctx,
+                             struct _glapi_table *disp);
 
 extern void
 _mesa_init_queryobj(struct gl_context *ctx);
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 4514b12..09cbd29 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -1444,7 +1444,8 @@ _mesa_init_sampler_object_functions(struct dd_function_table *driver)
 
 
 void
-_mesa_init_sampler_object_dispatch(struct _glapi_table *disp)
+_mesa_init_sampler_object_dispatch(const struct gl_context *ctx,
+                                   struct _glapi_table *disp)
 {
    SET_GenSamplers(disp, _mesa_GenSamplers);
    SET_DeleteSamplers(disp, _mesa_DeleteSamplers);
@@ -1454,10 +1455,13 @@ _mesa_init_sampler_object_dispatch(struct _glapi_table *disp)
    SET_SamplerParameterf(disp, _mesa_SamplerParameterf);
    SET_SamplerParameteriv(disp, _mesa_SamplerParameteriv);
    SET_SamplerParameterfv(disp, _mesa_SamplerParameterfv);
-   SET_SamplerParameterIiv(disp, _mesa_SamplerParameterIiv);
-   SET_SamplerParameterIuiv(disp, _mesa_SamplerParameterIuiv);
    SET_GetSamplerParameteriv(disp, _mesa_GetSamplerParameteriv);
    SET_GetSamplerParameterfv(disp, _mesa_GetSamplerParameterfv);
-   SET_GetSamplerParameterIiv(disp, _mesa_GetSamplerParameterIiv);
-   SET_GetSamplerParameterIuiv(disp, _mesa_GetSamplerParameterIuiv);
+
+   if (_mesa_is_desktop_gl(ctx)) {
+      SET_SamplerParameterIiv(disp, _mesa_SamplerParameterIiv);
+      SET_SamplerParameterIuiv(disp, _mesa_SamplerParameterIuiv);
+      SET_GetSamplerParameterIiv(disp, _mesa_GetSamplerParameterIiv);
+      SET_GetSamplerParameterIuiv(disp, _mesa_GetSamplerParameterIuiv);
+   }
 }
diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h
index e70ee48..bea4c22 100644
--- a/src/mesa/main/samplerobj.h
+++ b/src/mesa/main/samplerobj.h
@@ -77,7 +77,8 @@ extern void
 _mesa_init_sampler_object_functions(struct dd_function_table *driver);
 
 extern void
-_mesa_init_sampler_object_dispatch(struct _glapi_table *disp);
+_mesa_init_sampler_object_dispatch(const struct gl_context *ctx,
+                                   struct _glapi_table *disp);
 
 extern void GLAPIENTRY
 _mesa_BindSampler(GLuint unit, GLuint sampler);
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index ea6cfdf..8a5359f 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -246,12 +246,15 @@ _mesa_init_transform_feedback_functions(struct dd_function_table *driver)
 
 
 void
-_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp)
+_mesa_init_transform_feedback_dispatch(struct gl_context *ctx,
+                                       struct _glapi_table *disp)
 {
    /* EXT_transform_feedback */
    SET_BeginTransformFeedbackEXT(disp, _mesa_BeginTransformFeedback);
    SET_EndTransformFeedbackEXT(disp, _mesa_EndTransformFeedback);
-   SET_BindBufferOffsetEXT(disp, _mesa_BindBufferOffsetEXT);
+   if (_mesa_is_desktop_gl(ctx)) {
+      SET_BindBufferOffsetEXT(disp, _mesa_BindBufferOffsetEXT);
+   }
    SET_TransformFeedbackVaryingsEXT(disp, _mesa_TransformFeedbackVaryings);
    SET_GetTransformFeedbackVaryingEXT(disp, _mesa_GetTransformFeedbackVarying);
    /* ARB_transform_feedback2 */
diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h
index 7d4a945..6285362 100644
--- a/src/mesa/main/transformfeedback.h
+++ b/src/mesa/main/transformfeedback.h
@@ -47,7 +47,8 @@ extern void
 _mesa_init_transform_feedback_functions(struct dd_function_table *driver);
 
 extern void
-_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp);
+_mesa_init_transform_feedback_dispatch(struct gl_context *ctx,
+                                       struct _glapi_table *disp);
 
 
 /*** GL_EXT_transform_feedback ***/
-- 
1.7.12.4



More information about the mesa-dev mailing list