diff --git a/src/nouveau/compiler/nak.h b/src/nouveau/compiler/nak.h index 937bf891e40..15035214187 100644 --- a/src/nouveau/compiler/nak.h +++ b/src/nouveau/compiler/nak.h @@ -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. diff --git a/src/nouveau/compiler/nak/sph.rs b/src/nouveau/compiler/nak/sph.rs index cbfd45eac09..c7e0f2f9793 100644 --- a/src/nouveau/compiler/nak/sph.rs +++ b/src/nouveau/compiler/nak/sph.rs @@ -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); diff --git a/src/nouveau/vulkan/nvk_physical_device.c b/src/nouveau/vulkan/nvk_physical_device.c index 359fffd09d2..c9cec88c629 100644 --- a/src/nouveau/vulkan/nvk_physical_device.c +++ b/src/nouveau/vulkan/nvk_physical_device.c @@ -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, diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index 4f9594e2a64..74b64dd166c 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -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;