diff options
author | Jason Ekstrand <[email protected]> | 2015-07-14 14:26:10 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-07-14 14:26:10 -0700 |
commit | 30445f8f7a27b80cb344343dc193b5276fc1e1ca (patch) | |
tree | 2817423bc626d0ed7da8d16b893c29db7f4f6cde /src | |
parent | d2c0870ff319665871d019e2edbcb831f02a9391 (diff) |
vk: Split the dynamic state binding function into one per state
Diffstat (limited to 'src')
-rw-r--r-- | src/vulkan/device.c | 61 | ||||
-rw-r--r-- | src/vulkan/meta.c | 41 |
2 files changed, 54 insertions, 48 deletions
diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 90ac956c040..d29e35ba20c 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -2882,33 +2882,48 @@ void anv_CmdBindPipeline( } } -void anv_CmdBindDynamicStateObject( +void anv_CmdBindDynamicViewportState( VkCmdBuffer cmdBuffer, - VkStateBindPoint stateBindPoint, - VkDynamicStateObject dynamicState) + VkDynamicViewportState dynamicViewportState) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer); + ANV_FROM_HANDLE(anv_dynamic_vp_state, vp_state, dynamicViewportState); - switch (stateBindPoint) { - case VK_STATE_BIND_POINT_VIEWPORT: - cmd_buffer->vp_state = anv_dynamic_vp_state_from_handle(dynamicState); - cmd_buffer->dirty |= ANV_CMD_BUFFER_VP_DIRTY; - break; - case VK_STATE_BIND_POINT_RASTER: - cmd_buffer->rs_state = anv_dynamic_rs_state_from_handle(dynamicState); - cmd_buffer->dirty |= ANV_CMD_BUFFER_RS_DIRTY; - break; - case VK_STATE_BIND_POINT_COLOR_BLEND: - cmd_buffer->cb_state = anv_dynamic_cb_state_from_handle(dynamicState); - cmd_buffer->dirty |= ANV_CMD_BUFFER_CB_DIRTY; - break; - case VK_STATE_BIND_POINT_DEPTH_STENCIL: - cmd_buffer->ds_state = anv_dynamic_ds_state_from_handle(dynamicState); - cmd_buffer->dirty |= ANV_CMD_BUFFER_DS_DIRTY; - break; - default: - break; - }; + cmd_buffer->vp_state = vp_state; + cmd_buffer->dirty |= ANV_CMD_BUFFER_VP_DIRTY; +} + +void anv_CmdBindDynamicRasterState( + VkCmdBuffer cmdBuffer, + VkDynamicRasterState dynamicRasterState) +{ + ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer); + ANV_FROM_HANDLE(anv_dynamic_rs_state, rs_state, dynamicRasterState); + + cmd_buffer->rs_state = rs_state; + cmd_buffer->dirty |= ANV_CMD_BUFFER_RS_DIRTY; +} + +void anv_CmdBindDynamicColorBlendState( + VkCmdBuffer cmdBuffer, + VkDynamicColorBlendState dynamicColorBlendState) +{ + ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer); + ANV_FROM_HANDLE(anv_dynamic_cb_state, cb_state, dynamicColorBlendState); + + cmd_buffer->cb_state = cb_state; + cmd_buffer->dirty |= ANV_CMD_BUFFER_CB_DIRTY; +} + +void anv_CmdBindDynamicDepthStencilState( + VkCmdBuffer cmdBuffer, + VkDynamicDepthStencilState dynamicDepthStencilState) +{ + ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer); + ANV_FROM_HANDLE(anv_dynamic_ds_state, ds_state, dynamicDepthStencilState); + + cmd_buffer->ds_state = ds_state; + cmd_buffer->dirty |= ANV_CMD_BUFFER_DS_DIRTY; } static struct anv_state diff --git a/src/vulkan/meta.c b/src/vulkan/meta.c index 0844565a996..140b6418377 100644 --- a/src/vulkan/meta.c +++ b/src/vulkan/meta.c @@ -240,24 +240,20 @@ meta_emit_clear(struct anv_cmd_buffer *cmd_buffer, /* We don't need anything here, only set if not already set. */ if (cmd_buffer->rs_state == NULL) - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_RASTER, + anv_CmdBindDynamicRasterState(anv_cmd_buffer_to_handle(cmd_buffer), device->meta_state.shared.rs_state); if (cmd_buffer->vp_state == NULL) - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_VIEWPORT, - cmd_buffer->framebuffer->vp_state); + anv_CmdBindDynamicViewportState(anv_cmd_buffer_to_handle(cmd_buffer), + cmd_buffer->framebuffer->vp_state); if (cmd_buffer->ds_state == NULL) - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_DEPTH_STENCIL, - device->meta_state.shared.ds_state); + anv_CmdBindDynamicDepthStencilState(anv_cmd_buffer_to_handle(cmd_buffer), + device->meta_state.shared.ds_state); if (cmd_buffer->cb_state == NULL) - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_COLOR_BLEND, - device->meta_state.shared.cb_state); + anv_CmdBindDynamicColorBlendState(anv_cmd_buffer_to_handle(cmd_buffer), + device->meta_state.shared.cb_state); anv_CmdDraw(anv_cmd_buffer_to_handle(cmd_buffer), 0, 3, 0, num_instances); } @@ -499,18 +495,15 @@ meta_prepare_blit(struct anv_cmd_buffer *cmd_buffer, /* We don't need anything here, only set if not already set. */ if (cmd_buffer->rs_state == NULL) - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_RASTER, + anv_CmdBindDynamicRasterState(anv_cmd_buffer_to_handle(cmd_buffer), device->meta_state.shared.rs_state); if (cmd_buffer->ds_state == NULL) - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_DEPTH_STENCIL, - device->meta_state.shared.ds_state); + anv_CmdBindDynamicDepthStencilState(anv_cmd_buffer_to_handle(cmd_buffer), + device->meta_state.shared.ds_state); saved_state->cb_state = anv_dynamic_cb_state_to_handle(cmd_buffer->cb_state); - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_COLOR_BLEND, - device->meta_state.shared.cb_state); + anv_CmdBindDynamicColorBlendState(anv_cmd_buffer_to_handle(cmd_buffer), + device->meta_state.shared.cb_state); } struct blit_region { @@ -683,9 +676,8 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer, .pAttachmentClearValues = NULL, }, VK_RENDER_PASS_CONTENTS_INLINE); - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_VIEWPORT, - anv_framebuffer_from_handle(fb)->vp_state); + anv_CmdBindDynamicViewportState(anv_cmd_buffer_to_handle(cmd_buffer), + anv_framebuffer_from_handle(fb)->vp_state); anv_CmdBindDescriptorSets(anv_cmd_buffer_to_handle(cmd_buffer), VK_PIPELINE_BIND_POINT_GRAPHICS, @@ -712,9 +704,8 @@ meta_finish_blit(struct anv_cmd_buffer *cmd_buffer, const struct anv_saved_state *saved_state) { anv_cmd_buffer_restore(cmd_buffer, saved_state); - anv_CmdBindDynamicStateObject(anv_cmd_buffer_to_handle(cmd_buffer), - VK_STATE_BIND_POINT_COLOR_BLEND, - saved_state->cb_state); + anv_CmdBindDynamicColorBlendState(anv_cmd_buffer_to_handle(cmd_buffer), + saved_state->cb_state); } static VkFormat |