| 213 | } |
| 214 | |
| 215 | void MultiScaler::DownscaleDepth(GPUContext* context, int32 dstWidth, int32 dstHeight, GPUTexture* src, GPUTextureView* dst) |
| 216 | { |
| 217 | PROFILE_GPU_CPU("Downscale Depth"); |
| 218 | bool outputDepth = ((GPUTexture*)dst->GetParent())->IsDepthStencil(); |
| 219 | if (checkIfSkipPass()) |
| 220 | { |
| 221 | if (outputDepth) |
| 222 | context->ClearDepth(dst); |
| 223 | else |
| 224 | context->Clear(dst, Color::Transparent); |
| 225 | return; |
| 226 | } |
| 227 | |
| 228 | // Prepare |
| 229 | Data data; |
| 230 | data.TexelSize.X = 1.0f / (float)src->Width(); |
| 231 | data.TexelSize.Y = 1.0f / (float)src->Height(); |
| 232 | auto cb = _shader->GetShader()->GetCB(0); |
| 233 | context->UpdateCB(cb, &data); |
| 234 | context->BindCB(0, cb); |
| 235 | |
| 236 | // Draw |
| 237 | context->SetViewportAndScissors((float)dstWidth, (float)dstHeight); |
| 238 | if (outputDepth) |
| 239 | context->SetRenderTarget(dst, (GPUTextureView*)nullptr); |
| 240 | else |
| 241 | context->SetRenderTarget(dst); |
| 242 | context->BindSR(0, src); |
| 243 | context->SetState(_psHalfDepth[outputDepth ? 1 : 0]); |
| 244 | context->DrawFullscreenTriangle(); |
| 245 | |
| 246 | // Cleanup |
| 247 | context->ResetRenderTarget(); |
| 248 | context->UnBindCB(0); |
| 249 | } |
| 250 | |
| 251 | void MultiScaler::BuildHiZ(GPUContext* context, GPUTexture* srcDepth, GPUTexture* dstHiZ) |
| 252 | { |
no test coverage detected