From fd501cf3af75357cb1de1a5496e8ae9c58fb79e8 Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 1 Feb 2018 10:37:54 -0800 Subject: [PATCH] Addressing review comments --- libraries/gpu-gl/src/gpu/gl/GLBackendShader.cpp | 3 +++ libraries/gpu-gles/src/gpu/gl/GLBackendShader.cpp | 3 +++ libraries/gpu/src/gpu/Shader.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackendShader.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackendShader.cpp index e9d23b543f..42e95ba6c6 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackendShader.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackendShader.cpp @@ -71,6 +71,9 @@ GLShader* GLBackend::compileBackendShader(const Shader& shader, Shader::Compilat if (handler) { bool retest = true; std::string currentSrc = shaderSource; + // When a Handler is specified, we can try multiple times to build the shader and let the handler change the source if the compilation fails. + // The retest bool is set to false as soon as the compilation succeed to wexit the while loop. + // The handler tells us if we should retry or not while returning a modified version of the source. while (retest) { bool result = ::gl::compileShader(shaderDomain, currentSrc, shaderDefines, shaderObject.glshader, compilationLogs[version].message); compilationLogs[version].compiled = result; diff --git a/libraries/gpu-gles/src/gpu/gl/GLBackendShader.cpp b/libraries/gpu-gles/src/gpu/gl/GLBackendShader.cpp index 350e95b46a..b799fb0037 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLBackendShader.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLBackendShader.cpp @@ -74,6 +74,9 @@ GLShader* GLBackend::compileBackendShader(const Shader& shader, Shader::Compilat if (handler) { bool retest = true; std::string currentSrc = shaderSource; + // When a Handler is specified, we can try multiple times to build the shader and let the handler change the source if the compilation fails. + // The retest bool is set to false as soon as the compilation succeed to wexit the while loop. + // The handler tells us if we should retry or not while returning a modified version of the source. while (retest) { bool result = ::gl::compileShader(shaderDomain, currentSrc, shaderDefines, shaderObject.glshader, compilationLogs[version].message); compilationLogs[version].compiled = result; diff --git a/libraries/gpu/src/gpu/Shader.h b/libraries/gpu/src/gpu/Shader.h index b7ca000d43..07800fa14a 100755 --- a/libraries/gpu/src/gpu/Shader.h +++ b/libraries/gpu/src/gpu/Shader.h @@ -253,7 +253,7 @@ protected: static ShaderPointer createOrReuseDomainShader(Type type, const Source& source); - using ProgramMapKey = glm::uvec3; // THe IDs of the shaders in a progrma make its key + using ProgramMapKey = glm::uvec3; // The IDs of the shaders in a program make its key class ProgramKeyLess { public: bool operator() (const ProgramMapKey& l, const ProgramMapKey& r) const {