From e7edde60ba2ec1e9a98641a7926ad847df10f73c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Thu, 11 Jun 2015 15:04:09 -0700 Subject: [PATCH] vk: Defer setting viewport dynamic state We can't emit this until we've done a 3D pipeline select. --- src/vulkan/device.c | 22 +++++++++++----------- src/vulkan/private.h | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/vulkan/device.c b/src/vulkan/device.c index f5ca70b83ec..9e872de89b6 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -2663,20 +2663,11 @@ void anv_CmdBindDynamicStateObject( VkDynamicStateObject dynamicState) { struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *) cmdBuffer; - struct anv_dynamic_vp_state *vp_state; switch (stateBindPoint) { case VK_STATE_BIND_POINT_VIEWPORT: - vp_state = (struct anv_dynamic_vp_state *) dynamicState; - /* We emit state immediately, but set cmd_buffer->vp_state to indicate - * that vp state has been set in this command buffer. */ - cmd_buffer->vp_state = vp_state; - anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_SCISSOR_STATE_POINTERS, - .ScissorRectPointer = vp_state->scissor.offset); - anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC, - .CCViewportPointer = vp_state->cc_vp.offset); - anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP, - .SFClipViewportPointer = vp_state->sf_clip_vp.offset); + cmd_buffer->vp_state = (struct anv_dynamic_vp_state *) dynamicState; + cmd_buffer->dirty |= ANV_CMD_BUFFER_VP_DIRTY; break; case VK_STATE_BIND_POINT_RASTER: cmd_buffer->rs_state = (struct anv_dynamic_rs_state *) dynamicState; @@ -3111,6 +3102,15 @@ anv_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) if (cmd_buffer->descriptors_dirty) flush_descriptor_sets(cmd_buffer); + if (cmd_buffer->dirty & ANV_CMD_BUFFER_VP_DIRTY) { + anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_SCISSOR_STATE_POINTERS, + .ScissorRectPointer = cmd_buffer->vp_state->scissor.offset); + anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC, + .CCViewportPointer = cmd_buffer->vp_state->cc_vp.offset); + anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP, + .SFClipViewportPointer = cmd_buffer->vp_state->sf_clip_vp.offset); + } + if (cmd_buffer->dirty & (ANV_CMD_BUFFER_PIPELINE_DIRTY | ANV_CMD_BUFFER_RS_DIRTY)) { anv_batch_emit_merge(&cmd_buffer->batch, cmd_buffer->rs_state->state_sf, pipeline->state_sf); diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 9f1345fd8ed..3e4dc796420 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -617,6 +617,7 @@ struct anv_buffer { #define ANV_CMD_BUFFER_RS_DIRTY (1 << 2) #define ANV_CMD_BUFFER_DS_DIRTY (1 << 3) #define ANV_CMD_BUFFER_CB_DIRTY (1 << 4) +#define ANV_CMD_BUFFER_VP_DIRTY (1 << 5) struct anv_vertex_binding { struct anv_buffer * buffer; -- 2.30.2