summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolbump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawpoolbump.cpp')
-rw-r--r--indra/newview/lldrawpoolbump.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 2556462cb4..ccf130be7a 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -349,27 +349,29 @@ void LLDrawPoolBump::beginShiny(bool invisible)
cube_map->setMatrix(1);
// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
// the cube map in the one pass shiny shaders
- cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
cube_map->enableTexture(cube_channel);
cube_map->enableTextureCoords(1);
diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
else
{
- cube_channel = 0;
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
diffuse_channel = -1;
cube_map->setMatrix(0);
- cube_map->enable(shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB));
+ cube_map->enable(cube_channel);
}
- cube_map->bind();
+ gGL.getTexUnit(cube_channel)->bind(cube_map);
+ gGL.getTexUnit(0)->activate();
}
else
{
cube_channel = 0;
diffuse_channel = -1;
+ gGL.getTexUnit(0)->disable();
cube_map->enable(0);
cube_map->setMatrix(0);
- cube_map->bind();
+ gGL.getTexUnit(0)->bind(cube_map);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA);
@@ -423,7 +425,7 @@ void LLDrawPoolBump::endShiny(bool invisible)
if (!invisible && mVertexShaderLevel > 1)
{
- shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
+ shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0)
{
@@ -435,18 +437,21 @@ void LLDrawPoolBump::endShiny(bool invisible)
shader->unbind();
gGL.getTexUnit(0)->activate();
- glEnable(GL_TEXTURE_2D);
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
}
if (cube_channel >= 0)
{
+ gGL.getTexUnit(cube_channel)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(cube_channel)->setTextureBlendType(LLTexUnit::TB_MULT);
}
}
- gGL.getTexUnit(0)->activate();
- LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
+ gGL.getTexUnit(diffuse_channel)->disable();
+ gGL.getTexUnit(cube_channel)->disable();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
-
+
diffuse_channel = -1;
cube_channel = 0;
mShiny = FALSE;
@@ -489,12 +494,14 @@ void LLDrawPoolBump::beginFullbrightShiny()
cube_map->setMatrix(1);
// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
// the cube map in the one pass shiny shaders
- cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB);
+ gGL.getTexUnit(1)->disable();
+ cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
cube_map->enableTexture(cube_channel);
cube_map->enableTextureCoords(1);
diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
- cube_map->bind();
+ gGL.getTexUnit(cube_channel)->bind(cube_map);
+ gGL.getTexUnit(0)->activate();
}
mShiny = TRUE;
}
@@ -535,14 +542,13 @@ void LLDrawPoolBump::endFullbrightShiny()
shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
gGL.getTexUnit(0)->activate();
- glEnable(GL_TEXTURE_2D);
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
shader->unbind();
-
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
- LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
diffuse_channel = -1;
@@ -561,7 +567,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL
applyModelMatrix(params);
params.mVertexBuffer->setBuffer(mask);
- params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
+ params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount/3);
}
}
@@ -599,8 +605,8 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params)
if (bump)
{
- bump->bind(1);
- bump->bind(0);
+ gGL.getTexUnit(1)->bind(bump);
+ gGL.getTexUnit(0)->bind(bump);
return TRUE;
}
return FALSE;
@@ -629,7 +635,7 @@ void LLDrawPoolBump::beginBump()
// TEXTURE UNIT 1
gGL.getTexUnit(1)->activate();
- glEnable(GL_TEXTURE_2D); // Texture unit 1
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
@@ -648,7 +654,7 @@ void LLDrawPoolBump::beginBump()
gGL.getTexUnit(0)->activate();
stop_glerror();
- LLViewerImage::unbindTexture(1, GL_TEXTURE_2D);
+ gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
}
//static
@@ -680,7 +686,7 @@ void LLDrawPoolBump::endBump()
// Disable texture unit 1
gGL.getTexUnit(1)->activate();
- glDisable(GL_TEXTURE_2D); // Texture unit 1
+ gGL.getTexUnit(1)->disable();
gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
// Disable texture unit 0
@@ -1083,17 +1089,17 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
{
if (params.mTexture.notNull())
{
- params.mTexture->bind(diffuse_channel);
+ gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get());
params.mTexture->addTextureStats(params.mVSize);
}
else
{
- LLImageGL::unbindTexture(0);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
}
params.mVertexBuffer->setBuffer(mask);
- params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
+ params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount/3);
if (params.mTextureMatrix)
{