Crysis 2 and 3 Remastered's RT shaders non-uniformly index into SSBO
descriptor arrays without specifying the NonUniformEXT qualifier on the
relevant access chains/load ops. This leads to artifacts around objects.
To add insult to injury, the game fails to provide a meaningful
applicationName/engineName in the Vulkan part of the DX11-Vulkan interop
solution used for RT. Both of these fields are set to "nvpro-sample"
(perhaps the code has been copied from NVIDIA's sample applications).
Therefore, fall back to executable name matching.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9883
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26391>
(cherry picked from commit
f1817ab7e03f188164c7d6850149781066418d49)
"description": "radv,vtn,driconf: Add and use radv_rt_ssbo_non_uniform workaround for Crysis 2/3 Remastered",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null
DRI_CONF_RADV_FLUSH_BEFORE_TIMESTAMP_WRITE(false)
DRI_CONF_RADV_RT_WAVE64(false)
DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION(false)
+ DRI_CONF_RADV_SSBO_NON_UNIFORM(false)
DRI_CONF_RADV_APP_LAYER()
DRI_CONF_SECTION_END
};
instance->tex_non_uniform = driQueryOptionb(&instance->dri_options, "radv_tex_non_uniform");
+ instance->ssbo_non_uniform = driQueryOptionb(&instance->dri_options, "radv_ssbo_non_uniform");
+
instance->app_layer = driQueryOptionstr(&instance->dri_options, "radv_app_layer");
instance->flush_before_timestamp_write =
key.image_2d_view_of_3d = device->image_2d_view_of_3d && device->physical_device->rad_info.gfx_level == GFX9;
key.tex_non_uniform = device->instance->tex_non_uniform;
+ key.ssbo_non_uniform = device->instance->ssbo_non_uniform;
for (unsigned i = 0; i < num_stages; ++i) {
const VkPipelineShaderStageCreateInfo *const stage = &stages[i];
bool flush_before_query_copy;
bool enable_unified_heap_on_apu;
bool tex_non_uniform;
+ bool ssbo_non_uniform;
bool flush_before_timestamp_write;
bool force_rt_wave64;
bool dual_color_blend_by_location;
.private_data = &spirv_debug_data,
},
.force_tex_non_uniform = key->tex_non_uniform,
+ .force_ssbo_non_uniform = key->ssbo_non_uniform,
};
nir = spirv_to_nir(spirv, stage->spirv.size / 4, spec_entries, num_spec_entries, stage->stage, stage->entrypoint,
&spirv_options, &device->physical_device->nir_options[stage->stage]);
uint32_t dynamic_provoking_vtx_mode : 1;
uint32_t dynamic_line_rast_mode : 1;
uint32_t tex_non_uniform : 1;
+ uint32_t ssbo_non_uniform : 1;
uint32_t enable_remove_point_size : 1;
uint32_t unknown_rast_prim : 1;
uint32_t mesh_shader_queries : 1;
/* Force texture sampling to be non-uniform. */
bool force_tex_non_uniform;
+ /* Force SSBO accesses to be non-uniform. */
+ bool force_ssbo_non_uniform;
/* In Debug Builds, instead of emitting an OS break on failure, just return NULL from
* spirv_to_nir(). This is useful for the unit tests that want to report a test failed
/* Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/3406 */
access |= base->access & ACCESS_NON_UNIFORM;
+ if (base->mode == vtn_variable_mode_ssbo && b->options->force_ssbo_non_uniform)
+ access |= ACCESS_NON_UNIFORM;
+
struct vtn_pointer *ptr = vtn_pointer_dereference(b, base, chain);
ptr->ptr_type = ptr_type;
ptr->access |= access;
<option name="radv_invariant_geom" value="true"/>
</application>
+ <application name="Crysis 2 Remastered" executable="Crysis2Remastered.exe">
+ <option name="radv_ssbo_non_uniform" value="true" />
+ </application>
+
+ <application name="Crysis 3 Remastered" executable="Crysis3Remastered.exe">
+ <option name="radv_ssbo_non_uniform" value="true" />
+ </application>
+
<!-- OpenGL Game workarounds (zink) -->
<application name="Black Geyser: Couriers of Darkness" executable="BlackGeyser.x86_64">
<option name="radv_zero_vram" value="true" />
DRI_CONF_OPT_B(radv_tex_non_uniform, def, \
"Always mark texture sample operations as non-uniform.")
+#define DRI_CONF_RADV_SSBO_NON_UNIFORM(def) \
+ DRI_CONF_OPT_B(radv_ssbo_non_uniform, def, \
+ "Always mark SSBO operations as non-uniform.")
+
#define DRI_CONF_RADV_FLUSH_BEFORE_TIMESTAMP_WRITE(def) \
DRI_CONF_OPT_B(radv_flush_before_timestamp_write, def, \
"Wait for previous commands to finish before writing timestamps")