From 9626d4330679cd5a7ae05d631bf517b77882b498 Mon Sep 17 00:00:00 2001 From: Marino von Wattenwyl Date: Mon, 29 Jan 2024 16:19:01 +0100 Subject: [PATCH 1/7] [PBR] Fix mipmap generation for roughness cube maps --- modules/sl/source/gl/SLGLTextureIBL.cpp | 52 +++++++++++++++---------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/modules/sl/source/gl/SLGLTextureIBL.cpp b/modules/sl/source/gl/SLGLTextureIBL.cpp index 232c687d..a6d89908 100644 --- a/modules/sl/source/gl/SLGLTextureIBL.cpp +++ b/modules/sl/source/gl/SLGLTextureIBL.cpp @@ -11,6 +11,8 @@ #include #include +//----------------------------------------------------------------------------- +const SLint ROUGHNESS_NUM_MIP_LEVELS = 5; //! Number of mip levels for roughness cubemaps //----------------------------------------------------------------------------- //! ctor for generated textures from hdr textures SLGLTextureIBL::SLGLTextureIBL(SLAssetManager* am, @@ -216,25 +218,34 @@ void SLGLTextureIBL::build(SLint texUnit) _bytesPerPixel = SL_HDR_PIXEL_BYTES; _internalFormat = SL_HDR_GL_INTERNAL_FORMAT; - for (unsigned int i = 0; i < 6; ++i) - { - glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, - 0, - _internalFormat, - _width, - _height, - 0, - SL_HDR_GL_FORMAT, - SL_HDR_GL_TYPE, - nullptr); - } glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, ROUGHNESS_NUM_MIP_LEVELS - 1); + + // Define textures for all mip levels of all six sides of the cube map + for (SLint mipLevel = 0; mipLevel < ROUGHNESS_NUM_MIP_LEVELS; mipLevel++) + { + // Calculate the size of this mip level + SLint mipWidth = _width / (1 << mipLevel); + SLint mipHeight = _height / (1 << mipLevel); - glGenerateMipmap(GL_TEXTURE_CUBE_MAP); + for (SLint i = 0; i < 6; i++) + { + glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, + mipLevel, + _internalFormat, + mipWidth, + mipHeight, + 0, + SL_HDR_GL_FORMAT, + SL_HDR_GL_TYPE, + nullptr); + } + } _shaderProgram->useProgram(); @@ -244,17 +255,16 @@ void SLGLTextureIBL::build(SLint texUnit) glActiveTexture(GL_TEXTURE0 + texUnit); glBindTexture(_sourceTexture->target(), _sourceTexture->texID()); - SLuint maxMipLevels = 5; - for (SLuint mip = 0; mip < maxMipLevels; ++mip) + for (SLint mipLevel = 0; mipLevel < ROUGHNESS_NUM_MIP_LEVELS; ++mipLevel) { - // resize framebuffer according to mip-level size - SLuint mipWidth = (SLuint)(_width * pow(0.5, mip)); - SLuint mipHeight = (SLuint)(_height * pow(0.5, mip)); + // Resize framebuffer according to mip level size + SLint mipWidth = _width / (1 << mipLevel); + SLint mipHeight = _height / (1 << mipLevel); glViewport(0, 0, mipWidth, mipHeight); glBindFramebuffer(GL_FRAMEBUFFER, fboID); - SLfloat roughness = (SLfloat)mip / (SLfloat)(maxMipLevels - 1); + SLfloat roughness = (SLfloat)mipLevel / (SLfloat)(ROUGHNESS_NUM_MIP_LEVELS - 1); _shaderProgram->uniform1f("u_roughness", roughness); for (SLuint i = 0; i < 6; ++i) { @@ -264,7 +274,7 @@ void SLGLTextureIBL::build(SLint texUnit) GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, _texID, - mip); + mipLevel); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); logFramebufferStatus(); @@ -274,7 +284,7 @@ void SLGLTextureIBL::build(SLint texUnit) if (_readBackPixels) { string name = "roughnessCubemap_mip" + - std::to_string(mip) + "_side" + + std::to_string(mipLevel) + "_side" + std::to_string(i) + ".png"; readPixels(mipWidth, mipHeight, From 6cabb3900f156d198509c8e900befecb43aef076 Mon Sep 17 00:00:00 2001 From: Marino von Wattenwyl Date: Thu, 8 Feb 2024 13:30:30 +0100 Subject: [PATCH 2/7] [PBR] Fix shaders for generating IBL textures on Android --- data/shaders/PBR_BRDFIntegration.frag | 44 +++++++++++++++++++----- data/shaders/PBR_PrefilterRoughness.frag | 44 +++++++++++++++++++----- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/data/shaders/PBR_BRDFIntegration.frag b/data/shaders/PBR_BRDFIntegration.frag index 0e2e12da..6346caa3 100644 --- a/data/shaders/PBR_BRDFIntegration.frag +++ b/data/shaders/PBR_BRDFIntegration.frag @@ -17,21 +17,49 @@ out vec4 o_FragColor; // ---------------------------------------------------------------------------- const float PI = 3.14159265359; // ---------------------------------------------------------------------------- -// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html -// efficient VanDerCorpus calculation. +#if GL_ES +// Slow VanDerCorpus calculation when on OpenGL ES because Android drivers +// apparently have issues with bit operations. +float RadicalInverse_VdC(uint n, uint base) +{ + float invBase = 1.0 / float(base); + float denom = 1.0; + float result = 0.0; + + for(uint i = 0u; i < 32u; ++i) + { + if(n > 0u) + { + denom = mod(float(n), 2.0); + result += denom * invBase; + invBase = invBase / 2.0; + n = uint(float(n) / 2.0); + } + } + + return result; +} +#else +// Efficient VanDerCorpus calculation +// based on: http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html float RadicalInverse_VdC(uint bits) { - bits = (bits << 16u) | (bits >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return 0.0; // / 0x100000000 } +#endif // ---------------------------------------------------------------------------- vec2 Hammersley(uint i, uint N) { +#if GL_ES + return vec2(float(i)/float(N), RadicalInverse_VdC(i, 2u)); +#else return vec2(float(i)/float(N), RadicalInverse_VdC(i)); +#endif } // ---------------------------------------------------------------------------- vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness) diff --git a/data/shaders/PBR_PrefilterRoughness.frag b/data/shaders/PBR_PrefilterRoughness.frag index d1b085f5..0f0ba1ad 100644 --- a/data/shaders/PBR_PrefilterRoughness.frag +++ b/data/shaders/PBR_PrefilterRoughness.frag @@ -35,21 +35,49 @@ float DistributionGGX(vec3 N, vec3 H, float roughness) return nom / denom; } // ---------------------------------------------------------------------------- -// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html -// efficient VanDerCorpus calculation. +#if GL_ES +// Slow VanDerCorpus calculation when on OpenGL ES because Android drivers +// apparently have issues with bit operations. +float RadicalInverse_VdC(uint n, uint base) +{ + float invBase = 1.0 / float(base); + float denom = 1.0; + float result = 0.0; + + for(uint i = 0u; i < 32u; ++i) + { + if(n > 0u) + { + denom = mod(float(n), 2.0); + result += denom * invBase; + invBase = invBase / 2.0; + n = uint(float(n) / 2.0); + } + } + + return result; +} +#else +// Efficient VanDerCorpus calculation +// based on: http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html float RadicalInverse_VdC(uint bits) { - bits = (bits << 16u) | (bits >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 } +#endif // ---------------------------------------------------------------------------- vec2 Hammersley(uint i, uint N) { +#if GL_ES + return vec2(float(i)/float(N), RadicalInverse_VdC(i, 2u)); +#else return vec2(float(i)/float(N), RadicalInverse_VdC(i)); +#endif } // ---------------------------------------------------------------------------- vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness) From 0d81d7aec52418763cc564f4fa5f301dabad2964 Mon Sep 17 00:00:00 2001 From: Marino von Wattenwyl Date: Thu, 8 Feb 2024 14:45:39 +0100 Subject: [PATCH 3/7] [PBR] Clean up shader code for generating IBL textures --- data/shaders/PBR_BRDFIntegration.frag | 2 +- data/shaders/PBR_CylinderToCubeMap.frag | 8 ++++---- data/shaders/PBR_IrradianceConvolution.frag | 8 ++++---- data/shaders/PBR_PrefilterRoughness.frag | 17 ++++++++--------- modules/sl/source/gl/SLGLTextureIBL.cpp | 14 +++++++++----- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/data/shaders/PBR_BRDFIntegration.frag b/data/shaders/PBR_BRDFIntegration.frag index 6346caa3..e0e8ff48 100644 --- a/data/shaders/PBR_BRDFIntegration.frag +++ b/data/shaders/PBR_BRDFIntegration.frag @@ -19,7 +19,7 @@ const float PI = 3.14159265359; // ---------------------------------------------------------------------------- #if GL_ES // Slow VanDerCorpus calculation when on OpenGL ES because Android drivers -// apparently have issues with bit operations. +// apparently have issues with bit operations. float RadicalInverse_VdC(uint n, uint base) { float invBase = 1.0 / float(base); diff --git a/data/shaders/PBR_CylinderToCubeMap.frag b/data/shaders/PBR_CylinderToCubeMap.frag index 27b10c61..8f1dd08b 100644 --- a/data/shaders/PBR_CylinderToCubeMap.frag +++ b/data/shaders/PBR_CylinderToCubeMap.frag @@ -13,11 +13,11 @@ precision highp float; //----------------------------------------------------------------------------- -in vec3 v_P_WS; // sample direction in world space +in vec3 v_P_WS; // sample direction in world space -uniform sampler2D u_textureEnvCubemap0; // Equirectagular map +uniform sampler2D u_environmentMap; // environment cube map texture -out vec4 o_fragColor; // output fragment color +out vec4 o_fragColor; // output fragment color //----------------------------------------------------------------------------- const vec2 invAtan = vec2(0.1591, 0.3183); //----------------------------------------------------------------------------- @@ -35,7 +35,7 @@ vec2 SampleSphericalMap(vec3 v) void main() { vec2 uv = SampleSphericalMap(normalize(v_P_WS)); - vec3 color = texture(u_textureEnvCubemap0, uv).rgb; + vec3 color = texture(u_environmentMap, uv).rgb; o_fragColor = vec4(color, 1.0); } diff --git a/data/shaders/PBR_IrradianceConvolution.frag b/data/shaders/PBR_IrradianceConvolution.frag index 0a25c4fc..2fb34736 100644 --- a/data/shaders/PBR_IrradianceConvolution.frag +++ b/data/shaders/PBR_IrradianceConvolution.frag @@ -12,11 +12,11 @@ precision highp float; //----------------------------------------------------------------------------- -in vec3 v_P_WS; // sample direction in world space +in vec3 v_P_WS; // sample direction in world space -uniform samplerCube u_matTextureDiffuse0; // environment cube map texture +uniform samplerCube u_environmentMap; // environment cube map texture -out vec4 o_fragColor; // output fragment color +out vec4 o_fragColor; // output fragment color //----------------------------------------------------------------------------- const float PI = 3.14159265359; //----------------------------------------------------------------------------- @@ -48,7 +48,7 @@ void main() tangentSample.y * up + tangentSample.z * N; - irradiance += texture(u_matTextureDiffuse0, sampleVec).rgb * cos(theta) * sin(theta); + irradiance += texture(u_environmentMap, sampleVec).rgb * cos(theta) * sin(theta); nrSamples++; } } diff --git a/data/shaders/PBR_PrefilterRoughness.frag b/data/shaders/PBR_PrefilterRoughness.frag index 0f0ba1ad..ef7255d9 100644 --- a/data/shaders/PBR_PrefilterRoughness.frag +++ b/data/shaders/PBR_PrefilterRoughness.frag @@ -12,12 +12,13 @@ precision highp float; //----------------------------------------------------------------------------- -in vec3 v_P_WS; // sample direction +in vec3 v_P_WS; // sample direction -uniform samplerCube u_texture0; // Equirectagular map -uniform float u_roughness; // roughnes value +uniform samplerCube u_environmentMap; // environment cube map +uniform float u_environmentMapSize; // current mip level +uniform float u_roughness; // roughnes value -out vec4 o_fragColor; // output fragment color +out vec4 o_fragColor; // output fragment color // ---------------------------------------------------------------------------- const float PI = 3.14159265359; // ---------------------------------------------------------------------------- @@ -37,7 +38,7 @@ float DistributionGGX(vec3 N, vec3 H, float roughness) // ---------------------------------------------------------------------------- #if GL_ES // Slow VanDerCorpus calculation when on OpenGL ES because Android drivers -// apparently have issues with bit operations. +// apparently have issues with bit operations. float RadicalInverse_VdC(uint n, uint base) { float invBase = 1.0 / float(base); @@ -131,13 +132,11 @@ void main() float HdotV = max(dot(H, V), 0.0); float pdf = D * NdotH / (4.0 * HdotV) + 0.0001; - float resolution = 512.0; // resolution of source cubemap (per face) - float saTexel = 4.0 * PI / (6.0 * resolution * resolution); + float saTexel = 4.0 * PI / (6.0 * u_environmentMapSize * u_environmentMapSize); float saSample = 1.0 / (float(SAMPLE_COUNT) * pdf + 0.0001); - float mipLevel = u_roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); - prefilteredColor += textureLod(u_texture0, L, mipLevel).rgb * NdotL; + prefilteredColor += textureLod(u_environmentMap, L, mipLevel).rgb * NdotL; totalWeight += NdotL; } } diff --git a/modules/sl/source/gl/SLGLTextureIBL.cpp b/modules/sl/source/gl/SLGLTextureIBL.cpp index a6d89908..7ce73548 100644 --- a/modules/sl/source/gl/SLGLTextureIBL.cpp +++ b/modules/sl/source/gl/SLGLTextureIBL.cpp @@ -56,15 +56,15 @@ SLGLTextureIBL::SLGLTextureIBL(SLAssetManager* am, _shaderProgram = new SLGLProgramGeneric(am, shaderPath + "PBR_CubeMap.vert", shaderPath + "PBR_CylinderToCubeMap.frag"); - if (texType == TT_irradianceCubemap) + else if (texType == TT_irradianceCubemap) _shaderProgram = new SLGLProgramGeneric(am, shaderPath + "PBR_CubeMap.vert", shaderPath + "PBR_IrradianceConvolution.frag"); - if (texType == TT_roughnessCubemap) + else if (texType == TT_roughnessCubemap) _shaderProgram = new SLGLProgramGeneric(am, shaderPath + "PBR_CubeMap.vert", shaderPath + "PBR_PrefilterRoughness.frag"); - if (texType == TT_brdfLUT) + else if (texType == TT_brdfLUT) _shaderProgram = new SLGLProgramGeneric(am, shaderPath + "PBR_BRDFIntegration.vert", shaderPath + "PBR_BRDFIntegration.frag"); @@ -157,7 +157,7 @@ void SLGLTextureIBL::build(SLint texUnit) if (_sourceTexture != nullptr) _sourceTexture->bindActive(); - _shaderProgram->uniform1i("u_texture0", texUnit); + _shaderProgram->uniform1i("u_environmentMap", texUnit); glActiveTexture(GL_TEXTURE0 + texUnit); glBindTexture(_sourceTexture->target(), @@ -251,7 +251,10 @@ void SLGLTextureIBL::build(SLint texUnit) if (_sourceTexture != nullptr) _sourceTexture->bindActive(); - _shaderProgram->uniform1i("u_texture0", texUnit); + + _shaderProgram->uniform1i("u_environmentMap", texUnit); + _shaderProgram->uniform1f("u_environmentMapSize", (float)_sourceTexture->width()); + glActiveTexture(GL_TEXTURE0 + texUnit); glBindTexture(_sourceTexture->target(), _sourceTexture->texID()); @@ -266,6 +269,7 @@ void SLGLTextureIBL::build(SLint texUnit) SLfloat roughness = (SLfloat)mipLevel / (SLfloat)(ROUGHNESS_NUM_MIP_LEVELS - 1); _shaderProgram->uniform1f("u_roughness", roughness); + for (SLuint i = 0; i < 6; ++i) { SLMat4f mvp = _captureProjection * _captureViews[i]; From 9e1d8e3a2504a5a14bee8fabf37a0796e7f47c15 Mon Sep 17 00:00:00 2001 From: Marcus Hudritsch Date: Sat, 10 Feb 2024 11:42:07 +0100 Subject: [PATCH 4/7] MacOS doesn't like #if GL_ES only #if defined(GL_ES) --- data/shaders/PBR_BRDFIntegration.frag | 12 +++++++----- data/shaders/PBR_PrefilterRoughness.frag | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/data/shaders/PBR_BRDFIntegration.frag b/data/shaders/PBR_BRDFIntegration.frag index e0e8ff48..6c8dea98 100644 --- a/data/shaders/PBR_BRDFIntegration.frag +++ b/data/shaders/PBR_BRDFIntegration.frag @@ -3,7 +3,7 @@ // Purpose: GLSL fragment program for generating a BRDF integration map, // which is the second part of the specular integral. // Date: April 2018 -// Authors: Carlos Arauz, Marcus Hudritsch +// Authors: Carlos Arauz, Marcus Hudritsch, Marino von Wattenwyl // License: This software is provided under the GNU General Public License // Please visit: http://opensource.org/licenses/GPL-3.0 //############################################################################# @@ -17,9 +17,11 @@ out vec4 o_FragColor; // ---------------------------------------------------------------------------- const float PI = 3.14159265359; // ---------------------------------------------------------------------------- -#if GL_ES + +#if defined(GL_ES) // MacOS doesn't like #if GL_ES (!!!) // Slow VanDerCorpus calculation when on OpenGL ES because Android drivers // apparently have issues with bit operations. +// See also: https://learnopengl.com/PBR/IBL/Specular-IBL float RadicalInverse_VdC(uint n, uint base) { float invBase = 1.0 / float(base); @@ -55,11 +57,11 @@ float RadicalInverse_VdC(uint bits) // ---------------------------------------------------------------------------- vec2 Hammersley(uint i, uint N) { -#if GL_ES + #if defined(GL_ES) return vec2(float(i)/float(N), RadicalInverse_VdC(i, 2u)); -#else + #else return vec2(float(i)/float(N), RadicalInverse_VdC(i)); -#endif + #endif } // ---------------------------------------------------------------------------- vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness) diff --git a/data/shaders/PBR_PrefilterRoughness.frag b/data/shaders/PBR_PrefilterRoughness.frag index ef7255d9..86ee65e4 100644 --- a/data/shaders/PBR_PrefilterRoughness.frag +++ b/data/shaders/PBR_PrefilterRoughness.frag @@ -36,7 +36,7 @@ float DistributionGGX(vec3 N, vec3 H, float roughness) return nom / denom; } // ---------------------------------------------------------------------------- -#if GL_ES +#if defined(GL_ES) // MacOS doesn't like #if GL_ES (!!!) // Slow VanDerCorpus calculation when on OpenGL ES because Android drivers // apparently have issues with bit operations. float RadicalInverse_VdC(uint n, uint base) @@ -74,7 +74,7 @@ float RadicalInverse_VdC(uint bits) // ---------------------------------------------------------------------------- vec2 Hammersley(uint i, uint N) { -#if GL_ES +#if defined(GL_ES) // MacOS doesn't like #if GL_ES (!!!) return vec2(float(i)/float(N), RadicalInverse_VdC(i, 2u)); #else return vec2(float(i)/float(N), RadicalInverse_VdC(i)); From b512f39bc9a12e9c6c9596427aa2a1404d49ae37 Mon Sep 17 00:00:00 2001 From: Marcus Hudritsch Date: Sat, 10 Feb 2024 11:58:55 +0100 Subject: [PATCH 5/7] Increased SLProject version. Tests on Android succeeded. --- apps/app_demo_slproject/android/build.gradle | 2 +- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- apps/source/AppDemo.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/app_demo_slproject/android/build.gradle b/apps/app_demo_slproject/android/build.gradle index ddd2768c..5376df21 100644 --- a/apps/app_demo_slproject/android/build.gradle +++ b/apps/app_demo_slproject/android/build.gradle @@ -5,7 +5,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.2' + classpath 'com.android.tools.build:gradle:8.2.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/apps/app_demo_slproject/android/gradle/wrapper/gradle-wrapper.properties b/apps/app_demo_slproject/android/gradle/wrapper/gradle-wrapper.properties index 795abbcf..3656f4fc 100644 --- a/apps/app_demo_slproject/android/gradle/wrapper/gradle-wrapper.properties +++ b/apps/app_demo_slproject/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip diff --git a/apps/source/AppDemo.cpp b/apps/source/AppDemo.cpp index 2fb597f9..1eaf19ab 100644 --- a/apps/source/AppDemo.cpp +++ b/apps/source/AppDemo.cpp @@ -29,7 +29,7 @@ SLDeviceRotation AppDemo::devRot; SLDeviceLocation AppDemo::devLoc; SLstring AppDemo::name = "SLProjectApp"; SLstring AppDemo::appTag = "SLProject"; -SLstring AppDemo::version = "4.1.002"; +SLstring AppDemo::version = "4.1.003"; #ifdef _DEBUG SLstring AppDemo::configuration = "Debug"; #else From 8e092e0be3d7224321417fdebce75959d4262b55 Mon Sep 17 00:00:00 2001 From: Marcus Hudritsch Date: Sat, 10 Feb 2024 14:40:14 +0100 Subject: [PATCH 6/7] iOS works fine in debug and release --- modules/sl/source/gl/SLGLTextureIBL.cpp | 1 - modules/utils/externals/zlib/contrib/minizip/zip.c | 4 ++-- modules/utils/source/Utils_iOS.mm | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/sl/source/gl/SLGLTextureIBL.cpp b/modules/sl/source/gl/SLGLTextureIBL.cpp index 7ce73548..9053bdcf 100644 --- a/modules/sl/source/gl/SLGLTextureIBL.cpp +++ b/modules/sl/source/gl/SLGLTextureIBL.cpp @@ -107,7 +107,6 @@ SLGLTextureIBL::~SLGLTextureIBL() Build the texture into a cube map, rendering the texture 6 times and capturing each time one side of the cube (except for the BRDF LUT texture, which is completely generated by calculations directly with the shader). - @todo Priority 1: These frame buffer ops do not work properly on iOS & Android. This is probably the most difficult OpenGL code in the project. */ void SLGLTextureIBL::build(SLint texUnit) diff --git a/modules/utils/externals/zlib/contrib/minizip/zip.c b/modules/utils/externals/zlib/contrib/minizip/zip.c index 44e88a9c..42c96a20 100644 --- a/modules/utils/externals/zlib/contrib/minizip/zip.c +++ b/modules/utils/externals/zlib/contrib/minizip/zip.c @@ -1473,8 +1473,8 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in err=deflate(&zi->ci.stream, Z_NO_FLUSH); if(uTotalOutBefore > zi->ci.stream.total_out) { - int bBreak = 0; - bBreak++; + //int bBreak = 0; + //bBreak++; } zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; diff --git a/modules/utils/source/Utils_iOS.mm b/modules/utils/source/Utils_iOS.mm index 7fcb62bb..83a01c06 100644 --- a/modules/utils/source/Utils_iOS.mm +++ b/modules/utils/source/Utils_iOS.mm @@ -74,8 +74,7 @@ NSString* nsPath = [NSString stringWithCString:path.c_str() encoding:[NSString defaultCStringEncoding]]; - NSString* nsFolder = [NSString stringWithCString:folder.c_str() - encoding:[NSString defaultCStringEncoding]]; + [NSString stringWithCString:folder.c_str() encoding:[NSString defaultCStringEncoding]]; NSFileManager* fileManager = [NSFileManager defaultManager]; From 4136558258c86cf5c0c341cd0f28b2f7cd011221 Mon Sep 17 00:00:00 2001 From: Marcus Hudritsch Date: Sat, 10 Feb 2024 15:06:25 +0100 Subject: [PATCH 7/7] Update SLGLShader.cpp --- modules/sl/source/gl/SLGLShader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/sl/source/gl/SLGLShader.cpp b/modules/sl/source/gl/SLGLShader.cpp index 7602a311..821ddf8c 100644 --- a/modules/sl/source/gl/SLGLShader.cpp +++ b/modules/sl/source/gl/SLGLShader.cpp @@ -141,6 +141,7 @@ SLbool SLGLShader::createAndCompile(SLVLight* lights) if (compileSuccess == GL_FALSE) { GLchar log[1024]; + if (Utils::onlyErrorLogs) Utils::onlyErrorLogs = false; glGetShaderInfoLog(_shaderID, sizeof(log), nullptr, &log[0]); SL_LOG("*** COMPILER ERROR ***"); SL_LOG("Source file: %s\n", _file.c_str());