| 187 | }); |
| 188 | |
| 189 | void ExponentialHeightFog::DrawFog(GPUContext* context, RenderContext& renderContext, GPUTextureView* output) |
| 190 | { |
| 191 | PROFILE_GPU_CPU("Exponential Height Fog"); |
| 192 | auto volumetricFogTexture = renderContext.List->Fog.VolumetricFogTexture; |
| 193 | bool useVolumetricFog = volumetricFogTexture != nullptr; |
| 194 | |
| 195 | // Setup shader inputs |
| 196 | Data data; |
| 197 | GBufferPass::SetInputs(renderContext.View, data.GBuffer); |
| 198 | data.ExponentialHeightFog = renderContext.List->Fog.ExponentialHeightFogData; |
| 199 | data.VolumetricFog = renderContext.List->Fog.VolumetricFogData; |
| 200 | data.TemporalAAJitter = renderContext.View.TemporalAAJitter; |
| 201 | auto cb = _shader->GetShader()->GetCB(0); |
| 202 | ASSERT_LOW_LAYER(cb->GetSize() == sizeof(Data)); |
| 203 | context->UpdateCB(cb, &data); |
| 204 | context->BindCB(0, cb); |
| 205 | context->BindSR(0, renderContext.Buffers->DepthBuffer); |
| 206 | context->BindSR(1, volumetricFogTexture); |
| 207 | |
| 208 | // TODO: instead of rendering fullscreen triangle, draw quad transformed at the fog start distance (also it could use early depth discard) |
| 209 | // TODO: or use DepthBounds to limit the fog rendering to the distance range |
| 210 | |
| 211 | // Draw fog |
| 212 | const int32 psIndex = (useVolumetricFog ? 1 : 0); |
| 213 | context->SetState(_psFog.Get(psIndex)); |
| 214 | context->SetRenderTarget(output); |
| 215 | context->DrawFullscreenTriangle(); |
| 216 | } |
| 217 | |
| 218 | void ExponentialHeightFog::OnEnable() |
| 219 | { |
nothing calls this directly
no test coverage detected