Adjustments to test compute shader
This commit is contained in:
parent
81ff8a8da6
commit
99bd2c429b
2 changed files with 15 additions and 8 deletions
|
@ -414,7 +414,8 @@
|
|||
(if $use-compute (
|
||||
(program prg-combine "combine.c.glsl")
|
||||
(pipeline pl-combine prg-combine)
|
||||
(set combine-compute-size 16)
|
||||
(set combine-compute-size-x 8)
|
||||
(set combine-compute-size-y 32)
|
||||
)(
|
||||
(framebuffer rt-combined tx-combined)
|
||||
(program prg-combine "combine.f.glsl")
|
||||
|
@ -476,10 +477,10 @@
|
|||
(profiling "Combine"
|
||||
(uniforms-i prg-combine 0 0)
|
||||
(uniforms-i prg-combine 1 1)
|
||||
(uniforms prg-combine 2 $vp-width $vp-height)
|
||||
|
||||
(use-pipeline pl-combine)
|
||||
(if (not $use-compute) (
|
||||
(uniforms prg-combine 2 $vp-width $vp-height)
|
||||
(use-framebuffer rt-combined)
|
||||
))
|
||||
(use-texture 0 in-main smp-combine-input)
|
||||
|
@ -511,8 +512,8 @@
|
|||
(if $use-compute (
|
||||
(image 0 tx-combined 0)
|
||||
(compute
|
||||
(add 1 (div $vp-width $combine-compute-size))
|
||||
(add 1 (div $vp-height $combine-compute-size))
|
||||
(add 1 (div $vp-width $combine-compute-size-x))
|
||||
(add 1 (div $vp-height $combine-compute-size-y))
|
||||
1)
|
||||
)(
|
||||
(viewport 0 0 $vp-width $vp-height)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#version 450 core
|
||||
|
||||
layout( local_size_x = 16 , local_size_y = 16 ) in;
|
||||
layout(
|
||||
local_size_x = 8 ,
|
||||
local_size_y = 32
|
||||
) in;
|
||||
|
||||
//! type compute
|
||||
//! include lib/utils.glsl
|
||||
|
@ -15,7 +18,7 @@ layout( location = 6 ) uniform vec3 u_ColorLift;
|
|||
layout( location = 7 ) uniform vec3 u_ColorGain;
|
||||
layout( location = 8 ) uniform vec3 u_ColorGamma;
|
||||
|
||||
layout( binding = 0 , rgba8 ) writeonly uniform image2D ub_Output;
|
||||
layout( binding = 0 , rgba8 ) writeonly uniform image2D u_Output;
|
||||
|
||||
#define uVigShapeMul (u_Vignette1.x)
|
||||
#define uVigShapePow (u_Vignette1.y)
|
||||
|
@ -27,7 +30,10 @@ layout( binding = 0 , rgba8 ) writeonly uniform image2D ub_Output;
|
|||
void main( void )
|
||||
{
|
||||
ivec2 coords = ivec2( gl_GlobalInvocationID.xy );
|
||||
vec2 pos = vec2( coords ) / u_OutputSize;
|
||||
vec2 pos = vec2( coords ) / vec2( imageSize( u_Output ) );
|
||||
if ( pos.x > 1. || pos.y > 1. ) {
|
||||
return;
|
||||
}
|
||||
float f = u_Bloom.x;
|
||||
vec3 color = textureLod( u_MainInput , pos , 0 ).rgb;
|
||||
|
||||
|
@ -58,6 +64,6 @@ void main( void )
|
|||
color = pow( color , vec3( 1 ) / ( u_ColorGamma + 2.2 ) );
|
||||
|
||||
// Write it
|
||||
imageStore( ub_Output , coords ,
|
||||
imageStore( u_Output , coords ,
|
||||
vec4( color , M_Luminosity( color ) ) );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue