| 195 | } |
| 196 | |
| 197 | void RenderFormatToken::_updateTargets() |
| 198 | { |
| 199 | if ( GFX->getActiveRenderTarget() == NULL ) |
| 200 | return; |
| 201 | |
| 202 | const Point2I &rtSize = GFX->getActiveRenderTarget()->getSize(); |
| 203 | |
| 204 | if ( rtSize.x <= mTargetSize.x && |
| 205 | rtSize.y <= mTargetSize.y && |
| 206 | !mTargetUpdatePending ) |
| 207 | return; |
| 208 | |
| 209 | mTargetSize = rtSize; |
| 210 | mTargetUpdatePending = false; |
| 211 | mTargetChainIdx = 0; |
| 212 | |
| 213 | for( U32 i = 0; i < TargetChainLength; i++ ) |
| 214 | { |
| 215 | if( !mTargetChain[i] ) |
| 216 | mTargetChain[i] = GFX->allocRenderToTextureTarget(); |
| 217 | |
| 218 | // Update color target |
| 219 | if(mColorFormat != GFXFormat_COUNT) |
| 220 | { |
| 221 | // try reuse of old color texture |
| 222 | if( !mTargetColorTexture[i] || mTargetColorTexture[i].getFormat() != mColorFormat |
| 223 | || mTargetColorTexture[i].getWidthHeight() != rtSize) |
| 224 | { |
| 225 | mTargetColorTexture[i].set( rtSize.x, rtSize.y, mColorFormat, |
| 226 | &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), |
| 227 | 1, mTargetAALevel ); |
| 228 | mTargetChain[i]->attachTexture( GFXTextureTarget::Color0, mTargetColorTexture[i] ); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | // Update depth target |
| 236 | if(mDepthFormat != GFXFormat_COUNT) |
| 237 | { |
| 238 | // try reuse of old depth texture |
| 239 | if( !mTargetDepthStencilTexture[i] || mTargetDepthStencilTexture[i].getFormat() != mColorFormat |
| 240 | || mTargetDepthStencilTexture[i].getWidthHeight() != rtSize) |
| 241 | { |
| 242 | mTargetDepthStencilTexture[i].set( rtSize.x, rtSize.y, mDepthFormat, |
| 243 | &GFXDefaultZTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), |
| 244 | 1, mTargetAALevel ); |
| 245 | mTargetChain[i]->attachTexture( GFXTextureTarget::DepthStencil, mTargetDepthStencilTexture[i] ); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | void RenderFormatToken::_teardownTargets() |
| 254 | { |
nothing calls this directly
no test coverage detected