| 102 | } |
| 103 | |
| 104 | void RenderFormatToken::process(SceneRenderState *state, RenderPassStateBin *callingBin) |
| 105 | { |
| 106 | switch(mFCState) |
| 107 | { |
| 108 | case FTSWaiting: |
| 109 | { |
| 110 | GFXDEBUGEVENT_SCOPE_EX(RFT_Waiting, ColorI::BLUE, avar("[%s Activate] (%s)", getName(), GFXStringTextureFormat[mColorFormat])); |
| 111 | mFCState = FTSActive; |
| 112 | |
| 113 | mTarget.setViewport( GFX->getViewport() ); |
| 114 | |
| 115 | // Update targets |
| 116 | _updateTargets(); |
| 117 | |
| 118 | // If we have a copy PostEffect then get the active backbuffer copy |
| 119 | // now before we swap the render targets. |
| 120 | GFXTexHandle curBackBuffer; |
| 121 | if(mCopyPostEffect.isValid()) |
| 122 | curBackBuffer = PFXMGR->getBackBufferTex(); |
| 123 | |
| 124 | // Push target |
| 125 | GFX->pushActiveRenderTarget(); |
| 126 | GFX->setActiveRenderTarget(mTargetChain[mTargetChainIdx]); |
| 127 | |
| 128 | // Set viewport |
| 129 | GFX->setViewport( mTarget.getViewport() ); |
| 130 | |
| 131 | // Clear |
| 132 | GFX->clear(GFXClearTarget | GFXClearZBuffer | GFXClearStencil, gCanvasClearColor, 1.0f, 0); |
| 133 | |
| 134 | // Set active z target on render pass |
| 135 | if(mTargetDepthStencilTexture[mTargetChainIdx].isValid()) |
| 136 | { |
| 137 | if(callingBin->getRenderPass()->getDepthTargetTexture() != GFXTextureTarget::sDefaultDepthStencil) |
| 138 | mStoredPassZTarget = callingBin->getRenderPass()->getDepthTargetTexture(); |
| 139 | else |
| 140 | mStoredPassZTarget = NULL; |
| 141 | |
| 142 | callingBin->getRenderPass()->setDepthTargetTexture(mTargetDepthStencilTexture[mTargetChainIdx]); |
| 143 | } |
| 144 | |
| 145 | // Run the PostEffect which copies data into the new target. |
| 146 | if ( mCopyPostEffect.isValid() ) |
| 147 | mCopyPostEffect->process( state, curBackBuffer, &mTarget.getViewport() ); |
| 148 | } |
| 149 | break; |
| 150 | |
| 151 | case FTSActive: |
| 152 | { |
| 153 | GFXDEBUGEVENT_SCOPE_EX(RFT_Active, ColorI::BLUE, avar("[%s Deactivate]", getName())); |
| 154 | mFCState = FTSComplete; |
| 155 | |
| 156 | // Pop target |
| 157 | AssertFatal(GFX->getActiveRenderTarget() == mTargetChain[mTargetChainIdx], "Render target stack went wrong somewhere"); |
| 158 | mTargetChain[mTargetChainIdx]->resolve(); |
| 159 | GFX->popActiveRenderTarget(); |
| 160 | mTarget.setTexture( mTargetColorTexture[mTargetChainIdx] ); |
| 161 |
nothing calls this directly
no test coverage detected