spirv: add an options to lower SpvOpTerminateInvocation to OpKill
To workaround game bugs like Indiana Jones.
Original workaround found by Hans-Kristian.
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 4d4418dbb3
)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32730>
This commit is contained in:

committed by
Dylan Baker

parent
72c1e65d44
commit
6a946ade04
@@ -734,7 +734,7 @@
|
|||||||
"description": "spirv: add an options to lower SpvOpTerminateInvocation to OpKill",
|
"description": "spirv: add an options to lower SpvOpTerminateInvocation to OpKill",
|
||||||
"nominated": true,
|
"nominated": true,
|
||||||
"nomination_type": 1,
|
"nomination_type": 1,
|
||||||
"resolution": 0,
|
"resolution": 1,
|
||||||
"main_sha": null,
|
"main_sha": null,
|
||||||
"because_sha": null,
|
"because_sha": null,
|
||||||
"notes": null
|
"notes": null
|
||||||
|
@@ -133,6 +133,11 @@ struct spirv_to_nir_options {
|
|||||||
/* Force SSBO accesses to be non-uniform. */
|
/* Force SSBO accesses to be non-uniform. */
|
||||||
bool force_ssbo_non_uniform;
|
bool force_ssbo_non_uniform;
|
||||||
|
|
||||||
|
/* Whether OpTerminateInvocation should be lowered to OpKill to workaround
|
||||||
|
* game bugs.
|
||||||
|
*/
|
||||||
|
bool lower_terminate_to_discard;
|
||||||
|
|
||||||
/* In Debug Builds, instead of emitting an OS break on failure, just return NULL from
|
/* 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
|
* spirv_to_nir(). This is useful for the unit tests that want to report a test failed
|
||||||
* but continue executing other tests.
|
* but continue executing other tests.
|
||||||
|
@@ -976,7 +976,10 @@ branch_type_for_terminator(struct vtn_builder *b, struct vtn_block *block)
|
|||||||
case SpvOpKill:
|
case SpvOpKill:
|
||||||
return vtn_branch_type_discard;
|
return vtn_branch_type_discard;
|
||||||
case SpvOpTerminateInvocation:
|
case SpvOpTerminateInvocation:
|
||||||
return vtn_branch_type_terminate_invocation;
|
if (b->options->lower_terminate_to_discard)
|
||||||
|
return vtn_branch_type_discard;
|
||||||
|
else
|
||||||
|
return vtn_branch_type_terminate_invocation;
|
||||||
case SpvOpIgnoreIntersectionKHR:
|
case SpvOpIgnoreIntersectionKHR:
|
||||||
return vtn_branch_type_ignore_intersection;
|
return vtn_branch_type_ignore_intersection;
|
||||||
case SpvOpTerminateRayKHR:
|
case SpvOpTerminateRayKHR:
|
||||||
|
Reference in New Issue
Block a user