From 5df7ada451a993efff2b80bb1af2d8c7579ba00b Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Sat, 29 Apr 2023 08:28:40 +0800 Subject: 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 --- tools/gfx/d3d/d3d-util.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tools/gfx/d3d/d3d-util.cpp') 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 #include #include -#if SLANG_ENABLE_FXC +#if SLANG_ENABLE_DXBC_SUPPORT #include #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& 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"); -- cgit v1.2.3