reorganized directory
This commit is contained in:
parent
9d507e38cb
commit
076355e2d1
35 changed files with 0 additions and 0 deletions
6
test/.gitignore
vendored
Normal file
6
test/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
shaders/compiled/*
|
||||
.build
|
||||
.vscode
|
||||
lettuce
|
||||
gpu_triangle
|
||||
test_enum
|
||||
33
test/compile-shaders.sh
Executable file
33
test/compile-shaders.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
source_directory="shaders/source"
|
||||
compiled_directory="shaders/compiled"
|
||||
vulkan_version="1.0"
|
||||
mkdir -p $compiled_directory
|
||||
rm -f $compiled_directory/*
|
||||
|
||||
|
||||
echo "compiling from $source_directory -> $compiled_directory"
|
||||
for file in "$source_directory"/*; do
|
||||
filename=$(basename "$file")
|
||||
if [[ "$filename" =~ ^([^\.]+)\.([^\.]+)\.([^\.]+)$ ]]; then
|
||||
middlepart="${BASH_REMATCH[2]}"
|
||||
filename="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
|
||||
shader_language="${BASH_REMATCH[3]}"
|
||||
|
||||
if [[ "$shader_language" != "glsl" ]]; then
|
||||
echo "FUCK YOU I'M NOT COMPILING HLSL SHADERS, DO IT YOURSELF"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$middlepart" == "frag" ]]; then
|
||||
echo "frag $filename.$shader_language > $filename.spv"
|
||||
glslc -O -fshader-stage=fragment --target-env=vulkan$vulkan_version "$source_directory/$filename.$shader_language" -fshader-stage=fragment -o "$compiled_directory/$filename.spv"
|
||||
elif [[ "$middlepart" == "vert" ]]; then
|
||||
echo "vert $filename.$shader_language > $filename.spv"
|
||||
glslc -O -fshader-stage=vertex --target-env=vulkan$vulkan_version "$source_directory/$filename.$shader_language" -o "$compiled_directory/$filename.spv"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
tree $compiled_directory
|
||||
BIN
test/lettuce.bmp
Normal file
BIN
test/lettuce.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 481 KiB |
29
test/shaders/source/RawTriangle.vert.glsl
Normal file
29
test/shaders/source/RawTriangle.vert.glsl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#version 450 core
|
||||
|
||||
// Explicitly set the output location for Vulkan
|
||||
layout(location = 0) out vec4 vColor;
|
||||
|
||||
void main() {
|
||||
// Initialize with default values
|
||||
vec2 pos = vec2(0.0);
|
||||
vec4 color = vec4(0.0);
|
||||
|
||||
// Use Vulkan's gl_VertexIndex instead of gl_VertexID
|
||||
switch(gl_VertexIndex) {
|
||||
case 0:
|
||||
pos = vec2(-1.0, -1.0);
|
||||
color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
break;
|
||||
case 1:
|
||||
pos = vec2(1.0, -1.0);
|
||||
color = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
break;
|
||||
case 2:
|
||||
pos = vec2(0.0, 1.0);
|
||||
color = vec4(0.0, 0.0, 1.0, 1.0);
|
||||
break;
|
||||
}
|
||||
|
||||
gl_Position = vec4(pos, 0.0, 1.0);
|
||||
vColor = color;
|
||||
}
|
||||
9
test/shaders/source/SolidColor.frag.glsl
Normal file
9
test/shaders/source/SolidColor.frag.glsl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#version 450 core
|
||||
|
||||
layout(location = 0) in vec4 Color; // Explicit location for fragment input
|
||||
layout(location = 0) out vec4 FragColor; // Explicit location for fragment output
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = Color;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue