aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llrender')
-rw-r--r--linden/indra/llrender/llimagegl.cpp2
-rw-r--r--linden/indra/llrender/llrender.cpp24
-rw-r--r--linden/indra/llrender/llrender.h11
3 files changed, 20 insertions, 17 deletions
diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp
index a41b931..9a392d7 100644
--- a/linden/indra/llrender/llimagegl.cpp
+++ b/linden/indra/llrender/llimagegl.cpp
@@ -748,7 +748,7 @@ BOOL LLImageGL::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S3
748// Copy sub image from frame buffer 748// Copy sub image from frame buffer
749BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height) 749BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height)
750{ 750{
751 if (gGL.getTexUnit(0)->bind(this)) 751 if (gGL.getTexUnit(0)->bind(this, true))
752 { 752 {
753 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height); 753 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height);
754 mInitialized = true; 754 mInitialized = true;
diff --git a/linden/indra/llrender/llrender.cpp b/linden/indra/llrender/llrender.cpp
index a15f44a..fcd76d4 100644
--- a/linden/indra/llrender/llrender.cpp
+++ b/linden/indra/llrender/llrender.cpp
@@ -175,7 +175,7 @@ void LLTexUnit::disable(void)
175 } 175 }
176} 176}
177 177
178bool LLTexUnit::bind(const LLImageGL* texture) 178bool LLTexUnit::bind(const LLImageGL* texture, bool forceBind)
179{ 179{
180 if (mIndex < 0) return false; 180 if (mIndex < 0) return false;
181 181
@@ -183,29 +183,27 @@ bool LLTexUnit::bind(const LLImageGL* texture)
183 183
184 if (texture == NULL) 184 if (texture == NULL)
185 { 185 {
186 return texture->bindError(mIndex); 186 llwarns << "NULL LLTexUnit::bind texture" << llendl;
187 return false;
187 } 188 }
188 189
189 if (!texture->isInitialized()) 190 if (!texture->isInitialized() && !forceBind)
190 { 191 {
191 return texture->bindDefaultImage(mIndex); 192 return texture->bindDefaultImage(mIndex);
192 } 193 }
194
193 if (!texture->getTexName()) //if texture does not exist 195 if (!texture->getTexName()) //if texture does not exist
194 { 196 {
195 return texture->bindDefaultImage(mIndex); 197 return texture->bindDefaultImage(mIndex);
196 } 198 }
197 199
198 // Disabled caching of binding state. 200 // Disabled caching of binding state.
199 if (texture != NULL) 201 activate();
200 { 202 enable(texture->getTarget());
201 activate(); 203 mCurrTexture = texture->getTexName();
202 enable(texture->getTarget()); 204 glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
203 mCurrTexture = texture->getTexName(); 205 texture->updateBindStats();
204 glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture); 206 return true;
205 texture->updateBindStats();
206 return true;
207 }
208 return false;
209} 207}
210 208
211bool LLTexUnit::bind(LLCubeMap* cubeMap) 209bool LLTexUnit::bind(LLCubeMap* cubeMap)
diff --git a/linden/indra/llrender/llrender.h b/linden/indra/llrender/llrender.h
index 8c648f3..7dcb504 100644
--- a/linden/indra/llrender/llrender.h
+++ b/linden/indra/llrender/llrender.h
@@ -135,12 +135,17 @@ public:
135 // Disables the current texture unit 135 // Disables the current texture unit
136 void disable(void); 136 void disable(void);
137 137
138 // Binds the LLImageGL to this texture unit (automatically enables the unit for the LLImageGL's texture type) 138 // Binds the LLImageGL to this texture unit
139 bool bind(const LLImageGL* texture); 139 // (automatically enables the unit for the LLImageGL's texture type)
140 // Binds a cubemap to this texture unit (automatically enables the texture unit for cubemaps) 140 bool bind(const LLImageGL* texture, bool forceBind = false);
141
142 // Binds a cubemap to this texture unit
143 // (automatically enables the texture unit for cubemaps)
141 bool bind(LLCubeMap* cubeMap); 144 bool bind(LLCubeMap* cubeMap);
145
142 // Binds a render target to this texture unit (automatically enables the texture unit for the RT's texture type) 146 // Binds a render target to this texture unit (automatically enables the texture unit for the RT's texture type)
143 bool bind(LLRenderTarget * renderTarget, bool bindDepth = false); 147 bool bind(LLRenderTarget * renderTarget, bool bindDepth = false);
148
144 // Manually binds a texture to the texture unit (automatically enables the tex unit for the given texture type) 149 // Manually binds a texture to the texture unit (automatically enables the tex unit for the given texture type)
145 bool bindManual(eTextureType type, U32 texture); 150 bool bindManual(eTextureType type, U32 texture);
146 151