From d9e26c3483396cc2ab5f9b9bdaf347969a5205d1 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 30 Apr 2019 13:44:57 +0200 Subject: [PATCH] mesa: add EXT_dsa glMultiTexParameter* 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 | 28 ++++++ src/mapi/glapi/gen/static_data.py | 4 + src/mesa/main/dlist.c | 89 +++++++++++++++++++ src/mesa/main/tests/dispatch_sanity.cpp | 8 +- src/mesa/main/texparam.c | 87 ++++++++++++++++++ src/mesa/main/texparam.h | 12 +++ 6 files changed, 224 insertions(+), 4 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 7b52b47e5ea..a22ad73ed74 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -383,6 +383,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index ae14df59212..73688de9c3e 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1523,6 +1523,10 @@ offsets = { "MultiTexEnvfvEXT": 1487, "GetMultiTexEnvivEXT": 1488, "GetMultiTexEnvfvEXT": 1489, + "MultiTexParameteriEXT": 1490, + "MultiTexParameterivEXT": 1491, + "MultiTexParameterfEXT": 1492, + "MultiTexParameterfvEXT": 1493, } functions = [ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 6abb1c29dce..995e1fdc636 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -581,6 +581,8 @@ typedef enum OPCODE_COPY_TEXTURE_SUB_IMAGE1D, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, + OPCODE_MULTITEXPARAMETER_F, + OPCODE_MULTITEXPARAMETER_I, OPCODE_MULTITEXENV, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D, @@ -9908,6 +9910,69 @@ save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, } +static void GLAPIENTRY +save_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname, + const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_MULTITEXPARAMETER_F, 7); + if (n) { + n[1].e = texunit; + n[2].e = target; + n[3].e = pname; + n[4].f = params[0]; + n[5].f = params[1]; + n[6].f = params[2]; + n[7].f = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_MultiTexParameterfvEXT(ctx->Exec, (texunit, target, pname, params)); + } +} + + +static void GLAPIENTRY +save_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param) +{ + GLfloat parray[4]; + parray[0] = param; + parray[1] = parray[2] = parray[3] = 0.0F; + save_MultiTexParameterfvEXT(texunit, target, pname, parray); +} + +static void GLAPIENTRY +save_MultiTexParameterivEXT(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_I, 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_MultiTexParameterivEXT(ctx->Exec, (texunit, target, pname, params)); + } +} + +static void GLAPIENTRY +save_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param) +{ + GLint fparam[4]; + fparam[0] = param; + fparam[1] = fparam[2] = fparam[3] = 0; + save_MultiTexParameterivEXT(texunit, target, pname, fparam); +} + + static void GLAPIENTRY save_MultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params) { @@ -11702,6 +11767,26 @@ execute_list(struct gl_context *ctx, GLuint list) n[7].i, n[8].i, n[9].i, n[10].i)); break; + case OPCODE_MULTITEXPARAMETER_F: + { + GLfloat params[4]; + params[0] = n[4].f; + params[1] = n[5].f; + params[2] = n[6].f; + params[3] = n[7].f; + CALL_MultiTexParameterfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params)); + } + break; + case OPCODE_MULTITEXPARAMETER_I: + { + GLint params[4]; + params[0] = n[4].i; + params[1] = n[5].i; + params[2] = n[6].i; + params[3] = n[7].i; + CALL_MultiTexParameterivEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params)); + } + break; case OPCODE_MULTITEXENV: { GLfloat params[4]; @@ -12725,6 +12810,10 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_CopyTextureSubImage1DEXT(table, save_CopyTextureSubImage1DEXT); SET_CopyTextureSubImage2DEXT(table, save_CopyTextureSubImage2DEXT); SET_CopyTextureSubImage3DEXT(table, save_CopyTextureSubImage3DEXT); + SET_MultiTexParameteriEXT(table, save_MultiTexParameteriEXT); + SET_MultiTexParameterivEXT(table, save_MultiTexParameterivEXT); + SET_MultiTexParameterfEXT(table, save_MultiTexParameterfEXT); + SET_MultiTexParameterfvEXT(table, save_MultiTexParameterfvEXT); SET_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT); SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT); SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT); diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 0702c6de0a3..661f275af7f 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1072,10 +1072,10 @@ const struct function common_desktop_functions_possible[] = { //{ "glGetMultiTexGendvEXT", 12, -1 }, //{ "glGetMultiTexGenfvEXT", 12, -1 }, //{ "glGetMultiTexGenivEXT", 12, -1 }, - //{ "glMultiTexParameterfEXT", 12, -1 }, - //{ "glMultiTexParameterfvEXT", 12, -1 }, - //{ "glMultiTexParameteriEXT", 12, -1 }, - //{ "glMultiTexParameterivEXT", 12, -1 }, + { "glMultiTexParameterfEXT", 12, -1 }, + { "glMultiTexParameterfvEXT", 12, -1 }, + { "glMultiTexParameteriEXT", 12, -1 }, + { "glMultiTexParameterivEXT", 12, -1 }, //{ "glMultiTexImage1DEXT", 12, -1 }, //{ "glMultiTexImage2DEXT", 12, -1 }, //{ "glMultiTexSubImage1DEXT", 12, -1 }, diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 78888b660fa..a61bd57d7d2 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1195,6 +1195,27 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params) _mesa_texture_parameterfv(ctx, texObj, pname, params, true); } +void GLAPIENTRY +_mesa_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + false, + "glMultiTexParameterfvEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glMultiTexParameterifvEXT(target)"); + return; + } + + _mesa_texture_parameterfv(ctx, texObj, pname, params, true); +} + void GLAPIENTRY _mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param) { @@ -1214,6 +1235,28 @@ _mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat _mesa_texture_parameterf(ctx, texObj, pname, param, true); } +void GLAPIENTRY +_mesa_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, + GLfloat param) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + false, + "glMultiTexParameterfEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glMultiTexParameterfEXT"); + return; + } + + _mesa_texture_parameterf(ctx, texObj, pname, param, true); +} + void GLAPIENTRY _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param) { @@ -1246,6 +1289,28 @@ _mesa_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint pa _mesa_texture_parameteri(ctx, texObj, pname, param, true); } +void GLAPIENTRY +_mesa_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, + GLint param) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_get_texobj_by_target_and_texunit(ctx, target, + texunit - GL_TEXTURE0, + false, + "glMultiTexParameteriEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glMultiTexParameteriEXT(target)"); + return; + } + + _mesa_texture_parameteri(ctx, texObj, pname, param, true); +} + void GLAPIENTRY _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param) { @@ -1279,6 +1344,28 @@ _mesa_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, _mesa_texture_parameteriv(ctx, texObj, pname, params, true); } +void GLAPIENTRY +_mesa_MultiTexParameterivEXT(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, + false, + "glMultiTexParameterivEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glMultiTexParameterivEXT(target)"); + return; + } + + _mesa_texture_parameteriv(ctx, texObj, pname, params, true); +} + void GLAPIENTRY _mesa_TextureParameteriv(GLuint texture, GLenum pname, const GLint *params) diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h index 77cb6ff6584..a336d2bb6ad 100644 --- a/src/mesa/main/texparam.h +++ b/src/mesa/main/texparam.h @@ -185,4 +185,16 @@ _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params); extern void GLAPIENTRY _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params); +extern void GLAPIENTRY +_mesa_MultiTexParameterfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param); + +extern void GLAPIENTRY +_mesa_MultiTexParameterfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); + +extern void GLAPIENTRY +_mesa_MultiTexParameteriEXT(GLenum texunit, GLenum target, GLenum pname, GLint param); + +extern void GLAPIENTRY +_mesa_MultiTexParameterivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint *params); + #endif /* TEXPARAM_H */ -- 2.30.2