aboutsummaryrefslogtreecommitdiff
path: root/shaders/spv/shader_copy.comp
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/spv/shader_copy.comp')
-rw-r--r--shaders/spv/shader_copy.comp28
1 files changed, 28 insertions, 0 deletions
diff --git a/shaders/spv/shader_copy.comp b/shaders/spv/shader_copy.comp
new file mode 100644
index 0000000..876bdf7
--- /dev/null
+++ b/shaders/spv/shader_copy.comp
@@ -0,0 +1,28 @@
+#version 310 es
+
+layout (local_size_x = 8, local_size_y = 8) in;
+
+layout (binding = 0) readonly buffer InBuf {
+ uvec4 data[];
+} in_buf;
+
+layout (binding = 1) writeonly buffer OutBuf {
+ uvec4 data[];
+} out_buf;
+
+layout (push_constant) uniform PushConsts {
+ uint in_img_width;
+ uint in_x_offset;
+ uint out_img_width;
+ uint out_x_offset;
+ uint copy_width;
+} prop;
+
+void main ()
+{
+ uvec2 g_id = gl_GlobalInvocationID.xy;
+ g_id.x = min (g_id.x, prop.copy_width - 1u);
+
+ out_buf.data[g_id.y * prop.out_img_width + prop.out_x_offset + g_id.x] =
+ in_buf.data[g_id.y * prop.in_img_width + prop.in_x_offset + g_id.x];
+}