diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llrender/llimagegl.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llrender/llimagegl.cpp')
-rw-r--r-- | linden/indra/llrender/llimagegl.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp index b2b08e0..76c8252 100644 --- a/linden/indra/llrender/llimagegl.cpp +++ b/linden/indra/llrender/llimagegl.cpp | |||
@@ -41,6 +41,8 @@ | |||
41 | 41 | ||
42 | #include "llmath.h" | 42 | #include "llmath.h" |
43 | #include "llgl.h" | 43 | #include "llgl.h" |
44 | #include "llglimmediate.h" | ||
45 | |||
44 | 46 | ||
45 | //---------------------------------------------------------------------------- | 47 | //---------------------------------------------------------------------------- |
46 | 48 | ||
@@ -49,6 +51,8 @@ const F32 MIN_TEXTURE_LIFETIME = 10.f; | |||
49 | //statics | 51 | //statics |
50 | LLGLuint LLImageGL::sCurrentBoundTextures[MAX_GL_TEXTURE_UNITS] = { 0 }; | 52 | LLGLuint LLImageGL::sCurrentBoundTextures[MAX_GL_TEXTURE_UNITS] = { 0 }; |
51 | 53 | ||
54 | U32 LLImageGL::sUniqueCount = 0; | ||
55 | U32 LLImageGL::sBindCount = 0; | ||
52 | S32 LLImageGL::sGlobalTextureMemory = 0; | 56 | S32 LLImageGL::sGlobalTextureMemory = 0; |
53 | S32 LLImageGL::sBoundTextureMemory = 0; | 57 | S32 LLImageGL::sBoundTextureMemory = 0; |
54 | S32 LLImageGL::sCurBoundTextureMemory = 0; | 58 | S32 LLImageGL::sCurBoundTextureMemory = 0; |
@@ -123,6 +127,7 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) | |||
123 | // static | 127 | // static |
124 | void LLImageGL::bindExternalTexture(LLGLuint gl_name, S32 stage, LLGLenum bind_target ) | 128 | void LLImageGL::bindExternalTexture(LLGLuint gl_name, S32 stage, LLGLenum bind_target ) |
125 | { | 129 | { |
130 | gGL.flush(); | ||
126 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); | 131 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); |
127 | glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); | 132 | glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); |
128 | glBindTexture(bind_target, gl_name); | 133 | glBindTexture(bind_target, gl_name); |
@@ -135,6 +140,7 @@ void LLImageGL::unbindTexture(S32 stage, LLGLenum bind_target) | |||
135 | // LLGLSLShader can return -1 | 140 | // LLGLSLShader can return -1 |
136 | if (stage >= 0) | 141 | if (stage >= 0) |
137 | { | 142 | { |
143 | gGL.flush(); | ||
138 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); | 144 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); |
139 | glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); | 145 | glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); |
140 | glBindTexture(bind_target, 0); | 146 | glBindTexture(bind_target, 0); |
@@ -148,6 +154,7 @@ void LLImageGL::unbindTexture(S32 stage) | |||
148 | // LLGLSLShader can return -1 | 154 | // LLGLSLShader can return -1 |
149 | if (stage >= 0) | 155 | if (stage >= 0) |
150 | { | 156 | { |
157 | gGL.flush(); | ||
151 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); | 158 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); |
152 | glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); | 159 | glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); |
153 | glBindTexture(GL_TEXTURE_2D, 0); | 160 | glBindTexture(GL_TEXTURE_2D, 0); |
@@ -411,6 +418,7 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const | |||
411 | llwarns << "Trying to bind a texture while GL is disabled!" << llendl; | 418 | llwarns << "Trying to bind a texture while GL is disabled!" << llendl; |
412 | } | 419 | } |
413 | 420 | ||
421 | |||
414 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); | 422 | glActiveTextureARB(GL_TEXTURE0_ARB + stage); |
415 | 423 | ||
416 | if (sCurrentBoundTextures[stage] && sCurrentBoundTextures[stage] == mTexName) | 424 | if (sCurrentBoundTextures[stage] && sCurrentBoundTextures[stage] == mTexName) |
@@ -425,12 +433,15 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const | |||
425 | mMissed = ! getIsResident(TRUE); | 433 | mMissed = ! getIsResident(TRUE); |
426 | #endif | 434 | #endif |
427 | 435 | ||
436 | gGL.flush(); | ||
428 | glBindTexture(mBindTarget, mTexName); | 437 | glBindTexture(mBindTarget, mTexName); |
429 | sCurrentBoundTextures[stage] = mTexName; | 438 | sCurrentBoundTextures[stage] = mTexName; |
439 | sBindCount++; | ||
430 | 440 | ||
431 | if (mLastBindTime != sLastFrameTime) | 441 | if (mLastBindTime != sLastFrameTime) |
432 | { | 442 | { |
433 | // we haven't accounted for this texture yet this frame | 443 | // we haven't accounted for this texture yet this frame |
444 | sUniqueCount++; | ||
434 | updateBoundTexMem(mTextureMemory); | 445 | updateBoundTexMem(mTextureMemory); |
435 | mLastBindTime = sLastFrameTime; | 446 | mLastBindTime = sLastFrameTime; |
436 | } | 447 | } |
@@ -439,6 +450,7 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const | |||
439 | } | 450 | } |
440 | else | 451 | else |
441 | { | 452 | { |
453 | gGL.flush(); | ||
442 | glBindTexture(mBindTarget, 0); | 454 | glBindTexture(mBindTarget, 0); |
443 | sCurrentBoundTextures[stage] = 0; | 455 | sCurrentBoundTextures[stage] = 0; |
444 | return FALSE; | 456 | return FALSE; |
@@ -665,7 +677,6 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) | |||
665 | } | 677 | } |
666 | mHasMipMaps = FALSE; | 678 | mHasMipMaps = FALSE; |
667 | } | 679 | } |
668 | glFlush(); | ||
669 | stop_glerror(); | 680 | stop_glerror(); |
670 | } | 681 | } |
671 | 682 | ||
@@ -686,7 +697,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
686 | return FALSE; | 697 | return FALSE; |
687 | } | 698 | } |
688 | 699 | ||
689 | if (x_pos == 0 && y_pos == 0 && width == getWidth() && height == getHeight()) | 700 | if (x_pos == 0 && y_pos == 0 && width == getWidth() && height == getHeight() && data_width == width && data_height == height) |
690 | { | 701 | { |
691 | setImage(datap, FALSE); | 702 | setImage(datap, FALSE); |
692 | } | 703 | } |
@@ -759,7 +770,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
759 | glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); | 770 | glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
760 | stop_glerror(); | 771 | stop_glerror(); |
761 | } | 772 | } |
762 | glFlush(); | 773 | |
763 | return TRUE; | 774 | return TRUE; |
764 | } | 775 | } |
765 | 776 | ||
@@ -1046,6 +1057,7 @@ void LLImageGL::destroyGLTexture() | |||
1046 | { | 1057 | { |
1047 | unbindTexture(i, GL_TEXTURE_2D); | 1058 | unbindTexture(i, GL_TEXTURE_2D); |
1048 | stop_glerror(); | 1059 | stop_glerror(); |
1060 | glActiveTextureARB(GL_TEXTURE0_ARB); | ||
1049 | } | 1061 | } |
1050 | } | 1062 | } |
1051 | 1063 | ||