Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2021-01-04 11:59:26 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2021-01-04 12:00:12 +0300
commitddb3c65648032d5c5d671af8d3303a223a113852 (patch)
tree52f7a7d89a84b1c7553346049ebd5559f745aa3a /reference
parentc4ff129fe34ba70de583b1a75f6ace2feefd6976 (diff)
Handle reserved identifiers for functions.
gl_ identifiers are already handled by fixups, so remove redundant code.
Diffstat (limited to 'reference')
-rw-r--r--reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag31
-rw-r--r--reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag33
-rw-r--r--reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag21
3 files changed, 85 insertions, 0 deletions
diff --git a/reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag b/reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag
new file mode 100644
index 00000000..1f1f6fac
--- /dev/null
+++ b/reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag
@@ -0,0 +1,31 @@
+static float FragColor;
+
+struct SPIRV_Cross_Output
+{
+ float FragColor : SV_Target0;
+};
+
+float _mat3(float a)
+{
+ return a + 1.0f;
+}
+
+float _RESERVED_IDENTIFIER_FIXUP_gl_Foo(int a)
+{
+ return float(a) + 1.0f;
+}
+
+void frag_main()
+{
+ float param = 2.0f;
+ int param_1 = 4;
+ FragColor = _mat3(param) + _RESERVED_IDENTIFIER_FIXUP_gl_Foo(param_1);
+}
+
+SPIRV_Cross_Output main()
+{
+ frag_main();
+ SPIRV_Cross_Output stage_output;
+ stage_output.FragColor = FragColor;
+ return stage_output;
+}
diff --git a/reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag b/reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag
new file mode 100644
index 00000000..5c8ec371
--- /dev/null
+++ b/reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag
@@ -0,0 +1,33 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct main0_out
+{
+ float FragColor [[color(0)]];
+};
+
+static inline __attribute__((always_inline))
+float _mat3(thread const float& a)
+{
+ return a + 1.0;
+}
+
+static inline __attribute__((always_inline))
+float _RESERVED_IDENTIFIER_FIXUP_gl_Foo(thread const int& a)
+{
+ return float(a) + 1.0;
+}
+
+fragment main0_out main0()
+{
+ main0_out out = {};
+ float param = 2.0;
+ int param_1 = 4;
+ out.FragColor = _mat3(param) + _RESERVED_IDENTIFIER_FIXUP_gl_Foo(param_1);
+ return out;
+}
+
diff --git a/reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag b/reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag
new file mode 100644
index 00000000..52f0c616
--- /dev/null
+++ b/reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag
@@ -0,0 +1,21 @@
+#version 450
+
+layout(location = 0) out float FragColor;
+
+float _mat3(float a)
+{
+ return a + 1.0;
+}
+
+float _RESERVED_IDENTIFIER_FIXUP_gl_Foo(int a)
+{
+ return float(a) + 1.0;
+}
+
+void main()
+{
+ float param = 2.0;
+ int param_1 = 4;
+ FragColor = _mat3(param) + _RESERVED_IDENTIFIER_FIXUP_gl_Foo(param_1);
+}
+