summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-10-12 16:39:32 +0800
committerErik Kundiman <erik@megapahit.org>2024-10-12 16:39:32 +0800
commit4f26fe6430cd12914b0d6edf33baabe19829d014 (patch)
tree1e1ee5f7167b2d825cfea9a7e5ef8d0e0f9f37d3
parent722c63cec4c4a1aee2fc5e9699a54da19a634f12 (diff)
Preprocess eTextureType like sGLTextureType
(cause eTextureType seems to have been designed to mirror sGLTextureType) otherwise you'd get a GL error of invalid enum of the first argument for glTexImage2D.
-rw-r--r--indra/llrender/llrender.cpp2
-rw-r--r--indra/llrender/llrender.h6
-rw-r--r--indra/llrender/llrendertarget.cpp2
-rw-r--r--indra/newview/llheroprobemanager.cpp2
-rw-r--r--indra/newview/llreflectionmapmanager.cpp8
-rw-r--r--indra/newview/pipeline.cpp6
6 files changed, 24 insertions, 2 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index ca10e10b00..fd34a94ae8 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -2149,9 +2149,11 @@ void LLRender::debugTexUnits(void)
case LLTexUnit::TT_TEXTURE:
LL_CONT << "Texture 2D";
break;
+#if GL_VERSION_3_1
case LLTexUnit::TT_RECT_TEXTURE:
LL_CONT << "Texture Rectangle";
break;
+#endif
case LLTexUnit::TT_CUBE_MAP:
LL_CONT << "Cube Map";
break;
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index d198b0cd7c..4e568b2b2b 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -67,10 +67,16 @@ public:
typedef enum
{
TT_TEXTURE = 0, // Standard 2D Texture
+#if GL_VERSION_3_1
TT_RECT_TEXTURE, // Non power of 2 texture
+#endif
TT_CUBE_MAP, // 6-sided cube map texture
+#if GL_VERSION_4_0
TT_CUBE_MAP_ARRAY, // Array of cube maps
+#endif
+#if GL_VERSION_3_2
TT_MULTISAMPLE_TEXTURE, // see GL_ARB_texture_multisample
+#endif
TT_TEXTURE_3D, // standard 3D Texture
TT_NONE, // No texture type is currently enabled
} eTextureType;
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 2674fa1ec6..1ff0dec23a 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -255,12 +255,14 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
stop_glerror();
}
+#if GL_VERSION_3_1
if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
{
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
stop_glerror();
}
else
+#endif
{
// ATI doesn't support mirrored repeat for rectangular textures.
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index ce419498cf..368306ded8 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -414,8 +414,10 @@ void LLHeroProbeManager::generateRadiance(LLReflectionMap* probe)
gHeroRadianceGenProgram.bind();
mVertexBuffer->setBuffer();
+#if GL_VERSION_4_0
S32 channel = gHeroRadianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
mTexture->bind(channel);
+#endif
gHeroRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gHeroRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
gHeroRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, mHeroProbeStrength);
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index 2cad413d18..846f8a895a 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -825,8 +825,10 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
gRadianceGenProgram.bind();
mVertexBuffer->setBuffer();
+#if GL_VERSION_4_0
S32 channel = gRadianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
mTexture->bind(channel);
+#endif
gRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, 1.f);
@@ -873,8 +875,10 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
{
//generate irradiance map
gIrradianceGenProgram.bind();
+#if GL_VERSION_4_0
S32 channel = gIrradianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
mTexture->bind(channel);
+#endif
gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
@@ -907,11 +911,11 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
mVertexBuffer->drawArrays(gGL.TRIANGLE_STRIP, 0, 4);
S32 res = mMipChain[i].getWidth();
- mIrradianceMaps->bind(channel);
#if GL_VERSION_4_0
+ mIrradianceMaps->bind(channel);
glCopyTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, i - start_mip, 0, 0, probe->mCubeIndex * 6 + cf, 0, 0, res, res);
-#endif
mTexture->bind(channel);
+#endif
}
}
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index fae55055c5..b3b1d272d0 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -8787,8 +8787,13 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
return;
}
+#if GL_VERSION_4_0
S32 channel = shader.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
+#else
+ S32 channel;
+#endif
bool bound = false;
+#if GL_VERSION_4_0
if (channel > -1 && mReflectionMapManager.mTexture.notNull())
{
mReflectionMapManager.mTexture->bind(channel);
@@ -8819,6 +8824,7 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
setEnvMat(shader);
}
+#endif
// reflection probe shaders generally sample the scene map as well for SSR
channel = shader.enableTexture(LLShaderMgr::SCENE_MAP);