| 19 | using namespace donut::engine; |
| 20 | |
| 21 | PostProcess::PostProcess( nvrhi::IDevice* device, std::shared_ptr<donut::engine::ShaderFactory> shaderFactory, |
| 22 | std::shared_ptr<engine::CommonRenderPasses> commonPasses, std::shared_ptr<ShaderDebug> shaderDebug |
| 23 | ) |
| 24 | : m_device(device) |
| 25 | , m_commonPasses(commonPasses) |
| 26 | , m_bindingCache(device) |
| 27 | , m_shaderDebug(shaderDebug) |
| 28 | { |
| 29 | |
| 30 | for (uint32_t i = 0; i < (uint32_t)ComputePassType::MaxCount; i++) |
| 31 | { |
| 32 | std::vector<donut::engine::ShaderMacro> shaderMacros; |
| 33 | switch ((ComputePassType)i) |
| 34 | { |
| 35 | case(ComputePassType::StablePlanesDebugViz): |
| 36 | shaderMacros.push_back(donut::engine::ShaderMacro({ "STABLE_PLANES_DEBUG_VIZ", "1" })); |
| 37 | break; |
| 38 | case(ComputePassType::RELAXDenoiserPrepareInputs): |
| 39 | shaderMacros.push_back(donut::engine::ShaderMacro({ "DENOISER_PREPARE_INPUTS", "1" })); |
| 40 | shaderMacros.push_back(donut::engine::ShaderMacro({ "USE_RELAX", "1" })); |
| 41 | break; |
| 42 | case(ComputePassType::REBLURDenoiserPrepareInputs): |
| 43 | shaderMacros.push_back(donut::engine::ShaderMacro({ "DENOISER_PREPARE_INPUTS", "1" })); |
| 44 | shaderMacros.push_back(donut::engine::ShaderMacro({ "USE_RELAX", "0" })); |
| 45 | break; |
| 46 | case(ComputePassType::RELAXDenoiserFinalMerge): |
| 47 | shaderMacros.push_back(donut::engine::ShaderMacro({ "DENOISER_FINAL_MERGE", "1" })); |
| 48 | shaderMacros.push_back(donut::engine::ShaderMacro({ "USE_RELAX", "1" })); |
| 49 | break; |
| 50 | case(ComputePassType::REBLURDenoiserFinalMerge): |
| 51 | shaderMacros.push_back(donut::engine::ShaderMacro({ "DENOISER_FINAL_MERGE", "1" })); |
| 52 | shaderMacros.push_back(donut::engine::ShaderMacro({ "USE_RELAX", "0" })); |
| 53 | break; |
| 54 | case(ComputePassType::DLSSRRDenoiserPrepareInputs): |
| 55 | shaderMacros.push_back(donut::engine::ShaderMacro({ "DENOISER_PREPARE_INPUTS", "1" })); |
| 56 | shaderMacros.push_back(donut::engine::ShaderMacro({ "DENOISER_DLSS_RR", "1" })); |
| 57 | break; |
| 58 | case(ComputePassType::NoDenoiserFinalMerge): |
| 59 | shaderMacros.push_back(donut::engine::ShaderMacro({ "NO_DENOISER_FINAL_MERGE", "1" })); |
| 60 | break; |
| 61 | case(ComputePassType::DummyPlaceholder): shaderMacros.push_back(donut::engine::ShaderMacro({ "DUMMY_PLACEHOLDER_EFFECT", "1" })); break; |
| 62 | }; |
| 63 | m_computeShaders[i] = shaderFactory->CreateShader("app/ProcessingPasses/PostProcess.hlsl", "main", &shaderMacros, nvrhi::ShaderType::Compute); |
| 64 | } |
| 65 | //m_MainCS = shaderFactory->CreateShader("app/ProcessingPasses/PostProcess.hlsl", "main", &std::vector<donut::engine::ShaderMacro>(1, donut::engine::ShaderMacro("USE_CS", "1")), nvrhi::ShaderType::Compute); |
| 66 | |
| 67 | nvrhi::BindingLayoutDesc layoutDesc; |
| 68 | |
| 69 | layoutDesc.visibility = nvrhi::ShaderType::Compute | nvrhi::ShaderType::Pixel; |
| 70 | layoutDesc.bindings = { |
| 71 | nvrhi::BindingLayoutItem::VolatileConstantBuffer(0), |
| 72 | nvrhi::BindingLayoutItem::PushConstants(1, sizeof(SampleMiniConstants)), |
| 73 | nvrhi::BindingLayoutItem::Texture_SRV(0), |
| 74 | nvrhi::BindingLayoutItem::Texture_UAV(0), |
| 75 | nvrhi::BindingLayoutItem::Texture_SRV(2), |
| 76 | nvrhi::BindingLayoutItem::Texture_SRV(3), |
| 77 | nvrhi::BindingLayoutItem::Texture_SRV(4), |
| 78 | nvrhi::BindingLayoutItem::Texture_SRV(5), |
nothing calls this directly
no test coverage detected