diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2020-02-19 14:22:43 -0800 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2020-02-21 13:09:44 -0800 |
commit | 89a3856714e2410e9ae3e0ee2cafe2fdd86e8b81 (patch) | |
tree | e27c6662258e15d23b22646b1618434f1b9d8beb /src/intel/vulkan/genX_cmd_buffer.c | |
parent | 7df5d36078a8e0eeffa935a5d1a267cb431ca4db (diff) |
anv: Add pipe_state_for_stage() helper
Reviewed-by: Jason Ekstrand <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3911>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3911>
Diffstat (limited to 'src/intel/vulkan/genX_cmd_buffer.c')
-rw-r--r-- | src/intel/vulkan/genX_cmd_buffer.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index c35cad61d13..51b14f2cb9d 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2351,25 +2351,37 @@ anv_descriptor_set_address(struct anv_cmd_buffer *cmd_buffer, } } +static struct anv_cmd_pipeline_state * +pipe_state_for_stage(struct anv_cmd_buffer *cmd_buffer, + gl_shader_stage stage) +{ + switch (stage) { + case MESA_SHADER_COMPUTE: + return &cmd_buffer->state.compute.base; + + case MESA_SHADER_VERTEX: + case MESA_SHADER_TESS_CTRL: + case MESA_SHADER_TESS_EVAL: + case MESA_SHADER_GEOMETRY: + case MESA_SHADER_FRAGMENT: + return &cmd_buffer->state.gfx.base; + + default: + unreachable("invalid stage"); + } +} + static VkResult emit_binding_table(struct anv_cmd_buffer *cmd_buffer, gl_shader_stage stage, struct anv_state *bt_state) { struct anv_subpass *subpass = cmd_buffer->state.subpass; - struct anv_cmd_pipeline_state *pipe_state; - struct anv_pipeline *pipeline; uint32_t state_offset; - switch (stage) { - case MESA_SHADER_COMPUTE: - pipe_state = &cmd_buffer->state.compute.base; - break; - default: - pipe_state = &cmd_buffer->state.gfx.base; - break; - } - pipeline = pipe_state->pipeline; + struct anv_cmd_pipeline_state *pipe_state = + pipe_state_for_stage(cmd_buffer, stage); + struct anv_pipeline *pipeline = pipe_state->pipeline; if (!anv_pipeline_has_stage(pipeline, stage)) { *bt_state = (struct anv_state) { 0, }; @@ -2618,8 +2630,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer, struct anv_state *state) { struct anv_cmd_pipeline_state *pipe_state = - stage == MESA_SHADER_COMPUTE ? &cmd_buffer->state.compute.base : - &cmd_buffer->state.gfx.base; + pipe_state_for_stage(cmd_buffer, stage); struct anv_pipeline *pipeline = pipe_state->pipeline; if (!anv_pipeline_has_stage(pipeline, stage)) { |