summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_private.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-06-20 09:06:44 -0700
committerJason Ekstrand <[email protected]>2017-06-20 18:51:26 -0700
commit1bd0acab21c250b263604a52ca6694941a6f02e0 (patch)
treec69734a52f561da8ef8ae3b027f9832db9177429 /src/compiler/spirv/vtn_private.h
parent93055576ae81a30880ab7079b5e832098946b3f6 (diff)
spirv: Work around the Doom shader bug
Doom shipped with a broken version of GLSLang which handles samplers as function arguments in a way that isn't spec-compliant. In particular, it creates a temporary local sampler variable and copies the sampler into it. While Dave has had a hack patch out for a while that gets it working, we've never landed it because we've been hoping that a game update would come out with fixed shaders. Unfortunately, no game update appears on to be on the horizon and I've found this issue in yet another application so I think we're stuck working around it. Hopefully, we can delete this code one day. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99467 Cc: "17.1" <[email protected]> Tested-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_private.h')
-rw-r--r--src/compiler/spirv/vtn_private.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 59fcc94fcda..a377c901446 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -288,6 +288,20 @@ struct vtn_variable {
nir_variable *var;
nir_variable **members;
+ /**
+ * In some early released versions of GLSLang, it implemented all function
+ * calls by making copies of all parameters into temporary variables and
+ * passing those variables into the function. It even did so for samplers
+ * and images which violates the SPIR-V spec. Unfortunately, two games
+ * (Talos Principle and Doom) shipped with this old version of GLSLang and
+ * also happen to pass samplers into functions. Talos Principle received
+ * an update fairly shortly after release with an updated GLSLang. Doom,
+ * on the other hand, has never received an update so we need to work
+ * around this GLSLang issue in SPIR-V -> NIR. Hopefully, we can drop this
+ * hack at some point in the future.
+ */
+ struct vtn_access_chain *copy_prop_sampler;
+
struct vtn_access_chain chain;
};