summaryrefslogtreecommitdiffstats
path: root/src/imgui/backends/vulkan
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/imgui/backends/vulkan/generate_spv.sh6
-rw-r--r--src/imgui/backends/vulkan/glsl_shader.frag14
-rw-r--r--src/imgui/backends/vulkan/glsl_shader.vert25
3 files changed, 45 insertions, 0 deletions
diff --git a/src/imgui/backends/vulkan/generate_spv.sh b/src/imgui/backends/vulkan/generate_spv.sh
new file mode 100755
index 0000000..948ef77
--- /dev/null
+++ b/src/imgui/backends/vulkan/generate_spv.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+## -V: create SPIR-V binary
+## -x: save binary output as text-based 32-bit hexadecimal numbers
+## -o: output file
+glslangValidator -V -x -o glsl_shader.frag.u32 glsl_shader.frag
+glslangValidator -V -x -o glsl_shader.vert.u32 glsl_shader.vert
diff --git a/src/imgui/backends/vulkan/glsl_shader.frag b/src/imgui/backends/vulkan/glsl_shader.frag
new file mode 100644
index 0000000..ce7e6f7
--- /dev/null
+++ b/src/imgui/backends/vulkan/glsl_shader.frag
@@ -0,0 +1,14 @@
+#version 450 core
+layout(location = 0) out vec4 fColor;
+
+layout(set=0, binding=0) uniform sampler2D sTexture;
+
+layout(location = 0) in struct {
+ vec4 Color;
+ vec2 UV;
+} In;
+
+void main()
+{
+ fColor = In.Color * texture(sTexture, In.UV.st);
+}
diff --git a/src/imgui/backends/vulkan/glsl_shader.vert b/src/imgui/backends/vulkan/glsl_shader.vert
new file mode 100644
index 0000000..9425365
--- /dev/null
+++ b/src/imgui/backends/vulkan/glsl_shader.vert
@@ -0,0 +1,25 @@
+#version 450 core
+layout(location = 0) in vec2 aPos;
+layout(location = 1) in vec2 aUV;
+layout(location = 2) in vec4 aColor;
+
+layout(push_constant) uniform uPushConstant {
+ vec2 uScale;
+ vec2 uTranslate;
+} pc;
+
+out gl_PerVertex {
+ vec4 gl_Position;
+};
+
+layout(location = 0) out struct {
+ vec4 Color;
+ vec2 UV;
+} Out;
+
+void main()
+{
+ Out.Color = aColor;
+ Out.UV = aUV;
+ gl_Position = vec4(aPos * pc.uScale + pc.uTranslate, 0, 1);
+}