aboutsummaryrefslogtreecommitdiffstats
path: root/examples/shaders
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-08 20:13:12 -0500
committerDavid Robillard <d@drobilla.net>2023-01-08 22:32:09 -0500
commit5ee8c8f69338870e8062782dfcc08f60d455eb35 (patch)
treec702af776f077aba8b2a24329049adeea3919e73 /examples/shaders
parent94c96f496c9e22af8fdc59042b59408d04d9c496 (diff)
downloadpugl-5ee8c8f69338870e8062782dfcc08f60d455eb35.tar.gz
pugl-5ee8c8f69338870e8062782dfcc08f60d455eb35.tar.bz2
pugl-5ee8c8f69338870e8062782dfcc08f60d455eb35.zip
Add support for OpenGL ES 3.2 in pugl_shader_demo
Diffstat (limited to 'examples/shaders')
-rw-r--r--examples/shaders/header_320_es.glsl8
-rw-r--r--examples/shaders/header_330.glsl3
-rw-r--r--examples/shaders/header_420.glsl3
-rw-r--r--examples/shaders/meson.build1
-rw-r--r--examples/shaders/rect.frag8
-rw-r--r--examples/shaders/rect.vert8
6 files changed, 23 insertions, 8 deletions
diff --git a/examples/shaders/header_320_es.glsl b/examples/shaders/header_320_es.glsl
new file mode 100644
index 0000000..ce5fe68
--- /dev/null
+++ b/examples/shaders/header_320_es.glsl
@@ -0,0 +1,8 @@
+// Copyright 2020-2023 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#version 320 es
+
+#define NOPERSPECTIVE
+#define INTER(qualifiers)
+#define UBO(qualifiers) layout(std140)
diff --git a/examples/shaders/header_330.glsl b/examples/shaders/header_330.glsl
index 1de3301..11bdc53 100644
--- a/examples/shaders/header_330.glsl
+++ b/examples/shaders/header_330.glsl
@@ -1,7 +1,8 @@
-// Copyright 2020 David Robillard <d@drobilla.net>
+// Copyright 2020-2023 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
#version 330 core
+#define NOPERSPECTIVE
#define INTER(qualifiers)
#define UBO(qualifiers) layout(std140)
diff --git a/examples/shaders/header_420.glsl b/examples/shaders/header_420.glsl
index 95fe1a1..cd226c9 100644
--- a/examples/shaders/header_420.glsl
+++ b/examples/shaders/header_420.glsl
@@ -1,7 +1,8 @@
-// Copyright 2020 David Robillard <d@drobilla.net>
+// Copyright 2020-2023 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
#version 420 core
+#define NOPERSPECTIVE noperspective
#define INTER(qualifiers) layout(qualifiers)
#define UBO(qualifiers) layout(std140, qualifiers)
diff --git a/examples/shaders/meson.build b/examples/shaders/meson.build
index 54e9235..479f162 100644
--- a/examples/shaders/meson.build
+++ b/examples/shaders/meson.build
@@ -2,6 +2,7 @@
# SPDX-License-Identifier: 0BSD OR ISC
shader_files = [
+ 'header_320_es.glsl',
'header_330.glsl',
'header_420.glsl',
'rect.frag',
diff --git a/examples/shaders/rect.frag b/examples/shaders/rect.frag
index 9cee53b..17290bd 100644
--- a/examples/shaders/rect.frag
+++ b/examples/shaders/rect.frag
@@ -11,9 +11,11 @@
specified precisely in pixels to draw sharp lines. The border width is just
hardcoded, but could be made a uniform or vertex attribute easily enough. */
-INTER(location = 0) noperspective in vec2 f_uv;
-INTER(location = 1) noperspective in vec2 f_size;
-INTER(location = 2) noperspective in vec4 f_fillColor;
+precision mediump float;
+
+INTER(location = 0) NOPERSPECTIVE in vec2 f_uv;
+INTER(location = 1) NOPERSPECTIVE in vec2 f_size;
+INTER(location = 2) NOPERSPECTIVE in vec4 f_fillColor;
layout(location = 0) out vec4 FragColor;
diff --git a/examples/shaders/rect.vert b/examples/shaders/rect.vert
index 0fa4dbc..ebdbec5 100644
--- a/examples/shaders/rect.vert
+++ b/examples/shaders/rect.vert
@@ -4,6 +4,8 @@
/* The vertex shader is trivial, but forwards scaled UV coordinates (in pixels)
to the fragment shader for drawing the border. */
+precision mediump float;
+
UBO(binding = 0) uniform UniformBufferObject
{
mat4 projection;
@@ -15,9 +17,9 @@ layout(location = 1) in vec2 v_origin;
layout(location = 2) in vec2 v_size;
layout(location = 3) in vec4 v_fillColor;
-INTER(location = 0) noperspective out vec2 f_uv;
-INTER(location = 1) noperspective out vec2 f_size;
-INTER(location = 2) noperspective out vec4 f_fillColor;
+INTER(location = 0) NOPERSPECTIVE out vec2 f_uv;
+INTER(location = 1) NOPERSPECTIVE out vec2 f_size;
+INTER(location = 2) NOPERSPECTIVE out vec4 f_fillColor;
void
main()