summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <nroberts@igalia.com>2019-09-05 00:06:32 +0200
committerNeil Roberts <nroberts@igalia.com>2019-09-05 14:13:31 +0200
commit2920fc26a78e594af4dc630783c61c9b3cb62677 (patch)
treeb3754ed78fac07bc4c290eb0cde54fa9f4d65fc5
parent2b3e98842f0139fe86a28a8f57c846caf3abfaf4 (diff)
generators: Add the default precision for floats in GLSL ES shaders
In GLSL ES fragment shaders there is no default precision for floats. The generated shaders are using floats in the return type of a function. These had undefined precision which should be invalid. Mesa has started detecting this since 95927c414ff. Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
-rw-r--r--generated_tests/templates/gen_extensions_defined/disabled.glsl.mako4
-rw-r--r--generated_tests/templates/gen_extensions_defined/enabled.glsl.mako4
-rw-r--r--generated_tests/templates/gen_extensions_defined/undefined-require.glsl.mako4
3 files changed, 12 insertions, 0 deletions
diff --git a/generated_tests/templates/gen_extensions_defined/disabled.glsl.mako b/generated_tests/templates/gen_extensions_defined/disabled.glsl.mako
index f4fc92f56..68e9a8dcb 100644
--- a/generated_tests/templates/gen_extensions_defined/disabled.glsl.mako
+++ b/generated_tests/templates/gen_extensions_defined/disabled.glsl.mako
@@ -33,6 +33,10 @@
#extension ${ext} : require
% endfor
+% if version.is_es:
+precision mediump float;
+% endif
+
#if defined ${extension}
# error ${extension} is defined, but should not be
#endif
diff --git a/generated_tests/templates/gen_extensions_defined/enabled.glsl.mako b/generated_tests/templates/gen_extensions_defined/enabled.glsl.mako
index 09a82fab1..c7bd33e05 100644
--- a/generated_tests/templates/gen_extensions_defined/enabled.glsl.mako
+++ b/generated_tests/templates/gen_extensions_defined/enabled.glsl.mako
@@ -34,6 +34,10 @@
#extension ${ext} : require
% endfor
+% if version.is_es:
+precision mediump float;
+% endif
+
#if !defined ${extension}
# error ${extension} is not defined
#elif ${extension} != 1
diff --git a/generated_tests/templates/gen_extensions_defined/undefined-require.glsl.mako b/generated_tests/templates/gen_extensions_defined/undefined-require.glsl.mako
index 5edec34c6..32e9043d1 100644
--- a/generated_tests/templates/gen_extensions_defined/undefined-require.glsl.mako
+++ b/generated_tests/templates/gen_extensions_defined/undefined-require.glsl.mako
@@ -34,4 +34,8 @@
% endfor
#extension ${extension} : require
+% if version.is_es:
+precision mediump float;
+% endif
+
float foo() { return 0.0; }