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 <hans-kristian.arntzen@arm.com>2018-09-10 13:13:26 +0300
committerHans-Kristian Arntzen <hans-kristian.arntzen@arm.com>2018-09-10 13:13:26 +0300
commit63f6466065a327188ba1184a536fe494e86af823 (patch)
treeb27ed50f5bc4196552dfee3cdddc39561ae189ca /shaders
parent7a32167d637c1df14d2e0f08693e73fde0540be2 (diff)
Support Component decoration in GLSL.
Diffstat (limited to 'shaders')
-rw-r--r--shaders/asm/frag/locations-components.asm.frag102
-rw-r--r--shaders/desktop-only/frag/layout-component.desktop.frag14
2 files changed, 116 insertions, 0 deletions
diff --git a/shaders/asm/frag/locations-components.asm.frag b/shaders/asm/frag/locations-components.asm.frag
new file mode 100644
index 00000000..bf8c6a69
--- /dev/null
+++ b/shaders/asm/frag/locations-components.asm.frag
@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Wine VKD3D Shader Compiler; 0
+; Bound: 67
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %8 %16 %22 %28 %33 %o0
+ OpName %main "main"
+ OpName %v1 "v1"
+ OpName %v2 "v2"
+ OpName %o0 "o0"
+ OpName %r0 "r0"
+ OpDecorate %8 Location 1
+ OpDecorate %16 Location 1
+ OpDecorate %16 Component 2
+ OpDecorate %22 Location 2
+ OpDecorate %22 Flat
+ OpDecorate %28 Location 2
+ OpDecorate %28 Component 1
+ OpDecorate %28 Flat
+ OpDecorate %33 Location 2
+ OpDecorate %33 Component 2
+ OpDecorate %33 Flat
+ OpDecorate %o0 Location 0
+ %void = OpTypeVoid
+ %2 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%_ptr_Input_v2float = OpTypePointer Input %v2float
+ %8 = OpVariable %_ptr_Input_v2float Input
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %v1 = OpVariable %_ptr_Private_v4float Private
+%_ptr_Input_float = OpTypePointer Input %float
+ %16 = OpVariable %_ptr_Input_float Input
+%_ptr_Private_float = OpTypePointer Private %float
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+ %22 = OpVariable %_ptr_Input_float Input
+ %v2 = OpVariable %_ptr_Private_v4float Private
+ %uint_0 = OpConstant %uint 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %28 = OpVariable %_ptr_Input_uint Input
+ %uint_1 = OpConstant %uint 1
+ %33 = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %o0 = OpVariable %_ptr_Output_v4float Output
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %int = OpTypeInt 32 1
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Output_float = OpTypePointer Output %float
+ %main = OpFunction %void None %2
+ %4 = OpLabel
+ %r0 = OpVariable %_ptr_Function_v4float Function
+ %12 = OpLoad %v2float %8
+ %13 = OpLoad %v4float %v1
+ %14 = OpVectorShuffle %v4float %13 %12 4 5 2 3
+ OpStore %v1 %14
+ %17 = OpLoad %float %16
+ %21 = OpInBoundsAccessChain %_ptr_Private_float %v1 %uint_2
+ OpStore %21 %17
+ %24 = OpLoad %float %22
+ %26 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_0
+ OpStore %26 %24
+ %29 = OpLoad %uint %28
+ %30 = OpBitcast %float %29
+ %32 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_1
+ OpStore %32 %30
+ %34 = OpLoad %uint %33
+ %35 = OpBitcast %float %34
+ %36 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_2
+ OpStore %36 %35
+ %42 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_1
+ %43 = OpLoad %float %42
+ %44 = OpBitcast %int %43
+ %45 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_2
+ %46 = OpLoad %float %45
+ %47 = OpBitcast %int %46
+ %48 = OpIAdd %int %44 %47
+ %49 = OpBitcast %float %48
+ %51 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0
+ OpStore %51 %49
+ %52 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0
+ %53 = OpLoad %float %52
+ %54 = OpBitcast %uint %53
+ %55 = OpConvertUToF %float %54
+ %57 = OpInBoundsAccessChain %_ptr_Output_float %o0 %uint_1
+ OpStore %57 %55
+ %58 = OpInBoundsAccessChain %_ptr_Private_float %v1 %uint_1
+ %59 = OpLoad %float %58
+ %60 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_0
+ %61 = OpLoad %float %60
+ %62 = OpFAdd %float %59 %61
+ %63 = OpInBoundsAccessChain %_ptr_Output_float %o0 %uint_0
+ OpStore %63 %62
+ %64 = OpLoad %v4float %v1
+ %65 = OpLoad %v4float %o0
+ %66 = OpVectorShuffle %v4float %65 %64 0 1 6 4
+ OpStore %o0 %66
+ OpReturn
+ OpFunctionEnd
diff --git a/shaders/desktop-only/frag/layout-component.desktop.frag b/shaders/desktop-only/frag/layout-component.desktop.frag
new file mode 100644
index 00000000..fade67ba
--- /dev/null
+++ b/shaders/desktop-only/frag/layout-component.desktop.frag
@@ -0,0 +1,14 @@
+#version 450
+layout(location = 0, component = 0) in vec2 v0;
+layout(location = 0, component = 2) in float v1;
+layout(location = 0) out vec2 FragColor;
+
+in Vertex
+{
+ layout(location = 1, component = 2) in float v3;
+};
+
+void main()
+{
+ FragColor = v0 + v1 + v3;
+}