radv: track if VRS is enabled to apply a workaround on GFX10.3

On some chips, gl_FragCoord.z has to be adjusted.

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/7837>
This commit is contained in:
Samuel Pitoiset
2020-12-11 13:35:45 +01:00
committed by Marge Bot
parent c587eaadf6
commit 7a464f4296
4 changed files with 21 additions and 0 deletions

View File

@@ -2657,6 +2657,7 @@ VkResult radv_CreateDevice(
bool robust_buffer_access = false;
bool overallocation_disallowed = false;
bool custom_border_colors = false;
bool vrs_enabled = false;
/* Check enabled features */
if (pCreateInfo->pEnabledFeatures) {
@@ -2693,6 +2694,13 @@ VkResult radv_CreateDevice(
custom_border_colors = border_color_features->customBorderColors;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR: {
const VkPhysicalDeviceFragmentShadingRateFeaturesKHR *vrs = (const void *)ext;
vrs_enabled = vrs->pipelineFragmentShadingRate ||
vrs->primitiveFragmentShadingRate ||
vrs->attachmentFragmentShadingRate;
break;
}
default:
break;
}
@@ -2738,6 +2746,12 @@ VkResult radv_CreateDevice(
device->robust_buffer_access = robust_buffer_access;
device->adjust_frag_coord_z = (vrs_enabled ||
device->enabled_extensions.KHR_fragment_shading_rate) &&
(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);
mtx_init(&device->shader_slab_mutex, mtx_plain);
list_inithead(&device->shader_slabs);

View File

@@ -825,6 +825,11 @@ struct radv_device {
/* Whether the app has enabled the robustBufferAccess feature. */
bool robust_buffer_access;
/* Whether gl_FragCoord.z should be adjusted for VRS due to a hw bug
* on some GFX10.3 chips.
*/
bool adjust_frag_coord_z;
/* Whether the driver uses a global BO list. */
bool use_global_bo_list;

View File

@@ -1293,6 +1293,7 @@ shader_variant_compile(struct radv_device *device,
options->has_ls_vgpr_init_bug = device->physical_device->rad_info.has_ls_vgpr_init_bug;
options->use_ngg_streamout = device->physical_device->use_ngg_streamout;
options->enable_mrt_output_nan_fixup = device->instance->enable_mrt_output_nan_fixup;
options->adjust_frag_coord_z = device->adjust_frag_coord_z;
options->debug.func = radv_compiler_debug;
options->debug.private_data = &debug_data;

View File

@@ -135,6 +135,7 @@ struct radv_nir_compiler_options {
bool explicit_scratch_args;
bool clamp_shadow_reference;
bool robust_buffer_access;
bool adjust_frag_coord_z;
bool dump_shader;
bool dump_preoptir;
bool record_ir;