diff options
author | Paul Berry <[email protected]> | 2013-07-30 20:49:56 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2013-08-01 20:18:42 -0700 |
commit | 906eff09e374c75b0486011b73b7048f6070456e (patch) | |
tree | 6b11fe03d732cb0aaaa04d09dce1735bea8669c2 /src | |
parent | e7ed70a52e2d0efc11d1e9fe19938bc431f947c1 (diff) |
glsl: Change do_set_program_inouts' is_fragment_shader arg to shader_type.
This will allow us to add geometry shader support without having to
add another boolean argument.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ir.h | 2 | ||||
-rw-r--r-- | src/glsl/ir_set_program_inouts.cpp | 24 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 3 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 |
5 files changed, 16 insertions, 17 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 7ac291cf40e..f5b4468ec20 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -2061,7 +2061,7 @@ ir_has_call(ir_instruction *ir); extern void do_set_program_inouts(exec_list *instructions, struct gl_program *prog, - bool is_fragment_shader); + GLenum shader_type); extern char * prototype_string(const glsl_type *return_type, const char *name, diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp index 91a8b452683..ef95cbeaeb7 100644 --- a/src/glsl/ir_set_program_inouts.cpp +++ b/src/glsl/ir_set_program_inouts.cpp @@ -44,11 +44,10 @@ class ir_set_program_inouts_visitor : public ir_hierarchical_visitor { public: - ir_set_program_inouts_visitor(struct gl_program *prog, - bool is_fragment_shader) + ir_set_program_inouts_visitor(struct gl_program *prog, GLenum shader_type) { this->prog = prog; - this->is_fragment_shader = is_fragment_shader; + this->shader_type = shader_type; } ~ir_set_program_inouts_visitor() { @@ -61,7 +60,7 @@ public: virtual ir_visitor_status visit(ir_dereference_variable *); struct gl_program *prog; - bool is_fragment_shader; + GLenum shader_type; }; static inline bool @@ -114,10 +113,10 @@ ir_set_program_inouts_visitor::visit(ir_dereference_variable *ir) if (ir->type->is_array()) { mark(this->prog, ir->var, 0, ir->type->length * ir->type->fields.array->matrix_columns, - this->is_fragment_shader); + this->shader_type == GL_FRAGMENT_SHADER); } else { mark(this->prog, ir->var, 0, ir->type->matrix_columns, - this->is_fragment_shader); + this->shader_type == GL_FRAGMENT_SHADER); } return visit_continue; @@ -144,7 +143,7 @@ ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir) } mark(this->prog, var, index->value.i[0] * width, width, - this->is_fragment_shader); + this->shader_type == GL_FRAGMENT_SHADER); return visit_continue_with_parent; } @@ -164,7 +163,8 @@ ir_set_program_inouts_visitor::visit_enter(ir_function_signature *ir) ir_visitor_status ir_set_program_inouts_visitor::visit_enter(ir_expression *ir) { - if (is_fragment_shader && ir->operation == ir_unop_dFdy) { + if (this->shader_type == GL_FRAGMENT_SHADER && + ir->operation == ir_unop_dFdy) { gl_fragment_program *fprog = (gl_fragment_program *) prog; fprog->UsesDFdy = true; } @@ -175,7 +175,7 @@ ir_visitor_status ir_set_program_inouts_visitor::visit_enter(ir_discard *) { /* discards are only allowed in fragment shaders. */ - assert(is_fragment_shader); + assert(this->shader_type == GL_FRAGMENT_SHADER); gl_fragment_program *fprog = (gl_fragment_program *) prog; fprog->UsesKill = true; @@ -185,14 +185,14 @@ ir_set_program_inouts_visitor::visit_enter(ir_discard *) void do_set_program_inouts(exec_list *instructions, struct gl_program *prog, - bool is_fragment_shader) + GLenum shader_type) { - ir_set_program_inouts_visitor v(prog, is_fragment_shader); + ir_set_program_inouts_visitor v(prog, shader_type); prog->InputsRead = 0; prog->OutputsWritten = 0; prog->SystemValuesRead = 0; - if (is_fragment_shader) { + if (shader_type == GL_FRAGMENT_SHADER) { gl_fragment_program *fprog = (gl_fragment_program *) prog; memset(fprog->InterpQualifier, 0, sizeof(fprog->InterpQualifier)); fprog->IsCentroid = 0; diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 3322e805542..418ea9b0331 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -236,8 +236,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) reparent_ir(shader->ir, shader->ir); ralloc_free(mem_ctx); - do_set_program_inouts(shader->ir, prog, - shader->base.Type == GL_FRAGMENT_SHADER); + do_set_program_inouts(shader->ir, prog, shader->base.Type); prog->SamplersUsed = shader->base.active_samplers; _mesa_update_shader_textures_used(shProg, prog); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index f0fc1b9b155..14f43f64e24 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2961,7 +2961,7 @@ get_mesa_program(struct gl_context *ctx, */ mesa_instructions = NULL; - do_set_program_inouts(shader->ir, prog, shader->Type == GL_FRAGMENT_SHADER); + do_set_program_inouts(shader->ir, prog, shader->Type); prog->SamplersUsed = shader->active_samplers; prog->ShadowSamplers = shader->shadow_samplers; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 3dfd5e5b334..69f860a0e08 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5121,7 +5121,7 @@ get_mesa_program(struct gl_context *ctx, prog->Instructions = NULL; prog->NumInstructions = 0; - do_set_program_inouts(shader->ir, prog, shader->Type == GL_FRAGMENT_SHADER); + do_set_program_inouts(shader->ir, prog, shader->Type); count_resources(v, prog); _mesa_reference_program(ctx, &shader->Program, prog); |