From c2004debd57921c6d2f3658ea05e0b0e2232b94a Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Mon, 7 May 2018 11:41:19 -0700 Subject: [PATCH] test using highp floats everywhere for android --- .../gpu-gl/src/gpu/gl41/GL41BackendShader.cpp | 1 - .../gpu-gl/src/gpu/gl45/GL45BackendShader.cpp | 1 - .../src/gpu/gles/GLESBackendShader.cpp | 7 +++---- libraries/graphics/src/graphics/Light.slh | 2 +- .../src/graphics/LightIrradiance.shared.slh | 4 ++-- .../src/graphics/LightVolume.shared.slh | 4 ++-- libraries/graphics/src/graphics/Material.slh | 11 ++++------- .../src/graphics/SphericalHarmonics.shared.slh | 18 +++++++++--------- libraries/render-utils/src/LightingModel.slh | 8 ++++---- 9 files changed, 25 insertions(+), 31 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp index 151b5bd1f9..64c9033cf7 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendShader.cpp @@ -17,7 +17,6 @@ std::string GL41Backend::getBackendShaderHeader() const { static const std::string header( R"SHADER(#version 410 core #define GPU_GL410 - #define PRECISIONQ #define BITFIELD int )SHADER"); return header; diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp index 6f6ded518f..44e439df55 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendShader.cpp @@ -18,7 +18,6 @@ std::string GL45Backend::getBackendShaderHeader() const { static const std::string header( R"SHADER(#version 450 core #define GPU_GL450 - #define PRECISIONQ #define BITFIELD int )SHADER" #ifdef GPU_SSBO_TRANSFORM_OBJECT diff --git a/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp b/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp index 4278d732c8..7e8056ba79 100644 --- a/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp +++ b/libraries/gpu-gles/src/gpu/gles/GLESBackendShader.cpp @@ -17,10 +17,9 @@ std::string GLESBackend::getBackendShaderHeader() const { static const std::string header( R"SHADER(#version 310 es #extension GL_EXT_texture_buffer : enable - precision lowp float; // check precision 2 - precision lowp samplerBuffer; - precision lowp sampler2DShadow; - #define PRECISIONQ highp + precision highp float; + precision highp samplerBuffer; + precision highp sampler2DShadow; #define BITFIELD highp int )SHADER"); return header; diff --git a/libraries/graphics/src/graphics/Light.slh b/libraries/graphics/src/graphics/Light.slh index c8992730f0..53b840f5fb 100644 --- a/libraries/graphics/src/graphics/Light.slh +++ b/libraries/graphics/src/graphics/Light.slh @@ -34,7 +34,7 @@ vec3 getLightIrradiance(Light l) { return lightIrradiance_getIrradiance(l.irradi // Light Ambient struct LightAmbient { - PRECISIONQ vec4 _ambient; + vec4 _ambient; SphericalHarmonics _ambientSphere; mat4 transform; }; diff --git a/libraries/graphics/src/graphics/LightIrradiance.shared.slh b/libraries/graphics/src/graphics/LightIrradiance.shared.slh index 4ae7967bf5..13d6cf4b93 100644 --- a/libraries/graphics/src/graphics/LightIrradiance.shared.slh +++ b/libraries/graphics/src/graphics/LightIrradiance.shared.slh @@ -14,9 +14,9 @@ #define LightIrradianceConstRef LightIrradiance struct LightIrradiance { - PRECISIONQ vec4 colorIntensity; + vec4 colorIntensity; // falloffRadius, cutoffRadius, falloffSpot, spare - PRECISIONQ vec4 attenuation; + vec4 attenuation; }; diff --git a/libraries/graphics/src/graphics/LightVolume.shared.slh b/libraries/graphics/src/graphics/LightVolume.shared.slh index 4e4359eac0..3f0cb135f5 100644 --- a/libraries/graphics/src/graphics/LightVolume.shared.slh +++ b/libraries/graphics/src/graphics/LightVolume.shared.slh @@ -16,8 +16,8 @@ #define LightVolumeConstRef LightVolume struct LightVolume { - PRECISIONQ vec4 positionRadius; - PRECISIONQ vec4 directionSpotCos; + vec4 positionRadius; + vec4 directionSpotCos; }; bool lightVolume_isPoint(LightVolume lv) { return bool(lv.directionSpotCos.w < 0.f); } diff --git a/libraries/graphics/src/graphics/Material.slh b/libraries/graphics/src/graphics/Material.slh index ecf3c18a0e..dd2985b4da 100644 --- a/libraries/graphics/src/graphics/Material.slh +++ b/libraries/graphics/src/graphics/Material.slh @@ -15,10 +15,10 @@ // to what is provided by the uniform buffer, or the material key has the wrong bits struct Material { - PRECISIONQ vec4 _emissiveOpacity; - PRECISIONQ vec4 _albedoRoughness; - PRECISIONQ vec4 _fresnelMetallic; - PRECISIONQ vec4 _scatteringSpare2Key; + vec4 _emissiveOpacity; + vec4 _albedoRoughness; + vec4 _fresnelMetallic; + vec4 _scatteringSpare2Key; }; uniform materialBuffer { @@ -64,7 +64,4 @@ const BITFIELD OCCLUSION_MAP_BIT = 0x00004000; const BITFIELD LIGHTMAP_MAP_BIT = 0x00008000; const BITFIELD SCATTERING_MAP_BIT = 0x00010000; -#ifdef GL_ES -precision lowp float; -#endif <@endif@> diff --git a/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh b/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh index 6e1763dcba..312824c5a3 100644 --- a/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh +++ b/libraries/graphics/src/graphics/SphericalHarmonics.shared.slh @@ -16,15 +16,15 @@ #define SphericalHarmonicsConstRef SphericalHarmonics struct SphericalHarmonics { - PRECISIONQ vec4 L00; - PRECISIONQ vec4 L1m1; - PRECISIONQ vec4 L10; - PRECISIONQ vec4 L11; - PRECISIONQ vec4 L2m2; - PRECISIONQ vec4 L2m1; - PRECISIONQ vec4 L20; - PRECISIONQ vec4 L21; - PRECISIONQ vec4 L22; + vec4 L00; + vec4 L1m1; + vec4 L10; + vec4 L11; + vec4 L2m2; + vec4 L2m1; + vec4 L20; + vec4 L21; + vec4 L22; }; vec4 sphericalHarmonics_evalSphericalLight(SphericalHarmonicsConstRef sh, vec3 direction) { diff --git a/libraries/render-utils/src/LightingModel.slh b/libraries/render-utils/src/LightingModel.slh index 6a5982f1e8..8abdb5cbf9 100644 --- a/libraries/render-utils/src/LightingModel.slh +++ b/libraries/render-utils/src/LightingModel.slh @@ -14,10 +14,10 @@ <@func declareLightingModel()@> struct LightingModel { - PRECISIONQ vec4 _UnlitEmissiveLightmapBackground; - PRECISIONQ vec4 _ScatteringDiffuseSpecularAlbedo; - PRECISIONQ vec4 _AmbientDirectionalPointSpot; - PRECISIONQ vec4 _ShowContourObscuranceWireframe; + vec4 _UnlitEmissiveLightmapBackground; + vec4 _ScatteringDiffuseSpecularAlbedo; + vec4 _AmbientDirectionalPointSpot; + vec4 _ShowContourObscuranceWireframe; }; uniform lightingModelBuffer{