diff options
author | Kristian Høgsberg Kristensen <[email protected]> | 2015-08-20 22:41:22 -0700 |
---|---|---|
committer | Kristian Høgsberg Kristensen <[email protected]> | 2015-08-24 13:45:41 -0700 |
commit | 3800573fb5390e84eebc2ebdbcd85f5736626f65 (patch) | |
tree | 0d3a45a9564bc2021a5560d80d95a692fe2eb142 /src/vulkan | |
parent | 615da3795a76e7f18e518d2c896613c3f9c04d27 (diff) |
vk: Move gen8 specific state into gen8 sub-structs
This commit moves all occurances of gen8 specific state into a gen8
substruct. This clearly identifies the state as gen8 specific and
prepares for adding gen7 state structs. In the process we also rename
the field names to exactly match the command or state packet name,
without the 3DSTATE prefix, eg:
3DSTATE_VF -> gen8.vf
3DSTATE_WM_DEPTH_STENCIL -> gen8.wm_depth_stencil
Signed-off-by: Kristian Høgsberg Kristensen <[email protected]>
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/anv_device.c | 2 | ||||
-rw-r--r-- | src/vulkan/anv_private.h | 26 | ||||
-rw-r--r-- | src/vulkan/gen8_cmd_buffer.c | 22 | ||||
-rw-r--r-- | src/vulkan/gen8_pipeline.c | 13 | ||||
-rw-r--r-- | src/vulkan/gen8_state.c | 8 |
5 files changed, 38 insertions, 33 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index bf256765bdf..27a51129a74 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1909,7 +1909,7 @@ VkResult anv_CreateDynamicColorBlendState( .BlendConstantColorAlpha = pCreateInfo->blendConst[3] }; - GEN7_COLOR_CALC_STATE_pack(NULL, state->state_color_calc, &color_calc_state); + GEN7_COLOR_CALC_STATE_pack(NULL, state->color_calc_state, &color_calc_state); *pState = anv_dynamic_cb_state_to_handle(state); diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 58480aca818..4d30bcb68ff 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -569,17 +569,21 @@ struct anv_dynamic_vp_state { }; struct anv_dynamic_rs_state { - uint32_t state_sf[GEN8_3DSTATE_SF_length]; - uint32_t state_raster[GEN8_3DSTATE_RASTER_length]; + struct { + uint32_t sf[GEN8_3DSTATE_SF_length]; + uint32_t raster[GEN8_3DSTATE_RASTER_length]; + } gen8; }; struct anv_dynamic_ds_state { - uint32_t state_wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length]; - uint32_t state_color_calc[GEN8_COLOR_CALC_STATE_length]; + struct { + uint32_t wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length]; + uint32_t color_calc_state[GEN8_COLOR_CALC_STATE_length]; + } gen8; }; struct anv_dynamic_cb_state { - uint32_t state_color_calc[GEN8_COLOR_CALC_STATE_length]; + uint32_t color_calc_state[GEN8_COLOR_CALC_STATE_length]; }; @@ -861,13 +865,15 @@ struct anv_pipeline { uint32_t vb_used; uint32_t binding_stride[MAX_VBS]; - uint32_t state_sf[GEN8_3DSTATE_SF_length]; - uint32_t state_vf[GEN8_3DSTATE_VF_length]; - uint32_t state_raster[GEN8_3DSTATE_RASTER_length]; - uint32_t state_wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length]; - uint32_t cs_thread_width_max; uint32_t cs_right_mask; + + struct { + uint32_t sf[GEN8_3DSTATE_SF_length]; + uint32_t vf[GEN8_3DSTATE_VF_length]; + uint32_t raster[GEN8_3DSTATE_RASTER_length]; + uint32_t wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length]; + } gen8; }; struct anv_graphics_pipeline_create_info { diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c index 68d6d4a42d3..6d5004a1ca2 100644 --- a/src/vulkan/gen8_cmd_buffer.c +++ b/src/vulkan/gen8_cmd_buffer.c @@ -97,19 +97,19 @@ gen8_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) if (cmd_buffer->state.dirty & (ANV_CMD_BUFFER_PIPELINE_DIRTY | ANV_CMD_BUFFER_RS_DIRTY)) { anv_batch_emit_merge(&cmd_buffer->batch, - cmd_buffer->state.rs_state->state_sf, - pipeline->state_sf); + cmd_buffer->state.rs_state->gen8.sf, + pipeline->gen8.sf); anv_batch_emit_merge(&cmd_buffer->batch, - cmd_buffer->state.rs_state->state_raster, - pipeline->state_raster); + cmd_buffer->state.rs_state->gen8.raster, + pipeline->gen8.raster); } if (cmd_buffer->state.ds_state && (cmd_buffer->state.dirty & (ANV_CMD_BUFFER_PIPELINE_DIRTY | ANV_CMD_BUFFER_DS_DIRTY))) { anv_batch_emit_merge(&cmd_buffer->batch, - cmd_buffer->state.ds_state->state_wm_depth_stencil, - pipeline->state_wm_depth_stencil); + cmd_buffer->state.ds_state->gen8.wm_depth_stencil, + pipeline->gen8.wm_depth_stencil); } if (cmd_buffer->state.dirty & (ANV_CMD_BUFFER_CB_DIRTY | @@ -117,16 +117,16 @@ gen8_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) struct anv_state state; if (cmd_buffer->state.ds_state == NULL) state = anv_cmd_buffer_emit_dynamic(cmd_buffer, - cmd_buffer->state.cb_state->state_color_calc, + cmd_buffer->state.cb_state->color_calc_state, GEN8_COLOR_CALC_STATE_length, 64); else if (cmd_buffer->state.cb_state == NULL) state = anv_cmd_buffer_emit_dynamic(cmd_buffer, - cmd_buffer->state.ds_state->state_color_calc, + cmd_buffer->state.ds_state->gen8.color_calc_state, GEN8_COLOR_CALC_STATE_length, 64); else state = anv_cmd_buffer_merge_dynamic(cmd_buffer, - cmd_buffer->state.ds_state->state_color_calc, - cmd_buffer->state.cb_state->state_color_calc, + cmd_buffer->state.ds_state->gen8.color_calc_state, + cmd_buffer->state.cb_state->color_calc_state, GEN8_COLOR_CALC_STATE_length, 64); anv_batch_emit(&cmd_buffer->batch, @@ -138,7 +138,7 @@ gen8_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) if (cmd_buffer->state.dirty & (ANV_CMD_BUFFER_PIPELINE_DIRTY | ANV_CMD_BUFFER_INDEX_BUFFER_DIRTY)) { anv_batch_emit_merge(&cmd_buffer->batch, - cmd_buffer->state.state_vf, pipeline->state_vf); + cmd_buffer->state.state_vf, pipeline->gen8.vf); } cmd_buffer->state.vb_dirty &= ~vb_emit; diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c index 220317c2d48..a993552cfd3 100644 --- a/src/vulkan/gen8_pipeline.c +++ b/src/vulkan/gen8_pipeline.c @@ -124,7 +124,7 @@ emit_ia_state(struct anv_pipeline *pipeline, GEN8_3DSTATE_VF_header, .IndexedDrawCutIndexEnable = info->primitiveRestartEnable, }; - GEN8_3DSTATE_VF_pack(NULL, pipeline->state_vf, &vf); + GEN8_3DSTATE_VF_pack(NULL, pipeline->gen8.vf, &vf); anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_VF_TOPOLOGY, .PrimitiveTopologyType = topology); @@ -165,7 +165,7 @@ emit_rs_state(struct anv_pipeline *pipeline, /* FINISHME: VkBool32 rasterizerDiscardEnable; */ - GEN8_3DSTATE_SF_pack(NULL, pipeline->state_sf, &sf); + GEN8_3DSTATE_SF_pack(NULL, pipeline->gen8.sf, &sf); struct GEN8_3DSTATE_RASTER raster = { GEN8_3DSTATE_RASTER_header, @@ -177,8 +177,6 @@ emit_rs_state(struct anv_pipeline *pipeline, .ViewportZClipTestEnable = info->depthClipEnable }; - GEN8_3DSTATE_RASTER_pack(NULL, pipeline->state_raster, &raster); - anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_SBE, .ForceVertexURBEntryReadLength = false, .ForceVertexURBEntryReadOffset = false, @@ -186,6 +184,7 @@ emit_rs_state(struct anv_pipeline *pipeline, .NumberofSFOutputAttributes = pipeline->wm_prog_data.num_varying_inputs); + GEN8_3DSTATE_RASTER_pack(NULL, pipeline->gen8.raster, &raster); } static void @@ -311,8 +310,8 @@ emit_ds_state(struct anv_pipeline *pipeline, /* We're going to OR this together with the dynamic state. We need * to make sure it's initialized to something useful. */ - memset(pipeline->state_wm_depth_stencil, 0, - sizeof(pipeline->state_wm_depth_stencil)); + memset(pipeline->gen8.wm_depth_stencil, 0, + sizeof(pipeline->gen8.wm_depth_stencil)); return; } @@ -335,7 +334,7 @@ emit_ds_state(struct anv_pipeline *pipeline, .BackfaceStencilTestFunction = vk_to_gen_compare_op[info->back.stencilCompareOp], }; - GEN8_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, pipeline->state_wm_depth_stencil, &wm_depth_stencil); + GEN8_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, pipeline->gen8.wm_depth_stencil, &wm_depth_stencil); } VkResult diff --git a/src/vulkan/gen8_state.c b/src/vulkan/gen8_state.c index 736a1d9455f..f035baabf74 100644 --- a/src/vulkan/gen8_state.c +++ b/src/vulkan/gen8_state.c @@ -49,7 +49,7 @@ VkResult gen8_CreateDynamicRasterState( .LineWidth = pCreateInfo->lineWidth, }; - GEN8_3DSTATE_SF_pack(NULL, state->state_sf, &sf); + GEN8_3DSTATE_SF_pack(NULL, state->gen8.sf, &sf); bool enable_bias = pCreateInfo->depthBias != 0.0f || pCreateInfo->slopeScaledDepthBias != 0.0f; @@ -62,7 +62,7 @@ VkResult gen8_CreateDynamicRasterState( .GlobalDepthOffsetClamp = pCreateInfo->depthBiasClamp }; - GEN8_3DSTATE_RASTER_pack(NULL, state->state_raster, &raster); + GEN8_3DSTATE_RASTER_pack(NULL, state->gen8.raster, &raster); *pState = anv_dynamic_rs_state_to_handle(state); @@ -506,7 +506,7 @@ VkResult gen8_CreateDynamicDepthStencilState( .BackfaceStencilWriteMask = pCreateInfo->stencilWriteMask & 0xff, }; - GEN8_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, state->state_wm_depth_stencil, + GEN8_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, state->gen8.wm_depth_stencil, &wm_depth_stencil); struct GEN8_COLOR_CALC_STATE color_calc_state = { @@ -514,7 +514,7 @@ VkResult gen8_CreateDynamicDepthStencilState( .BackFaceStencilReferenceValue = pCreateInfo->stencilBackRef }; - GEN8_COLOR_CALC_STATE_pack(NULL, state->state_color_calc, &color_calc_state); + GEN8_COLOR_CALC_STATE_pack(NULL, state->gen8.color_calc_state, &color_calc_state); *pState = anv_dynamic_ds_state_to_handle(state); |