diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mapi/glapi/gen/EXT_direct_state_access.xml | 72 | ||||
-rw-r--r-- | src/mapi/glapi/gen/static_data.py | 9 | ||||
-rw-r--r-- | src/mesa/main/arbprogram.c | 316 | ||||
-rw-r--r-- | src/mesa/main/arbprogram.h | 38 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 102 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 20 |
6 files changed, 485 insertions, 72 deletions
diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 28cc9b91b0f..b7074c34841 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -1008,5 +1008,77 @@ <param name="pname" type="GLenum" /> <param name="params" type="GLint *" /> </function> + + <!-- ARB_vertex_program --> + <function name="NamedProgramStringEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="format" type="GLenum" /> + <param name="len" type="GLsizei" /> + <param name="string" type="const GLvoid*" /> + </function> + + <function name="GetNamedProgramStringEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="string" type="GLvoid*" /> + </function> + + <function name="NamedProgramLocalParameter4fEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="index" type="GLuint" /> + <param name="x" type="GLfloat" /> + <param name="y" type="GLfloat" /> + <param name="z" type="GLfloat" /> + <param name="w" type="GLfloat" /> + </function> + + <function name="NamedProgramLocalParameter4fvEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="index" type="GLuint" /> + <param name="params" type="const GLfloat*" /> + </function> + + <function name="GetNamedProgramLocalParameterfvEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="index" type="GLuint" /> + <param name="params" type="GLfloat*" /> + </function> + + <function name="NamedProgramLocalParameter4dEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="index" type="GLuint" /> + <param name="x" type="GLdouble" /> + <param name="y" type="GLdouble" /> + <param name="z" type="GLdouble" /> + <param name="w" type="GLdouble" /> + </function> + + <function name="NamedProgramLocalParameter4dvEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="index" type="GLuint" /> + <param name="params" type="const GLdouble*" /> + </function> + + <function name="GetNamedProgramLocalParameterdvEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="index" type="GLuint" /> + <param name="params" type="GLdouble*" /> + </function> + + <function name="GetNamedProgramivEXT"> + <param name="program" type="GLuint" /> + <param name="target" type="GLenum" /> + <param name="pname" type="GLenum" /> + <param name="params" type="GLint*" /> + </function> + </category> </OpenGLAPI> diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py index 141eb8ff7ff..2116a1b38a5 100644 --- a/src/mapi/glapi/gen/static_data.py +++ b/src/mapi/glapi/gen/static_data.py @@ -1573,6 +1573,15 @@ offsets = { "GetNamedRenderbufferParameterivEXT": 1537, "ClientAttribDefaultEXT": 1538, "PushClientAttribDefaultEXT": 1539, + "NamedProgramStringEXT": 1540, + "GetNamedProgramStringEXT": 1541, + "NamedProgramLocalParameter4fEXT": 1542, + "NamedProgramLocalParameter4fvEXT": 1543, + "GetNamedProgramLocalParameterfvEXT": 1544, + "NamedProgramLocalParameter4dEXT": 1545, + "NamedProgramLocalParameter4dvEXT": 1546, + "GetNamedProgramLocalParameterdvEXT": 1547, + "GetNamedProgramivEXT": 1548, } functions = [ diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 24ef8666b3c..062052b5061 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -59,6 +59,40 @@ flush_vertices_for_program_constants(struct gl_context *ctx, GLenum target) ctx->NewDriverState |= new_driver_state; } +static struct gl_program* +lookup_or_create_program(GLuint id, GLenum target, const char* caller) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_program* newProg; + + if (id == 0) { + /* Bind a default program */ + if (target == GL_VERTEX_PROGRAM_ARB) + newProg = ctx->Shared->DefaultVertexProgram; + else + newProg = ctx->Shared->DefaultFragmentProgram; + } + else { + /* Bind a user program */ + newProg = _mesa_lookup_program(ctx, id); + if (!newProg || newProg == &_mesa_DummyProgram) { + /* allocate a new program now */ + newProg = ctx->Driver.NewProgram(ctx, target, id, true); + if (!newProg) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller); + return NULL; + } + _mesa_HashInsert(ctx->Shared->Programs, id, newProg); + } + else if (newProg->Target != target) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(target mismatch)", caller); + return NULL; + } + } + return newProg; +} + /** * Bind a program (make it current) * \note Called from the GL API dispatcher by both glBindProgramNV @@ -88,32 +122,9 @@ _mesa_BindProgramARB(GLenum target, GLuint id) * NOTE: binding to a non-existant program is not an error. * That's supposed to be caught in glBegin. */ - if (id == 0) { - /* Bind a default program */ - newProg = NULL; - if (target == GL_VERTEX_PROGRAM_ARB) - newProg = ctx->Shared->DefaultVertexProgram; - else - newProg = ctx->Shared->DefaultFragmentProgram; - } - else { - /* Bind a user program */ - newProg = _mesa_lookup_program(ctx, id); - if (!newProg || newProg == &_mesa_DummyProgram) { - /* allocate a new program now */ - newProg = ctx->Driver.NewProgram(ctx, target, id, true); - if (!newProg) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB"); - return; - } - _mesa_HashInsert(ctx->Shared->Programs, id, newProg); - } - else if (newProg->Target != target) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindProgramARB(target mismatch)"); - return; - } - } + newProg = lookup_or_create_program(id, target, "glBindProgram"); + if (!newProg) + return; /** All error checking is complete now **/ @@ -259,27 +270,35 @@ _mesa_IsProgramARB(GLuint id) return GL_FALSE; } -static GLboolean -get_local_param_pointer(struct gl_context *ctx, const char *func, - GLenum target, GLuint index, GLfloat **param) +static struct gl_program* +get_current_program(struct gl_context* ctx, GLenum target, const char* caller) { - struct gl_program *prog; - GLuint maxParams; - if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { - prog = ctx->VertexProgram.Current; - maxParams = ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams; + return ctx->VertexProgram.Current; } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { - prog = ctx->FragmentProgram.Current; - maxParams = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams; + return ctx->FragmentProgram.Current; } else { _mesa_error(ctx, GL_INVALID_ENUM, - "%s(target)", func); - return GL_FALSE; + "%s(target)", caller); + return NULL; + } +} + +static GLboolean +get_local_param_pointer(struct gl_context *ctx, const char *func, + struct gl_program* prog, GLenum target, + GLuint index, GLfloat **param) +{ + GLuint maxParams; + + if (target == GL_VERTEX_PROGRAM_ARB) { + maxParams = ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams; + } else { + maxParams = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams; } if (index >= maxParams) { @@ -326,11 +345,10 @@ get_env_param_pointer(struct gl_context *ctx, const char *func, } } -void GLAPIENTRY -_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, +static void +set_program_string(struct gl_program *prog, GLenum target, GLenum format, GLsizei len, const GLvoid *string) { - struct gl_program *prog; bool failed; GET_CURRENT_CONTEXT(ctx); @@ -363,12 +381,10 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, #endif /* ENABLE_SHADER_CACHE */ if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { - prog = ctx->VertexProgram.Current; _mesa_parse_arb_vertex_program(ctx, target, string, len, prog); } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { - prog = ctx->FragmentProgram.Current; _mesa_parse_arb_fragment_program(ctx, target, string, len, prog); } else { @@ -432,6 +448,36 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, } } +void GLAPIENTRY +_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, + const GLvoid *string) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { + set_program_string(ctx->VertexProgram.Current, target, format, len, string); + } + else if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + set_program_string(ctx->FragmentProgram.Current, target, format, len, string); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)"); + return; + } +} + +void GLAPIENTRY +_mesa_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len, + const GLvoid *string) +{ + struct gl_program* prog = lookup_or_create_program(program, target, "glNamedProgramStringEXT"); + + if (!prog) { + return; + } + set_program_string(prog, target, format, len, string); +} + /** * Set a program env parameter register. @@ -576,11 +622,40 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, { GET_CURRENT_CONTEXT(ctx); GLfloat *param; + struct gl_program* prog = get_current_program(ctx, target, "glProgramLocalParameterARB"); + if (!prog) { + return; + } flush_vertices_for_program_constants(ctx, target); if (get_local_param_pointer(ctx, "glProgramLocalParameterARB", - target, index, ¶m)) { + prog, target, index, ¶m)) { + assert(index < MAX_PROGRAM_LOCAL_PARAMS); + ASSIGN_4V(param, x, y, z, w); + } +} + +void GLAPIENTRY +_mesa_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat *param; + struct gl_program* prog = lookup_or_create_program(program, target, + "glNamedProgramLocalParameter4fEXT"); + + if (!prog) { + return; + } + + if ((target == GL_VERTEX_PROGRAM_ARB && prog == ctx->VertexProgram.Current) || + (target == GL_FRAGMENT_PROGRAM_ARB && prog == ctx->FragmentProgram.Current)) { + flush_vertices_for_program_constants(ctx, target); + } + + if (get_local_param_pointer(ctx, "glNamedProgramLocalParameter4fEXT", + prog, target, index, ¶m)) { assert(index < MAX_PROGRAM_LOCAL_PARAMS); ASSIGN_4V(param, x, y, z, w); } @@ -597,11 +672,24 @@ _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, void GLAPIENTRY +_mesa_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index, + const GLfloat *params) +{ + _mesa_NamedProgramLocalParameter4fEXT(program, target, index, params[0], + params[1], params[2], params[3]); +} + + +void GLAPIENTRY _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest; + struct gl_program* prog = get_current_program(ctx, target, "glProgramLocalParameters4fv"); + if (!prog) { + return; + } flush_vertices_for_program_constants(ctx, target); @@ -610,7 +698,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, } if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT", - target, index, &dest)) { + prog, target, index, &dest)) { GLuint maxParams = target == GL_FRAGMENT_PROGRAM_ARB ? ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams : ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams; @@ -637,6 +725,16 @@ _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, void GLAPIENTRY +_mesa_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index, + GLdouble x, GLdouble y, + GLdouble z, GLdouble w) +{ + _mesa_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x, (GLfloat) y, + (GLfloat) z, (GLfloat) w); +} + + +void GLAPIENTRY _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { @@ -647,14 +745,47 @@ _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, void GLAPIENTRY +_mesa_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index, + const GLdouble *params) +{ + _mesa_NamedProgramLocalParameter4fEXT(program, target, index, + (GLfloat) params[0], (GLfloat) params[1], + (GLfloat) params[2], (GLfloat) params[3]); +} + + +void GLAPIENTRY _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat *params) { GLfloat *param; GET_CURRENT_CONTEXT(ctx); + struct gl_program* prog = get_current_program(ctx, target, "glGetProgramLocalParameterfvARB"); + if (!prog) { + return; + } if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT", - target, index, ¶m)) { + prog, target, index, ¶m)) { + COPY_4V(params, param); + } +} + + +void GLAPIENTRY +_mesa_GetNamedProgramLocalParameterfvEXT(GLuint program, GLenum target, GLuint index, + GLfloat *params) +{ + GLfloat *param; + GET_CURRENT_CONTEXT(ctx); + struct gl_program* prog = lookup_or_create_program(program, target, + "glGetNamedProgramLocalParameterfvEXT"); + if (!prog) { + return; + } + + if (get_local_param_pointer(ctx, "glGetNamedProgramLocalParameterfvEXT", + prog, target, index, ¶m)) { COPY_4V(params, param); } } @@ -666,34 +797,50 @@ _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, { GLfloat *param; GET_CURRENT_CONTEXT(ctx); + struct gl_program* prog = get_current_program(ctx, target, "glGetProgramLocalParameterdvARB"); + if (!prog) { + return; + } if (get_local_param_pointer(ctx, "glProgramLocalParameters4fvEXT", - target, index, ¶m)) { + prog, target, index, ¶m)) { COPY_4V(params, param); } } void GLAPIENTRY -_mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) +_mesa_GetNamedProgramLocalParameterdvEXT(GLuint program, GLenum target, GLuint index, + GLdouble *params) +{ + GLfloat *param; + GET_CURRENT_CONTEXT(ctx); + struct gl_program* prog = lookup_or_create_program(program, target, + "glGetNamedProgramLocalParameterdvEXT"); + if (!prog) { + return; + } + + if (get_local_param_pointer(ctx, "glGetNamedProgramLocalParameterdvEXT", + prog, target, index, ¶m)) { + COPY_4V(params, param); + } +} + + +static void +get_program_iv(struct gl_program *prog, GLenum target, GLenum pname, + GLint *params) { const struct gl_program_constants *limits; - struct gl_program *prog; + GET_CURRENT_CONTEXT(ctx); - if (target == GL_VERTEX_PROGRAM_ARB - && ctx->Extensions.ARB_vertex_program) { - prog = ctx->VertexProgram.Current; + if (target == GL_VERTEX_PROGRAM_ARB) { limits = &ctx->Const.Program[MESA_SHADER_VERTEX]; } - else if (target == GL_FRAGMENT_PROGRAM_ARB - && ctx->Extensions.ARB_fragment_program) { - prog = ctx->FragmentProgram.Current; - limits = &ctx->Const.Program[MESA_SHADER_FRAGMENT]; - } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); - return; + limits = &ctx->Const.Program[MESA_SHADER_FRAGMENT]; } assert(prog); @@ -857,6 +1004,35 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) void GLAPIENTRY +_mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_program* prog = get_current_program(ctx, target, + "glGetProgramivARB"); + if (!prog) { + return; + } + get_program_iv(prog, target, pname, params); +} + +void GLAPIENTRY +_mesa_GetNamedProgramivEXT(GLuint program, GLenum target, GLenum pname, + GLint *params) +{ + struct gl_program* prog; + if (pname == GL_PROGRAM_BINDING_ARB) { + return _mesa_GetProgramivARB(target, pname, params); + } + prog = lookup_or_create_program(program, target, + "glGetNamedProgramivEXT"); + if (!prog) { + return; + } + get_program_iv(prog, target, pname, params); +} + + +void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) { const struct gl_program *prog; @@ -886,3 +1062,25 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) else *dst = '\0'; } + + +void GLAPIENTRY +_mesa_GetNamedProgramStringEXT(GLuint program, GLenum target, + GLenum pname, GLvoid *string) { + char *dst = (char *) string; + GET_CURRENT_CONTEXT(ctx); + struct gl_program* prog = lookup_or_create_program(program, target, + "glGetNamedProgramStringEXT"); + if (!prog) + return; + + if (pname != GL_PROGRAM_STRING_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetNamedProgramStringEXT(pname)"); + return; + } + + if (prog->String) + memcpy(dst, prog->String, strlen((char *) prog->String)); + else + *dst = '\0'; +} diff --git a/src/mesa/main/arbprogram.h b/src/mesa/main/arbprogram.h index af0bdff1e65..0a86e9d5e18 100644 --- a/src/mesa/main/arbprogram.h +++ b/src/mesa/main/arbprogram.h @@ -48,6 +48,9 @@ extern void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string); +extern void GLAPIENTRY +_mesa_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, + GLsizei len, const GLvoid *string); extern void GLAPIENTRY _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, @@ -91,10 +94,29 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, extern void GLAPIENTRY +_mesa_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, + GLuint index, const GLfloat *params); + +extern void GLAPIENTRY +_mesa_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, + GLuint index, GLdouble x, GLdouble y, + GLdouble z, GLdouble w); + +extern void GLAPIENTRY +_mesa_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, + GLuint index, const GLdouble *params); + + +extern void GLAPIENTRY +_mesa_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, + GLuint index, GLfloat x, GLfloat y, + GLfloat z, GLfloat w); + + +extern void GLAPIENTRY _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat *params); - extern void GLAPIENTRY _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params); @@ -114,18 +136,30 @@ extern void GLAPIENTRY _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble *params); +extern void GLAPIENTRY +_mesa_GetNamedProgramLocalParameterdvEXT(GLuint program, GLenum target, + GLuint index, GLdouble *params); extern void GLAPIENTRY -_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, +_mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat *params); +extern void GLAPIENTRY +_mesa_GetNamedProgramLocalParameterfvEXT(GLuint program, GLenum target, + GLuint index, GLfloat *params); extern void GLAPIENTRY _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params); +extern void GLAPIENTRY +_mesa_GetNamedProgramivEXT(GLuint program, GLenum target, GLenum pname, + GLint *params); extern void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string); +extern void GLAPIENTRY +_mesa_GetNamedProgramStringEXT(GLuint program, GLenum target, + GLenum pname, GLvoid *string); #endif diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 622fb805660..843446b78b1 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -608,6 +608,8 @@ typedef enum OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_1D, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_2D, OPCODE_COMPRESSED_MULTITEX_SUB_IMAGE_3D, + OPCODE_NAMED_PROGRAM_STRING, + OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ @@ -1289,7 +1291,9 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist) case OPCODE_COMPRESSED_MULTITEX_IMAGE_3D: free(get_pointer(&n[10])); break; - + case OPCODE_NAMED_PROGRAM_STRING: + free(get_pointer(&n[5])); + break; case OPCODE_CONTINUE: n = (Node *) get_pointer(&n[1]); free(block); @@ -10905,6 +10909,87 @@ save_CompressedMultiTexSubImage3DEXT(GLenum texunit, GLenum target, GLint level, } +static void GLAPIENTRY +save_NamedProgramStringEXT(GLuint program, GLenum target, GLenum format, GLsizei len, + const GLvoid * string) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + + n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_STRING, 4 + POINTER_DWORDS); + if (n) { + GLubyte *programCopy = malloc(len); + if (!programCopy) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glNamedProgramStringEXT"); + return; + } + memcpy(programCopy, string, len); + n[1].ui = program; + n[2].e = target; + n[3].e = format; + n[4].i = len; + save_pointer(&n[5], programCopy); + } + if (ctx->ExecuteFlag) { + CALL_NamedProgramStringEXT(ctx->Exec, (program, target, format, len, string)); + } +} + + +static void GLAPIENTRY +save_NamedProgramLocalParameter4fEXT(GLuint program, GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER, 7); + if (n) { + n[1].ui = program; + n[2].e = target; + n[3].ui = index; + n[4].f = x; + n[5].f = y; + n[6].f = z; + n[7].f = w; + } + if (ctx->ExecuteFlag) { + CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, (program, target, index, x, y, z, w)); + } +} + + +static void GLAPIENTRY +save_NamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index, + const GLfloat *params) +{ + save_NamedProgramLocalParameter4fEXT(program, target, index, params[0], + params[1], params[2], params[3]); +} + + +static void GLAPIENTRY +save_NamedProgramLocalParameter4dEXT(GLuint program, GLenum target, GLuint index, + GLdouble x, GLdouble y, + GLdouble z, GLdouble w) +{ + save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) x, + (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + + +static void GLAPIENTRY +save_NamedProgramLocalParameter4dvEXT(GLuint program, GLenum target, GLuint index, + const GLdouble *params) +{ + save_NamedProgramLocalParameter4fEXT(program, target, index, (GLfloat) params[0], + (GLfloat) params[1], (GLfloat) params[2], + (GLfloat) params[3]); +} + + /** * Save an error-generating command into display list. * @@ -12815,6 +12900,16 @@ execute_list(struct gl_context *ctx, GLuint list) n[9].i, n[10].e, n[11].i, get_pointer(&n[12]))); break; + case OPCODE_NAMED_PROGRAM_STRING: + CALL_NamedProgramStringEXT(ctx->Exec, + (n[1].ui, n[2].e, n[3].e, n[4].i, + get_pointer(&n[5]))); + break; + case OPCODE_NAMED_PROGRAM_LOCAL_PARAMETER: + CALL_NamedProgramLocalParameter4fEXT(ctx->Exec, + (n[1].ui, n[2].e, n[3].ui, n[4].f, + n[5].f, n[6].f, n[7].f)); + break; case OPCODE_CONTINUE: n = (Node *) get_pointer(&n[1]); @@ -13854,6 +13949,11 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_CompressedMultiTexSubImage1DEXT(table, save_CompressedMultiTexSubImage1DEXT); SET_CompressedMultiTexSubImage2DEXT(table, save_CompressedMultiTexSubImage2DEXT); SET_CompressedMultiTexSubImage3DEXT(table, save_CompressedMultiTexSubImage3DEXT); + SET_NamedProgramStringEXT(table, save_NamedProgramStringEXT); + SET_NamedProgramLocalParameter4dEXT(table, save_NamedProgramLocalParameter4dEXT); + SET_NamedProgramLocalParameter4dvEXT(table, save_NamedProgramLocalParameter4dvEXT); + SET_NamedProgramLocalParameter4fEXT(table, save_NamedProgramLocalParameter4fEXT); + SET_NamedProgramLocalParameter4fvEXT(table, save_NamedProgramLocalParameter4fvEXT); } diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index be322aa792e..fa1ba641452 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1096,15 +1096,15 @@ const struct function common_desktop_functions_possible[] = { { "glDisableClientStateIndexedEXT", 12, -1 }, { "glGetPointerIndexedvEXT", 12, -1 }, /* GL_EXT_direct_state_access - ARB_vertex_program */ - //{ "glNamedProgramStringEXT", 10, -1 }, - //{ "glNamedProgramLocalParameter4dEXT", 10, -1 }, - //{ "glNamedProgramLocalParameter4dvEXT", 10, -1 }, - //{ "glNamedProgramLocalParameter4fEXT", 10, -1 }, - //{ "glNamedProgramLocalParameter4fvEXT", 10, -1 }, - //{ "glGetNamedProgramLocalParameter4dvEXT", 10, -1 }, - //{ "glGetNamedProgramLocalParameter4fvEXT", 10, -1 }, - //{ "glGetNamedProgramivEXT", 10, -1 }, - //{ "glGetNamedProgramStringEXT", 10, -1 }, + { "glNamedProgramStringEXT", 10, -1 }, + { "glNamedProgramLocalParameter4dEXT", 10, -1 }, + { "glNamedProgramLocalParameter4dvEXT", 10, -1 }, + { "glNamedProgramLocalParameter4fEXT", 10, -1 }, + { "glNamedProgramLocalParameter4fvEXT", 10, -1 }, + { "glGetNamedProgramLocalParameterdvEXT", 10, -1 }, + { "glGetNamedProgramLocalParameterfvEXT", 10, -1 }, + { "glGetNamedProgramivEXT", 10, -1 }, + { "glGetNamedProgramStringEXT", 10, -1 }, /* GL_EXT_direct_state_access - GL 1.3 */ { "glCompressedTextureImage1DEXT", 13, -1 }, { "glCompressedTextureImage2DEXT", 13, -1 }, @@ -1133,7 +1133,7 @@ const struct function common_desktop_functions_possible[] = { { "glGetNamedBufferPointervEXT", 15, -1 }, { "glGetNamedBufferSubDataEXT", 15, -1 }, /* GL_EXT_direct_state_access - GL 2.0 */ - //{ "glProgramUniform1iEXT", 20, -1 }, + // { "glProgramUniform1iEXT", 20, -1 }, //{ "glProgramUniform1ivEXT", 20, -1 }, //{ "glProgramUniform1fEXT", 20, -1 }, //{ "glProgramUniform1fvEXT", 20, -1 }, |