From 360ef827651bdc0da4b8ac251f3f048b1cab60d7 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 4 Jun 2019 14:11:46 +0200 Subject: [PATCH] mesa: add glTextureParameteri/iv/f/fvEXT MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- .../glapi/gen/EXT_direct_state_access.xml | 42 +++++++ src/mapi/glapi/gen/static_data.py | 6 + src/mesa/main/dlist.c | 88 ++++++++++++++ src/mesa/main/tests/dispatch_sanity.cpp | 12 +- src/mesa/main/texparam.c | 112 ++++++++++++++++++ src/mesa/main/texparam.h | 17 +++ 6 files changed, 271 insertions(+), 6 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 37f443bb9b5..63ce189c766 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -102,6 +102,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index 006b5bb8152..2372f991edd 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1481,6 +1481,12 @@ offsets = { "TextureSubImage2DEXT": 1445, "CompressedTextureSubImage2DEXT": 1446, "MapNamedBufferEXT": 1447, + "GetTextureParameterivEXT": 1448, + "GetTextureParameterfvEXT": 1449, + "TextureParameteriEXT": 1450, + "TextureParameterivEXT": 1451, + "TextureParameterfEXT": 1452, + "TextureParameterfvEXT": 1453, } functions = [ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 0b035aa7b1b..b07449b2133 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -568,6 +568,8 @@ typedef enum OPCODE_MATRIX_FRUSTUM, OPCODE_MATRIX_PUSH, OPCODE_MATRIX_POP, + OPCODE_TEXTUREPARAMETER_F, + OPCODE_TEXTUREPARAMETER_I, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ @@ -9461,6 +9463,68 @@ save_MatrixMultTransposedEXT(GLenum matrixMode, const GLdouble m[16]) save_MatrixMultfEXT(matrixMode, tm); } +static void GLAPIENTRY +save_TextureParameterfvEXT(GLuint texture, 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_TEXTUREPARAMETER_F, 7); + if (n) { + n[1].ui = texture; + 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_TextureParameterfvEXT(ctx->Exec, (texture, target, pname, params)); + } +} + + +static void GLAPIENTRY +save_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param) +{ + GLfloat parray[4]; + parray[0] = param; + parray[1] = parray[2] = parray[3] = 0.0F; + save_TextureParameterfvEXT(texture, target, pname, parray); +} + +static void GLAPIENTRY +save_TextureParameterivEXT(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_I, 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_TextureParameterivEXT(ctx->Exec, (texture, target, pname, params)); + } +} + +static void GLAPIENTRY +save_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param) +{ + GLint fparam[4]; + fparam[0] = param; + fparam[1] = fparam[2] = fparam[3] = 0; + save_TextureParameterivEXT(texture, target, pname, fparam); +} + /** * Save an error-generating command into display list. @@ -11027,6 +11091,26 @@ execute_list(struct gl_context *ctx, GLuint list) case OPCODE_MATRIX_POP: CALL_MatrixPopEXT(ctx->Exec, (n[1].e)); break; + case OPCODE_TEXTUREPARAMETER_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_TextureParameterfvEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params)); + } + break; + case OPCODE_TEXTUREPARAMETER_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_TextureParameterivEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].e, params)); + } + break; case OPCODE_CONTINUE: n = (Node *) get_pointer(&n[1]); @@ -12019,6 +12103,10 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_MatrixLoadTransposedEXT(table, save_MatrixLoadTransposedEXT); SET_MatrixMultTransposefEXT(table, save_MatrixMultTransposefEXT); SET_MatrixMultTransposedEXT(table, save_MatrixMultTransposedEXT); + SET_TextureParameteriEXT(table, save_TextureParameteriEXT); + SET_TextureParameterivEXT(table, save_TextureParameterivEXT); + SET_TextureParameterfEXT(table, save_TextureParameterfEXT); + SET_TextureParameterfvEXT(table, save_TextureParameterfvEXT); } diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index a524c58caf4..a8751e3b69e 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1033,10 +1033,10 @@ const struct function common_desktop_functions_possible[] = { /* GL_EXT_direct_state_access - GL 1.1 */ //{ "glClientAttribDefaultEXT", 11, -1 }, //{ "glPushClientAttribDefaultEXT", 11, -1 }, - //{ "glTextureParameteriEXT", 11, -1 }, - //{ "glTextureParameterivEXT", 11, -1 }, - //{ "glTextureParameterfEXT", 11, -1 }, - //{ "glTextureParameterfvEXT", 11, -1 }, + { "glTextureParameteriEXT", 11, -1 }, + { "glTextureParameterivEXT", 11, -1 }, + { "glTextureParameterfEXT", 11, -1 }, + { "glTextureParameterfvEXT", 11, -1 }, //{ "glTextureImage1DEXT", 11, -1 }, //{ "glTextureImage2DEXT", 11, -1 }, //{ "glTextureSubImage1DEXT", 11, -1 }, @@ -1046,8 +1046,8 @@ const struct function common_desktop_functions_possible[] = { //{ "glCopyTextureSubImage1DEXT", 11, -1 }, //{ "glCopyTextureSubImage2DEXT", 11, -1 }, //{ "glGetTextureImageEXT", 11, -1 }, - //{ "glGetTextureParameterfvEXT", 11, -1 }, - //{ "glGetTextureParameterivEXT", 11, -1 }, + { "glGetTextureParameterfvEXT", 11, -1 }, + { "glGetTextureParameterivEXT", 11, -1 }, //{ "glGetTextureLevelParameterfvEXT", 11, -1 }, //{ "glGetTextureLevelParameterivEXT", 11, -1 }, /* GL_EXT_direct_state_access - GL 1.2 */ diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index a81036041d1..64bd0b63566 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1178,6 +1178,24 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) _mesa_texture_parameterIuiv(ctx, texObj, pname, params, false); } +void GLAPIENTRY +_mesa_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, const GLfloat *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureParameterfvEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterfvEXT"); + return; + } + + _mesa_texture_parameterfv(ctx, texObj, pname, params, true); +} void GLAPIENTRY _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params) @@ -1192,6 +1210,25 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params) _mesa_texture_parameterfv(ctx, texObj, pname, params, true); } +void GLAPIENTRY +_mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureParameterfEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterfEXT"); + return; + } + + _mesa_texture_parameterf(ctx, texObj, pname, param, true); +} + void GLAPIENTRY _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param) { @@ -1205,6 +1242,25 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param) _mesa_texture_parameterf(ctx, texObj, pname, param, true); } +void GLAPIENTRY +_mesa_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glTextureParameteriEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteriEXT(target)"); + return; + } + + _mesa_texture_parameteri(ctx, texObj, pname, param, true); +} + void GLAPIENTRY _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param) { @@ -1218,6 +1274,26 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param) _mesa_texture_parameteri(ctx, texObj, pname, param, true); } +void GLAPIENTRY +_mesa_TextureParameterivEXT(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, + "glTextureParameterivEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterivEXT(target)"); + return; + } + + _mesa_texture_parameteriv(ctx, texObj, pname, params, true); +} + void GLAPIENTRY _mesa_TextureParameteriv(GLuint texture, GLenum pname, const GLint *params) @@ -2376,6 +2452,24 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params) get_tex_parameterIiv(ctx, texObj, pname, (GLint *) params, false); } +void GLAPIENTRY +_mesa_GetTextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, GLfloat *params) +{ + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + + texObj = _mesa_lookup_or_create_texture(ctx, target, texture, false, true, + "glGetTextureParameterfvEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTextureParameterfvEXT"); + return; + } + + get_tex_parameterfv(ctx, texObj, pname, params, true); +} void GLAPIENTRY _mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params) @@ -2390,6 +2484,24 @@ _mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params) get_tex_parameterfv(ctx, obj, pname, params, true); } +void GLAPIENTRY +_mesa_GetTextureParameterivEXT(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, + "glGetTextureParameterivEXT"); + if (!texObj) + return; + + if (!is_texparameteri_target_valid(texObj->Target)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTextureParameterivEXT"); + return; + } + get_tex_parameteriv(ctx, texObj, pname, params, true); + } + void GLAPIENTRY _mesa_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params) { diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h index b2f6a847337..130d32f2c76 100644 --- a/src/mesa/main/texparam.h +++ b/src/mesa/main/texparam.h @@ -109,10 +109,15 @@ _mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params); +extern void GLAPIENTRY +_mesa_GetTextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, GLfloat *params); extern void GLAPIENTRY _mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params); +extern void GLAPIENTRY +_mesa_GetTextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, GLint *params ); + extern void GLAPIENTRY _mesa_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params); @@ -141,15 +146,27 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params); extern void GLAPIENTRY _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params); +extern void GLAPIENTRY +_mesa_TextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, const GLfloat *params); + extern void GLAPIENTRY _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params); +extern void GLAPIENTRY +_mesa_TextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param); + extern void GLAPIENTRY _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param); +extern void GLAPIENTRY +_mesa_TextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param); + extern void GLAPIENTRY _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param); +extern void GLAPIENTRY +_mesa_TextureParameterivEXT(GLuint texture, GLenum target, GLenum pname, const GLint *params); + extern void GLAPIENTRY _mesa_TextureParameteriv(GLuint texture, GLenum pname, const GLint *params); -- 2.30.2