aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:48 -0500
committerJacek Antonelli2008-08-15 23:45:48 -0500
commit32b59b5609706d574e2e3b9ff6162d35f6d7781c (patch)
tree340ae6f090700b109f2ced1c41b8fb274a215bd3 /linden/indra/llrender
parentSecond Life viewer sources 1.20.4 (diff)
downloadmeta-impy-32b59b5609706d574e2e3b9ff6162d35f6d7781c.zip
meta-impy-32b59b5609706d574e2e3b9ff6162d35f6d7781c.tar.gz
meta-impy-32b59b5609706d574e2e3b9ff6162d35f6d7781c.tar.bz2
meta-impy-32b59b5609706d574e2e3b9ff6162d35f6d7781c.tar.xz
Second Life viewer sources 1.20.5
Diffstat (limited to 'linden/indra/llrender')
-rw-r--r--linden/indra/llrender/llrendertarget.cpp10
-rw-r--r--linden/indra/llrender/llrendertarget.h3
-rw-r--r--linden/indra/llrender/llvertexbuffer.cpp16
3 files changed, 29 insertions, 0 deletions
diff --git a/linden/indra/llrender/llrendertarget.cpp b/linden/indra/llrender/llrendertarget.cpp
index d95c8aa..e1f7703 100644
--- a/linden/indra/llrender/llrendertarget.cpp
+++ b/linden/indra/llrender/llrendertarget.cpp
@@ -33,6 +33,7 @@
33 33
34#include "llrendertarget.h" 34#include "llrendertarget.h"
35#include "llglimmediate.h" 35#include "llglimmediate.h"
36#include "llgl.h"
36 37
37 38
38BOOL LLRenderTarget::sUseFBO = FALSE; 39BOOL LLRenderTarget::sUseFBO = FALSE;
@@ -150,6 +151,15 @@ void LLRenderTarget::bindTarget()
150 glViewport(0, 0, mResX, mResY); 151 glViewport(0, 0, mResX, mResY);
151} 152}
152 153
154// static
155void LLRenderTarget::unbindTarget()
156{
157 if (gGLManager.mHasFramebufferObject)
158 {
159 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
160 }
161}
162
153void LLRenderTarget::clear() 163void LLRenderTarget::clear()
154{ 164{
155 U32 mask = GL_COLOR_BUFFER_BIT; 165 U32 mask = GL_COLOR_BUFFER_BIT;
diff --git a/linden/indra/llrender/llrendertarget.h b/linden/indra/llrender/llrendertarget.h
index d16d986..5e3c4d9 100644
--- a/linden/indra/llrender/llrendertarget.h
+++ b/linden/indra/llrender/llrendertarget.h
@@ -83,6 +83,9 @@ public:
83 //bind target for rendering 83 //bind target for rendering
84 //applies appropriate viewport 84 //applies appropriate viewport
85 void bindTarget(); 85 void bindTarget();
86
87 //unbind target for rendering
88 static void unbindTarget();
86 89
87 //clear render targer, clears depth buffer if present, 90 //clear render targer, clears depth buffer if present,
88 //uses scissor rect if in copy-to-texture mode 91 //uses scissor rect if in copy-to-texture mode
diff --git a/linden/indra/llrender/llvertexbuffer.cpp b/linden/indra/llrender/llvertexbuffer.cpp
index d165c01..ce80343 100644
--- a/linden/indra/llrender/llvertexbuffer.cpp
+++ b/linden/indra/llrender/llvertexbuffer.cpp
@@ -491,6 +491,7 @@ void LLVertexBuffer::destroyGLBuffer()
491 } 491 }
492 492
493 mGLBuffer = 0; 493 mGLBuffer = 0;
494 unbind();
494} 495}
495 496
496void LLVertexBuffer::destroyGLIndices() 497void LLVertexBuffer::destroyGLIndices()
@@ -517,6 +518,7 @@ void LLVertexBuffer::destroyGLIndices()
517 } 518 }
518 519
519 mGLIndices = 0; 520 mGLIndices = 0;
521 unbind();
520} 522}
521 523
522void LLVertexBuffer::updateNumVerts(S32 nverts) 524void LLVertexBuffer::updateNumVerts(S32 nverts)
@@ -737,8 +739,11 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
737 { 739 {
738 setBuffer(0); 740 setBuffer(0);
739 mLocked = TRUE; 741 mLocked = TRUE;
742 stop_glerror();
740 mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); 743 mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
744 stop_glerror();
741 mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); 745 mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
746 stop_glerror();
742 /*if (sMapped) 747 /*if (sMapped)
743 { 748 {
744 llerrs << "Mapped two VBOs at the same time!" << llendl; 749 llerrs << "Mapped two VBOs at the same time!" << llendl;
@@ -767,8 +772,11 @@ void LLVertexBuffer::unmapBuffer()
767 { 772 {
768 if (useVBOs() && mLocked) 773 if (useVBOs() && mLocked)
769 { 774 {
775 stop_glerror();
770 glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); 776 glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
777 stop_glerror();
771 glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); 778 glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
779 stop_glerror();
772 780
773 /*if (!sMapped) 781 /*if (!sMapped)
774 { 782 {
@@ -907,7 +915,9 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
907 { 915 {
908 llerrs << "VBO bound while another VBO mapped!" << llendl; 916 llerrs << "VBO bound while another VBO mapped!" << llendl;
909 }*/ 917 }*/
918 stop_glerror();
910 glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); 919 glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
920 stop_glerror();
911 sBindCount++; 921 sBindCount++;
912 sVBOActive = TRUE; 922 sVBOActive = TRUE;
913 setup = TRUE; // ... or the bound buffer changed 923 setup = TRUE; // ... or the bound buffer changed
@@ -918,7 +928,9 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
918 { 928 {
919 llerrs << "VBO bound while another VBO mapped!" << llendl; 929 llerrs << "VBO bound while another VBO mapped!" << llendl;
920 }*/ 930 }*/
931 stop_glerror();
921 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); 932 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
933 stop_glerror();
922 sBindCount++; 934 sBindCount++;
923 sIBOActive = TRUE; 935 sIBOActive = TRUE;
924 } 936 }
@@ -927,11 +939,15 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
927 { 939 {
928 if (mGLBuffer) 940 if (mGLBuffer)
929 { 941 {
942 stop_glerror();
930 glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), NULL, mUsage); 943 glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), NULL, mUsage);
944 stop_glerror();
931 } 945 }
932 if (mGLIndices) 946 if (mGLIndices)
933 { 947 {
948 stop_glerror();
934 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), NULL, mUsage); 949 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), NULL, mUsage);
950 stop_glerror();
935 } 951 }
936 952
937 mEmpty = TRUE; 953 mEmpty = TRUE;