diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 26fed37adac..a85c7db68a0 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -3359,19 +3359,21 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr device->force_vrs = radv_parse_force_vrs_config_file(file); - if (!radv_device_init_notifier(device)) { + if (radv_device_init_notifier(device)) { + device->force_vrs_enabled = true; + } else { fprintf(stderr, "radv: Failed to initialize the notifier for RADV_FORCE_VRS_CONFIG_FILE!\n"); } } else if (getenv("RADV_FORCE_VRS")) { const char *vrs_rates = getenv("RADV_FORCE_VRS"); device->force_vrs = radv_parse_vrs_rates(vrs_rates); + device->force_vrs_enabled = device->force_vrs != RADV_FORCE_VRS_1x1; } } device->adjust_frag_coord_z = - (device->vk.enabled_extensions.KHR_fragment_shading_rate || - device->force_vrs != RADV_FORCE_VRS_1x1) && + (device->vk.enabled_extensions.KHR_fragment_shading_rate || device->force_vrs_enabled) && (device->physical_device->rad_info.family == CHIP_SIENNA_CICHLID || device->physical_device->rad_info.family == CHIP_NAVY_FLOUNDER || device->physical_device->rad_info.family == CHIP_VANGOGH); diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index a7de117e9b5..f9973b8ea9f 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -2984,7 +2984,8 @@ radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline, if (pipeline->device->instance->enable_mrt_output_nan_fixup) key.ps.enable_mrt_output_nan_fixup = true; - key.ps.force_vrs = pipeline->device->force_vrs; + + key.ps.force_vrs_enabled = pipeline->device->force_vrs_enabled; if (pipeline->device->instance->debug_flags & RADV_DEBUG_INVARIANT_GEOM) key.invariant_geom = true; @@ -3664,7 +3665,7 @@ radv_consider_force_vrs(const struct radv_pipeline *pipeline, bool noop_fs, nir_ { struct radv_device *device = pipeline->device; - if (device->force_vrs == RADV_FORCE_VRS_1x1) + if (!device->force_vrs_enabled) return false; /* Only VS and GS are supported for now. */ diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 39b006ed838..22c202fab63 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -877,6 +877,9 @@ struct radv_device { struct radv_shader_prolog *instance_rate_vs_prologs[816]; simple_mtx_t trace_mtx; + + /* Whether per-vertex VRS is forced. */ + bool force_vrs_enabled; }; struct radv_device_memory { diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 61323641b67..d34781e729f 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -89,7 +89,7 @@ struct radv_pipeline_key { bool lower_discard_to_demote; bool enable_mrt_output_nan_fixup; - uint8_t force_vrs; + bool force_vrs_enabled; } ps; struct {