diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llrender/llrender.cpp | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/linden/indra/llrender/llrender.cpp b/linden/indra/llrender/llrender.cpp index b1fe153..07ba9f1 100644 --- a/linden/indra/llrender/llrender.cpp +++ b/linden/indra/llrender/llrender.cpp | |||
@@ -47,7 +47,7 @@ F64 gGLLastModelView[16]; | |||
47 | F64 gGLProjection[16]; | 47 | F64 gGLProjection[16]; |
48 | S32 gGLViewport[4]; | 48 | S32 gGLViewport[4]; |
49 | 49 | ||
50 | static const U32 LL_NUM_TEXTURE_LAYERS = 8; | 50 | static const U32 LL_NUM_TEXTURE_LAYERS = 16; // KL was 8 ( keep a track on this ) 16 in render-pipeline |
51 | 51 | ||
52 | static GLenum sGLTextureType[] = | 52 | static GLenum sGLTextureType[] = |
53 | { | 53 | { |
@@ -192,24 +192,25 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) | |||
192 | 192 | ||
193 | if (!texture->getTexName()) //if texture does not exist | 193 | if (!texture->getTexName()) //if texture does not exist |
194 | { | 194 | { |
195 | if (texture->isDeleted()) | 195 | //if deleted, will re-generate it immediately |
196 | { | 196 | texture->forceImmediateUpdate() ; |
197 | // This will re-generate the texture immediately. | ||
198 | texture->forceImmediateUpdate() ; | ||
199 | } | ||
200 | 197 | ||
201 | texture->forceUpdateBindStats() ; | ||
202 | return texture->bindDefaultImage(mIndex); | 198 | return texture->bindDefaultImage(mIndex); |
203 | } | 199 | } |
204 | 200 | ||
205 | if(gAuditTexture && for_rendering && LLImageGL::sCurTexPickSize > 0) | 201 | #if !LL_RELEASE_FOR_DOWNLOAD |
202 | if(for_rendering) | ||
206 | { | 203 | { |
207 | if(texture->getWidth() * texture->getHeight() == LLImageGL::sCurTexPickSize) | 204 | int w = texture->getWidth(texture->getDiscardLevel()) ; |
205 | int h = texture->getHeight(texture->getDiscardLevel()) ; | ||
206 | |||
207 | if(w * h == LLImageGL::sCurTexPickSize) | ||
208 | { | 208 | { |
209 | texture->updateBindStats(); | 209 | texture->updateBindStats(); |
210 | return bind(LLImageGL::sDefaultTexturep.get()); | 210 | return bind(LLImageGL::sDefaultTexturep.get()); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | #endif | ||
213 | 214 | ||
214 | if ((mCurrTexture != texture->getTexName()) || forceBind) | 215 | if ((mCurrTexture != texture->getTexName()) || forceBind) |
215 | { | 216 | { |
@@ -227,7 +228,6 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) | |||
227 | setTextureFilteringOption(texture->mFilterOption); | 228 | setTextureFilteringOption(texture->mFilterOption); |
228 | } | 229 | } |
229 | } | 230 | } |
230 | |||
231 | return true; | 231 | return true; |
232 | } | 232 | } |
233 | 233 | ||
@@ -280,6 +280,11 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) | |||
280 | 280 | ||
281 | if (bindDepth) | 281 | if (bindDepth) |
282 | { | 282 | { |
283 | if (renderTarget->hasStencil()) | ||
284 | { | ||
285 | llwarns << "Cannot bind a render buffer for sampling. Allocate render target without a stencil buffer if sampling of depth buffer is required." << llendl; | ||
286 | } | ||
287 | |||
283 | bindManual(renderTarget->getUsage(), renderTarget->getDepth()); | 288 | bindManual(renderTarget->getUsage(), renderTarget->getDepth()); |
284 | } | 289 | } |
285 | else | 290 | else |
@@ -293,15 +298,18 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) | |||
293 | 298 | ||
294 | bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) | 299 | bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) |
295 | { | 300 | { |
296 | if (mIndex < 0 || mCurrTexture == texture) return false; | 301 | if (mIndex < 0) return false; |
297 | |||
298 | gGL.flush(); | ||
299 | 302 | ||
300 | activate(); | 303 | if(mCurrTexture != texture) |
301 | enable(type); | 304 | { |
302 | mCurrTexture = texture; | 305 | gGL.flush(); |
303 | glBindTexture(sGLTextureType[type], texture); | 306 | |
304 | mHasMipMaps = hasMips; | 307 | activate(); |
308 | enable(type); | ||
309 | mCurrTexture = texture; | ||
310 | glBindTexture(sGLTextureType[type], texture); | ||
311 | mHasMipMaps = hasMips; | ||
312 | } | ||
305 | return true; | 313 | return true; |
306 | } | 314 | } |
307 | 315 | ||
@@ -414,7 +422,7 @@ void LLTexUnit::setTextureBlendType(eTextureBlendType type) | |||
414 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); | 422 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); |
415 | break; | 423 | break; |
416 | default: | 424 | default: |
417 | llerrs << "Unknown Texture Blend Type: " << type << llendl; | 425 | llwarns << "Unknown Texture Blend Type: " << type << llendl; |
418 | break; | 426 | break; |
419 | } | 427 | } |
420 | setColorScale(scale_amount); | 428 | setColorScale(scale_amount); |
@@ -809,7 +817,7 @@ void LLRender::setSceneBlendType(eBlendType type) | |||
809 | glBlendFunc(GL_ONE, GL_ZERO); | 817 | glBlendFunc(GL_ONE, GL_ZERO); |
810 | break; | 818 | break; |
811 | default: | 819 | default: |
812 | llerrs << "Unknown Scene Blend Type: " << type << llendl; | 820 | llwarns << "Unknown Scene Blend Type: " << type << llendl; |
813 | break; | 821 | break; |
814 | } | 822 | } |
815 | } | 823 | } |
@@ -883,7 +891,7 @@ void LLRender::begin(const GLuint& mode) | |||
883 | } | 891 | } |
884 | else if (mCount != 0) | 892 | else if (mCount != 0) |
885 | { | 893 | { |
886 | llerrs << "gGL.begin() called redundantly." << llendl; | 894 | llwarns << "gGL.begin() called redundantly." << llendl; |
887 | } | 895 | } |
888 | 896 | ||
889 | mMode = mode; | 897 | mMode = mode; |
@@ -914,22 +922,22 @@ void LLRender::flush() | |||
914 | #if 0 | 922 | #if 0 |
915 | if (!glIsEnabled(GL_VERTEX_ARRAY)) | 923 | if (!glIsEnabled(GL_VERTEX_ARRAY)) |
916 | { | 924 | { |
917 | llerrs << "foo 1" << llendl; | 925 | llwarns << "foo 1" << llendl; |
918 | } | 926 | } |
919 | 927 | ||
920 | if (!glIsEnabled(GL_COLOR_ARRAY)) | 928 | if (!glIsEnabled(GL_COLOR_ARRAY)) |
921 | { | 929 | { |
922 | llerrs << "foo 2" << llendl; | 930 | llwarns << "foo 2" << llendl; |
923 | } | 931 | } |
924 | 932 | ||
925 | if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) | 933 | if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) |
926 | { | 934 | { |
927 | llerrs << "foo 3" << llendl; | 935 | llwarns << "foo 3" << llendl; |
928 | } | 936 | } |
929 | 937 | ||
930 | if (glIsEnabled(GL_NORMAL_ARRAY)) | 938 | if (glIsEnabled(GL_NORMAL_ARRAY)) |
931 | { | 939 | { |
932 | llerrs << "foo 7" << llendl; | 940 | llwarns << "foo 7" << llendl; |
933 | } | 941 | } |
934 | 942 | ||
935 | GLvoid* pointer; | 943 | GLvoid* pointer; |
@@ -937,19 +945,19 @@ void LLRender::flush() | |||
937 | glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); | 945 | glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); |
938 | if (pointer != &(mBuffer[0].v)) | 946 | if (pointer != &(mBuffer[0].v)) |
939 | { | 947 | { |
940 | llerrs << "foo 4" << llendl; | 948 | llwarns << "foo 4" << llendl; |
941 | } | 949 | } |
942 | 950 | ||
943 | glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); | 951 | glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); |
944 | if (pointer != &(mBuffer[0].c)) | 952 | if (pointer != &(mBuffer[0].c)) |
945 | { | 953 | { |
946 | llerrs << "foo 5" << llendl; | 954 | llwarns << "foo 5" << llendl; |
947 | } | 955 | } |
948 | 956 | ||
949 | glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); | 957 | glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); |
950 | if (pointer != &(mBuffer[0].uv)) | 958 | if (pointer != &(mBuffer[0].uv)) |
951 | { | 959 | { |
952 | llerrs << "foo 6" << llendl; | 960 | llwarns << "foo 6" << llendl; |
953 | } | 961 | } |
954 | #endif | 962 | #endif |
955 | 963 | ||