Skip to content

Commit

Permalink
radv: add radv_lower_terminate_to_discard and enable for Indiana Jones
Browse files Browse the repository at this point in the history
To workaround game bug.

This fixes the rendering issue with eyes.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32606>
(cherry picked from commit c7a7f02)
  • Loading branch information
hakzsam committed Dec 13, 2024
1 parent 13df7a6 commit f55f336
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pick_status.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
"description": "radv: add radv_lower_terminate_to_discard and enable for Indiana Jones",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null
Expand Down
4 changes: 4 additions & 0 deletions src/amd/vulkan/radv_instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ static const driOptionDescription radv_dri_options[] = {
DRI_CONF_RADV_OVERRIDE_COMPUTE_SHADER_VERSION(0)
DRI_CONF_RADV_OVERRIDE_RAY_TRACING_SHADER_VERSION(0)
DRI_CONF_RADV_SSBO_NON_UNIFORM(false)
DRI_CONF_RADV_LOWER_TERMINATE_TO_DISCARD(false)
DRI_CONF_RADV_APP_LAYER()
DRI_CONF_SECTION_END
};
Expand Down Expand Up @@ -262,6 +263,9 @@ radv_init_dri_options(struct radv_instance *instance)

instance->drirc.disable_dcc_mips = driQueryOptionb(&instance->drirc.options, "radv_disable_dcc_mips");
instance->drirc.disable_dcc_stores = driQueryOptionb(&instance->drirc.options, "radv_disable_dcc_stores");

instance->drirc.lower_terminate_to_discard =
driQueryOptionb(&instance->drirc.options, "radv_lower_terminate_to_discard");
}

static const struct vk_instance_extension_table radv_instance_extensions_supported = {
Expand Down
1 change: 1 addition & 0 deletions src/amd/vulkan/radv_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct radv_instance {
bool vk_require_astc;
bool disable_dcc_mips;
bool disable_dcc_stores;
bool lower_terminate_to_discard;
char *app_layer;
uint8_t override_graphics_shader_version;
uint8_t override_compute_shader_version;
Expand Down
1 change: 1 addition & 0 deletions src/amd/vulkan/radv_physical_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ radv_physical_device_init_cache_key(struct radv_physical_device *pdev)
key->split_fma = !!(instance->debug_flags & RADV_DEBUG_SPLIT_FMA);
key->ssbo_non_uniform = instance->drirc.ssbo_non_uniform;
key->tex_non_uniform = instance->drirc.tex_non_uniform;
key->lower_terminate_to_discard = instance->drirc.lower_terminate_to_discard;
key->use_llvm = pdev->use_llvm;
key->use_ngg = pdev->use_ngg;
key->use_ngg_culling = pdev->use_ngg_culling;
Expand Down
1 change: 1 addition & 0 deletions src/amd/vulkan/radv_physical_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct radv_physical_device_cache_key {
uint32_t split_fma : 1;
uint32_t ssbo_non_uniform : 1;
uint32_t tex_non_uniform : 1;
uint32_t lower_terminate_to_discard : 1;
uint32_t use_llvm : 1;
uint32_t use_ngg : 1;
uint32_t use_ngg_culling : 1;
Expand Down
1 change: 1 addition & 0 deletions src/amd/vulkan/radv_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st
},
.force_tex_non_uniform = pdev->cache_key.tex_non_uniform,
.force_ssbo_non_uniform = pdev->cache_key.ssbo_non_uniform,
.lower_terminate_to_discard = pdev->cache_key.lower_terminate_to_discard,
};
nir = spirv_to_nir(spirv, stage->spirv.size / 4, spec_entries, num_spec_entries, stage->stage, stage->entrypoint,
&spirv_options, &pdev->nir_options[stage->stage]);
Expand Down
1 change: 1 addition & 0 deletions src/util/00-radv-defaults.conf
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Application bugs worked around in this file:
<option name="radv_legacy_sparse_binding" value="true" />
<option name="radv_disable_dcc_stores" value="true" />
<option name="radv_invariant_geom" value="true" />
<option name="radv_lower_terminate_to_discard" value="true" />
</application>

<application name="DOOM (2016)" application_name_match="DOOM$">
Expand Down
4 changes: 4 additions & 0 deletions src/util/driconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,10 @@
DRI_CONF_OPT_B(radv_disable_dcc_stores, def, \
"Disable DCC for color storage images")

#define DRI_CONF_RADV_LOWER_TERMINATE_TO_DISCARD(def) \
DRI_CONF_OPT_B(radv_lower_terminate_to_discard, def, \
"Lower terminate to discard (which is implicitly demote)")

#define DRI_CONF_RADV_DISABLE_ANISO_SINGLE_LEVEL(def) \
DRI_CONF_OPT_B(radv_disable_aniso_single_level, def, \
"Disable anisotropic filtering for single level images")
Expand Down

0 comments on commit f55f336

Please sign in to comment.