diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llrendertarget.cpp | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/linden/indra/llrender/llrendertarget.cpp b/linden/indra/llrender/llrendertarget.cpp index 4cf8451..151b761 100644 --- a/linden/indra/llrender/llrendertarget.cpp +++ b/linden/indra/llrender/llrendertarget.cpp | |||
@@ -47,10 +47,10 @@ void check_framebuffer_status() | |||
47 | case GL_FRAMEBUFFER_COMPLETE_EXT: | 47 | case GL_FRAMEBUFFER_COMPLETE_EXT: |
48 | break; | 48 | break; |
49 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: | 49 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: |
50 | llerrs << "WTF?" << llendl; | 50 | llwarns << "WTF?" << llendl; |
51 | break; | 51 | break; |
52 | default: | 52 | default: |
53 | llerrs << "WTF?" << llendl; | 53 | llwarns << "WTF?" << llendl; |
54 | } | 54 | } |
55 | } | 55 | } |
56 | } | 56 | } |
@@ -139,9 +139,9 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt) | |||
139 | 139 | ||
140 | U32 offset = mTex.size(); | 140 | U32 offset = mTex.size(); |
141 | if (offset >= 4 || | 141 | if (offset >= 4 || |
142 | (offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers))) | 142 | offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)) |
143 | { | 143 | { |
144 | llerrs << "Too many color attachments!" << llendl; | 144 | llwarns << "Too many color attachments!" << llendl; // KL |
145 | } | 145 | } |
146 | 146 | ||
147 | U32 tex; | 147 | U32 tex; |
@@ -203,7 +203,7 @@ void LLRenderTarget::allocateDepth() | |||
203 | gGL.getTexUnit(0)->bindManual(mUsage, mDepth); | 203 | gGL.getTexUnit(0)->bindManual(mUsage, mDepth); |
204 | U32 internal_type = LLTexUnit::getInternalType(mUsage); | 204 | U32 internal_type = LLTexUnit::getInternalType(mUsage); |
205 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | 205 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); |
206 | LLImageGL::setManualImage(internal_type, 0, GL_DEPTH24_STENCIL8_EXT, mResX, mResY, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL); | 206 | LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
@@ -211,7 +211,7 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) | |||
211 | { | 211 | { |
212 | if (!mFBO || !target.mFBO) | 212 | if (!mFBO || !target.mFBO) |
213 | { | 213 | { |
214 | llerrs << "Cannot share depth buffer between non FBO render targets." << llendl; | 214 | llwarns << "Cannot share depth buffer between non FBO render targets." << llendl; |
215 | } | 215 | } |
216 | 216 | ||
217 | if (mDepth) | 217 | if (mDepth) |
@@ -349,16 +349,16 @@ U32 LLRenderTarget::getTexture(U32 attachment) const | |||
349 | { | 349 | { |
350 | if (attachment > mTex.size()-1) | 350 | if (attachment > mTex.size()-1) |
351 | { | 351 | { |
352 | llerrs << "Invalid attachment index." << llendl; | 352 | llwarns << "Invalid attachment index [getTexture]." << llendl; // lets not crash KL its a pain in the ass! |
353 | } | 353 | } |
354 | return mTex[attachment]; | 354 | return mTex[attachment]; |
355 | } | 355 | } |
356 | 356 | ||
357 | void LLRenderTarget::bindTexture(U32 index, S32 channel) | 357 | void LLRenderTarget::bindTexture(U32 index, S32 channel) |
358 | { | 358 | { |
359 | if (index > mTex.size()-1) | 359 | if (index > 6)//mTex.size()-1) // KL yeah i know its a bit arbitary but make the number big enough as some unused render defer elements cause this to go wild |
360 | { | 360 | { |
361 | llerrs << "Invalid attachment index." << llendl; | 361 | llwarns << "Invalid attachment index [bindtexture]." << llendl; |
362 | } | 362 | } |
363 | gGL.getTexUnit(channel)->bindManual(mUsage, mTex[index]); | 363 | gGL.getTexUnit(channel)->bindManual(mUsage, mTex[index]); |
364 | } | 364 | } |
@@ -440,7 +440,7 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, | |||
440 | #if !LL_DARWIN | 440 | #if !LL_DARWIN |
441 | if (!source.mFBO || !mFBO) | 441 | if (!source.mFBO || !mFBO) |
442 | { | 442 | { |
443 | llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl; | 443 | llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl; |
444 | } | 444 | } |
445 | 445 | ||
446 | if (mSampleBuffer) | 446 | if (mSampleBuffer) |
@@ -449,12 +449,27 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, | |||
449 | } | 449 | } |
450 | else | 450 | else |
451 | { | 451 | { |
452 | glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, source.mFBO); | 452 | if (mask == GL_DEPTH_BUFFER_BIT && source.mStencil != mStencil) |
453 | glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, mFBO); | 453 | { |
454 | 454 | source.bindTarget(); | |
455 | glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 455 | gGL.getTexUnit(0)->bind(this, true); |
456 | 456 | ||
457 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | 457 | glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, srcX0, srcY0, dstX0, dstY0, dstX1, dstY1); |
458 | source.flush(); | ||
459 | } | ||
460 | else | ||
461 | { | ||
462 | glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, source.mFBO); | ||
463 | stop_glerror(); | ||
464 | glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, mFBO); | ||
465 | stop_glerror(); | ||
466 | check_framebuffer_status(); | ||
467 | stop_glerror(); | ||
468 | glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | ||
469 | stop_glerror(); | ||
470 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||
471 | stop_glerror(); | ||
472 | } | ||
458 | } | 473 | } |
459 | #endif | 474 | #endif |
460 | } | 475 | } |
@@ -553,14 +568,14 @@ void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth | |||
553 | 568 | ||
554 | if (!gGLManager.mHasFramebufferMultisample) | 569 | if (!gGLManager.mHasFramebufferMultisample) |
555 | { | 570 | { |
556 | llerrs << "Attempting to allocate unsupported render target type!" << llendl; | 571 | llwarns << "Attempting to allocate unsupported render target type!" << llendl; |
557 | } | 572 | } |
558 | 573 | ||
559 | mSamples = samples; | 574 | mSamples = samples; |
560 | 575 | ||
561 | if (mSamples <= 1) | 576 | if (mSamples <= 1) |
562 | { | 577 | { |
563 | llerrs << "Cannot create a multisample buffer with less than 2 samples." << llendl; | 578 | llwarns << "Cannot create a multisample buffer with less than 2 samples." << llendl; |
564 | } | 579 | } |
565 | 580 | ||
566 | stop_glerror(); | 581 | stop_glerror(); |
@@ -608,9 +623,9 @@ void LLMultisampleBuffer::addColorAttachment(U32 color_fmt) | |||
608 | 623 | ||
609 | U32 offset = mTex.size(); | 624 | U32 offset = mTex.size(); |
610 | if (offset >= 4 || | 625 | if (offset >= 4 || |
611 | (offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers))) | 626 | offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)) |
612 | { | 627 | { |
613 | llerrs << "Too many color attachments!" << llendl; | 628 | llwarns << "Too many color attachments!" << llendl; |
614 | } | 629 | } |
615 | 630 | ||
616 | U32 tex; | 631 | U32 tex; |
@@ -631,10 +646,10 @@ void LLMultisampleBuffer::addColorAttachment(U32 color_fmt) | |||
631 | case GL_FRAMEBUFFER_COMPLETE_EXT: | 646 | case GL_FRAMEBUFFER_COMPLETE_EXT: |
632 | break; | 647 | break; |
633 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: | 648 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: |
634 | llerrs << "WTF?" << llendl; | 649 | llwarns << "WTF?" << llendl; |
635 | break; | 650 | break; |
636 | default: | 651 | default: |
637 | llerrs << "WTF?" << llendl; | 652 | llwarns << "WTF?" << llendl; |
638 | } | 653 | } |
639 | 654 | ||
640 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | 655 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |