From 6104e54a7fc643e6397743eb7ba45268fa7000f9 Mon Sep 17 00:00:00 2001 From: Morten Nobel-Joergensen Date: Sat, 24 Mar 2018 10:36:01 +0100 Subject: [PATCH] Fix GLSL ES bug (removed precision) --- em-build.sh | 2 ++ include/sre/impl/ShaderSource.inl | 14 +++++++------- src/embedded_deps/global_uniforms_incl.glsl | 14 +++++++------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/em-build.sh b/em-build.sh index 82d3ae40..fe17bc2b 100755 --- a/em-build.sh +++ b/em-build.sh @@ -33,6 +33,7 @@ emcc -Iinclude src/imgui/imgui.cpp \ src/sre/SpriteAtlas.cpp \ src/sre/Inspector.cpp \ src/sre/Log.cpp \ + src/sre/impl/UniformSet.cpp \ test/$FILENAME.cpp \ -O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=67108864 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --preload-file test_data -s USE_SDL=2 -o html/$FILENAME.html done @@ -62,6 +63,7 @@ emcc -Iinclude src/imgui/imgui.cpp \ src/sre/SpriteAtlas.cpp \ src/sre/Inspector.cpp \ src/sre/Log.cpp \ + src/sre/impl/UniformSet.cpp \ examples/$FILENAME.cpp \ -O2 -std=c++14 -s USE_WEBGL2=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=33554432 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='["png"]' --preload-file examples_data -s USE_SDL=2 -o html/$FILENAME.html done diff --git a/include/sre/impl/ShaderSource.inl b/include/sre/impl/ShaderSource.inl index f2edb90b..10e9d501 100644 --- a/include/sre/impl/ShaderSource.inl +++ b/include/sre/impl/ShaderSource.inl @@ -803,13 +803,13 @@ std::make_pair("global_uniforms_incl.glsl",R"(#if __VER layout(std140) uniform g_global_uniforms { #endif #ifdef GL_ES -uniform precision highp mat4 g_view; -uniform precision highp mat4 g_projection; -uniform precision highp vec4 g_viewport; -uniform precision highp vec4 g_cameraPos; -uniform precision highp vec4 g_ambientLight; -uniform precision highp vec4 g_lightColorRange[SI_LIGHTS]; -uniform precision highp vec4 g_lightPosType[SI_LIGHTS]; +uniform highp mat4 g_view; +uniform highp mat4 g_projection; +uniform highp vec4 g_viewport; +uniform highp vec4 g_cameraPos; +uniform highp vec4 g_ambientLight; +uniform highp vec4 g_lightColorRange[SI_LIGHTS]; +uniform highp vec4 g_lightPosType[SI_LIGHTS]; #else uniform mat4 g_view; uniform mat4 g_projection; diff --git a/src/embedded_deps/global_uniforms_incl.glsl b/src/embedded_deps/global_uniforms_incl.glsl index f7768bd5..1166697d 100644 --- a/src/embedded_deps/global_uniforms_incl.glsl +++ b/src/embedded_deps/global_uniforms_incl.glsl @@ -2,13 +2,13 @@ layout(std140) uniform g_global_uniforms { #endif #ifdef GL_ES -uniform precision highp mat4 g_view; -uniform precision highp mat4 g_projection; -uniform precision highp vec4 g_viewport; -uniform precision highp vec4 g_cameraPos; -uniform precision highp vec4 g_ambientLight; -uniform precision highp vec4 g_lightColorRange[SI_LIGHTS]; -uniform precision highp vec4 g_lightPosType[SI_LIGHTS]; +uniform highp mat4 g_view; +uniform highp mat4 g_projection; +uniform highp vec4 g_viewport; +uniform highp vec4 g_cameraPos; +uniform highp vec4 g_ambientLight; +uniform highp vec4 g_lightColorRange[SI_LIGHTS]; +uniform highp vec4 g_lightPosType[SI_LIGHTS]; #else uniform mat4 g_view; uniform mat4 g_projection;