diff options
author | Timothy Arceri <[email protected]> | 2017-02-01 11:25:05 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-02-02 08:31:28 +1100 |
commit | b940b2fd163f39576ddee23cee7fa60aa94f98fd (patch) | |
tree | 02eb655acc19f162c57b90ca0efb29ee95f51d51 /src/mesa/state_tracker | |
parent | a7050ea1f94b8169839a9b83f10669036e2ed0f6 (diff) |
st/mesa: inline get_mesa_program()
In the past I've gotten this function confused with the one in
ir_to_mesa.cpp of the same name. Now that the affected flag setting
has move into a helper it makes sense just to inline this remaining
code.
Reviewed-by: Edward O'Callaghan <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 823a2b4fe98..77a51d57a39 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6951,37 +6951,6 @@ set_prog_affected_state_flags(struct gl_program *prog) } } -static struct gl_program * -get_mesa_program(struct gl_context *ctx, - struct gl_shader_program *shader_program, - struct gl_linked_shader *shader) -{ - struct pipe_screen *pscreen = ctx->st->pipe->screen; - enum pipe_shader_type ptarget = st_shader_stage_to_ptarget(shader->Stage); - enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir) - pscreen->get_shader_param(pscreen, ptarget, PIPE_SHADER_CAP_PREFERRED_IR); - struct gl_program *prog = NULL; - - if (preferred_ir == PIPE_SHADER_IR_NIR) { - /* TODO only for GLSL VS/FS for now: */ - switch (shader->Stage) { - case MESA_SHADER_VERTEX: - case MESA_SHADER_FRAGMENT: - prog = st_nir_get_mesa_program(ctx, shader_program, shader); - default: - break; - } - } else { - prog = get_mesa_program_tgsi(ctx, shader_program, shader); - } - - if (prog) { - set_prog_affected_state_flags(prog); - } - - return prog; -} - /* See if there are unsupported control flow statements. */ class ir_control_flow_info_visitor : public ir_hierarchical_visitor { private: @@ -7163,19 +7132,36 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) build_program_resource_list(ctx, prog); for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { - struct gl_program *linked_prog; - - if (prog->_LinkedShaders[i] == NULL) + struct gl_linked_shader *shader = prog->_LinkedShaders[i]; + if (shader == NULL) continue; - linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); + enum pipe_shader_type ptarget = + st_shader_stage_to_ptarget(shader->Stage); + enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir) + pscreen->get_shader_param(pscreen, ptarget, + PIPE_SHADER_CAP_PREFERRED_IR); + + struct gl_program *linked_prog = NULL; + if (preferred_ir == PIPE_SHADER_IR_NIR) { + /* TODO only for GLSL VS/FS for now: */ + switch (shader->Stage) { + case MESA_SHADER_VERTEX: + case MESA_SHADER_FRAGMENT: + linked_prog = st_nir_get_mesa_program(ctx, prog, shader); + default: + break; + } + } else { + linked_prog = get_mesa_program_tgsi(ctx, prog, shader); + } if (linked_prog) { + set_prog_affected_state_flags(linked_prog); if (!ctx->Driver.ProgramStringNotify(ctx, _mesa_shader_stage_to_program(i), linked_prog)) { - _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, - NULL); + _mesa_reference_program(ctx, &shader->Program, NULL); return GL_FALSE; } } |