summaryrefslogtreecommitdiff
path: root/tests/glsl/sascha-willems/debugmarker
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-09 11:34:21 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-09 13:44:59 -0700
commitfcf83dbf9effab3bd98bad2b83b2468b7eb05cfd (patch)
tree41047c94883b86ec085a81597391ce3ef557cd43 /tests/glsl/sascha-willems/debugmarker
parent52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff)
Initial import of code.
Diffstat (limited to 'tests/glsl/sascha-willems/debugmarker')
-rw-r--r--tests/glsl/sascha-willems/debugmarker/colorpass.frag14
-rw-r--r--tests/glsl/sascha-willems/debugmarker/colorpass.vert29
-rw-r--r--tests/glsl/sascha-willems/debugmarker/postprocess.frag43
-rw-r--r--tests/glsl/sascha-willems/debugmarker/postprocess.vert18
-rw-r--r--tests/glsl/sascha-willems/debugmarker/toon.frag40
-rw-r--r--tests/glsl/sascha-willems/debugmarker/toon.vert42
6 files changed, 186 insertions, 0 deletions
diff --git a/tests/glsl/sascha-willems/debugmarker/colorpass.frag b/tests/glsl/sascha-willems/debugmarker/colorpass.frag
new file mode 100644
index 000000000..de5dcb4dc
--- /dev/null
+++ b/tests/glsl/sascha-willems/debugmarker/colorpass.frag
@@ -0,0 +1,14 @@
+#version 450
+//TEST:COMPARE_GLSL:
+
+#extension GL_ARB_separate_shader_objects : enable
+#extension GL_ARB_shading_language_420pack : enable
+
+layout (location = 0) in vec3 inColor;
+
+layout (location = 0) out vec4 outFragColor;
+
+void main()
+{
+ outFragColor.rgb = inColor;
+} \ No newline at end of file
diff --git a/tests/glsl/sascha-willems/debugmarker/colorpass.vert b/tests/glsl/sascha-willems/debugmarker/colorpass.vert
new file mode 100644
index 000000000..46b93f8dc
--- /dev/null
+++ b/tests/glsl/sascha-willems/debugmarker/colorpass.vert
@@ -0,0 +1,29 @@
+#version 450
+//TEST:COMPARE_GLSL:
+
+#extension GL_ARB_separate_shader_objects : enable
+#extension GL_ARB_shading_language_420pack : enable
+
+layout (location = 0) in vec4 inPos;
+layout (location = 3) in vec3 inColor;
+
+layout (binding = 0) uniform UBO
+{
+ mat4 projection;
+ mat4 model;
+} ubo;
+
+layout (location = 0) out vec3 outColor;
+
+out gl_PerVertex
+{
+ vec4 gl_Position;
+};
+
+void main()
+{
+ {
+ outColor = inColor;
+ }
+ gl_Position = ubo.projection * ubo.model * inPos;
+}
diff --git a/tests/glsl/sascha-willems/debugmarker/postprocess.frag b/tests/glsl/sascha-willems/debugmarker/postprocess.frag
new file mode 100644
index 000000000..0546baaa4
--- /dev/null
+++ b/tests/glsl/sascha-willems/debugmarker/postprocess.frag
@@ -0,0 +1,43 @@
+#version 450
+//TEST:COMPARE_GLSL:
+
+#extension GL_ARB_separate_shader_objects : enable
+#extension GL_ARB_shading_language_420pack : enable
+
+layout (binding = 1) uniform sampler2D samplerColor;
+
+layout (location = 0) in vec2 inUV;
+
+layout (location = 0) out vec4 outFragColor;
+
+void main()
+{
+ // Single pass gauss blur
+
+ const vec2 texOffset = vec2(0.01, 0.01);
+
+ vec2 tc0 = inUV + vec2(-texOffset.s, -texOffset.t);
+ vec2 tc1 = inUV + vec2( 0.0, -texOffset.t);
+ vec2 tc2 = inUV + vec2(+texOffset.s, -texOffset.t);
+ vec2 tc3 = inUV + vec2(-texOffset.s, 0.0);
+ vec2 tc4 = inUV + vec2( 0.0, 0.0);
+ vec2 tc5 = inUV + vec2(+texOffset.s, 0.0);
+ vec2 tc6 = inUV + vec2(-texOffset.s, +texOffset.t);
+ vec2 tc7 = inUV + vec2( 0.0, +texOffset.t);
+ vec2 tc8 = inUV + vec2(+texOffset.s, +texOffset.t);
+
+ vec4 col0 = texture(samplerColor, tc0);
+ vec4 col1 = texture(samplerColor, tc1);
+ vec4 col2 = texture(samplerColor, tc2);
+ vec4 col3 = texture(samplerColor, tc3);
+ vec4 col4 = texture(samplerColor, tc4);
+ vec4 col5 = texture(samplerColor, tc5);
+ vec4 col6 = texture(samplerColor, tc6);
+ vec4 col7 = texture(samplerColor, tc7);
+ vec4 col8 = texture(samplerColor, tc8);
+
+ vec4 sum = (1.0 * col0 + 2.0 * col1 + 1.0 * col2 +
+ 2.0 * col3 + 4.0 * col4 + 2.0 * col5 +
+ 1.0 * col6 + 2.0 * col7 + 1.0 * col8) / 16.0;
+ outFragColor = vec4(sum.rgb, 1.0);
+} \ No newline at end of file
diff --git a/tests/glsl/sascha-willems/debugmarker/postprocess.vert b/tests/glsl/sascha-willems/debugmarker/postprocess.vert
new file mode 100644
index 000000000..6a368e9b6
--- /dev/null
+++ b/tests/glsl/sascha-willems/debugmarker/postprocess.vert
@@ -0,0 +1,18 @@
+#version 450
+//TEST:COMPARE_GLSL:
+
+#extension GL_ARB_separate_shader_objects : enable
+#extension GL_ARB_shading_language_420pack : enable
+
+layout (location = 0) out vec2 outUV;
+
+out gl_PerVertex
+{
+ vec4 gl_Position;
+};
+
+void main()
+{
+ outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
+ gl_Position = vec4(outUV * vec2(2.0f, 2.0f) + vec2(-1.0f, -1.0f), 0.0f, 1.0f);
+} \ No newline at end of file
diff --git a/tests/glsl/sascha-willems/debugmarker/toon.frag b/tests/glsl/sascha-willems/debugmarker/toon.frag
new file mode 100644
index 000000000..ed9832f11
--- /dev/null
+++ b/tests/glsl/sascha-willems/debugmarker/toon.frag
@@ -0,0 +1,40 @@
+#version 450
+//TEST:COMPARE_GLSL:
+
+#extension GL_ARB_separate_shader_objects : enable
+#extension GL_ARB_shading_language_420pack : enable
+
+layout (binding = 1) uniform sampler2D samplerColorMap;
+
+layout (location = 0) in vec3 inNormal;
+layout (location = 1) in vec3 inColor;
+layout (location = 2) in vec2 inUV;
+layout (location = 3) in vec3 inViewVec;
+layout (location = 4) in vec3 inLightVec;
+
+layout (location = 0) out vec4 outFragColor;
+
+void main()
+{
+ // Desaturate color
+ vec3 color = vec3(mix(inColor, vec3(dot(vec3(0.2126,0.7152,0.0722), inColor)), 0.65));
+
+ // High ambient colors because mesh materials are pretty dark
+ vec3 ambient = color * vec3(1.0);
+ vec3 N = normalize(inNormal);
+ vec3 L = normalize(inLightVec);
+ vec3 V = normalize(inViewVec);
+ vec3 R = reflect(-L, N);
+ vec3 diffuse = max(dot(N, L), 0.0) * color;
+ vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75);
+ outFragColor = vec4(ambient + diffuse * 1.75 + specular, 1.0);
+
+ float intensity = dot(N,L);
+ float shade = 1.0;
+ shade = intensity < 0.5 ? 0.75 : shade;
+ shade = intensity < 0.35 ? 0.6 : shade;
+ shade = intensity < 0.25 ? 0.5 : shade;
+ shade = intensity < 0.1 ? 0.25 : shade;
+
+ outFragColor.rgb = inColor * 3.0 * shade;
+} \ No newline at end of file
diff --git a/tests/glsl/sascha-willems/debugmarker/toon.vert b/tests/glsl/sascha-willems/debugmarker/toon.vert
new file mode 100644
index 000000000..d0b3be251
--- /dev/null
+++ b/tests/glsl/sascha-willems/debugmarker/toon.vert
@@ -0,0 +1,42 @@
+#version 450
+//TEST:COMPARE_GLSL:
+
+#extension GL_ARB_separate_shader_objects : enable
+#extension GL_ARB_shading_language_420pack : enable
+
+layout (location = 0) in vec3 inPos;
+layout (location = 1) in vec3 inNormal;
+layout (location = 2) in vec2 inUV;
+layout (location = 3) in vec3 inColor;
+
+layout (binding = 0) uniform UBO
+{
+ mat4 projection;
+ mat4 model;
+ vec4 lightPos;
+} ubo;
+
+layout (location = 0) out vec3 outNormal;
+layout (location = 1) out vec3 outColor;
+layout (location = 2) out vec2 outUV;
+layout (location = 3) out vec3 outViewVec;
+layout (location = 4) out vec3 outLightVec;
+
+out gl_PerVertex
+{
+ vec4 gl_Position;
+};
+
+void main()
+{
+ outNormal = inNormal;
+ outColor = inColor;
+ outUV = inUV;
+ gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
+
+ vec4 pos = ubo.model * vec4(inPos, 1.0);
+ outNormal = mat3(ubo.model) * inNormal;
+ vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz;
+ outLightVec = lPos - pos.xyz;
+ outViewVec = -pos.xyz;
+} \ No newline at end of file