MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / RenderResolve

Method RenderResolve

BindlessDeferred/BindlessDeferred.cpp:1929–1966  ·  view source on GitHub ↗

Performs MSAA resolve with a full-screen pixel shader

Source from the content-addressed store, hash-verified

1927
1928// Performs MSAA resolve with a full-screen pixel shader
1929void BindlessDeferred::RenderResolve()
1930{
1931 if(AppSettings::MSAAMode == MSAAModes::MSAANone)
1932 return;
1933
1934 ID3D12GraphicsCommandList* cmdList = DX12::CmdList;
1935
1936 PIXMarker pixMarker(cmdList, "MSAA Resolve");
1937 ProfileBlock profileBlock(cmdList, "MSAA Resolve");
1938
1939 resolveTarget.MakeWritable(cmdList);
1940
1941 D3D12_CPU_DESCRIPTOR_HANDLE rtvs[1] = { resolveTarget.RTV.CPUHandle };
1942 cmdList->OMSetRenderTargets(ArraySize_(rtvs), rtvs, false, nullptr);
1943 DX12::SetViewport(cmdList, resolveTarget.Width(), resolveTarget.Height());
1944
1945 const uint64 deferred = AppSettings::RenderMode == RenderModes::DeferredTexturing ? 1 : 0;
1946 ID3D12PipelineState* pso = resolvePSOs[deferred];
1947
1948 cmdList->SetGraphicsRootSignature(resolveRootSignature);
1949 cmdList->SetPipelineState(pso);
1950
1951 cmdList->SetGraphicsRoot32BitConstant(0, uint32(mainTarget.Width()), 0);
1952 cmdList->SetGraphicsRoot32BitConstant(0, uint32(mainTarget.Height()), 1);
1953
1954 AppSettings::BindCBufferGfx(cmdList, 1);
1955
1956 D3D12_CPU_DESCRIPTOR_HANDLE srvs[1] = { deferred ? deferredMSAATarget.SRV() : mainTarget.SRV() };
1957 DX12::BindShaderResources(cmdList, 2, ArraySize_(srvs), srvs);
1958
1959 cmdList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
1960 cmdList->IASetIndexBuffer(nullptr);
1961 cmdList->IASetVertexBuffers(0, 0, nullptr);
1962
1963 cmdList->DrawInstanced(3, 1, 0, 0);
1964
1965 resolveTarget.MakeReadable(cmdList);
1966}
1967
1968// Runs a simple compute shader that reads depth + tangent from for a particular pixel, and copies
1969// the results to a readback buffer that's used to generate the "cursor" decal

Callers

nothing calls this directly

Calls 8

SetViewportFunction · 0.85
BindCBufferGfxFunction · 0.85
BindShaderResourcesFunction · 0.85
MakeWritableMethod · 0.80
MakeReadableMethod · 0.80
WidthMethod · 0.45
HeightMethod · 0.45
SRVMethod · 0.45

Tested by

no test coverage detected