]> git.sesse.net Git - movit/commitdiff
Move compute shader functions from the header to the footer; easier to unify with...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 22 Nov 2017 19:11:06 +0000 (20:11 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 22 Nov 2017 19:13:59 +0000 (20:13 +0100)
effect_chain.cpp
footer.comp [new file with mode: 0644]
footer.compute [deleted file]
header.comp

index d56a24806771a0a1e8d444078a28935731305720..a83a952dfaae331bb5431000823cecefd6b82e7f 100644 (file)
@@ -500,7 +500,7 @@ void EffectChain::compile_glsl_program(Phase *phase)
        }
 
        if (phase->is_compute_shader) {
-               frag_shader.append(read_file("footer.compute"));
+               frag_shader.append(read_file("footer.comp"));
                phase->output_node->effect->register_uniform_vec2("inv_output_size", (float *)&phase->inv_output_size);
                phase->output_node->effect->register_uniform_vec2("output_texcoord_adjust", (float *)&phase->output_texcoord_adjust);
        } else {
diff --git a/footer.comp b/footer.comp
new file mode 100644 (file)
index 0000000..3ece901
--- /dev/null
@@ -0,0 +1,19 @@
+void main()
+{
+       INPUT();
+}
+
+vec4 tex2D(sampler2D s, vec2 coord)
+{
+       return texture(s, coord);
+}
+
+void cs_output(uvec2 coord, vec4 val)
+{
+       imageStore(outbuf, ivec2(coord), val);
+}
+
+void cs_output(ivec2 coord, vec4 val)
+{
+       imageStore(outbuf, coord, val);
+}
diff --git a/footer.compute b/footer.compute
deleted file mode 100644 (file)
index 1baa856..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// GLSL is pickier than the C++ preprocessor in if-testing for undefined
-// tokens; do some fixups here to keep it happy.
-
-void main()
-{
-       INPUT();
-}
index 266e24fc83b4519c3bd3a7247b711a23bb7b87c9..d922e33efedaaf511f61a9406a1b6bf6a8db7a51 100644 (file)
@@ -5,19 +5,9 @@
 // FIXME this needs to be auto-output or something
 uniform restrict writeonly image2D outbuf;
 
-vec4 tex2D(sampler2D s, vec2 coord)
-{
-       return texture(s, coord);
-}
-
-void cs_output(uvec2 coord, vec4 val)
-{
-       imageStore(outbuf, ivec2(coord), val);
-}
-
-void cs_output(ivec2 coord, vec4 val)
-{
-       imageStore(outbuf, coord, val);
-}
+// Defined in footer.comp.
+vec4 tex2D(sampler2D s, vec2 coord);
+void cs_output(uvec2 coord, vec4 val);
+void cs_output(ivec2 coord, vec4 val);
 
 #define OUTPUT(tc, val) cs_output(tc, val)