summaryrefslogtreecommitdiffstats
path: root/tools/gfx/d3d
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-04-29 08:28:40 +0800
committerGitHub <noreply@github.com>2023-04-29 08:28:40 +0800
commit5df7ada451a993efff2b80bb1af2d8c7579ba00b (patch)
treed28dc6704e4f12ec68a1e9a32f6a1ee439888387 /tools/gfx/d3d
parent2492ec59fb52c15d1658ab32f473521b40664168 (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/d3d')
-rw-r--r--tools/gfx/d3d/d3d-util.cpp14
1 files changed, 8 insertions, 6 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");