diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-04-19 23:07:53 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-04-20 14:07:51 +0300 |
commit | b386828671a40feea026ccefae17560e58e0d440 (patch) | |
tree | ac65240a1672c39cdb549e06503cc9c882043ff5 /source/blender/draw/engines/eevee/shaders/shadow_geom.glsl | |
parent | 3fa665f56dc82d2fe379a6d79f335fc696cec626 (diff) |
Eevee: Do shadow cube render in one pass.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/shadow_geom.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/shadow_geom.glsl | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_geom.glsl b/source/blender/draw/engines/eevee/shaders/shadow_geom.glsl index 1032fe4e956..3e63032abe3 100644 --- a/source/blender/draw/engines/eevee/shaders/shadow_geom.glsl +++ b/source/blender/draw/engines/eevee/shaders/shadow_geom.glsl @@ -2,20 +2,22 @@ layout(triangles) in; layout(triangle_strip, max_vertices=3) out; -uniform mat4 ShadowMatrix; -uniform int Layer; +layout(std140) uniform shadow_render_block { + mat4 ShadowMatrix[6]; + int Layer; +}; in vec4 vPos[]; +in int face[]; void main() { - gl_Layer = Layer; - gl_Position = ShadowMatrix * vPos[0]; - EmitVertex(); - gl_Layer = Layer; - gl_Position = ShadowMatrix * vPos[1]; - EmitVertex(); - gl_Layer = Layer; - gl_Position = ShadowMatrix * vPos[2]; - EmitVertex(); + int f = face[0]; + gl_Layer = Layer + f; + + for (int v = 0; v < 3; ++v) { + gl_Position = ShadowMatrix[f] * vPos[v]; + EmitVertex(); + } + EndPrimitive(); }
\ No newline at end of file |