summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-06-12 12:28:12 -0700
committerGitHub <noreply@github.com>2017-06-12 12:28:12 -0700
commitd1f11a29f8a48eecd47ac64c8635ed062cba982d (patch)
treeb929d3d7f77da2ba538846f598e7eeb0a302b0cc /tests
parent4d63b6fe73018ae253bbef0075478f5989ad279a (diff)
parent5fe2cf3279c279750d4821a9fa97bdbbe876e568 (diff)
Merge pull request #2 from tfoleyNV/glsl-render-test
GLSL: get GLSL limping in `render-test`
Diffstat (limited to 'tests')
-rw-r--r--tests/render/cross-compile0.hlsl73
1 files changed, 68 insertions, 5 deletions
diff --git a/tests/render/cross-compile0.hlsl b/tests/render/cross-compile0.hlsl
index 9a9dd1cdc..e41de7ef1 100644
--- a/tests/render/cross-compile0.hlsl
+++ b/tests/render/cross-compile0.hlsl
@@ -1,12 +1,17 @@
-//TEST:COMPARE_HLSL_CROSS_COMPILE_RENDER:
+//TEST:COMPARE_HLSL_GLSL_RENDER:
-// Now we are going to test that we can cross-compile a Spire/HLSL
-// input file over to GLSL and render with it.
+// This is a basic test case for cross-compilation behavior.
+//
+// We will define distinct HLSL and GLSL entry points,
+// but the two will share a dependency on a file of
+// pure Spire code that provides the actual shading logic.
+
+#if defined(__HLSL__)
cbuffer Uniforms
{
float4x4 modelViewProjection;
-}
+};
struct AssembledVertex
{
@@ -24,7 +29,6 @@ struct Fragment
float4 color;
};
-
// Vertex Shader
struct VertexStageInput
@@ -49,6 +53,7 @@ VertexStageOutput vertexMain(VertexStageInput input)
output.sv_position = mul(modelViewProjection, float4(position, 1.0));
return output;
+
}
// Fragment Shader
@@ -74,3 +79,61 @@ FragmentStageOutput fragmentMain(FragmentStageInput input)
return output;
}
+#elif defined(__GLSL__)
+
+#version 420
+
+uniform Uniforms
+{
+ mat4x4 modelViewProjection;
+};
+
+#define ASSEMBLED_VERTEX(QUAL) \
+ /* */
+
+#define V2F(QUAL) \
+ QUAL vec3 coarse_color; \
+ /* */
+
+// Vertex Shader
+
+#ifdef __GLSL_VERTEX__
+
+layout(location = 0)
+in vec3 assembled_position;
+
+layout(location = 1)
+in vec3 assembled_color;
+
+V2F(out)
+
+void main()
+{
+ vec3 position = assembled_position;
+ vec3 color = assembled_color;
+
+ coarse_color = color;
+// gl_Position = modelViewProjection * vec4(position, 1.0);
+ gl_Position = vec4(position, 1.0) * modelViewProjection;
+}
+
+#endif
+
+#ifdef __GLSL_FRAGMENT__
+
+V2F(in)
+
+layout(location = 0)
+out vec4 fragment_color;
+
+void main()
+{
+ vec3 color = coarse_color;
+
+ fragment_color = vec4(color, 1.0);
+}
+
+
+#endif
+
+#endif