diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-04-29 08:28:40 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-29 08:28:40 +0800 |
| commit | 5df7ada451a993efff2b80bb1af2d8c7579ba00b (patch) | |
| tree | d28dc6704e4f12ec68a1e9a32f6a1ee439888387 /tools/gfx | |
| parent | 2492ec59fb52c15d1658ab32f473521b40664168 (diff) | |
Minor tidyings around d3d usage (#2854)
* Remove unused COM annotation
* Move SLANG_ENABLE_DXBC_SUPPORT to slang.h
* Add DX11 simple compute test
* Remove unnecessary COM parameter annotation
* Run compute smoke test for DX12
* Ignore d3d11 tests when we do not have fxc
* Do not try to find NVAPI on Linux
* Add some logs to .gitignore
* Minor cleanups in d3d12 headers
* Fix tautological comparison (due to integer overflow)
* Limit OutputDebugStringA to Windows
Diffstat (limited to 'tools/gfx')
| -rw-r--r-- | tools/gfx/d3d/d3d-util.cpp | 14 | ||||
| -rw-r--r-- | tools/gfx/d3d12/d3d12-command-encoder.h | 4 | ||||
| -rw-r--r-- | tools/gfx/d3d12/d3d12-device.h | 2 | ||||
| -rw-r--r-- | tools/gfx/d3d12/d3d12-submitter.h | 8 |
4 files changed, 15 insertions, 13 deletions
diff --git a/tools/gfx/d3d/d3d-util.cpp b/tools/gfx/d3d/d3d-util.cpp index c5092ddbd..aff610796 100644 --- a/tools/gfx/d3d/d3d-util.cpp +++ b/tools/gfx/d3d/d3d-util.cpp @@ -4,7 +4,7 @@ #include <d3d12.h> #include <dxgi1_4.h> #include <dxgidebug.h> -#if SLANG_ENABLE_FXC +#if SLANG_ENABLE_DXBC_SUPPORT #include <d3dcompiler.h> #endif @@ -418,6 +418,9 @@ bool D3DUtil::isTypeless(DXGI_FORMAT format) // /* static */Result D3DUtil::compileHLSLShader(char const* sourcePath, char const* source, char const* entryPointName, char const* dxProfileName, ComPtr<ID3DBlob>& shaderBlobOut) { +#if !SLANG_ENABLE_DXBC_SUPPORT + return SLANG_E_NOT_IMPLEMENTED; +#else // Rather than statically link against the `d3dcompile` library, we // dynamically load it. // @@ -425,9 +428,6 @@ bool D3DUtil::isTypeless(DXGI_FORMAT format) // shader bytecode as part of an offline process, rather than doing it // on-the-fly like this // -#if !SLANG_ENABLE_FXC - return SLANG_E_NOT_IMPLEMENTED; -#else static pD3DCompile compileFunc = nullptr; if (!compileFunc) { @@ -475,13 +475,15 @@ bool D3DUtil::isTypeless(DXGI_FORMAT format) { ::fputs((const char*)errorBlob->GetBufferPointer(), stderr); ::fflush(stderr); +#if SLANG_WINDOWS_FAMILY ::OutputDebugStringA((const char*)errorBlob->GetBufferPointer()); +#endif } SLANG_RETURN_ON_FAIL(hr); shaderBlobOut.swap(shaderBlob); return SLANG_OK; -#endif // SLANG_ENABLE_FXC +#endif // SLANG_ENABLE_DXBC_SUPPORT } /* static */SharedLibrary::Handle D3DUtil::getDxgiModule() @@ -512,7 +514,7 @@ bool D3DUtil::isTypeless(DXGI_FORMAT format) } typedef HRESULT(WINAPI *PFN_DXGI_CREATE_FACTORY)(REFIID riid, void **ppFactory); - typedef HRESULT(WINAPI *PFN_DXGI_CREATE_FACTORY_2)(UINT Flags, REFIID riid, _COM_Outptr_ void **ppFactory); + typedef HRESULT(WINAPI *PFN_DXGI_CREATE_FACTORY_2)(UINT Flags, REFIID riid, void **ppFactory); { auto createFactory2 = (PFN_DXGI_CREATE_FACTORY_2)SharedLibrary::findSymbolAddressByName(dxgiModule, "CreateDXGIFactory2"); diff --git a/tools/gfx/d3d12/d3d12-command-encoder.h b/tools/gfx/d3d12/d3d12-command-encoder.h index 9e9a8c879..4190e985c 100644 --- a/tools/gfx/d3d12/d3d12-command-encoder.h +++ b/tools/gfx/d3d12/d3d12-command-encoder.h @@ -89,7 +89,7 @@ public: IBufferResource* const* buffers, ResourceState src, ResourceState dst) override; - virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() {} + virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override {} virtual SLANG_NO_THROW void SLANG_MCALL writeTimestamp(IQueryPool* pool, GfxIndex index) override; virtual SLANG_NO_THROW void SLANG_MCALL copyTexture( @@ -337,7 +337,7 @@ public: GfxCount width, GfxCount height, GfxCount depth) override; - virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() {} + virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override {} }; #endif diff --git a/tools/gfx/d3d12/d3d12-device.h b/tools/gfx/d3d12/d3d12-device.h index e77693ebe..975ba419b 100644 --- a/tools/gfx/d3d12/d3d12-device.h +++ b/tools/gfx/d3d12/d3d12-device.h @@ -17,7 +17,7 @@ using namespace Slang; // Define function pointer types for PIX library. typedef HRESULT(WINAPI* PFN_BeginEventOnCommandList)( - ID3D12GraphicsCommandList* commandList, UINT64 color, _In_ PCSTR formatString); + ID3D12GraphicsCommandList* commandList, UINT64 color, PCSTR formatString); typedef HRESULT(WINAPI* PFN_EndEventOnCommandList)(ID3D12GraphicsCommandList* commandList); struct D3D12DeviceInfo diff --git a/tools/gfx/d3d12/d3d12-submitter.h b/tools/gfx/d3d12/d3d12-submitter.h index 0b9f885a2..77c3f8c0d 100644 --- a/tools/gfx/d3d12/d3d12-submitter.h +++ b/tools/gfx/d3d12/d3d12-submitter.h @@ -34,8 +34,8 @@ struct GraphicsSubmitter : public Submitter virtual void setRootSRV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation) override; virtual void setRootDescriptorTable( int index, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor) override; - void setRootSignature(ID3D12RootSignature* rootSignature); - void setRootConstants( + virtual void setRootSignature(ID3D12RootSignature* rootSignature) override; + virtual void setRootConstants( Index rootParamIndex, Index dstOffsetIn32BitValues, Index countOf32BitValues, @@ -57,8 +57,8 @@ struct ComputeSubmitter : public Submitter virtual void setRootSRV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation) override; virtual void setRootDescriptorTable( int index, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor) override; - void setRootSignature(ID3D12RootSignature* rootSignature); - void setRootConstants( + virtual void setRootSignature(ID3D12RootSignature* rootSignature) override; + virtual void setRootConstants( Index rootParamIndex, Index dstOffsetIn32BitValues, Index countOf32BitValues, |
