radv: Add a driconf option to force non uniform texture sampling
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Sat, 10 Dec 2022 11:37:56 +0000 (12:37 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Dec 2022 18:18:32 +0000 (18:18 +0000)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h
src/util/driconf.h

index ac94bec..8b0adb8 100644 (file)
@@ -1144,6 +1144,7 @@ static const driOptionDescription radv_dri_options[] = {
       DRI_CONF_RADV_DGC(false)
       DRI_CONF_RADV_FLUSH_BEFORE_QUERY_COPY(false)
       DRI_CONF_RADV_ENABLE_UNIFIED_HEAP_ON_APU(false)
+      DRI_CONF_RADV_TEX_NON_UNIFORM(false)
    DRI_CONF_SECTION_END
 };
 // clang-format on
@@ -1198,6 +1199,8 @@ radv_init_dri_options(struct radv_instance *instance)
 
    instance->enable_unified_heap_on_apu =
       driQueryOptionb(&instance->dri_options, "radv_enable_unified_heap_on_apu");
+
+   instance->tex_non_uniform = driQueryOptionb(&instance->dri_options, "radv_tex_non_uniform");
 }
 
 static VkResult create_null_physical_device(struct vk_instance *vk_instance);
index 2de3f23..4c8e2a9 100644 (file)
@@ -2674,6 +2674,8 @@ radv_generate_pipeline_key(const struct radv_pipeline *pipeline, VkPipelineCreat
    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;
+
    return key;
 }
 
index 0d43cb6..19c6f41 100644 (file)
@@ -369,6 +369,7 @@ struct radv_instance {
    bool disable_sinking_load_input_fs;
    bool flush_before_query_copy;
    bool enable_unified_heap_on_apu;
+   bool tex_non_uniform;
 };
 
 VkResult radv_init_wsi(struct radv_physical_device *physical_device);
index 6ea3f36..41f817f 100644 (file)
@@ -834,6 +834,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_
                .func = radv_spirv_nir_debug,
                .private_data = &spirv_debug_data,
             },
+         .force_tex_non_uniform = key->tex_non_uniform,
       };
       nir = spirv_to_nir(spirv, stage->spirv.size / 4, spec_entries, num_spec_entries, stage->stage,
                          stage->entrypoint, &spirv_options,
index 062fe17..ad5de84 100644 (file)
@@ -77,6 +77,7 @@ struct radv_pipeline_key {
    uint32_t dynamic_rasterization_samples : 1;
    uint32_t dynamic_color_write_mask : 1;
    uint32_t dynamic_provoking_vtx_mode : 1;
+   uint32_t tex_non_uniform : 1;
 
    struct {
       uint32_t instance_rate_inputs;
index 8fb89ca..1df74c7 100644 (file)
    DRI_CONF_OPT_B(radv_enable_unified_heap_on_apu, def, \
                   "Enable an unified heap with DEVICE_LOCAL on integrated GPUs")
 
+#define DRI_CONF_RADV_TEX_NON_UNIFORM(def) \
+   DRI_CONF_OPT_B(radv_tex_non_uniform, def, \
+                  "Always mark texture sample operations as non-uniform.")
+
 /**
  * \brief ANV specific configuration options
  */