radv: allow to force per-vertex VRS if the config file is present
This is needed to add the primitive shading rate output to the vertex or geometry shaders, even if the default value is 1x1. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14713>
This commit is contained in:
@@ -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);
|
||||
|
@@ -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. */
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user