From e04f95057fc6fdf5815815044556a5902211dac5 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 29 Apr 2019 19:26:55 +0200 Subject: [PATCH] mesa: add EXT_dsa (Get)MultiTexEnv 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 | 42 ++++++++++ src/mapi/glapi/gen/static_data.py | 6 ++ src/mesa/main/dlist.c | 82 +++++++++++++++++++ src/mesa/main/texenv.c | 70 +++++++++++++++- src/mesa/main/texenv.h | 24 ++++++ 5 files changed, 223 insertions(+), 1 deletion(-) diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 41fcf1e93b6..7b52b47e5ea 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -341,6 +341,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index fae79d470d9..ae14df59212 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1517,6 +1517,12 @@ offsets = { "EnableClientStateiEXT": 1481, "DisableClientStateiEXT": 1482, "GetPointerIndexedvEXT": 1483, + "MultiTexEnviEXT": 1484, + "MultiTexEnvivEXT": 1485, + "MultiTexEnvfEXT": 1486, + "MultiTexEnvfvEXT": 1487, + "GetMultiTexEnvivEXT": 1488, + "GetMultiTexEnvfvEXT": 1489, } functions = [ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 7dd39a1bafa..6abb1c29dce 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -581,6 +581,7 @@ typedef enum OPCODE_COPY_TEXTURE_SUB_IMAGE1D, OPCODE_COPY_TEXTURE_SUB_IMAGE2D, OPCODE_COPY_TEXTURE_SUB_IMAGE3D, + OPCODE_MULTITEXENV, OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D, /* The following three are meta instructions */ @@ -9906,6 +9907,73 @@ save_CopyTextureSubImage3DEXT(GLuint texture, GLenum target, GLint level, } } + +static void GLAPIENTRY +save_MultiTexEnvfvEXT(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_MULTITEXENV, 7); + if (n) { + n[1].e = texunit; + n[2].e = target; + n[3].e = pname; + if (pname == GL_TEXTURE_ENV_COLOR) { + n[4].f = params[0]; + n[5].f = params[1]; + n[6].f = params[2]; + n[7].f = params[3]; + } + else { + n[4].f = params[0]; + n[5].f = n[6].f = n[7].f = 0.0F; + } + } + if (ctx->ExecuteFlag) { + CALL_MultiTexEnvfvEXT(ctx->Exec, (texunit, target, pname, params)); + } +} + + +static void GLAPIENTRY +save_MultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param) +{ + GLfloat parray[4]; + parray[0] = (GLfloat) param; + parray[1] = parray[2] = parray[3] = 0.0F; + save_MultiTexEnvfvEXT(texunit, target, pname, parray); +} + + +static void GLAPIENTRY +save_MultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param) +{ + GLfloat p[4]; + p[0] = (GLfloat) param; + p[1] = p[2] = p[3] = 0.0F; + save_MultiTexEnvfvEXT(texunit, target, pname, p); +} + + +static void GLAPIENTRY +save_MultiTexEnvivEXT(GLenum texunit, GLenum target, GLenum pname, const GLint * param) +{ + GLfloat p[4]; + if (pname == GL_TEXTURE_ENV_COLOR) { + p[0] = INT_TO_FLOAT(param[0]); + p[1] = INT_TO_FLOAT(param[1]); + p[2] = INT_TO_FLOAT(param[2]); + p[3] = INT_TO_FLOAT(param[3]); + } + else { + p[0] = (GLfloat) param[0]; + p[1] = p[2] = p[3] = 0.0F; + } + save_MultiTexEnvfvEXT(texunit, target, pname, p); +} + + static void GLAPIENTRY save_CompressedTextureSubImage2DEXT(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, @@ -11634,6 +11702,16 @@ execute_list(struct gl_context *ctx, GLuint list) n[7].i, n[8].i, n[9].i, n[10].i)); break; + case OPCODE_MULTITEXENV: + { + GLfloat params[4]; + params[0] = n[4].f; + params[1] = n[5].f; + params[2] = n[6].f; + params[3] = n[7].f; + CALL_MultiTexEnvfvEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, params)); + } + break; case OPCODE_COMPRESSED_TEXTURE_SUB_IMAGE_2D: CALL_CompressedTextureSubImage2DEXT(ctx->Exec, (n[1].ui, n[2].e, n[3].i, n[4].i, @@ -12647,6 +12725,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_MultiTexEnvfEXT(table, save_MultiTexEnvfEXT); + SET_MultiTexEnvfvEXT(table, save_MultiTexEnvfvEXT); + SET_MultiTexEnviEXT(table, save_MultiTexEnviEXT); + SET_MultiTexEnvivEXT(table, save_MultiTexEnvivEXT); SET_CompressedTextureSubImage2DEXT(table, save_CompressedTextureSubImage2DEXT); } diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 8274b0b88a8..c9fcce2faf3 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -545,7 +545,6 @@ _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) } - void GLAPIENTRY _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) { @@ -574,6 +573,59 @@ _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) } +void GLAPIENTRY +_mesa_MultiTexEnvfEXT( GLenum texunit, GLenum target, + GLenum pname, GLfloat param ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0; + _mesa_texenvfv_indexed(ctx, texunit - GL_TEXTURE0, target, pname, p); +} + +void GLAPIENTRY +_mesa_MultiTexEnvfvEXT( GLenum texunit, GLenum target, + GLenum pname, const GLfloat *param ) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_texenvfv_indexed(ctx, texunit - GL_TEXTURE0, target, pname, param); +} + + +void GLAPIENTRY +_mesa_MultiTexEnviEXT( GLenum texunit, GLenum target, + GLenum pname, GLint param ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat p[4]; + p[0] = (GLfloat) param; + p[1] = p[2] = p[3] = 0.0; + _mesa_texenvfv_indexed( ctx, texunit - GL_TEXTURE0, target, pname, p ); +} + + +void GLAPIENTRY +_mesa_MultiTexEnvivEXT( GLenum texunit, GLenum target, + GLenum pname, const GLint *param ) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat p[4]; + if (pname == GL_TEXTURE_ENV_COLOR) { + p[0] = INT_TO_FLOAT( param[0] ); + p[1] = INT_TO_FLOAT( param[1] ); + p[2] = INT_TO_FLOAT( param[2] ); + p[3] = INT_TO_FLOAT( param[3] ); + } + else { + p[0] = (GLfloat) param[0]; + p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */ + } + _mesa_texenvfv_indexed( ctx, texunit - GL_TEXTURE0, target, pname, p ); +} + + + /** * Helper for glGetTexEnvi/f() @@ -823,9 +875,25 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) } +void GLAPIENTRY +_mesa_GetMultiTexEnvfvEXT( GLenum texunit, GLenum target, + GLenum pname, GLfloat *params ) +{ + _mesa_gettexenvfv_indexed(texunit - GL_TEXTURE0, target, pname, params); +} + + void GLAPIENTRY _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); _mesa_gettexenviv_indexed(ctx->Texture.CurrentUnit, target, pname, params); } + + +void GLAPIENTRY +_mesa_GetMultiTexEnvivEXT( GLenum texunit, GLenum target, + GLenum pname, GLint *params ) +{ + _mesa_gettexenviv_indexed(texunit - GL_TEXTURE0, target, pname, params); +} diff --git a/src/mesa/main/texenv.h b/src/mesa/main/texenv.h index 4aa3cb179d1..e5f968db9da 100644 --- a/src/mesa/main/texenv.h +++ b/src/mesa/main/texenv.h @@ -48,4 +48,28 @@ _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ); +extern void GLAPIENTRY +_mesa_MultiTexEnvfEXT( GLenum texunit, GLenum target, + GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_MultiTexEnvfvEXT( GLenum texunit, GLenum target, + GLenum pname, const GLfloat *param ); + +extern void GLAPIENTRY +_mesa_MultiTexEnviEXT( GLenum texunit, GLenum target, + GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_MultiTexEnvivEXT( GLenum texunit, GLenum target, + GLenum pname, const GLint *param ); + +extern void GLAPIENTRY +_mesa_GetMultiTexEnvivEXT( GLenum texunit, GLenum target, + GLenum pname, GLint *param ); + +extern void GLAPIENTRY +_mesa_GetMultiTexEnvfvEXT( GLenum texunit, GLenum target, + GLenum pname, GLfloat *param ); + #endif /* TEXENV_H */ -- 2.30.2