mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-22 22:50:32 +01:00
anv: add VK_EXT_depth_bias_control support
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23716>
This commit is contained in:
parent
f39fa39809
commit
ba42012857
2 changed files with 33 additions and 2 deletions
|
|
@ -302,6 +302,7 @@ get_device_extensions(const struct anv_physical_device *device,
|
|||
.EXT_conditional_rendering = true,
|
||||
.EXT_conservative_rasterization = true,
|
||||
.EXT_custom_border_color = true,
|
||||
.EXT_depth_bias_control = true,
|
||||
.EXT_depth_clamp_zero_one = true,
|
||||
.EXT_depth_clip_control = true,
|
||||
.EXT_depth_clip_enable = true,
|
||||
|
|
@ -815,6 +816,12 @@ get_features(const struct anv_physical_device *pdevice,
|
|||
|
||||
/* VK_EXT_dynamic_rendering_unused_attachments */
|
||||
.dynamicRenderingUnusedAttachments = true,
|
||||
|
||||
/* VK_EXT_depth_bias_control */
|
||||
.depthBiasControl = true,
|
||||
.floatRepresentation = true,
|
||||
.leastRepresentableValueForceUnormRepresentation = false,
|
||||
.depthBiasExact = true,
|
||||
};
|
||||
|
||||
/* The new DOOM and Wolfenstein games require depthBounds without
|
||||
|
|
|
|||
|
|
@ -462,7 +462,8 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||
|
||||
if ((cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_LINE_WIDTH) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_PROVOKING_VERTEX)) {
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_PROVOKING_VERTEX) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_BIAS_FACTORS)) {
|
||||
uint32_t sf_dw[GENX(3DSTATE_SF_length)];
|
||||
struct GENX(3DSTATE_SF) sf = {
|
||||
GENX(3DSTATE_SF_header),
|
||||
|
|
@ -470,7 +471,30 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||
|
||||
ANV_SETUP_PROVOKING_VERTEX(sf, dyn->rs.provoking_vertex);
|
||||
|
||||
sf.LineWidth = dyn->rs.line.width,
|
||||
sf.LineWidth = dyn->rs.line.width;
|
||||
|
||||
/**
|
||||
* From the Vulkan Spec:
|
||||
*
|
||||
* "VK_DEPTH_BIAS_REPRESENTATION_FLOAT_EXT specifies that the depth
|
||||
* bias representation is a factor of constant r equal to 1."
|
||||
*
|
||||
* From the SKL PRMs, Volume 7: 3D-Media-GPGPU, Depth Offset:
|
||||
*
|
||||
* "When UNORM Depth Buffer is at Output Merger (or no Depth Buffer):
|
||||
*
|
||||
* Bias = GlobalDepthOffsetConstant * r + GlobalDepthOffsetScale * MaxDepthSlope
|
||||
*
|
||||
* Where r is the minimum representable value > 0 in the depth
|
||||
* buffer format, converted to float32 (note: If state bit Legacy
|
||||
* Global Depth Bias Enable is set, the r term will be forced to
|
||||
* 1.0)"
|
||||
*
|
||||
* When VK_DEPTH_BIAS_REPRESENTATION_FLOAT_EXT is set, enable
|
||||
* LegacyGlobalDepthBiasEnable.
|
||||
*/
|
||||
sf.LegacyGlobalDepthBiasEnable =
|
||||
dyn->rs.depth_bias.representation == VK_DEPTH_BIAS_REPRESENTATION_FLOAT_EXT;
|
||||
|
||||
GENX(3DSTATE_SF_pack)(NULL, sf_dw, &sf);
|
||||
anv_batch_emit_merge(&cmd_buffer->batch, sf_dw, pipeline->gfx8.sf);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue