panvk: add a driConf to force enable atomics in shaders

This is mainly useful for enabling validation layers, but might also
be useful for a few apps that use very basic atomic operations. In
general these operations do not work properly in Bifrost, but they
work well enough to e.g. pass some piglit tests.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35710>
This commit is contained in:
Eric R. Smith 2025-06-23 14:47:51 -03:00 committed by Marge Bot
parent fcd2fbfdfd
commit 65bc0f715e
4 changed files with 12 additions and 2 deletions

View file

@ -168,6 +168,7 @@ static const driOptionDescription panvk_dri_options[] = {
DRI_CONF_PAN_COMPUTE_CORE_MASK(~0ull)
DRI_CONF_PAN_FRAGMENT_CORE_MASK(~0ull)
DRI_CONF_PAN_ENABLE_VERTEX_PIPELINE_STORES_ATOMICS(false)
DRI_CONF_PAN_FORCE_ENABLE_SHADER_ATOMICS(false)
DRI_CONF_SECTION_END
};
@ -184,6 +185,8 @@ panvk_init_dri_options(struct panvk_instance *instance)
instance->enable_vertex_pipeline_stores_atomics = driQueryOptionb(
&instance->dri_options, "pan_enable_vertex_pipeline_stores_atomics");
instance->force_enable_shader_atomics = driQueryOptionb(
&instance->dri_options, "pan_force_enable_shader_atomics");
}
VKAPI_ATTR VkResult VKAPI_CALL

View file

@ -49,6 +49,7 @@ struct panvk_instance {
uint32_t force_vk_vendor;
bool enable_vertex_pipeline_stores_atomics;
bool force_enable_shader_atomics;
struct {
struct pan_kmod_allocator allocator;

View file

@ -241,7 +241,8 @@ panvk_per_arch(get_physical_device_features)(
.textureCompressionETC2 = has_texture_compression_etc2(device),
.textureCompressionASTC_LDR = has_texture_compression_astc_ldr(device),
.textureCompressionBC = has_texture_compression_bc(device),
.fragmentStoresAndAtomics = PAN_ARCH >= 10,
.fragmentStoresAndAtomics = (PAN_ARCH >= 10) ||
instance->force_enable_shader_atomics,
.shaderImageGatherExtended = true,
.shaderStorageImageExtendedFormats = true,
.shaderStorageImageReadWithoutFormat = true,
@ -257,7 +258,8 @@ panvk_per_arch(get_physical_device_features)(
/* On v13+, the hardware isn't speculatively referencing to invalid
indices anymore. */
.vertexPipelineStoresAndAtomics =
PAN_ARCH >= 13 && instance->enable_vertex_pipeline_stores_atomics,
(PAN_ARCH >= 13 && instance->enable_vertex_pipeline_stores_atomics) ||
instance->force_enable_shader_atomics,
/* Vulkan 1.1 */
.storageBuffer16BitAccess = true,

View file

@ -611,6 +611,10 @@
DRI_CONF_OPT_B(pan_enable_vertex_pipeline_stores_atomics, def, \
"Enable vertexPipelineStoresAndAtomics on v13+ (This cannot work on older generation because of speculative behaviors around vertices)")
#define DRI_CONF_PAN_FORCE_ENABLE_SHADER_ATOMICS(def) \
DRI_CONF_OPT_B(pan_force_enable_shader_atomics, def, \
"Enable fragmentStoresAndAtomics and vertexPipelineStoresAndAtomics on any architecture. (This may not work reliably and is for debug purposes only!)")
/**
* \brief Turnip specific configuration options
*/