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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-01-26 14:46:37 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-01-26 14:46:37 +0300
commit5b299e5999e2b59e30edd4e770f64aa700e482d6 (patch)
tree17052358b339e20c44ca942e62b735ef63b23f88 /source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl
parent9bce134e56c28045aee37080f5c5b6622a07927b (diff)
D13910: Workbench: Port shaders to use GPUShaderCreateInfo
Also adds a few things to GPUShader for easily create shaders. Heavy usage of macros to compose the createInfo and avoid duplications and copy paste bugs. This makes the link between the shader request functions (in workbench_shader.cc) and the actual createInfo a bit obscure since the names are composed and not searchable. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D13910
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl')
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl45
1 files changed, 7 insertions, 38 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl
index 272f0621185..4a7b1522426 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_caps_geom.glsl
@@ -2,38 +2,6 @@
# define USE_INVOC_EXT
#endif
-#ifdef DOUBLE_MANIFOLD
-# ifdef USE_INVOC_EXT
-# define invoc_len 2
-# else
-# define vert_len 6
-# endif
-#else
-# ifdef USE_INVOC_EXT
-# define invoc_len 2
-# else
-# define vert_len 6
-# endif
-#endif
-
-#ifdef USE_INVOC_EXT
-layout(triangles, invocations = invoc_len) in;
-layout(triangle_strip, max_vertices = 3) out;
-#else
-layout(triangles) in;
-layout(triangle_strip, max_vertices = vert_len) out;
-#endif
-
-uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
-
-in VertexData
-{
- vec3 pos; /* local position */
- vec4 frontPosition; /* final ndc position */
- vec4 backPosition;
-}
-vData[];
-
vec4 get_pos(int v, bool backface)
{
return (backface) ? vData[v].backPosition : vData[v].frontPosition;
@@ -74,18 +42,19 @@ void main()
/* In case of non manifold geom, we only increase/decrease
* the stencil buffer by one but do every faces as they were facing the light. */
bool invert = backface;
+ const bool is_manifold = false;
#else
const bool invert = false;
- if (!backface) {
+ const bool is_manifold = true;
#endif
+
+ if (!is_manifold || !backface) {
#ifdef USE_INVOC_EXT
- bool do_front = (gl_InvocationID & 1) == 0;
- emit_cap(do_front, invert);
+ bool do_front = (gl_InvocationID & 1) == 0;
+ emit_cap(do_front, invert);
#else
emit_cap(true, invert);
emit_cap(false, invert);
#endif
-#ifndef DOUBLE_MANIFOLD
-}
-#endif
+ }
}