From c2d6f61f26c60f1cd2c61c4e350d38015660c2fd Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 9 Sep 2019 16:44:11 +0200 Subject: [PATCH] mesa: add EXT_dsa + EXT_texture_integer functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- .../glapi/gen/EXT_direct_state_access.xml | 57 ++++++++ src/mapi/glapi/gen/static_data.py | 8 ++ src/mesa/main/dlist.c | 133 ++++++++++++++++++ src/mesa/main/tests/dispatch_sanity.cpp | 16 +-- src/mesa/main/texparam.c | 127 +++++++++++++++++ src/mesa/main/texparam.h | 24 ++++ 6 files changed, 357 insertions(+), 8 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 6a26a43dba2..1a987e3cd0a 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -1099,5 +1099,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index ae041817bb3..938acbc0191 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1584,6 +1584,14 @@ offsets = { "GetNamedProgramivEXT": 1548, "TextureBufferEXT": 1549, "MultiTexBufferEXT": 1550, + "TextureParameterIivEXT": 1551, + "TextureParameterIuivEXT": 1552, + "GetTextureParameterIivEXT": 1553, + "GetTextureParameterIuivEXT": 1554, + "MultiTexParameterIivEXT": 1555, + "MultiTexParameterIuivEXT": 1556, + "GetMultiTexParameterIivEXT": 1557, + "GetMultiTexParameterIuivEXT": 1558, } functions = [ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 843446b78b1..5d73a4c670c 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -570,6 +570,8 @@ typedef enum OPCODE_MATRIX_POP, OPCODE_TEXTUREPARAMETER_F, OPCODE_TEXTUREPARAMETER_I, + OPCODE_TEXTUREPARAMETER_II, + OPCODE_TEXTUREPARAMETER_IUI, OPCODE_TEXTURE_IMAGE1D, OPCODE_TEXTURE_IMAGE2D, OPCODE_TEXTURE_IMAGE3D, @@ -584,6 +586,8 @@ typedef enum OPCODE_BIND_MULTITEXTURE, OPCODE_MULTITEXPARAMETER_F, OPCODE_MULTITEXPARAMETER_I, + OPCODE_MULTITEXPARAMETER_II, + OPCODE_MULTITEXPARAMETER_IUI, OPCODE_MULTITEX_IMAGE1D, OPCODE_MULTITEX_IMAGE2D, OPCODE_MULTITEX_IMAGE3D, @@ -9616,6 +9620,49 @@ save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint par save_TextureParameterivEXT(texture, target, pname, fparam); } +static void GLAPIENTRY +save_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint* params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_II, 7); + if (n) { + n[1].ui = texture; + n[2].e = target; + n[3].e = pname; + n[4].i = params[0]; + n[5].i = params[1]; + n[6].i = params[2]; + n[7].i = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_TextureParameterIivEXT(ctx->Exec, (texture, target, pname, params)); + } +} + +static void GLAPIENTRY +save_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint* params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_TEXTUREPARAMETER_IUI, 7); + if (n) { + n[1].ui = texture; + n[2].e = target; + n[3].e = pname; + n[4].ui = params[0]; + n[5].ui = params[1]; + n[6].ui = params[2]; + n[7].ui = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_TextureParameterIuivEXT(ctx->Exec, (texture, target, pname, params)); + } +} + + static void GLAPIENTRY save_TextureImage1DEXT(GLuint texture, GLenum target, GLint level, GLint components, @@ -10037,6 +10084,48 @@ save_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const G } } +static void GLAPIENTRY +save_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_II, 7); + if (n) { + n[1].e = texunit; + n[2].e = target; + n[3].e = pname; + n[4].i = params[0]; + n[5].i = params[1]; + n[6].i = params[2]; + n[7].i = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_MultiTexParameterIivEXT(ctx->Exec, (texunit, target, pname, params)); + } +} + +static void GLAPIENTRY +save_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_IUI, 7); + if (n) { + n[1].e = texunit; + n[2].e = target; + n[3].e = pname; + n[4].ui = params[0]; + n[5].ui = params[1]; + n[6].ui = params[2]; + n[7].ui = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_MultiTexParameterIuivEXT(ctx->Exec, (texunit, target, pname, params)); + } +} + static void GLAPIENTRY save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param) { @@ -12575,6 +12664,26 @@ execute_list(struct gl_context *ctx, GLuint list) CALL_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params)); } break; + case OPCODE_TEXTUREPARAMETER_II: + { + GLint params[4]; + params[0] = n[4].i; + params[1] = n[5].i; + params[2] = n[6].i; + params[3] = n[7].i; + CALL_TextureParameterIivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params)); + } + break; + case OPCODE_TEXTUREPARAMETER_IUI: + { + GLuint params[4]; + params[0] = n[4].ui; + params[1] = n[5].ui; + params[2] = n[6].ui; + params[3] = n[7].ui; + CALL_TextureParameterIuivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params)); + } + break; case OPCODE_TEXTURE_IMAGE1D: { const struct gl_pixelstore_attrib save = ctx->Unpack; @@ -12708,6 +12817,26 @@ execute_list(struct gl_context *ctx, GLuint list) CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params)); } break; + case OPCODE_MULTITEXPARAMETER_II: + { + GLint params[4]; + params[0] = n[4].i; + params[1] = n[5].i; + params[2] = n[6].i; + params[3] = n[7].i; + CALL_MultiTexParameterIivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params)); + } + break; + case OPCODE_MULTITEXPARAMETER_IUI: + { + GLuint params[4]; + params[0] = n[4].ui; + params[1] = n[5].ui; + params[2] = n[6].ui; + params[3] = n[7].ui; + CALL_MultiTexParameterIuivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params)); + } + break; case OPCODE_MULTITEX_IMAGE1D: { const struct gl_pixelstore_attrib save = ctx->Unpack; @@ -13906,6 +14035,8 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_TextureParameterivEXT(table, save_TextureParameterivEXT); SET_TextureParameterfEXT(table, save_TextureParameterfEXT); SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT); + SET_TextureParameterIivEXT(table, save_TextureParameterIivEXT); + SET_TextureParameterIuivEXT(table, save_TextureParameterIuivEXT); SET_TextureImage1DEXT(table, save_TextureImage1DEXT); SET_TextureImage2DEXT(table, save_TextureImage2DEXT); SET_TextureImage3DEXT(table, save_TextureImage3DEXT); @@ -13920,6 +14051,8 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_BindMultiTextureEXT(table, save_BindMultiTextureEXT); SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT); SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT); + SET_MultiTexParameterIivEXT(table, save_MultiTexParameterIivEXT); + SET_MultiTexParameterIuivEXT(table, save_MultiTexParameterIuivEXT); SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT); SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT); SET_MultiTexImage1DEXT(table, save_MultiTexImage1DEXT); diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index e0451b36df3..ed38f00b694 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1140,14 +1140,14 @@ const struct function common_desktop_functions_possible[] = { { "glTextureBufferEXT", 10, -1 }, { "glMultiTexBufferEXT", 10, -1 }, /* GL_EXT_direct_state_access - EXT_texture_integer */ - //{ "glTextureParameterIivEXT", 10, -1 }, - //{ "glTextureParameterIuivEXT", 10, -1 }, - //{ "glGetTextureParameterIivEXT", 10, -1 }, - //{ "glGetTextureParameterIuivEXT", 10, -1 }, - //{ "glMultiTexParameterIivEXT", 10, -1 }, - //{ "glMultiTexParameterIuivEXT", 10, -1 }, - //{ "glGetMultiTexParameterIivEXT", 10, -1 }, - //{ "glGetMultiTexParameterIuivEXT", 10, -1 }, + { "glTextureParameterIivEXT", 10, -1 }, + { "glTextureParameterIuivEXT", 10, -1 }, + { "glGetTextureParameterIivEXT", 10, -1 }, + { "glGetTextureParameterIuivEXT", 10, -1 }, + { "glMultiTexParameterIivEXT", 10, -1 }, + { "glMultiTexParameterIuivEXT", 10, -1 }, + { "glGetMultiTexParameterIivEXT", 10, -1 }, + { "glGetMultiTexParameterIuivEXT", 10, -1 }, /* GL_EXT_direct_state_access - EXT_gpu_shader4 */ //{ "glProgramUniform1uiEXT", 10, -1 }, //{ "glProgramUniform1uivEXT", 10, -1 }, diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index ade10b2e2b4..c642f456992 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1394,6 +1394,38 @@ _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params) _mesa_texture_parameterIiv(ctx, texObj, pname, params, true); } +void GLAPIENTRY +_mesa_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, + const GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureParameterIivEXT"); + if (!texObj) + return; + + _mesa_texture_parameterIiv(ctx, texObj, pname, params, true); +} + +void GLAPIENTRY +_mesa_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, + const GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + true, + "glMultiTexParameterIivEXT"); + if (!texObj) + return; + + _mesa_texture_parameterIiv(ctx, texObj, pname, params, true); +} + void GLAPIENTRY _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params) { @@ -1407,6 +1439,38 @@ _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params) _mesa_texture_parameterIuiv(ctx, texObj, pname, params, true); } +void GLAPIENTRY +_mesa_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, + const GLuint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureParameterIuivEXT"); + if (!texObj) + return; + + _mesa_texture_parameterIuiv(ctx, texObj, pname, params, true); +} + +void GLAPIENTRY +_mesa_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, + const GLuint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + true, + "glMultiTexParameterIuivEXT"); + if (!texObj) + return; + + _mesa_texture_parameterIuiv(ctx, texObj, pname, params, true); +} + GLboolean _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target, bool dsa) @@ -2739,6 +2803,37 @@ _mesa_GetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params) get_tex_parameterIiv(ctx, texObj, pname, params, true); } +void GLAPIENTRY +_mesa_GetTextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glGetTextureParameterIivEXT"); + if (!texObj) + return; + + + get_tex_parameterIiv(ctx, texObj, pname, params, true); +} + +void GLAPIENTRY +_mesa_GetMultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, + GLint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + true, + "glGetMultiTexParameterIiv"); + if (!texObj) + return; + + get_tex_parameterIiv(ctx, texObj, pname, params, true); +} void GLAPIENTRY _mesa_GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params) @@ -2752,3 +2847,35 @@ _mesa_GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params) get_tex_parameterIiv(ctx, texObj, pname, (GLint *) params, true); } + +void GLAPIENTRY +_mesa_GetTextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, + GLuint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glGetTextureParameterIuvEXT"); + if (!texObj) + return; + + get_tex_parameterIiv(ctx, texObj, pname, (GLint *) params, true); +} + +void GLAPIENTRY +_mesa_GetMultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, + GLuint *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + true, + "glGetMultiTexParameterIuiv"); + if (!texObj) + return; + + get_tex_parameterIiv(ctx, texObj, pname, (GLint *) params, true); +} diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h index 858a5126a84..d352b560138 100644 --- a/src/mesa/main/texparam.h +++ b/src/mesa/main/texparam.h @@ -143,9 +143,21 @@ _mesa_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params); +extern void GLAPIENTRY +_mesa_GetTextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_GetMultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, GLint *params); + extern void GLAPIENTRY _mesa_GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params); +extern void GLAPIENTRY +_mesa_GetTextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, GLuint *params); + +extern void GLAPIENTRY +_mesa_GetMultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, GLuint *params); + extern void GLAPIENTRY _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); @@ -192,9 +204,21 @@ _mesa_TextureParameteriv(GLuint texture, GLenum pname, const GLint *params); extern void GLAPIENTRY _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params); +extern void GLAPIENTRY +_mesa_TextureParameterIivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params); + +extern void GLAPIENTRY +_mesa_MultiTexParameterIivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params); + extern void GLAPIENTRY _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params); +extern void GLAPIENTRY +_mesa_TextureParameterIuivEXT(GLuint texture, GLenum target, GLenum pname, const GLuint *params); + +extern void GLAPIENTRY +_mesa_MultiTexParameterIuivEXT(GLenum texunit, GLenum target, GLenum pname, const GLuint *params); + extern void GLAPIENTRY _mesa_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param); -- 2.30.2