| 229 | } |
| 230 | |
| 231 | void HnPostProcessTask::PostProcessingTechnique::PrepareSRB(ITextureView* pClosestSelectedLocationSRV, Uint32 FrameIdx) |
| 232 | { |
| 233 | const auto* FrameTargets = PPTask.m_FrameTargets; |
| 234 | |
| 235 | for (Uint32 i = 0; i < HnFrameRenderTargets::GBUFFER_TARGET_COUNT; ++i) |
| 236 | { |
| 237 | if (FrameTargets->GBufferSRVs[i] == nullptr) |
| 238 | { |
| 239 | UNEXPECTED("G-buffer SRV ", i, " is null"); |
| 240 | return; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | ITextureView* pDepthSRV = FrameTargets->DepthDSV->GetTexture()->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE); |
| 245 | if (pDepthSRV == nullptr) |
| 246 | { |
| 247 | UNEXPECTED("Depth SRV is null"); |
| 248 | return; |
| 249 | } |
| 250 | |
| 251 | ITextureView* pSelectionDepthSRV = FrameTargets->SelectionDepthDSV->GetTexture()->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE); |
| 252 | if (pSelectionDepthSRV == nullptr) |
| 253 | { |
| 254 | UNEXPECTED("Selection depth SRV is null"); |
| 255 | return; |
| 256 | } |
| 257 | |
| 258 | ITextureView* pSSR = PPTask.m_SSR->GetSSRRadianceSRV(); |
| 259 | VERIFY_EXPR(pSSR != nullptr); |
| 260 | |
| 261 | ITextureView* pSSAO = PPTask.m_SSAO->GetAmbientOcclusionSRV(); |
| 262 | VERIFY_EXPR(pSSAO != nullptr); |
| 263 | |
| 264 | size_t ResIdx = FrameIdx % Resources.size(); |
| 265 | auto& SRB = Resources[ResIdx].SRB; |
| 266 | auto& ShaderVars = Resources[ResIdx].Vars; |
| 267 | |
| 268 | ITextureView* pOffscreenColorSRV = FrameTargets->GBufferSRVs[HnFrameRenderTargets::GBUFFER_TARGET_SCENE_COLOR]; |
| 269 | ITextureView* pSpecularIblSRV = FrameTargets->GBufferSRVs[HnFrameRenderTargets::GBUFFER_TARGET_IBL]; |
| 270 | ITextureView* pNormalSRV = FrameTargets->GBufferSRVs[HnFrameRenderTargets::GBUFFER_TARGET_NORMAL]; |
| 271 | ITextureView* pMaterialSRV = FrameTargets->GBufferSRVs[HnFrameRenderTargets::GBUFFER_TARGET_MATERIAL]; |
| 272 | ITextureView* pBaseColorSRV = FrameTargets->GBufferSRVs[HnFrameRenderTargets::GBUFFER_TARGET_BASE_COLOR]; |
| 273 | if (SRB) |
| 274 | { |
| 275 | auto VarValueChanged = [](const ShaderResourceVariableX& Var, IDeviceObject* pValue) { |
| 276 | return Var && Var.Get() != pValue; |
| 277 | }; |
| 278 | |
| 279 | if (VarValueChanged(ShaderVars.Color, pOffscreenColorSRV) || |
| 280 | VarValueChanged(ShaderVars.Depth, pDepthSRV) || |
| 281 | VarValueChanged(ShaderVars.SelectionDepth, pSelectionDepthSRV) || |
| 282 | VarValueChanged(ShaderVars.ClosestSelectedLocation, pClosestSelectedLocationSRV) || |
| 283 | VarValueChanged(ShaderVars.SSR, pSSR) || |
| 284 | VarValueChanged(ShaderVars.SSAO, pSSAO) || |
| 285 | VarValueChanged(ShaderVars.SpecularIBL, pSpecularIblSRV) || |
| 286 | VarValueChanged(ShaderVars.Normal, pNormalSRV) || |
| 287 | VarValueChanged(ShaderVars.Material, pMaterialSRV) || |
| 288 | VarValueChanged(ShaderVars.BaseColor, pBaseColorSRV)) |
no test coverage detected