v3dv: support for depthBiasClamp

Gets tests like the following working:
dEQP-VK.dynamic_state.rs_state.depth_bias_clamp

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8928>
This commit is contained in:
Alejandro Piñeiro 2021-02-09 13:12:03 +01:00 committed by Marge Bot
parent f7575fa71f
commit f758b1a25b
4 changed files with 7 additions and 1 deletions

View File

@ -53,6 +53,7 @@ const struct v3dv_dynamic_state default_dynamic_state = {
.blend_constants = { 0.0f, 0.0f, 0.0f, 0.0f },
.depth_bias = {
.constant_factor = 0.0f,
.depth_bias_clamp = 0.0f,
.slope_factor = 0.0f,
},
.line_width = 1.0f,
@ -3481,6 +3482,7 @@ emit_depth_bias(struct v3dv_cmd_buffer *cmd_buffer)
bias.depth_offset_units = dynamic->depth_bias.constant_factor;
if (pipeline->depth_bias.is_z16)
bias.depth_offset_units *= 256.0f;
bias.limit = dynamic->depth_bias.depth_bias_clamp;
}
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_DEPTH_BIAS;
@ -4693,6 +4695,7 @@ v3dv_CmdSetDepthBias(VkCommandBuffer commandBuffer,
V3DV_FROM_HANDLE(v3dv_cmd_buffer, cmd_buffer, commandBuffer);
cmd_buffer->state.dynamic.depth_bias.constant_factor = depthBiasConstantFactor;
cmd_buffer->state.dynamic.depth_bias.depth_bias_clamp = depthBiasClamp;
cmd_buffer->state.dynamic.depth_bias.slope_factor = depthBiasSlopeFactor;
cmd_buffer->state.dirty |= V3DV_CMD_DIRTY_DEPTH_BIAS;
}

View File

@ -847,7 +847,7 @@ v3dv_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
.multiDrawIndirect = false,
.drawIndirectFirstInstance = true,
.depthClamp = false,
.depthBiasClamp = false,
.depthBiasClamp = true,
.fillModeNonSolid = true,
.depthBounds = false, /* Only available since V3D 4.3.16.2 */
.wideLines = true,

View File

@ -2123,6 +2123,8 @@ pipeline_init_dynamic_state(
!(dynamic_states & V3DV_DYNAMIC_DEPTH_BIAS)) {
dynamic->depth_bias.constant_factor =
pRasterizationState->depthBiasConstantFactor;
dynamic->depth_bias.depth_bias_clamp =
pRasterizationState->depthBiasClamp;
dynamic->depth_bias.slope_factor =
pRasterizationState->depthBiasSlopeFactor;
}

View File

@ -724,6 +724,7 @@ struct v3dv_dynamic_state {
struct {
float constant_factor;
float depth_bias_clamp;
float slope_factor;
} depth_bias;