summaryrefslogtreecommitdiff
path: root/tests/glsl/sascha-willems/pbrbasic
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-02-02 08:49:04 -0800
committerGitHub <noreply@github.com>2018-02-02 08:49:04 -0800
commit0360f81b9741ece65768a65731bd23455a3b7a96 (patch)
treeeab15cf6737cf091bf94d073e82c7b233f958e57 /tests/glsl/sascha-willems/pbrbasic
parentb034398ab12d3cc3a5fc04174688cb707404791d (diff)
Remove support for the -no-checking flag (#392)
* Remove support for the -no-checking flag Fixes #381 Fixes #383 Work on #382 - No longer expose flag through API (`SLANG_COMPILE_FLAG_NO_CHECKING`) and command-line (`-no-checking`) options - Remove all logic in `check.cpp` that was withholding diagnostics (including errors) when the no-checking mode was enabled - Remove `HiddenImplicitCastExpr`, which was only created to support no-checking mode (it represented an implicit cast that our checking through was needed, but couldn't emit because it might be wrong) - Remove logic for storing function bodies as raw token lists when checking is turned off. I'm leaving in the `UnparsedStmt` AST node in case we ever need/want to lazily parse and check function bodies down the line. - Remove a few of the code-generation paths we had to contend with, but keep the comment about them in place. - Remove GLSL-based tests that can't meaningfully work with the new approach. - Fix other tests that used a GLSL baseline so that their GLSL compiles with `-pass-through glslang` instead of invoking `slang` with the `-no-checking` flag. - Remove tests that were explicitly added to test the "rewriter + IR" path, since that is no longer supported. There is more cleanup that can be done here, now that we know that AST-based rewrite and IR will never co-exist, but it is probably easier to deal with that as part of removing the AST-based rewrite path. We've lost some test coverage here, but actually not too much if we consider that we are dropping GLSL input anyway. * Fixup: test runner was mis-counting ignored tests * Fixup: turn on dumping on test failure under Travis * Fixup: enable extensions in Linux build of glslang
Diffstat (limited to 'tests/glsl/sascha-willems/pbrbasic')
-rw-r--r--tests/glsl/sascha-willems/pbrbasic/pbr.frag128
-rw-r--r--tests/glsl/sascha-willems/pbrbasic/pbr.vert39
2 files changed, 0 insertions, 167 deletions
diff --git a/tests/glsl/sascha-willems/pbrbasic/pbr.frag b/tests/glsl/sascha-willems/pbrbasic/pbr.frag
deleted file mode 100644
index 06a69e1e9..000000000
--- a/tests/glsl/sascha-willems/pbrbasic/pbr.frag
+++ /dev/null
@@ -1,128 +0,0 @@
-#version 450
-//TEST:COMPARE_GLSL:
-
-layout (location = 0) in vec3 inWorldPos;
-layout (location = 1) in vec3 inNormal;
-layout (location = 2) in vec2 inUV;
-
-layout (binding = 0) uniform UBO
-{
- mat4 projection;
- mat4 model;
- mat4 view;
- vec3 camPos;
-} ubo;
-
-layout (binding = 1) uniform UBOShared {
- vec4 lights[4];
-} uboParams;
-
-layout (location = 0) out vec4 outColor;
-
-layout(push_constant) uniform PushConsts {
- layout(offset = 12) float roughness;
- layout(offset = 16) float metallic;
- layout(offset = 20) float r;
- layout(offset = 24) float g;
- layout(offset = 28) float b;
-} material;
-
-const float PI = 3.14159265359;
-
-//#define ROUGHNESS_PATTERN 1
-
-vec3 materialcolor()
-{
- return vec3(material.r, material.g, material.b);
-}
-
-// Normal Distribution function --------------------------------------
-float D_GGX(float dotNH, float roughness)
-{
- float alpha = roughness * roughness;
- float alpha2 = alpha * alpha;
- float denom = dotNH * dotNH * (alpha2 - 1.0) + 1.0;
- return (alpha2)/(PI * denom*denom);
-}
-
-// Geometric Shadowing function --------------------------------------
-float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness)
-{
- float r = (roughness + 1.0);
- float k = (r*r) / 8.0;
- float GL = dotNL / (dotNL * (1.0 - k) + k);
- float GV = dotNV / (dotNV * (1.0 - k) + k);
- return GL * GV;
-}
-
-// Fresnel function ----------------------------------------------------
-vec3 F_Schlick(float cosTheta, float metallic)
-{
- vec3 F0 = mix(vec3(0.04), materialcolor(), metallic); // * material.specular
- vec3 F = F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0);
- return F;
-}
-
-// Specular BRDF composition --------------------------------------------
-
-vec3 BRDF(vec3 L, vec3 V, vec3 N, float metallic, float roughness)
-{
- // Precalculate vectors and dot products
- vec3 H = normalize (V + L);
- float dotNV = clamp(dot(N, V), 0.0, 1.0);
- float dotNL = clamp(dot(N, L), 0.0, 1.0);
- float dotLH = clamp(dot(L, H), 0.0, 1.0);
- float dotNH = clamp(dot(N, H), 0.0, 1.0);
-
- // Light color fixed
- vec3 lightColor = vec3(1.0);
-
- vec3 color = vec3(0.0);
-
- if (dotNL > 0.0)
- {
- float rroughness = max(0.05, roughness);
- // D = Normal distribution (Distribution of the microfacets)
- float D = D_GGX(dotNH, roughness);
- // G = Geometric shadowing term (Microfacets shadowing)
- float G = G_SchlicksmithGGX(dotNL, dotNV, roughness);
- // F = Fresnel factor (Reflectance depending on angle of incidence)
- vec3 F = F_Schlick(dotNV, metallic);
-
- vec3 spec = D * F * G / (4.0 * dotNL * dotNV);
-
- color += spec * dotNL * lightColor;
- }
-
- return color;
-}
-
-// ----------------------------------------------------------------------------
-void main()
-{
- vec3 N = normalize(inNormal);
- vec3 V = normalize(ubo.camPos - inWorldPos);
-
- float roughness = material.roughness;
-
- // Add striped pattern to roughness based on vertex position
-#ifdef ROUGHNESS_PATTERN
- roughness = max(roughness, step(fract(inWorldPos.y * 2.02), 0.5));
-#endif
-
- // Specular contribution
- vec3 Lo = vec3(0.0);
- for (int i = 0; i < uboParams.lights.length(); i++) {
- vec3 L = normalize(uboParams.lights[i].xyz - inWorldPos);
- Lo += BRDF(L, V, N, material.metallic, roughness);
- };
-
- // Combine with ambient
- vec3 color = materialcolor() * 0.02;
- color += Lo;
-
- // Gamma correct
- color = pow(color, vec3(0.4545));
-
- outColor = vec4(color, 1.0);
-} \ No newline at end of file
diff --git a/tests/glsl/sascha-willems/pbrbasic/pbr.vert b/tests/glsl/sascha-willems/pbrbasic/pbr.vert
deleted file mode 100644
index 9a85b892a..000000000
--- a/tests/glsl/sascha-willems/pbrbasic/pbr.vert
+++ /dev/null
@@ -1,39 +0,0 @@
-#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 (binding = 0) uniform UBO
-{
- mat4 projection;
- mat4 model;
- mat4 view;
- vec3 camPos;
-} ubo;
-
-layout (location = 0) out vec3 outWorldPos;
-layout (location = 1) out vec3 outNormal;
-layout (location = 2) out vec2 outUV;
-
-layout(push_constant) uniform PushConsts {
- vec3 objPos;
-} pushConsts;
-
-out gl_PerVertex
-{
- vec4 gl_Position;
-};
-
-void main()
-{
- vec3 locPos = vec3(ubo.model * vec4(inPos, 1.0));
- outWorldPos = locPos + pushConsts.objPos;
- outNormal = mat3(ubo.model) * inNormal;
- outUV = inUV;
- gl_Position = ubo.projection * ubo.view * vec4(outWorldPos, 1.0);
-}