mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
vulkan: rename depth bias graphics states
"constant" is a special keyword in OpenCL C, and we'd like to #define it suitably in host C23 to facilitate compatiblity between host/device headers. That means we can't have any identifiers named "global" or "constant". Fortunately, this is the only 'constant' in any file I'm hitting. To avoid the clash, don't abbreviate "constant factor", use "constant_factor" instead. For consistency, "slope factor" then becomes "slope_factor". The new names are longer but match the Vulkan API exactly. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> [Intel] Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> [NVK and panvk] Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> [V3DV] Reviewed-by: Simon Perretta <simon.perretta@imgtec.com> [IMG] Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32505>
This commit is contained in:
parent
c6021bd83c
commit
972f8aa287
15 changed files with 42 additions and 42 deletions
|
|
@ -191,9 +191,9 @@ radv_bind_dynamic_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_dy
|
|||
RADV_CMP_COPY(vk.ts.domain_origin, RADV_DYNAMIC_TESS_DOMAIN_ORIGIN);
|
||||
|
||||
RADV_CMP_COPY(vk.rs.line.width, RADV_DYNAMIC_LINE_WIDTH);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.constant, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.constant_factor, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.clamp, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.slope, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.slope_factor, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
RADV_CMP_COPY(vk.rs.depth_bias.representation, RADV_DYNAMIC_DEPTH_BIAS);
|
||||
RADV_CMP_COPY(vk.rs.line.stipple.factor, RADV_DYNAMIC_LINE_STIPPLE);
|
||||
RADV_CMP_COPY(vk.rs.line.stipple.pattern, RADV_DYNAMIC_LINE_STIPPLE);
|
||||
|
|
@ -3197,7 +3197,7 @@ radv_emit_depth_bias(struct radv_cmd_buffer *cmd_buffer)
|
|||
{
|
||||
const struct radv_dynamic_state *d = &cmd_buffer->state.dynamic;
|
||||
struct radv_rendering_state *render = &cmd_buffer->state.render;
|
||||
unsigned slope = fui(d->vk.rs.depth_bias.slope * 16.0f);
|
||||
unsigned slope = fui(d->vk.rs.depth_bias.slope_factor * 16.0f);
|
||||
unsigned pa_su_poly_offset_db_fmt_cntl = 0;
|
||||
|
||||
if (vk_format_has_depth(render->ds_att.format) &&
|
||||
|
|
@ -3219,11 +3219,11 @@ radv_emit_depth_bias(struct radv_cmd_buffer *cmd_buffer)
|
|||
}
|
||||
|
||||
radeon_set_context_reg_seq(cmd_buffer->cs, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 5);
|
||||
radeon_emit(cmd_buffer->cs, fui(d->vk.rs.depth_bias.clamp)); /* CLAMP */
|
||||
radeon_emit(cmd_buffer->cs, slope); /* FRONT SCALE */
|
||||
radeon_emit(cmd_buffer->cs, fui(d->vk.rs.depth_bias.constant)); /* FRONT OFFSET */
|
||||
radeon_emit(cmd_buffer->cs, slope); /* BACK SCALE */
|
||||
radeon_emit(cmd_buffer->cs, fui(d->vk.rs.depth_bias.constant)); /* BACK OFFSET */
|
||||
radeon_emit(cmd_buffer->cs, fui(d->vk.rs.depth_bias.clamp)); /* CLAMP */
|
||||
radeon_emit(cmd_buffer->cs, slope); /* FRONT SCALE */
|
||||
radeon_emit(cmd_buffer->cs, fui(d->vk.rs.depth_bias.constant_factor)); /* FRONT OFFSET */
|
||||
radeon_emit(cmd_buffer->cs, slope); /* BACK SCALE */
|
||||
radeon_emit(cmd_buffer->cs, fui(d->vk.rs.depth_bias.constant_factor)); /* BACK OFFSET */
|
||||
|
||||
radeon_set_context_reg(cmd_buffer->cs, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, pa_su_poly_offset_db_fmt_cntl);
|
||||
}
|
||||
|
|
@ -8752,9 +8752,9 @@ radv_CmdSetDepthBias2EXT(VkCommandBuffer commandBuffer, const VkDepthBiasInfoEXT
|
|||
const VkDepthBiasRepresentationInfoEXT *dbr_info =
|
||||
vk_find_struct_const(pDepthBiasInfo->pNext, DEPTH_BIAS_REPRESENTATION_INFO_EXT);
|
||||
|
||||
state->dynamic.vk.rs.depth_bias.constant = pDepthBiasInfo->depthBiasConstantFactor;
|
||||
state->dynamic.vk.rs.depth_bias.constant_factor = pDepthBiasInfo->depthBiasConstantFactor;
|
||||
state->dynamic.vk.rs.depth_bias.clamp = pDepthBiasInfo->depthBiasClamp;
|
||||
state->dynamic.vk.rs.depth_bias.slope = pDepthBiasInfo->depthBiasSlopeFactor;
|
||||
state->dynamic.vk.rs.depth_bias.slope_factor = pDepthBiasInfo->depthBiasSlopeFactor;
|
||||
state->dynamic.vk.rs.depth_bias.representation =
|
||||
dbr_info ? dbr_info->depthBiasRepresentation : VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT;
|
||||
|
||||
|
|
|
|||
|
|
@ -772,9 +772,9 @@ radv_pipeline_init_dynamic_state(const struct radv_device *device, struct radv_g
|
|||
}
|
||||
|
||||
if (states & RADV_DYNAMIC_DEPTH_BIAS) {
|
||||
dynamic->vk.rs.depth_bias.constant = state->rs->depth_bias.constant;
|
||||
dynamic->vk.rs.depth_bias.constant_factor = state->rs->depth_bias.constant_factor;
|
||||
dynamic->vk.rs.depth_bias.clamp = state->rs->depth_bias.clamp;
|
||||
dynamic->vk.rs.depth_bias.slope = state->rs->depth_bias.slope;
|
||||
dynamic->vk.rs.depth_bias.slope_factor = state->rs->depth_bias.slope_factor;
|
||||
dynamic->vk.rs.depth_bias.representation = state->rs->depth_bias.representation;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3034,9 +3034,9 @@ hk_flush_dynamic_state(struct hk_cmd_buffer *cmd, struct hk_cs *cs,
|
|||
VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT;
|
||||
|
||||
agx_pack(ptr, DEPTH_BIAS, cfg) {
|
||||
cfg.slope_scale = dyn->rs.depth_bias.slope;
|
||||
cfg.slope_scale = dyn->rs.depth_bias.slope_factor;
|
||||
cfg.clamp = dyn->rs.depth_bias.clamp;
|
||||
cfg.depth_bias = dyn->rs.depth_bias.constant;
|
||||
cfg.depth_bias = dyn->rs.depth_bias.constant_factor;
|
||||
cfg.depth_bias /= hk_depth_bias_factor(render->depth_att.vk_format,
|
||||
exact, force_unorm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1514,8 +1514,8 @@ v3dX(cmd_buffer_emit_depth_bias)(struct v3dv_cmd_buffer *cmd_buffer)
|
|||
v3dv_return_if_oom(cmd_buffer, NULL);
|
||||
|
||||
cl_emit(&job->bcl, DEPTH_OFFSET, bias) {
|
||||
bias.depth_offset_factor = dyn->rs.depth_bias.slope;
|
||||
bias.depth_offset_units = dyn->rs.depth_bias.constant;
|
||||
bias.depth_offset_factor = dyn->rs.depth_bias.slope_factor;
|
||||
bias.depth_offset_units = dyn->rs.depth_bias.constant_factor;
|
||||
#if V3D_VERSION <= 42
|
||||
if (pipeline->rendering_info.depth_attachment_format == VK_FORMAT_D16_UNORM)
|
||||
bias.depth_offset_units *= 256.0f;
|
||||
|
|
|
|||
|
|
@ -2827,8 +2827,8 @@ void
|
|||
tu6_emit_depth_bias(struct tu_cs *cs, const struct vk_rasterization_state *rs)
|
||||
{
|
||||
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_SU_POLY_OFFSET_SCALE, 3);
|
||||
tu_cs_emit(cs, A6XX_GRAS_SU_POLY_OFFSET_SCALE(rs->depth_bias.slope).value);
|
||||
tu_cs_emit(cs, A6XX_GRAS_SU_POLY_OFFSET_OFFSET(rs->depth_bias.constant).value);
|
||||
tu_cs_emit(cs, A6XX_GRAS_SU_POLY_OFFSET_SCALE(rs->depth_bias.slope_factor).value);
|
||||
tu_cs_emit(cs, A6XX_GRAS_SU_POLY_OFFSET_OFFSET(rs->depth_bias.constant_factor).value);
|
||||
tu_cs_emit(cs, A6XX_GRAS_SU_POLY_OFFSET_OFFSET_CLAMP(rs->depth_bias.clamp).value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -870,8 +870,8 @@ static void handle_graphics_pipeline(struct lvp_pipeline *pipeline,
|
|||
if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_RS_DEPTH_BIAS_ENABLE))
|
||||
state->depth_bias.enabled = ps->rs->depth_bias.enable;
|
||||
if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_RS_DEPTH_BIAS_FACTORS)) {
|
||||
state->depth_bias.offset_units = ps->rs->depth_bias.constant;
|
||||
state->depth_bias.offset_scale = ps->rs->depth_bias.slope;
|
||||
state->depth_bias.offset_units = ps->rs->depth_bias.constant_factor;
|
||||
state->depth_bias.offset_scale = ps->rs->depth_bias.slope_factor;
|
||||
state->depth_bias.offset_clamp = ps->rs->depth_bias.clamp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5273,8 +5273,8 @@ pvr_setup_isp_depth_bias_scissor_state(struct pvr_cmd_buffer *const cmd_buffer)
|
|||
.constant_factor = pvr_calculate_final_depth_bias_contant_factor(
|
||||
dev_info,
|
||||
cmd_buffer->state.depth_format,
|
||||
dynamic_state->rs.depth_bias.constant),
|
||||
.slope_factor = dynamic_state->rs.depth_bias.slope,
|
||||
dynamic_state->rs.depth_bias.constant_factor),
|
||||
.slope_factor = dynamic_state->rs.depth_bias.slope_factor,
|
||||
.clamp = dynamic_state->rs.depth_bias.clamp,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1127,8 +1127,8 @@ update_clip_raster(struct anv_gfx_dynamic_state *hw_state,
|
|||
SET(RASTER, raster.GlobalDepthOffsetEnableSolid, dyn->rs.depth_bias.enable);
|
||||
SET(RASTER, raster.GlobalDepthOffsetEnableWireframe, dyn->rs.depth_bias.enable);
|
||||
SET(RASTER, raster.GlobalDepthOffsetEnablePoint, dyn->rs.depth_bias.enable);
|
||||
SET(RASTER, raster.GlobalDepthOffsetConstant, dyn->rs.depth_bias.constant);
|
||||
SET(RASTER, raster.GlobalDepthOffsetScale, dyn->rs.depth_bias.slope);
|
||||
SET(RASTER, raster.GlobalDepthOffsetConstant, dyn->rs.depth_bias.constant_factor);
|
||||
SET(RASTER, raster.GlobalDepthOffsetScale, dyn->rs.depth_bias.slope_factor);
|
||||
SET(RASTER, raster.GlobalDepthOffsetClamp, dyn->rs.depth_bias.clamp);
|
||||
SET(RASTER, raster.FrontFaceFillMode, vk_to_intel_fillmode[dyn->rs.polygon_mode]);
|
||||
SET(RASTER, raster.BackFaceFillMode, vk_to_intel_fillmode[dyn->rs.polygon_mode]);
|
||||
|
|
|
|||
|
|
@ -102,8 +102,8 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||
.GlobalDepthOffsetEnableSolid = dyn->rs.depth_bias.enable,
|
||||
.GlobalDepthOffsetEnableWireframe = dyn->rs.depth_bias.enable,
|
||||
.GlobalDepthOffsetEnablePoint = dyn->rs.depth_bias.enable,
|
||||
.GlobalDepthOffsetConstant = dyn->rs.depth_bias.constant,
|
||||
.GlobalDepthOffsetScale = dyn->rs.depth_bias.slope,
|
||||
.GlobalDepthOffsetConstant = dyn->rs.depth_bias.constant_factor,
|
||||
.GlobalDepthOffsetScale = dyn->rs.depth_bias.slope_factor,
|
||||
.GlobalDepthOffsetClamp = dyn->rs.depth_bias.clamp,
|
||||
};
|
||||
GENX(3DSTATE_SF_pack)(NULL, sf_dw, &sf);
|
||||
|
|
|
|||
|
|
@ -240,8 +240,8 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||
.GlobalDepthOffsetEnableSolid = dyn->rs.depth_bias.enable,
|
||||
.GlobalDepthOffsetEnableWireframe = dyn->rs.depth_bias.enable,
|
||||
.GlobalDepthOffsetEnablePoint = dyn->rs.depth_bias.enable,
|
||||
.GlobalDepthOffsetConstant = dyn->rs.depth_bias.constant,
|
||||
.GlobalDepthOffsetScale = dyn->rs.depth_bias.slope,
|
||||
.GlobalDepthOffsetConstant = dyn->rs.depth_bias.constant_factor,
|
||||
.GlobalDepthOffsetScale = dyn->rs.depth_bias.slope_factor,
|
||||
.GlobalDepthOffsetClamp = dyn->rs.depth_bias.clamp,
|
||||
};
|
||||
GENX(3DSTATE_RASTER_pack)(NULL, raster_dw, &raster);
|
||||
|
|
|
|||
|
|
@ -2177,8 +2177,8 @@ nvk_flush_rs_state(struct nvk_cmd_buffer *cmd)
|
|||
unreachable("Unsupported depth bias representation");
|
||||
}
|
||||
/* TODO: The blob multiplies by 2 for some reason. We don't. */
|
||||
P_IMMD(p, NV9097, SET_DEPTH_BIAS, fui(dyn->rs.depth_bias.constant));
|
||||
P_IMMD(p, NV9097, SET_SLOPE_SCALE_DEPTH_BIAS, fui(dyn->rs.depth_bias.slope));
|
||||
P_IMMD(p, NV9097, SET_DEPTH_BIAS, fui(dyn->rs.depth_bias.constant_factor));
|
||||
P_IMMD(p, NV9097, SET_SLOPE_SCALE_DEPTH_BIAS, fui(dyn->rs.depth_bias.slope_factor));
|
||||
P_IMMD(p, NV9097, SET_DEPTH_BIAS_CLAMP, fui(dyn->rs.depth_bias.clamp));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1396,8 +1396,8 @@ prepare_ds(struct panvk_cmd_buffer *cmdbuf)
|
|||
cfg.depth_bias_enable = rs->depth_bias.enable;
|
||||
cfg.depth_function = test_z ? translate_compare_func(ds->depth.compare_op)
|
||||
: MALI_FUNC_ALWAYS;
|
||||
cfg.depth_units = rs->depth_bias.constant;
|
||||
cfg.depth_factor = rs->depth_bias.slope;
|
||||
cfg.depth_units = rs->depth_bias.constant_factor;
|
||||
cfg.depth_factor = rs->depth_bias.slope_factor;
|
||||
cfg.depth_bias_clamp = rs->depth_bias.clamp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -424,8 +424,8 @@ panvk_draw_prepare_fs_rsd(struct panvk_cmd_buffer *cmdbuf,
|
|||
cfg.stencil_mask_misc.single_sampled_lines =
|
||||
dyns->ms.rasterization_samples <= 1;
|
||||
|
||||
cfg.depth_units = rs->depth_bias.constant;
|
||||
cfg.depth_factor = rs->depth_bias.slope;
|
||||
cfg.depth_units = rs->depth_bias.constant_factor;
|
||||
cfg.depth_factor = rs->depth_bias.slope_factor;
|
||||
cfg.depth_bias_clamp = rs->depth_bias.clamp;
|
||||
|
||||
cfg.stencil_front.mask = ds->stencil.front.compare_mask;
|
||||
|
|
|
|||
|
|
@ -607,9 +607,9 @@ vk_rasterization_state_init(struct vk_rasterization_state *rs,
|
|||
rs->depth_bias.enable = rs_info->depthBiasEnable;
|
||||
if ((rs_info->depthBiasEnable || IS_DYNAMIC(RS_DEPTH_BIAS_ENABLE)) &&
|
||||
!IS_DYNAMIC(RS_DEPTH_BIAS_FACTORS)) {
|
||||
rs->depth_bias.constant = rs_info->depthBiasConstantFactor;
|
||||
rs->depth_bias.constant_factor = rs_info->depthBiasConstantFactor;
|
||||
rs->depth_bias.clamp = rs_info->depthBiasClamp;
|
||||
rs->depth_bias.slope = rs_info->depthBiasSlopeFactor;
|
||||
rs->depth_bias.slope_factor = rs_info->depthBiasSlopeFactor;
|
||||
}
|
||||
rs->line.width = rs_info->lineWidth;
|
||||
|
||||
|
|
@ -2149,9 +2149,9 @@ vk_dynamic_graphics_state_copy(struct vk_dynamic_graphics_state *dst,
|
|||
COPY_IF_SET(RS_PROVOKING_VERTEX, rs.provoking_vertex);
|
||||
COPY_IF_SET(RS_RASTERIZATION_STREAM, rs.rasterization_stream);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_ENABLE, rs.depth_bias.enable);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_FACTORS, rs.depth_bias.constant);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_FACTORS, rs.depth_bias.constant_factor);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_FACTORS, rs.depth_bias.clamp);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_FACTORS, rs.depth_bias.slope);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_FACTORS, rs.depth_bias.slope_factor);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_FACTORS, rs.depth_bias.representation);
|
||||
COPY_IF_SET(RS_DEPTH_BIAS_FACTORS, rs.depth_bias.exact);
|
||||
COPY_IF_SET(RS_LINE_WIDTH, rs.line.width);
|
||||
|
|
@ -3106,11 +3106,11 @@ vk_common_CmdSetDepthBias2EXT(
|
|||
struct vk_dynamic_graphics_state *dyn = &cmd->dynamic_graphics_state;
|
||||
|
||||
SET_DYN_VALUE(dyn, RS_DEPTH_BIAS_FACTORS,
|
||||
rs.depth_bias.constant, pDepthBiasInfo->depthBiasConstantFactor);
|
||||
rs.depth_bias.constant_factor, pDepthBiasInfo->depthBiasConstantFactor);
|
||||
SET_DYN_VALUE(dyn, RS_DEPTH_BIAS_FACTORS,
|
||||
rs.depth_bias.clamp, pDepthBiasInfo->depthBiasClamp);
|
||||
SET_DYN_VALUE(dyn, RS_DEPTH_BIAS_FACTORS,
|
||||
rs.depth_bias.slope, pDepthBiasInfo->depthBiasSlopeFactor);
|
||||
rs.depth_bias.slope_factor, pDepthBiasInfo->depthBiasSlopeFactor);
|
||||
|
||||
/** From the Vulkan 1.3.254 spec:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ struct vk_rasterization_state {
|
|||
*
|
||||
* MESA_VK_DYNAMIC_RS_DEPTH_BIAS_FACTORS
|
||||
*/
|
||||
float constant;
|
||||
float constant_factor;
|
||||
|
||||
/** VkPipelineRasterizationStateCreateInfo::depthBiasClamp
|
||||
*
|
||||
|
|
@ -353,7 +353,7 @@ struct vk_rasterization_state {
|
|||
*
|
||||
* MESA_VK_DYNAMIC_RS_DEPTH_BIAS_FACTORS
|
||||
*/
|
||||
float slope;
|
||||
float slope_factor;
|
||||
|
||||
/** VkDepthBiasRepresentationInfoEXT::depthBiasRepresentation
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue