Scripting - Handle compute shader groups automatically

This commit is contained in:
Emmanuel BENOîT 2017-12-25 20:39:56 +01:00
parent c3ccc9403a
commit 6b3f9bff2a
7 changed files with 37 additions and 29 deletions

View file

@ -19,13 +19,6 @@
(set use-compute 1)
(set render-compute-size-x 8)
(set render-compute-size-y 8)
(set combine-compute-size-x 8)
(set combine-compute-size-y 32)
(set dof-compute-size-x 64)
(set dof-compute-size-y 16)
(call scene-init)
(call dof-init)
(call bloom-init)
@ -150,10 +143,7 @@
(use-pipeline pl-scene-p1)
(if $use-compute (
(image 0 tx-scene-output 0)
(compute
(add 1 (div $vp-width $render-compute-size-x))
(add 1 (div $vp-height $render-compute-size-y))
1)
(compute $vp-width $vp-height 1)
)(
(uniforms prg-scene-p1 1 $vp-width $vp-height)
(use-framebuffer rt-scene)
@ -252,11 +242,7 @@
(uniforms-i prg-dof-pass1 0 0)
(uniforms-i prg-dof-pass2 0 0)
(if $use-compute (
(locals dof-cx dof-cy)
(set dof-cx (add 1 (div $vp-width $dof-compute-size-x)))
(set dof-cy (add 1 (div $vp-height $dof-compute-size-y)))
)(
(if (not $use-compute) (
(use-texture 1 in-depth smp-dof)
(uniforms-i prg-dof-pass1 1 1)
(uniforms-i prg-dof-pass2 1 1)
@ -268,7 +254,7 @@
(use-pipeline pl-dof-pass1)
(if $use-compute (
(image 0 tx-dof-pass1 0)
(compute $dof-cx $dof-cy 1)
(compute $vp-width $vp-height 1)
)(
(use-framebuffer rt-dof-pass1)
(viewport 0 0 $vp-width $vp-height)
@ -281,7 +267,7 @@
(use-pipeline pl-dof-pass2)
(if $use-compute (
(image 0 tx-dof-pass2 0)
(compute $dof-cx $dof-cy 1)
(compute $vp-width $vp-height 1)
)(
(use-framebuffer rt-dof-pass2)
(viewport 0 0 $vp-width $vp-height)
@ -567,10 +553,7 @@
(if $use-compute (
(image 0 tx-combined 0)
(compute
(add 1 (div $vp-width $combine-compute-size-x))
(add 1 (div $vp-height $combine-compute-size-y))
1)
(compute $vp-width $vp-height 1)
)(
(viewport 0 0 $vp-width $vp-height)
(fullscreen)

View file

@ -1,10 +1,5 @@
//! type chunk
layout(
local_size_x = 64 ,
local_size_y = 16
) in;
//#define DOF_USE_RANDOM
layout( location = 0 ) uniform sampler2D u_Input;

View file

@ -1,6 +1,12 @@
#version 450 core
//! type compute
layout(
local_size_x = 8 ,
local_size_y = 64
) in;
//! include chunks/dof-cs.glsl
void main()

View file

@ -1,6 +1,12 @@
#version 450 core
//! type compute
layout(
local_size_x = 8 ,
local_size_y = 20
) in;
//! include chunks/dof-cs.glsl
void main()