diff options
author | Jason Ekstrand <[email protected]> | 2015-11-30 14:19:41 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-11-30 14:19:41 -0800 |
commit | 4ab9391fbb35e627f2033494f0440536bb3341a8 (patch) | |
tree | 45230d879f5e634f097b478ef4d79d54c06d11d6 /src | |
parent | 73ef7d47d22442c089abbdd8bca028e4ea407824 (diff) |
vk/0.210.0: Rework dynamic states
Diffstat (limited to 'src')
-rw-r--r-- | src/vulkan/anv_cmd_buffer.c | 32 | ||||
-rw-r--r-- | src/vulkan/anv_meta_clear.c | 8 | ||||
-rw-r--r-- | src/vulkan/anv_pipeline.c | 21 | ||||
-rw-r--r-- | src/vulkan/anv_private.h | 2 | ||||
-rw-r--r-- | src/vulkan/gen7_cmd_buffer.c | 4 | ||||
-rw-r--r-- | src/vulkan/gen7_pipeline.c | 18 | ||||
-rw-r--r-- | src/vulkan/gen8_cmd_buffer.c | 4 | ||||
-rw-r--r-- | src/vulkan/gen8_pipeline.c | 16 |
8 files changed, 53 insertions, 52 deletions
diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index f42f6fd5183..401fd5681f6 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -50,7 +50,7 @@ const struct anv_dynamic_state default_dynamic_state = { .depth_bias = { .bias = 0.0f, .clamp = 0.0f, - .slope_scaled = 0.0f, + .slope = 0.0f, }, .blend_constants = { 0.0f, 0.0f, 0.0f, 0.0f }, .depth_bounds = { @@ -380,27 +380,27 @@ void anv_CmdSetLineWidth( void anv_CmdSetDepthBias( VkCommandBuffer commandBuffer, - float depthBias, + float depthBiasConstantFactor, float depthBiasClamp, - float slopeScaledDepthBias) + float depthBiasSlopeFactor) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); - cmd_buffer->state.dynamic.depth_bias.bias = depthBias; + cmd_buffer->state.dynamic.depth_bias.bias = depthBiasConstantFactor; cmd_buffer->state.dynamic.depth_bias.clamp = depthBiasClamp; - cmd_buffer->state.dynamic.depth_bias.slope_scaled = slopeScaledDepthBias; + cmd_buffer->state.dynamic.depth_bias.slope = depthBiasSlopeFactor; cmd_buffer->state.dirty |= ANV_CMD_DIRTY_DYNAMIC_DEPTH_BIAS; } void anv_CmdSetBlendConstants( VkCommandBuffer commandBuffer, - const float blendConst[4]) + const float blendConstants[4]) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); memcpy(cmd_buffer->state.dynamic.blend_constants, - blendConst, sizeof(float) * 4); + blendConstants, sizeof(float) * 4); cmd_buffer->state.dirty |= ANV_CMD_DIRTY_DYNAMIC_BLEND_CONSTANTS; } @@ -421,14 +421,14 @@ void anv_CmdSetDepthBounds( void anv_CmdSetStencilCompareMask( VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, - uint32_t stencilCompareMask) + uint32_t compareMask) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); if (faceMask & VK_STENCIL_FACE_FRONT_BIT) - cmd_buffer->state.dynamic.stencil_compare_mask.front = stencilCompareMask; + cmd_buffer->state.dynamic.stencil_compare_mask.front = compareMask; if (faceMask & VK_STENCIL_FACE_BACK_BIT) - cmd_buffer->state.dynamic.stencil_compare_mask.back = stencilCompareMask; + cmd_buffer->state.dynamic.stencil_compare_mask.back = compareMask; cmd_buffer->state.dirty |= ANV_CMD_DIRTY_DYNAMIC_STENCIL_COMPARE_MASK; } @@ -436,14 +436,14 @@ void anv_CmdSetStencilCompareMask( void anv_CmdSetStencilWriteMask( VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, - uint32_t stencilWriteMask) + uint32_t writeMask) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); if (faceMask & VK_STENCIL_FACE_FRONT_BIT) - cmd_buffer->state.dynamic.stencil_write_mask.front = stencilWriteMask; + cmd_buffer->state.dynamic.stencil_write_mask.front = writeMask; if (faceMask & VK_STENCIL_FACE_BACK_BIT) - cmd_buffer->state.dynamic.stencil_write_mask.back = stencilWriteMask; + cmd_buffer->state.dynamic.stencil_write_mask.back = writeMask; cmd_buffer->state.dirty |= ANV_CMD_DIRTY_DYNAMIC_STENCIL_WRITE_MASK; } @@ -451,14 +451,14 @@ void anv_CmdSetStencilWriteMask( void anv_CmdSetStencilReference( VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, - uint32_t stencilReference) + uint32_t reference) { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); if (faceMask & VK_STENCIL_FACE_FRONT_BIT) - cmd_buffer->state.dynamic.stencil_reference.front = stencilReference; + cmd_buffer->state.dynamic.stencil_reference.front = reference; if (faceMask & VK_STENCIL_FACE_BACK_BIT) - cmd_buffer->state.dynamic.stencil_reference.back = stencilReference; + cmd_buffer->state.dynamic.stencil_reference.back = reference; cmd_buffer->state.dirty |= ANV_CMD_DIRTY_DYNAMIC_STENCIL_REFERENCE; } diff --git a/src/vulkan/anv_meta_clear.c b/src/vulkan/anv_meta_clear.c index bcdc9e4d5b4..a9bcbc3be9e 100644 --- a/src/vulkan/anv_meta_clear.c +++ b/src/vulkan/anv_meta_clear.c @@ -459,10 +459,10 @@ create_depthstencil_pipeline(struct anv_device *device, .depthBoundsTestEnable = false, .stencilTestEnable = (aspects & VK_IMAGE_ASPECT_STENCIL_BIT), .front = { - .stencilPassOp = VK_STENCIL_OP_REPLACE, - .stencilCompareOp = VK_COMPARE_OP_ALWAYS, - .stencilWriteMask = UINT32_MAX, - .stencilReference = 0, /* dynamic */ + .passOp = VK_STENCIL_OP_REPLACE, + .compareOp = VK_COMPARE_OP_ALWAYS, + .writeMask = UINT32_MAX, + .reference = 0, /* dynamic */ }, .back = { 0 /* dont care */ }, }; diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c index 16d054665f5..e4209bd13c9 100644 --- a/src/vulkan/anv_pipeline.c +++ b/src/vulkan/anv_pipeline.c @@ -849,16 +849,17 @@ anv_pipeline_init_dynamic_state(struct anv_pipeline *pipeline, if (states & (1 << VK_DYNAMIC_STATE_DEPTH_BIAS)) { assert(pCreateInfo->pRasterState); - dynamic->depth_bias.bias = pCreateInfo->pRasterState->depthBias; + dynamic->depth_bias.bias = + pCreateInfo->pRasterState->depthBiasConstantFactor; dynamic->depth_bias.clamp = pCreateInfo->pRasterState->depthBiasClamp; - dynamic->depth_bias.slope_scaled = - pCreateInfo->pRasterState->slopeScaledDepthBias; + dynamic->depth_bias.slope = + pCreateInfo->pRasterState->depthBiasSlopeFactor; } if (states & (1 << VK_DYNAMIC_STATE_BLEND_CONSTANTS)) { assert(pCreateInfo->pColorBlendState); typed_memcpy(dynamic->blend_constants, - pCreateInfo->pColorBlendState->blendConst, 4); + pCreateInfo->pColorBlendState->blendConstants, 4); } /* If there is no depthstencil attachment, then don't read @@ -884,25 +885,25 @@ anv_pipeline_init_dynamic_state(struct anv_pipeline *pipeline, if (states & (1 << VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK)) { assert(pCreateInfo->pDepthStencilState); dynamic->stencil_compare_mask.front = - pCreateInfo->pDepthStencilState->front.stencilCompareMask; + pCreateInfo->pDepthStencilState->front.compareMask; dynamic->stencil_compare_mask.back = - pCreateInfo->pDepthStencilState->back.stencilCompareMask; + pCreateInfo->pDepthStencilState->back.compareMask; } if (states & (1 << VK_DYNAMIC_STATE_STENCIL_WRITE_MASK)) { assert(pCreateInfo->pDepthStencilState); dynamic->stencil_write_mask.front = - pCreateInfo->pDepthStencilState->front.stencilWriteMask; + pCreateInfo->pDepthStencilState->front.writeMask; dynamic->stencil_write_mask.back = - pCreateInfo->pDepthStencilState->back.stencilWriteMask; + pCreateInfo->pDepthStencilState->back.writeMask; } if (states & (1 << VK_DYNAMIC_STATE_STENCIL_REFERENCE)) { assert(pCreateInfo->pDepthStencilState); dynamic->stencil_reference.front = - pCreateInfo->pDepthStencilState->front.stencilReference; + pCreateInfo->pDepthStencilState->front.reference; dynamic->stencil_reference.back = - pCreateInfo->pDepthStencilState->back.stencilReference; + pCreateInfo->pDepthStencilState->back.reference; } } diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 0e148b36b1c..c86003f5823 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -917,7 +917,7 @@ struct anv_dynamic_state { struct { float bias; float clamp; - float slope_scaled; + float slope; } depth_bias; float blend_constants[4]; diff --git a/src/vulkan/gen7_cmd_buffer.c b/src/vulkan/gen7_cmd_buffer.c index b69982d6e52..9a3d4799d62 100644 --- a/src/vulkan/gen7_cmd_buffer.c +++ b/src/vulkan/gen7_cmd_buffer.c @@ -409,7 +409,7 @@ cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) ANV_CMD_DIRTY_DYNAMIC_DEPTH_BIAS)) { bool enable_bias = cmd_buffer->state.dynamic.depth_bias.bias != 0.0f || - cmd_buffer->state.dynamic.depth_bias.slope_scaled != 0.0f; + cmd_buffer->state.dynamic.depth_bias.slope != 0.0f; uint32_t sf_dw[GEN7_3DSTATE_SF_length]; struct GEN7_3DSTATE_SF sf = { @@ -419,7 +419,7 @@ cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) .GlobalDepthOffsetEnableWireframe = enable_bias, .GlobalDepthOffsetEnablePoint = enable_bias, .GlobalDepthOffsetConstant = cmd_buffer->state.dynamic.depth_bias.bias, - .GlobalDepthOffsetScale = cmd_buffer->state.dynamic.depth_bias.slope_scaled, + .GlobalDepthOffsetScale = cmd_buffer->state.dynamic.depth_bias.slope, .GlobalDepthOffsetClamp = cmd_buffer->state.dynamic.depth_bias.clamp }; GEN7_3DSTATE_SF_pack(NULL, sf_dw, &sf); diff --git a/src/vulkan/gen7_pipeline.c b/src/vulkan/gen7_pipeline.c index 1ae4d26bcdd..2f51b4bfc73 100644 --- a/src/vulkan/gen7_pipeline.c +++ b/src/vulkan/gen7_pipeline.c @@ -231,15 +231,15 @@ gen7_emit_ds_state(struct anv_pipeline *pipeline, .DoubleSidedStencilEnable = true, .StencilTestEnable = info->stencilTestEnable, - .StencilFailOp = vk_to_gen_stencil_op[info->front.stencilFailOp], - .StencilPassDepthPassOp = vk_to_gen_stencil_op[info->front.stencilPassOp], - .StencilPassDepthFailOp = vk_to_gen_stencil_op[info->front.stencilDepthFailOp], - .StencilTestFunction = vk_to_gen_compare_op[info->front.stencilCompareOp], - - .BackfaceStencilFailOp = vk_to_gen_stencil_op[info->back.stencilFailOp], - .BackfaceStencilPassDepthPassOp = vk_to_gen_stencil_op[info->back.stencilPassOp], - .BackfaceStencilPassDepthFailOp = vk_to_gen_stencil_op[info->back.stencilDepthFailOp], - .BackFaceStencilTestFunction = vk_to_gen_compare_op[info->back.stencilCompareOp], + .StencilFailOp = vk_to_gen_stencil_op[info->front.failOp], + .StencilPassDepthPassOp = vk_to_gen_stencil_op[info->front.passOp], + .StencilPassDepthFailOp = vk_to_gen_stencil_op[info->front.depthFailOp], + .StencilTestFunction = vk_to_gen_compare_op[info->front.compareOp], + + .BackfaceStencilFailOp = vk_to_gen_stencil_op[info->back.failOp], + .BackfaceStencilPassDepthPassOp = vk_to_gen_stencil_op[info->back.passOp], + .BackfaceStencilPassDepthFailOp = vk_to_gen_stencil_op[info->back.depthFailOp], + .BackFaceStencilTestFunction = vk_to_gen_compare_op[info->back.compareOp], }; GEN7_DEPTH_STENCIL_STATE_pack(NULL, &pipeline->gen7.depth_stencil_state, &state); diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c index 88062a6f61b..b6523b5ecf5 100644 --- a/src/vulkan/gen8_cmd_buffer.c +++ b/src/vulkan/gen8_cmd_buffer.c @@ -231,7 +231,7 @@ cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) if (cmd_buffer->state.dirty & (ANV_CMD_DIRTY_PIPELINE | ANV_CMD_DIRTY_DYNAMIC_DEPTH_BIAS)){ bool enable_bias = cmd_buffer->state.dynamic.depth_bias.bias != 0.0f || - cmd_buffer->state.dynamic.depth_bias.slope_scaled != 0.0f; + cmd_buffer->state.dynamic.depth_bias.slope != 0.0f; uint32_t raster_dw[GENX(3DSTATE_RASTER_length)]; struct GENX(3DSTATE_RASTER) raster = { @@ -240,7 +240,7 @@ cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) .GlobalDepthOffsetEnableWireframe = enable_bias, .GlobalDepthOffsetEnablePoint = enable_bias, .GlobalDepthOffsetConstant = cmd_buffer->state.dynamic.depth_bias.bias, - .GlobalDepthOffsetScale = cmd_buffer->state.dynamic.depth_bias.slope_scaled, + .GlobalDepthOffsetScale = cmd_buffer->state.dynamic.depth_bias.slope, .GlobalDepthOffsetClamp = cmd_buffer->state.dynamic.depth_bias.clamp }; GENX(3DSTATE_RASTER_pack)(NULL, raster_dw, &raster); diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c index fb0373c1f7e..16143300cf1 100644 --- a/src/vulkan/gen8_pipeline.c +++ b/src/vulkan/gen8_pipeline.c @@ -313,14 +313,14 @@ emit_ds_state(struct anv_pipeline *pipeline, .DoubleSidedStencilEnable = true, .StencilTestEnable = info->stencilTestEnable, - .StencilFailOp = vk_to_gen_stencil_op[info->front.stencilFailOp], - .StencilPassDepthPassOp = vk_to_gen_stencil_op[info->front.stencilPassOp], - .StencilPassDepthFailOp = vk_to_gen_stencil_op[info->front.stencilDepthFailOp], - .StencilTestFunction = vk_to_gen_compare_op[info->front.stencilCompareOp], - .BackfaceStencilFailOp = vk_to_gen_stencil_op[info->back.stencilFailOp], - .BackfaceStencilPassDepthPassOp = vk_to_gen_stencil_op[info->back.stencilPassOp], - .BackfaceStencilPassDepthFailOp =vk_to_gen_stencil_op[info->back.stencilDepthFailOp], - .BackfaceStencilTestFunction = vk_to_gen_compare_op[info->back.stencilCompareOp], + .StencilFailOp = vk_to_gen_stencil_op[info->front.failOp], + .StencilPassDepthPassOp = vk_to_gen_stencil_op[info->front.passOp], + .StencilPassDepthFailOp = vk_to_gen_stencil_op[info->front.depthFailOp], + .StencilTestFunction = vk_to_gen_compare_op[info->front.compareOp], + .BackfaceStencilFailOp = vk_to_gen_stencil_op[info->back.failOp], + .BackfaceStencilPassDepthPassOp = vk_to_gen_stencil_op[info->back.passOp], + .BackfaceStencilPassDepthFailOp =vk_to_gen_stencil_op[info->back.depthFailOp], + .BackfaceStencilTestFunction = vk_to_gen_compare_op[info->back.compareOp], }; GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, dw, &wm_depth_stencil); |