Mesa (master): nir/spirv: Add the option to keep ViewIndex as an input
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 19 16:55:20 UTC 2020
Module: Mesa
Branch: master
Commit: 340c73d4efd6198df077bc0f8b4e670df42f6ec6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=340c73d4efd6198df077bc0f8b4e670df42f6ec6
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Tue Jun 30 13:47:22 2020 +0200
nir/spirv: Add the option to keep ViewIndex as an input
This is necessary for fragment shaders on adreno.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5719>
---
src/compiler/spirv/nir_spirv.h | 4 ++++
src/compiler/spirv/vtn_variables.c | 9 +++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h
index 3d6f74e43ca..3cbd0269ffe 100644
--- a/src/compiler/spirv/nir_spirv.h
+++ b/src/compiler/spirv/nir_spirv.h
@@ -64,6 +64,10 @@ struct spirv_to_nir_options {
*/
bool frag_coord_is_sysval;
+ /* Whether to keep ViewIndex as an input instead of rewriting to a sysval.
+ */
+ bool view_index_is_input;
+
struct spirv_supported_capabilities caps;
/* Address format for various kinds of pointers. */
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 1cb848a3af8..a7ccafdc8b9 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1436,8 +1436,13 @@ vtn_get_builtin_location(struct vtn_builder *b,
set_mode_system_value(b, mode);
break;
case SpvBuiltInViewIndex:
- *location = SYSTEM_VALUE_VIEW_INDEX;
- set_mode_system_value(b, mode);
+ if (b->options && b->options->view_index_is_input) {
+ *location = VARYING_SLOT_VIEW_INDEX;
+ vtn_assert(*mode == nir_var_shader_in);
+ } else {
+ *location = SYSTEM_VALUE_VIEW_INDEX;
+ set_mode_system_value(b, mode);
+ }
break;
case SpvBuiltInSubgroupEqMask:
*location = SYSTEM_VALUE_SUBGROUP_EQ_MASK,
More information about the mesa-commit
mailing list