yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// d3d12-query.h 2#pragma once 3 4#include "d3d12-base.h" 5#include "d3d12-buffer.h" 6#include "d3d12-device.h" 7 8namespace gfx 9{ 10namespace d3d12 11{ 12 13using namespace Slang ; 14 15class QueryPoolImpl :public QueryPoolBase 16{ 17public : 18Result init (const IQueryPool ::Desc & desc ,DeviceImpl * device ); 19 20virtual SLANG_NO_THROW Result SLANG_MCALL 21getResult (GfxIndex queryIndex ,GfxCount count ,uint64_t * data )override ; 22 23void writeTimestamp (ID3D12GraphicsCommandList * cmdList ,GfxIndex index ); 24 25public : 26D3D12_QUERY_TYPE m_queryType ; 27ComPtr < ID3D12QueryHeap > m_queryHeap ; 28D3D12Resource m_readBackBuffer ; 29ComPtr < ID3D12CommandAllocator > m_commandAllocator ; 30ComPtr < ID3D12GraphicsCommandList > m_commandList ; 31ComPtr < ID3D12Fence > m_fence ; 32ComPtr < ID3D12CommandQueue > m_commandQueue ; 33HANDLE m_waitEvent ; 34UINT64 m_eventValue = 0 ; 35}; 36 37/// Implements the IQueryPool interface with a plain buffer. 38/// Used for query types that does not correspond to a D3D query, 39/// such as ray-tracing acceleration structure post-build info. 40class PlainBufferProxyQueryPoolImpl :public QueryPoolBase 41{ 42public : 43SLANG_COM_OBJECT_IUNKNOWN_ALL 44IQueryPool * getInterface (const Guid & guid ); 45 46public : 47Result init (const IQueryPool ::Desc & desc ,DeviceImpl * device ,uint32_t stride ); 48 49virtual SLANG_NO_THROW Result SLANG_MCALL reset ()override ; 50virtual SLANG_NO_THROW Result SLANG_MCALL 51getResult ( GfxIndex queryIndex, GfxCount count, uint64_t * data) override; 52 53public: 54QueryType m_queryType; 55RefPtr < BufferResourceImpl > m_bufferResource; 56RefPtr < DeviceImpl > m_device; 57List < uint8_t > m_result; 58bool m_resultDirty = true; 59uint32_t m_stride = 0 ; 60uint32_t m_count = 0 ; 61}; 62 63} // namespace d3d12 64} // namespace gfx