Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-12-03 00:02:17 +02:00
parent 94eb26d9bc
commit d7c5a05d02
13 changed files with 390 additions and 38 deletions

23
shaders/gradient.comp Normal file
View File

@@ -0,0 +1,23 @@
#version 460
layout (local_size_x = 16, local_size_y = 16) in;
layout(rgba16f, set = 0, binding = 0) uniform image2D image;
void main() {
ivec2 texelCoord = ivec2(gl_GlobalInvocationID.xy);
ivec2 size = imageSize(image);
if (texelCoord.x >= size.x || texelCoord.y >= size.y)
return;
vec2 uv = (vec2(texelCoord) + 0.5) / vec2(size);
float v = sin(uv.x * 10.0) + cos(uv.y * 10.0);
float r = 0.5 + 0.5 * cos(6.2831 * (uv.x + v));
float g = 0.5 + 0.5 * cos(6.2831 * (uv.y + v + 0.33));
float b = 0.5 + 0.5 * cos(6.2831 * (uv.x - uv.y + 0.66));
vec4 color = vec4(r, g, b, 1.0);
imageStore(image, texelCoord, color);
}

30
shaders/meson.build Normal file
View File

@@ -0,0 +1,30 @@
fs = import('fs')
glslc = find_program('glslc', required : false)
glslang = find_program('glslangValidator', required : false)
if glslc.found()
shader_compiler = glslc
shader_compile_cmd = [shader_compiler, '-o', '@OUTPUT@', '@INPUT@']
elif glslang.found()
shader_compiler = glslang
shader_compile_cmd = [shader_compiler, '-V', '@INPUT@', '-o', '@OUTPUT@']
else
error('Either glslc or glslangValidator is required to build shaders')
endif
shader_sources = files(
'gradient.comp',
)
spirv_shaders = []
foreach shader : shader_sources
shader_name = fs.stem(shader)
spirv_shaders += custom_target(
shader_name + '_spv',
input : shader,
output : shader_name + '.spv',
command : shader_compile_cmd,
build_by_default : true,
)
endforeach