[Mesa-dev] [PATCH v2 6/6] _mesa_create_exec_table: GLES3 fixes.
Paul Berry
stereotype441 at gmail.com
Mon Oct 22 17:22:46 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
- VertexAttribDivisor
- 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
- GetActiveUniformName
- GetnUniformdv
- GetnUniformfv
- GetnUniformiv
- GetnUniformuiv
Reviewed-by: Brian Paul <brianp at vmware.com>
v2: Make the ctx argument to _mesa_init_transform_feedback_dispatch()
a const pointer. Add a comment to remind us to add
GetBufferParameteri64v once tests exist for it. Also add
VertexAttribDivisor for GLES3, and remove GetActiveUniformName and
GetnUniform{dv,fv,iv,uiv} for GLES3.
Cc: Matt Turner <mattst88 at gmail.com>
---
src/mesa/main/api_exec.c | 36 ++++++++++++++++++++----------------
src/mesa/main/bufferobj.c | 3 +++
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 ++-
src/mesa/main/uniforms.c | 18 +++++++++++-------
10 files changed, 68 insertions(+), 43 deletions(-)
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 7a000e7..a670fba 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);
@@ -775,7 +777,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
}
/* GL_ARB_instanced_arrays */
- if (ctx->API != API_OPENGLES2) {
+ if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
SET_VertexAttribDivisorARB(exec, _mesa_VertexAttribDivisor);
}
@@ -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/bufferobj.c b/src/mesa/main/bufferobj.c
index ac6bbc5..ac58c99 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2341,6 +2341,9 @@ _mesa_init_bufferobj_dispatch(struct gl_context *ctx, struct _glapi_table *disp)
SET_DeleteBuffersARB(disp, _mesa_DeleteBuffersARB);
SET_GenBuffersARB(disp, _mesa_GenBuffersARB);
SET_GetBufferParameterivARB(disp, _mesa_GetBufferParameterivARB);
+ /* TODO: add GetBufferParameteri64v for desktop GL and GLES3 once tests
+ * exist for it.
+ */
SET_GetBufferPointervARB(disp, _mesa_GetBufferPointervARB);
if (ctx->API != API_OPENGLES2) {
SET_GetBufferSubDataARB(disp, _mesa_GetBufferSubDataARB);
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..0669b3a 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(const 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..6ff9c50 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(const struct gl_context *ctx,
+ struct _glapi_table *disp);
/*** GL_EXT_transform_feedback ***/
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 39fac15..d89255a 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -853,20 +853,24 @@ _mesa_init_shader_uniform_dispatch(const struct gl_context *ctx,
SET_Uniform4uivEXT(exec, _mesa_Uniform4uiv);
SET_GetUniformuivEXT(exec, _mesa_GetUniformuiv);
- /* GL_ARB_robustness */
- SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
- SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
- SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
- SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB); /* GL 4.0 */
-
/* GL_ARB_uniform_buffer_object / GL 3.1 */
SET_GetUniformBlockIndex(exec, _mesa_GetUniformBlockIndex);
SET_GetUniformIndices(exec, _mesa_GetUniformIndices);
SET_GetActiveUniformsiv(exec, _mesa_GetActiveUniformsiv);
SET_GetActiveUniformBlockiv(exec, _mesa_GetActiveUniformBlockiv);
SET_GetActiveUniformBlockName(exec, _mesa_GetActiveUniformBlockName);
- SET_GetActiveUniformName(exec, _mesa_GetActiveUniformName);
SET_UniformBlockBinding(exec, _mesa_UniformBlockBinding);
}
+
+ if (_mesa_is_desktop_gl(ctx)) {
+ /* GL_ARB_robustness */
+ SET_GetnUniformfvARB(exec, _mesa_GetnUniformfvARB);
+ SET_GetnUniformivARB(exec, _mesa_GetnUniformivARB);
+ SET_GetnUniformuivARB(exec, _mesa_GetnUniformuivARB);
+ SET_GetnUniformdvARB(exec, _mesa_GetnUniformdvARB);
+
+ /* GL_ARB_uniform_buffer_object / GL 3.1 */
+ SET_GetActiveUniformName(exec, _mesa_GetActiveUniformName);
+ }
#endif /* FEATURE_GL */
}
--
1.7.12.4
More information about the mesa-dev
mailing list