diff options
Diffstat (limited to 'src')
-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 | ||||
-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 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 2 | ||||
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 20 | ||||
-rw-r--r-- | src/mesa/main/shaderobj.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 30 |
16 files changed, 51 insertions, 57 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); 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); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index de149431572..f918bb6f717 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -784,7 +784,7 @@ struct dd_function_table { */ /*@{*/ struct gl_shader *(*NewShader)(struct gl_context *ctx, - GLuint name, GLenum type); + GLuint name, gl_shader_stage stage); void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg); /*@}*/ diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 26bf1625878..4977225220a 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -1199,7 +1199,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key) _mesa_glsl_parse_state *state; p.mem_ctx = ralloc_context(NULL); - p.shader = ctx->Driver.NewShader(ctx, 0, GL_FRAGMENT_SHADER); + p.shader = ctx->Driver.NewShader(ctx, 0, MESA_SHADER_FRAGMENT); p.shader->ir = new(p.shader) exec_list; state = new(p.shader) _mesa_glsl_parse_state(ctx, MESA_SHADER_FRAGMENT, p.shader); diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 9d440a0fd03..00caa1b4459 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -291,7 +291,7 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader) _mesa_error(ctx, GL_INVALID_OPERATION, "glAttachShader"); return; } else if (same_type_disallowed && - shProg->Shaders[i]->Type == sh->Type) { + shProg->Shaders[i]->Stage == sh->Stage) { /* Shader with the same type is already attached to this program, * OpenGL ES 2.0 and 3.0 specs say: * @@ -334,7 +334,9 @@ create_shader(struct gl_context *ctx, GLenum type) _mesa_HashLockMutex(ctx->Shared->ShaderObjects); name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); - sh = ctx->Driver.NewShader(ctx, name, type); + sh = ctx->Driver.NewShader(ctx, name, + _mesa_shader_enum_to_shader_stage(type)); + sh->Type = type; _mesa_HashInsertLocked(ctx->Shared->ShaderObjects, name, sh); _mesa_HashUnlockMutex(ctx->Shared->ShaderObjects); @@ -456,11 +458,11 @@ detach_shader(struct gl_context *ctx, GLuint program, GLuint shader) #ifdef DEBUG /* sanity check - make sure the new list's entries are sensible */ for (j = 0; j < shProg->NumShaders; j++) { - assert(shProg->Shaders[j]->Type == GL_VERTEX_SHADER || - shProg->Shaders[j]->Type == GL_TESS_CONTROL_SHADER || - shProg->Shaders[j]->Type == GL_TESS_EVALUATION_SHADER || - shProg->Shaders[j]->Type == GL_GEOMETRY_SHADER || - shProg->Shaders[j]->Type == GL_FRAGMENT_SHADER); + assert(shProg->Shaders[j]->Stage == MESA_SHADER_VERTEX || + shProg->Shaders[j]->Stage == MESA_SHADER_TESS_CTRL || + shProg->Shaders[j]->Stage == MESA_SHADER_TESS_EVAL || + shProg->Shaders[j]->Stage == MESA_SHADER_GEOMETRY || + shProg->Shaders[j]->Stage == MESA_SHADER_FRAGMENT); assert(shProg->Shaders[j]->RefCount > 0); } #endif @@ -1117,9 +1119,9 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg) shProg->LinkStatus ? "Success" : "Failed"); for (i = 0; i < shProg->NumShaders; i++) { - printf(" shader %u, type 0x%x\n", + printf(" shader %u, stage %u\n", shProg->Shaders[i]->Name, - shProg->Shaders[i]->Type); + shProg->Shaders[i]->Stage); } } } diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 189317c3a46..8283555740b 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -99,14 +99,12 @@ _mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader) * Called via ctx->Driver.NewShader() */ 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; - assert(_mesa_validate_shader_target(ctx, type)); 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; _mesa_init_shader(ctx, shader); } diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 98c075fcb2c..a8805645b6e 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -422,12 +422,12 @@ st_nir_get_mesa_program(struct gl_context *ctx, struct st_vertex_program *stvp; struct st_fragment_program *stfp; - switch (shader->Type) { - case GL_VERTEX_SHADER: + switch (shader->Stage) { + case MESA_SHADER_VERTEX: stvp = (struct st_vertex_program *)prog; stvp->shader_program = shader_program; break; - case GL_FRAGMENT_SHADER: + case MESA_SHADER_FRAGMENT: stfp = (struct st_fragment_program *)prog; stfp->shader_program = shader_program; break; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 8c6fe79d832..9de603c042f 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6459,7 +6459,7 @@ get_mesa_program_tgsi(struct gl_context *ctx, GLenum target = _mesa_shader_stage_to_program(shader->Stage); bool progress; struct gl_shader_compiler_options *options = - &ctx->Const.ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader->Type)]; + &ctx->Const.ShaderCompilerOptions[shader->Stage]; struct pipe_screen *pscreen = ctx->st->pipe->screen; unsigned ptarget = st_shader_stage_to_ptarget(shader->Stage); @@ -6554,8 +6554,8 @@ get_mesa_program_tgsi(struct gl_context *ctx, /* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */ v->simplify_cmp(); - if (shader->Type != GL_TESS_CONTROL_SHADER && - shader->Type != GL_TESS_EVALUATION_SHADER) + if (shader->Stage != MESA_SHADER_TESS_CTRL && + shader->Stage != MESA_SHADER_TESS_EVAL) v->copy_propagate(); while (v->eliminate_dead_code()); @@ -6591,7 +6591,7 @@ get_mesa_program_tgsi(struct gl_context *ctx, shader->ir = NULL; /* This must be done before the uniform storage is associated. */ - if (shader->Type == GL_FRAGMENT_SHADER && + if (shader->Stage == MESA_SHADER_FRAGMENT && (prog->InputsRead & VARYING_BIT_POS || prog->SystemValuesRead & (1 << SYSTEM_VALUE_FRAG_COORD))) { static const gl_state_index wposTransformState[STATE_LENGTH] = { @@ -6627,28 +6627,28 @@ get_mesa_program_tgsi(struct gl_context *ctx, struct st_tesseval_program *sttep; struct st_compute_program *stcp; - switch (shader->Type) { - case GL_VERTEX_SHADER: + switch (shader->Stage) { + case MESA_SHADER_VERTEX: stvp = (struct st_vertex_program *)prog; stvp->glsl_to_tgsi = v; break; - case GL_FRAGMENT_SHADER: + case MESA_SHADER_FRAGMENT: stfp = (struct st_fragment_program *)prog; stfp->glsl_to_tgsi = v; break; - case GL_GEOMETRY_SHADER: + case MESA_SHADER_GEOMETRY: stgp = (struct st_geometry_program *)prog; stgp->glsl_to_tgsi = v; break; - case GL_TESS_CONTROL_SHADER: + case MESA_SHADER_TESS_CTRL: sttcp = (struct st_tessctrl_program *)prog; sttcp->glsl_to_tgsi = v; break; - case GL_TESS_EVALUATION_SHADER: + case MESA_SHADER_TESS_EVAL: sttep = (struct st_tesseval_program *)prog; sttep->glsl_to_tgsi = v; break; - case GL_COMPUTE_SHADER: + case MESA_SHADER_COMPUTE: stcp = (struct st_compute_program *)prog; stcp->glsl_to_tgsi = v; break; @@ -6671,9 +6671,9 @@ get_mesa_program(struct gl_context *ctx, pscreen->get_shader_param(pscreen, ptarget, PIPE_SHADER_CAP_PREFERRED_IR); if (preferred_ir == PIPE_SHADER_IR_NIR) { /* TODO only for GLSL VS/FS for now: */ - switch (shader->Type) { - case GL_VERTEX_SHADER: - case GL_FRAGMENT_SHADER: + switch (shader->Stage) { + case MESA_SHADER_VERTEX: + case MESA_SHADER_FRAGMENT: return st_nir_get_mesa_program(ctx, shader_program, shader); default: break; @@ -6768,7 +6768,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) bool progress; exec_list *ir = prog->_LinkedShaders[i]->ir; - gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(prog->_LinkedShaders[i]->Type); + gl_shader_stage stage = prog->_LinkedShaders[i]->Stage; const struct gl_shader_compiler_options *options = &ctx->Const.ShaderCompilerOptions[stage]; unsigned ptarget = st_shader_stage_to_ptarget(stage); |