Runs a simple compute shader that reads depth + tangent from for a particular pixel, and copies the results to a readback buffer that's used to generate the "cursor" decal
| 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 |
| 1970 | void BindlessDeferred::RenderPicking() |
| 1971 | { |
| 1972 | if(currMouseState.IsOverWindow == false || AppSettings::EnableDecalPicker == false) |
| 1973 | return; |
| 1974 | |
| 1975 | ID3D12GraphicsCommandList* cmdList = DX12::CmdList; |
| 1976 | |
| 1977 | PIXMarker pixMarker(cmdList, "Picking"); |
| 1978 | |
| 1979 | cmdList->SetPipelineState(AppSettings::MSAAMode != MSAAModes::MSAANone ? pickingPSOs[1] : pickingPSOs[0]); |
| 1980 | cmdList->SetComputeRootSignature(pickingRS); |
| 1981 | |
| 1982 | pickingConstants.Data.InverseViewProjection = Float4x4::Invert(camera.ViewProjectionMatrix()); |
| 1983 | pickingConstants.Data.PixelPos = Uint2(currMouseState.X, currMouseState.Y); |
| 1984 | pickingConstants.Data.RTSize.x = float(mainTarget.Width()); |
| 1985 | pickingConstants.Data.RTSize.y = float(mainTarget.Height()); |
| 1986 | pickingConstants.Upload(); |
| 1987 | pickingConstants.SetAsComputeRootParameter(cmdList, 0); |
| 1988 | |
| 1989 | pickingBuffer.MakeWritable(cmdList); |
| 1990 | |
| 1991 | D3D12_CPU_DESCRIPTOR_HANDLE descriptors[3] = { tangentFrameTarget.SRV(), depthBuffer.SRV(), pickingBuffer.UAV() }; |
| 1992 | DX12::BindShaderResources(cmdList, 1, ArraySize_(descriptors), descriptors, CmdListMode::Compute); |
| 1993 | |
| 1994 | cmdList->Dispatch(1, 1, 1); |
| 1995 | |
| 1996 | pickingBuffer.MakeReadable(cmdList); |
| 1997 | |
| 1998 | cmdList->CopyResource(pickingReadbackBuffers[DX12::CurrFrameIdx].Resource, pickingBuffer.InternalBuffer.Resource); |
| 1999 | } |
| 2000 | |
| 2001 | // Renders the 2D "overhead" visualizer that shows per-cluster light/decal counts |
| 2002 | void BindlessDeferred::RenderClusterVisualizer() |
nothing calls this directly
no test coverage detected