mesa/glsl: stop using GL shader type internally
Instead use the internal gl_shader_stage enum everywhere. This makes things more consistent and gets rid of unnecessary conversions. Ideally it would be nice to remove the Type field from gl_shader altogether but currently it is used to differentiate between gl_shader and gl_shader_program in the ShaderObjects hash table. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -956,7 +956,7 @@ builtin_builder::create_shader()
|
||||
* GLSL utility code that could be linked against any stage, so just
|
||||
* arbitrarily pick GL_VERTEX_SHADER.
|
||||
*/
|
||||
shader = _mesa_new_shader(NULL, 0, GL_VERTEX_SHADER);
|
||||
shader = _mesa_new_shader(NULL, 0, MESA_SHADER_VERTEX);
|
||||
shader->symbols = new(mem_ctx) glsl_symbol_table;
|
||||
|
||||
gl_ModelViewProjectionMatrix =
|
||||
|
||||
@@ -2129,7 +2129,7 @@ assign_varying_locations(struct gl_context *ctx,
|
||||
* within a patch and can be used as shared memory.
|
||||
*/
|
||||
if (input_var || (prog->SeparateShader && consumer == NULL) ||
|
||||
producer->Type == GL_TESS_CONTROL_SHADER) {
|
||||
producer->Stage == MESA_SHADER_TESS_CTRL) {
|
||||
matches.record(output_var, input_var);
|
||||
}
|
||||
|
||||
|
||||
@@ -2235,7 +2235,7 @@ link_intrastage_shaders(void *mem_ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gl_shader *linked = ctx->Driver.NewShader(NULL, 0, main->Type);
|
||||
gl_shader *linked = ctx->Driver.NewShader(NULL, 0, shader_list[0]->Stage);
|
||||
linked->ir = new(linked) exec_list;
|
||||
clone_ir_list(mem_ctx, linked->ir, main->ir);
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ standalone_compile_shader(const struct standalone_options *_options,
|
||||
continue;
|
||||
|
||||
shader->Program = rzalloc(shader, gl_program);
|
||||
init_gl_program(shader->Program, shader->Type);
|
||||
init_gl_program(shader->Program, shader->Stage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,17 +68,16 @@ _mesa_shader_debug(struct gl_context *, GLenum, GLuint *,
|
||||
}
|
||||
|
||||
struct gl_shader *
|
||||
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
|
||||
_mesa_new_shader(struct gl_context *ctx, GLuint name, gl_shader_stage stage)
|
||||
{
|
||||
struct gl_shader *shader;
|
||||
|
||||
(void) ctx;
|
||||
|
||||
assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
|
||||
assert(stage == MESA_SHADER_FRAGMENT || stage == MESA_SHADER_VERTEX);
|
||||
shader = rzalloc(NULL, struct gl_shader);
|
||||
if (shader) {
|
||||
shader->Type = type;
|
||||
shader->Stage = _mesa_shader_enum_to_shader_stage(type);
|
||||
shader->Stage = stage;
|
||||
shader->Name = name;
|
||||
shader->RefCount = 1;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
|
||||
struct gl_shader *sh);
|
||||
|
||||
extern "C" struct gl_shader *
|
||||
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
|
||||
_mesa_new_shader(struct gl_context *ctx, GLuint name, gl_shader_stage stage);
|
||||
|
||||
extern "C" void
|
||||
_mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh);
|
||||
|
||||
Reference in New Issue
Block a user