summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-02-28 22:33:58 -0500
committerJonathan Bradley <jcb@pikum.xyz>2025-02-28 22:33:58 -0500
commit37347bf7811a5fa42c98e2a19adfee15252ee479 (patch)
tree70fe178ad777f52404f51b90c06b8d14ef101276 /assets
parent85bbecbdebf4f096418aea1cd4f9616f9d97e451 (diff)
pke: checkpoint: vk renames + first-pass ui
Renamed pipeline and descriptor names to be more self-descriptive. UI work is not done, and will not record. Needs vulkan items created (buffers).
Diffstat (limited to 'assets')
-rw-r--r--assets/shaders/glyph.vert2
-rw-r--r--assets/shaders/ui-base.frag23
-rw-r--r--assets/shaders/ui-base.vert30
3 files changed, 54 insertions, 1 deletions
diff --git a/assets/shaders/glyph.vert b/assets/shaders/glyph.vert
index a2c7de3..3f4b28a 100644
--- a/assets/shaders/glyph.vert
+++ b/assets/shaders/glyph.vert
@@ -23,7 +23,7 @@ out gl_PerVertex
vec4 gl_Position;
};
-void main()
+void main()
{
vec4 transformed_position = pos_scale * vec4(in_position, 0.0, 1.0);
gl_Position = vec4(transformed_position.xy, 0.0, 1.0);
diff --git a/assets/shaders/ui-base.frag b/assets/shaders/ui-base.frag
new file mode 100644
index 0000000..d6a9882
--- /dev/null
+++ b/assets/shaders/ui-base.frag
@@ -0,0 +1,23 @@
+# version 450
+
+layout(location = 0) in vec4 in_border_color;
+layout(location = 1) in vec4 in_background_color;
+layout(location = 2) in vec2 in_px_scale;
+layout(location = 3) in vec2 in_uv;
+
+layout(location = 0) out vec4 out_color;
+
+bool is_in_border() {
+ return in_uv.x <= in_px_scale.x
+ || in_uv.x >= 1.0-in_px_scale.x
+ || in_uv.y <= in_px_scale.x
+ || in_uv.y >= 1.0-in_px_scale.x;
+}
+
+void main() {
+ if (is_in_border()) {
+ out_color = in_border_color;
+ } else {
+ out_color = in_background_color;
+ }
+}
diff --git a/assets/shaders/ui-base.vert b/assets/shaders/ui-base.vert
new file mode 100644
index 0000000..458d599
--- /dev/null
+++ b/assets/shaders/ui-base.vert
@@ -0,0 +1,30 @@
+#version 450
+
+// vertex
+layout(location = 0) in vec2 in_position;
+layout(location = 1) in vec2 in_uv;
+
+// instance
+layout(location = 2) in mat4 pos_scale;
+layout(location = 6) in vec2 px_scale;
+layout(location = 7) in float depth;
+
+layout(location = 0) out vec4 out_border_color;
+layout(location = 1) out vec4 out_background_color;
+layout(location = 2) out vec2 out_px_scale;
+layout(location = 3) out vec2 out_uv;
+
+out gl_PerVertex
+{
+ vec4 gl_Position;
+};
+
+void main()
+{
+ vec4 transformed_position = pos_scale * vec4(in_position, 0.0, 1.0);
+ gl_Position = vec4(transformed_position.xy, depth, 1.0);
+ out_border_color = vec4(0.8, 0.8, 0.8, 1.0);
+ out_background_color = vec4(0.2, 0.3, 0.2, 1.0);
+ out_px_scale = px_scale;
+ out_uv = in_uv;
+}