diff options
author | Timothy Arceri <[email protected]> | 2016-06-05 13:17:51 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-06-16 10:45:35 +1000 |
commit | 31dee99e052902bc08ddbb1009748dc982ac3211 (patch) | |
tree | 47e631d7bcd04cc59429b971ce8d685b6cce787b /src/compiler/glsl | |
parent | bb1292e2261fa591cf66de443a1b0d4eb7f65cb2 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/builtin_functions.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/link_varyings.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/linker.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/standalone.cpp | 2 | ||||
-rw-r--r-- | src/compiler/glsl/standalone_scaffolding.cpp | 7 | ||||
-rw-r--r-- | src/compiler/glsl/standalone_scaffolding.h | 2 |
6 files changed, 8 insertions, 9 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index db0dcb6288f..018e4064f10 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -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 = diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 534393a3e6a..ef8bdbe3ade 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -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); } diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index d4d368a69ce..15481ffc75e 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -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); diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index c9f20e4f856..d0057df7f32 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -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); } } diff --git a/src/compiler/glsl/standalone_scaffolding.cpp b/src/compiler/glsl/standalone_scaffolding.cpp index 4edb7672cd0..396965af3b5 100644 --- a/src/compiler/glsl/standalone_scaffolding.cpp +++ b/src/compiler/glsl/standalone_scaffolding.cpp @@ -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; } diff --git a/src/compiler/glsl/standalone_scaffolding.h b/src/compiler/glsl/standalone_scaffolding.h index f853a187bf4..15dc7028f64 100644 --- a/src/compiler/glsl/standalone_scaffolding.h +++ b/src/compiler/glsl/standalone_scaffolding.h @@ -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); |