From: Paul Berry Date: Tue, 7 Jan 2014 18:58:56 +0000 (-0800) Subject: mesa: Store gl_shader_stage enum in gl_shader objects. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=65511e5f22e2ba0a5ebd9210319a55d80ea5334e;p=mesa.git mesa: Store gl_shader_stage enum in gl_shader objects. Reviewed-by: Brian Paul Reviewed-by: Kenneth Graunke --- diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 2f59848adbf..3260c44710f 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -362,6 +362,7 @@ main(int argc, char **argv) shader->Type = GL_FRAGMENT_SHADER; else usage_fail(argv[0]); + shader->Stage = _mesa_shader_enum_to_shader_stage(shader->Type); shader->Source = load_text_file(whole_program, argv[optind]); if (shader->Source == NULL) { diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp index 73dfe5c38be..6a717458e60 100644 --- a/src/glsl/standalone_scaffolding.cpp +++ b/src/glsl/standalone_scaffolding.cpp @@ -76,6 +76,7 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) shader = rzalloc(NULL, struct gl_shader); if (shader) { shader->Type = type; + shader->Stage = _mesa_shader_enum_to_shader_stage(type); shader->Name = name; shader->RefCount = 1; } diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp index 01f6f9585f0..bdb1e8ffdeb 100644 --- a/src/glsl/test_optpass.cpp +++ b/src/glsl/test_optpass.cpp @@ -204,6 +204,7 @@ int test_optpass(int argc, char **argv) struct gl_shader *shader = rzalloc(NULL, struct gl_shader); shader->Type = shader_type; + shader->Stage = _mesa_shader_enum_to_shader_stage(shader_type); string input = read_stdin_to_eof(); diff --git a/src/glsl/tests/builtin_variable_test.cpp b/src/glsl/tests/builtin_variable_test.cpp index 63949ee262e..9b4a097b1e4 100644 --- a/src/glsl/tests/builtin_variable_test.cpp +++ b/src/glsl/tests/builtin_variable_test.cpp @@ -65,6 +65,7 @@ common_builtin::SetUp() this->shader = rzalloc(this->mem_ctx, gl_shader); this->shader->Type = this->shader_type; + this->shader->Stage = _mesa_shader_enum_to_shader_stage(this->shader_type); this->state = new(mem_ctx) _mesa_glsl_parse_state(&this->ctx, this->shader->Type, diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index a40df6d17a4..c0d6aa27eeb 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -40,6 +40,7 @@ brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) shader = rzalloc(NULL, struct brw_shader); if (shader) { shader->base.Type = type; + shader->base.Stage = _mesa_shader_enum_to_shader_stage(type); shader->base.Name = name; _mesa_init_shader(ctx, &shader->base); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 04bc4d4660f..37e05927d8c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2319,6 +2319,7 @@ struct gl_shader * Must be the first field. */ GLenum Type; + gl_shader_stage Stage; GLuint Name; /**< AKA the handle */ GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; /**< Reference count */ diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 3076fb425c9..dc81bbc7717 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -110,6 +110,7 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) shader = rzalloc(NULL, struct gl_shader); if (shader) { shader->Type = type; + shader->Stage = _mesa_shader_enum_to_shader_stage(type); shader->Name = name; _mesa_init_shader(ctx, shader); } diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index b2131ed48b3..bd4eb5e3f20 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5207,6 +5207,7 @@ st_new_shader(struct gl_context *ctx, GLuint name, GLuint type) shader = rzalloc(NULL, struct gl_shader); if (shader) { shader->Type = type; + shader->Stage = _mesa_shader_enum_to_shader_stage(type); shader->Name = name; _mesa_init_shader(ctx, shader); }