diff options
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 37 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_uniform.c | 74 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_uniform.h | 4 |
3 files changed, 11 insertions, 104 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 2e1b8fba3..5be44bc51 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -3288,31 +3288,20 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); if (linked_prog) { - bool ok = true; + static const GLenum targets[] = { + GL_VERTEX_PROGRAM_ARB, + GL_FRAGMENT_PROGRAM_ARB, + GL_GEOMETRY_PROGRAM_NV + }; - switch (prog->_LinkedShaders[i]->Type) { - case GL_VERTEX_SHADER: + if (i == MESA_SHADER_VERTEX) { ((struct gl_vertex_program *)linked_prog)->UsesClipDistance = prog->Vert.UsesClipDistance; - _mesa_reference_vertprog(ctx, &prog->VertexProgram, - (struct gl_vertex_program *)linked_prog); - ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, - linked_prog); - break; - case GL_FRAGMENT_SHADER: - _mesa_reference_fragprog(ctx, &prog->FragmentProgram, - (struct gl_fragment_program *)linked_prog); - ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, - linked_prog); - break; - case GL_GEOMETRY_SHADER: - _mesa_reference_geomprog(ctx, &prog->GeometryProgram, - (struct gl_geometry_program *)linked_prog); - ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV, - linked_prog); - break; - } - if (!ok) { + } + + _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, + linked_prog); + if (!ctx->Driver.ProgramStringNotify(ctx, targets[i], linked_prog)) { return GL_FALSE; } } @@ -3427,10 +3416,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) } } - _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL); - _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL); - _mesa_reference_geomprog(ctx, &prog->GeometryProgram, NULL); - if (prog->LinkStatus) { link_shaders(ctx, prog); } diff --git a/mesalib/src/mesa/program/prog_uniform.c b/mesalib/src/mesa/program/prog_uniform.c index 28acb8871..d0b25e5c5 100644 --- a/mesalib/src/mesa/program/prog_uniform.c +++ b/mesalib/src/mesa/program/prog_uniform.c @@ -56,80 +56,6 @@ _mesa_free_uniform_list(struct gl_uniform_list *list) } -struct gl_uniform * -_mesa_append_uniform(struct gl_uniform_list *list, - const char *name, GLenum target, GLuint progPos) -{ - const GLuint oldNum = list->NumUniforms; - struct gl_uniform *uniform; - GLint index; - - assert(target == GL_VERTEX_PROGRAM_ARB || - target == GL_FRAGMENT_PROGRAM_ARB || - target == MESA_GEOMETRY_PROGRAM); - - index = _mesa_lookup_uniform(list, name); - if (index < 0) { - /* not found - append to list */ - - if (oldNum + 1 > list->Size) { - /* Need to grow the list array (alloc some extra) */ - list->Size += 4; - - /* realloc arrays */ - list->Uniforms = (struct gl_uniform *) - _mesa_realloc(list->Uniforms, - oldNum * sizeof(struct gl_uniform), - list->Size * sizeof(struct gl_uniform)); - } - - if (!list->Uniforms) { - /* out of memory */ - list->NumUniforms = 0; - list->Size = 0; - return GL_FALSE; - } - - uniform = list->Uniforms + oldNum; - - uniform->Name = _mesa_strdup(name); - uniform->VertPos = -1; - uniform->FragPos = -1; - uniform->GeomPos = -1; - uniform->Initialized = GL_FALSE; - - list->NumUniforms++; - } - else { - /* found */ - uniform = list->Uniforms + index; - } - - /* update position for the vertex or fragment program */ - if (target == GL_VERTEX_PROGRAM_ARB) { - if (uniform->VertPos != -1) { - /* this uniform is already in the list - that shouldn't happen */ - return GL_FALSE; - } - uniform->VertPos = progPos; - } else if (target == GL_FRAGMENT_PROGRAM_ARB) { - if (uniform->FragPos != -1) { - /* this uniform is already in the list - that shouldn't happen */ - return GL_FALSE; - } - uniform->FragPos = progPos; - } else { - if (uniform->GeomPos != -1) { - /* this uniform is already in the list - that shouldn't happen */ - return GL_FALSE; - } - uniform->GeomPos = progPos; - } - - return uniform; -} - - /** * Return the location/index of the named uniform in the uniform list, * or -1 if not found. diff --git a/mesalib/src/mesa/program/prog_uniform.h b/mesalib/src/mesa/program/prog_uniform.h index 67f78006e..83cd30780 100644 --- a/mesalib/src/mesa/program/prog_uniform.h +++ b/mesalib/src/mesa/program/prog_uniform.h @@ -72,10 +72,6 @@ _mesa_new_uniform_list(void); extern void _mesa_free_uniform_list(struct gl_uniform_list *list); -extern struct gl_uniform * -_mesa_append_uniform(struct gl_uniform_list *list, - const char *name, GLenum target, GLuint progPos); - extern GLint _mesa_lookup_uniform(const struct gl_uniform_list *list, const char *name); |