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/mesa/drivers | |
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/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_link.cpp | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.h | 3 |
4 files changed, 10 insertions, 15 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 6dcbc8bdfd8..3c86305d77f 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -121,14 +121,14 @@ _mesa_meta_framebuffer_texture_image(struct gl_context *ctx, level, layer, false, __func__); } -struct gl_shader * -_mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target, - const GLcharARB *source) +static struct gl_shader * +meta_compile_shader_with_debug(struct gl_context *ctx, gl_shader_stage stage, + const GLcharARB *source) { const GLuint name = ~0; struct gl_shader *sh; - sh = ctx->Driver.NewShader(ctx, name, target); + sh = ctx->Driver.NewShader(ctx, name, stage); sh->Source = strdup(source); sh->CompileStatus = false; _mesa_compile_shader(ctx, sh); @@ -183,9 +183,9 @@ _mesa_meta_compile_and_link_program(struct gl_context *ctx, sh_prog->NumShaders = 2; sh_prog->Shaders = malloc(2 * sizeof(struct gl_shader *)); sh_prog->Shaders[0] = - _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source); + meta_compile_shader_with_debug(ctx, MESA_SHADER_VERTEX, vs_source); sh_prog->Shaders[1] = - _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source); + meta_compile_shader_with_debug(ctx, MESA_SHADER_FRAGMENT, fs_source); _mesa_meta_link_program_with_debug(ctx, sh_prog); diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 0a7321c9d88..ba83a6dc21b 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -577,11 +577,6 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, void _mesa_meta_drawbuffers_from_bitfield(GLbitfield bits); -struct gl_shader * -_mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target, - const GLcharARB *source); - - void _mesa_meta_link_program_with_debug(struct gl_context *ctx, struct gl_shader_program *sh_prog); diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 16bfbaa8d7e..43b61328d6f 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -185,14 +185,13 @@ process_glsl_ir(gl_shader_stage stage, } extern "C" struct gl_shader * -brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) +brw_new_shader(struct gl_context *ctx, GLuint name, gl_shader_stage stage) { struct brw_shader *shader; shader = rzalloc(NULL, struct brw_shader); if (shader) { - shader->base.Type = type; - shader->base.Stage = _mesa_shader_enum_to_shader_stage(type); + shader->base.Stage = stage; shader->base.Name = name; _mesa_init_shader(ctx, &shader->base); } diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h index 9300f20b253..d74c6d6af9a 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.h +++ b/src/mesa/drivers/dri/i965/brw_shader.h @@ -289,7 +289,8 @@ bool brw_cs_precompile(struct gl_context *ctx, struct gl_program *prog); GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); -struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type); +struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, + gl_shader_stage stage); int type_size_scalar(const struct glsl_type *type); int type_size_vec4(const struct glsl_type *type); |