diff options
author | Pierre-Eric Pelloux-Prayer <[email protected]> | 2019-06-04 14:11:46 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-06-28 15:41:34 -0400 |
commit | 360ef827651bdc0da4b8ac251f3f048b1cab60d7 (patch) | |
tree | a482ca3c447605fe6c60317cc765da532166e7ef /src | |
parent | 29194648a6afc2cd681e3f5d1643ca49220b7975 (diff) |
mesa: add glTextureParameteri/iv/f/fvEXT
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mapi/glapi/gen/EXT_direct_state_access.xml | 42 | ||||
-rw-r--r-- | src/mapi/glapi/gen/static_data.py | 6 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 88 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 12 | ||||
-rw-r--r-- | src/mesa/main/texparam.c | 112 | ||||
-rw-r--r-- | 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 @@ <!-- OpenGL 1.1 --> + <function name="GetTextureParameterivEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="params" type="GLint *" /> + </function> + + <function name="GetTextureParameterfvEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="params" type="float *" /> + </function> + + <function name="TextureParameteriEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="param" type="int" /> + </function> + + <function name="TextureParameterivEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="params" type="const GLint *" /> + </function> + + <function name="TextureParameterfEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="param" type="float" /> + </function> + + <function name="TextureParameterfvEXT"> + <param name="texture" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="params" type="const float *" /> + </function> + <function name="TextureSubImage2DEXT"> <param name="texture" type="GLuint" /> <param name="target" type="GLenum" /> 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) @@ -1193,6 +1211,25 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params) } 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) { struct gl_texture_object *texObj; @@ -1206,6 +1243,25 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param) } 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) { struct gl_texture_object *texObj; @@ -1219,6 +1275,26 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param) } 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) @@ -2391,6 +2485,24 @@ _mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params) } 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) { struct gl_texture_object *obj; 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,11 +109,16 @@ _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); extern void GLAPIENTRY @@ -142,15 +147,27 @@ 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); extern void GLAPIENTRY |