diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lldrawpoolbump.cpp | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp index 0dd11d6..6593547 100644 --- a/linden/indra/newview/lldrawpoolbump.cpp +++ b/linden/indra/newview/lldrawpoolbump.cpp | |||
@@ -349,27 +349,29 @@ void LLDrawPoolBump::beginShiny(bool invisible) | |||
349 | cube_map->setMatrix(1); | 349 | cube_map->setMatrix(1); |
350 | // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for | 350 | // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for |
351 | // the cube map in the one pass shiny shaders | 351 | // the cube map in the one pass shiny shaders |
352 | cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); | 352 | cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); |
353 | cube_map->enableTexture(cube_channel); | 353 | cube_map->enableTexture(cube_channel); |
354 | cube_map->enableTextureCoords(1); | 354 | cube_map->enableTextureCoords(1); |
355 | diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | 355 | diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); |
356 | } | 356 | } |
357 | else | 357 | else |
358 | { | 358 | { |
359 | cube_channel = 0; | 359 | cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); |
360 | diffuse_channel = -1; | 360 | diffuse_channel = -1; |
361 | cube_map->setMatrix(0); | 361 | cube_map->setMatrix(0); |
362 | cube_map->enable(shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB)); | 362 | cube_map->enable(cube_channel); |
363 | } | 363 | } |
364 | cube_map->bind(); | 364 | gGL.getTexUnit(cube_channel)->bind(cube_map); |
365 | gGL.getTexUnit(0)->activate(); | ||
365 | } | 366 | } |
366 | else | 367 | else |
367 | { | 368 | { |
368 | cube_channel = 0; | 369 | cube_channel = 0; |
369 | diffuse_channel = -1; | 370 | diffuse_channel = -1; |
371 | gGL.getTexUnit(0)->disable(); | ||
370 | cube_map->enable(0); | 372 | cube_map->enable(0); |
371 | cube_map->setMatrix(0); | 373 | cube_map->setMatrix(0); |
372 | cube_map->bind(); | 374 | gGL.getTexUnit(0)->bind(cube_map); |
373 | 375 | ||
374 | gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); | 376 | gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); |
375 | gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA); | 377 | gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA); |
@@ -423,7 +425,7 @@ void LLDrawPoolBump::endShiny(bool invisible) | |||
423 | 425 | ||
424 | if (!invisible && mVertexShaderLevel > 1) | 426 | if (!invisible && mVertexShaderLevel > 1) |
425 | { | 427 | { |
426 | shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); | 428 | shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); |
427 | 429 | ||
428 | if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0) | 430 | if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0) |
429 | { | 431 | { |
@@ -435,18 +437,20 @@ void LLDrawPoolBump::endShiny(bool invisible) | |||
435 | 437 | ||
436 | shader->unbind(); | 438 | shader->unbind(); |
437 | gGL.getTexUnit(0)->activate(); | 439 | gGL.getTexUnit(0)->activate(); |
438 | glEnable(GL_TEXTURE_2D); | 440 | gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); |
439 | } | 441 | } |
440 | if (cube_channel >= 0) | 442 | if (cube_channel >= 0) |
441 | { | 443 | { |
444 | gGL.getTexUnit(cube_channel)->enable(LLTexUnit::TT_TEXTURE); | ||
442 | gGL.getTexUnit(cube_channel)->setTextureBlendType(LLTexUnit::TB_MULT); | 445 | gGL.getTexUnit(cube_channel)->setTextureBlendType(LLTexUnit::TB_MULT); |
443 | } | 446 | } |
444 | } | 447 | } |
445 | 448 | gGL.getTexUnit(diffuse_channel)->disable(); | |
446 | gGL.getTexUnit(0)->activate(); | 449 | gGL.getTexUnit(cube_channel)->disable(); |
447 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | 450 | |
451 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | ||
448 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); | 452 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); |
449 | 453 | ||
450 | diffuse_channel = -1; | 454 | diffuse_channel = -1; |
451 | cube_channel = 0; | 455 | cube_channel = 0; |
452 | mShiny = FALSE; | 456 | mShiny = FALSE; |
@@ -489,12 +493,14 @@ void LLDrawPoolBump::beginFullbrightShiny() | |||
489 | cube_map->setMatrix(1); | 493 | cube_map->setMatrix(1); |
490 | // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for | 494 | // Make sure that texture coord generation happens for tex unit 1, as that's the one we use for |
491 | // the cube map in the one pass shiny shaders | 495 | // the cube map in the one pass shiny shaders |
492 | cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); | 496 | gGL.getTexUnit(1)->disable(); |
497 | cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); | ||
493 | cube_map->enableTexture(cube_channel); | 498 | cube_map->enableTexture(cube_channel); |
494 | cube_map->enableTextureCoords(1); | 499 | cube_map->enableTextureCoords(1); |
495 | diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | 500 | diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); |
496 | 501 | ||
497 | cube_map->bind(); | 502 | gGL.getTexUnit(cube_channel)->bind(cube_map); |
503 | gGL.getTexUnit(0)->activate(); | ||
498 | } | 504 | } |
499 | mShiny = TRUE; | 505 | mShiny = TRUE; |
500 | } | 506 | } |
@@ -535,14 +541,13 @@ void LLDrawPoolBump::endFullbrightShiny() | |||
535 | shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | 541 | shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); |
536 | } | 542 | } |
537 | gGL.getTexUnit(0)->activate(); | 543 | gGL.getTexUnit(0)->activate(); |
538 | glEnable(GL_TEXTURE_2D); | 544 | gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); |
539 | 545 | ||
540 | shader->unbind(); | 546 | shader->unbind(); |
541 | |||
542 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); | 547 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); |
543 | } | 548 | } |
544 | 549 | ||
545 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | 550 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
546 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); | 551 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); |
547 | 552 | ||
548 | diffuse_channel = -1; | 553 | diffuse_channel = -1; |
@@ -561,7 +566,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL | |||
561 | applyModelMatrix(params); | 566 | applyModelMatrix(params); |
562 | 567 | ||
563 | params.mVertexBuffer->setBuffer(mask); | 568 | params.mVertexBuffer->setBuffer(mask); |
564 | params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); | 569 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); |
565 | gPipeline.addTrianglesDrawn(params.mCount/3); | 570 | gPipeline.addTrianglesDrawn(params.mCount/3); |
566 | } | 571 | } |
567 | } | 572 | } |
@@ -599,8 +604,8 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params) | |||
599 | 604 | ||
600 | if (bump) | 605 | if (bump) |
601 | { | 606 | { |
602 | bump->bind(1); | 607 | gGL.getTexUnit(1)->bind(bump); |
603 | bump->bind(0); | 608 | gGL.getTexUnit(0)->bind(bump); |
604 | return TRUE; | 609 | return TRUE; |
605 | } | 610 | } |
606 | return FALSE; | 611 | return FALSE; |
@@ -629,7 +634,7 @@ void LLDrawPoolBump::beginBump() | |||
629 | // TEXTURE UNIT 1 | 634 | // TEXTURE UNIT 1 |
630 | gGL.getTexUnit(1)->activate(); | 635 | gGL.getTexUnit(1)->activate(); |
631 | 636 | ||
632 | glEnable(GL_TEXTURE_2D); // Texture unit 1 | 637 | gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); |
633 | 638 | ||
634 | gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA); | 639 | gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA); |
635 | gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); | 640 | gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); |
@@ -648,7 +653,7 @@ void LLDrawPoolBump::beginBump() | |||
648 | gGL.getTexUnit(0)->activate(); | 653 | gGL.getTexUnit(0)->activate(); |
649 | stop_glerror(); | 654 | stop_glerror(); |
650 | 655 | ||
651 | LLViewerImage::unbindTexture(1, GL_TEXTURE_2D); | 656 | gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); |
652 | } | 657 | } |
653 | 658 | ||
654 | //static | 659 | //static |
@@ -680,7 +685,7 @@ void LLDrawPoolBump::endBump() | |||
680 | 685 | ||
681 | // Disable texture unit 1 | 686 | // Disable texture unit 1 |
682 | gGL.getTexUnit(1)->activate(); | 687 | gGL.getTexUnit(1)->activate(); |
683 | glDisable(GL_TEXTURE_2D); // Texture unit 1 | 688 | gGL.getTexUnit(1)->disable(); |
684 | gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT); | 689 | gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT); |
685 | 690 | ||
686 | // Disable texture unit 0 | 691 | // Disable texture unit 0 |
@@ -1083,17 +1088,17 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) | |||
1083 | { | 1088 | { |
1084 | if (params.mTexture.notNull()) | 1089 | if (params.mTexture.notNull()) |
1085 | { | 1090 | { |
1086 | params.mTexture->bind(diffuse_channel); | 1091 | gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get()); |
1087 | params.mTexture->addTextureStats(params.mVSize); | 1092 | params.mTexture->addTextureStats(params.mVSize); |
1088 | } | 1093 | } |
1089 | else | 1094 | else |
1090 | { | 1095 | { |
1091 | LLImageGL::unbindTexture(0); | 1096 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
1092 | } | 1097 | } |
1093 | } | 1098 | } |
1094 | 1099 | ||
1095 | params.mVertexBuffer->setBuffer(mask); | 1100 | params.mVertexBuffer->setBuffer(mask); |
1096 | params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); | 1101 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); |
1097 | gPipeline.addTrianglesDrawn(params.mCount/3); | 1102 | gPipeline.addTrianglesDrawn(params.mCount/3); |
1098 | if (params.mTextureMatrix) | 1103 | if (params.mTextureMatrix) |
1099 | { | 1104 | { |