nvk, nak: Wire up conservative rasterization underestimate

bit 611 in SPH actually control underestimate, let's wire that and
expose it.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28937>
This commit is contained in:
Mary Guillemard
2024-05-13 17:44:11 +02:00
committed by Marge Bot
parent 715f2f1425
commit db2f2ee078
4 changed files with 12 additions and 6 deletions

View File

@@ -41,8 +41,7 @@ struct nak_fs_key {
* VkPipelineMultisampleStateCreateInfo::minSampleShading
*/
bool force_sample_shading;
uint8_t _pad;
bool uses_underestimate;
/**
* The constant buffer index and offset at which the sample locations table lives.

View File

@@ -453,12 +453,11 @@ impl ShaderProgramHeader {
self.set_bit(610, does_interlock);
}
// TODO: This seems always set on fragment shaders, figure out what this is for.
#[inline]
#[allow(dead_code)]
pub fn set_unknown_bit611(&mut self, value: bool) {
pub fn set_uses_underestimate(&mut self, uses_underestimate: bool) {
assert!(self.shader_type == ShaderType::Fragment);
self.set_bit(611, value);
self.set_bit(611, uses_underestimate);
}
#[inline]
@@ -533,6 +532,8 @@ pub fn encode_header(
}
let zs_self_dep = fs_key.map_or(false, |key| key.zs_self_dep);
let uses_underestimate =
fs_key.map_or(false, |key| key.uses_underestimate);
// This isn't so much a "Do we write multiple render targets?" bit
// as a "Should color0 be broadcast to all render targets?" bit. In
@@ -547,6 +548,7 @@ pub fn encode_header(
sph.set_omap_depth(io.writes_depth);
sph.set_omap_targets(io.writes_color);
sph.set_does_interlock(io.does_interlock);
sph.set_uses_underestimate(uses_underestimate);
for (index, value) in io.barycentric_attr_in.iter().enumerate() {
sph.set_pervertex_imap_vector(index, *value);

View File

@@ -873,7 +873,7 @@ nvk_get_device_properties(const struct nvk_instance *instance,
.primitiveOverestimationSize = info->cls_eng3d >= VOLTA_A ? 1.0f / 512.0f : 0.0,
.maxExtraPrimitiveOverestimationSize = 0.75,
.extraPrimitiveOverestimationSizeGranularity = 0.25,
.primitiveUnderestimation = false,
.primitiveUnderestimation = info->cls_eng3d >= VOLTA_A,
.conservativePointAndLineRasterization = true,
.degenerateLinesRasterized = info->cls_eng3d >= VOLTA_A,
.degenerateTrianglesRasterized = info->cls_eng3d >= PASCAL_A,

View File

@@ -154,6 +154,11 @@ nvk_populate_fs_key(struct nak_fs_key *key,
key->sample_locations_cb = 0;
key->sample_locations_offset = nvk_root_descriptor_offset(draw.sample_locations);
/* Turn underestimate on when no state is availaible or if explicitly set */
if (state == NULL || state->rs == NULL ||
state->rs->conservative_mode == VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT)
key->uses_underestimate = true;
if (state == NULL)
return;