diff options
Diffstat (limited to 'tools/gfx/d3d11')
| -rw-r--r-- | tools/gfx/d3d11/d3d11-base.h | 10 | ||||
| -rw-r--r-- | tools/gfx/d3d11/d3d11-device.cpp | 15 | ||||
| -rw-r--r-- | tools/gfx/d3d11/d3d11-helper-functions.cpp | 2 |
3 files changed, 18 insertions, 9 deletions
diff --git a/tools/gfx/d3d11/d3d11-base.h b/tools/gfx/d3d11/d3d11-base.h index d47682f18..ce38bb174 100644 --- a/tools/gfx/d3d11/d3d11-base.h +++ b/tools/gfx/d3d11/d3d11-base.h @@ -13,11 +13,15 @@ #include "slang-com-ptr.h" #include "../flag-combiner.h" -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX -#include <Windows.h> +#pragma push_macro("WIN32_LEAN_AND_MEAN") +#pragma push_macro("NOMINMAX") #undef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #undef NOMINMAX +#define NOMINMAX +#include <windows.h> +#pragma pop_macro("NOMINMAX") +#pragma pop_macro("WIN32_LEAN_AND_MEAN") #include <d3d11_2.h> #include <d3dcompiler.h> diff --git a/tools/gfx/d3d11/d3d11-device.cpp b/tools/gfx/d3d11/d3d11-device.cpp index cc2eda089..e6a348dc1 100644 --- a/tools/gfx/d3d11/d3d11-device.cpp +++ b/tools/gfx/d3d11/d3d11-device.cpp @@ -46,15 +46,20 @@ SlangResult DeviceImpl::initialize(const Desc& desc) m_desc = desc; // Rather than statically link against D3D, we load it dynamically. - HMODULE d3dModule = LoadLibraryA("d3d11.dll"); - if (!d3dModule) + SharedLibrary::Handle d3dModule; +#if SLANG_WINDOWS_FAMILY + const char* libName = "d3d11"; +#else + const char* libName = "dxvk_d3d11"; +#endif + if (SLANG_FAILED(SharedLibrary::load(libName, d3dModule))) { - fprintf(stderr, "error: failed load 'd3d11.dll'\n"); + fprintf(stderr, "error: failed to load '%s'\n", libName); return SLANG_FAIL; } PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN D3D11CreateDeviceAndSwapChain_ = - (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)GetProcAddress(d3dModule, "D3D11CreateDeviceAndSwapChain"); + (PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)SharedLibrary::findSymbolAddressByName(d3dModule, "D3D11CreateDeviceAndSwapChain"); if (!D3D11CreateDeviceAndSwapChain_) { fprintf(stderr, @@ -63,7 +68,7 @@ SlangResult DeviceImpl::initialize(const Desc& desc) } PFN_D3D11_CREATE_DEVICE D3D11CreateDevice_ = - (PFN_D3D11_CREATE_DEVICE)GetProcAddress(d3dModule, "D3D11CreateDevice"); + (PFN_D3D11_CREATE_DEVICE)SharedLibrary::findSymbolAddressByName(d3dModule, "D3D11CreateDevice"); if (!D3D11CreateDevice_) { fprintf(stderr, diff --git a/tools/gfx/d3d11/d3d11-helper-functions.cpp b/tools/gfx/d3d11/d3d11-helper-functions.cpp index 4e1df9879..6774b7d93 100644 --- a/tools/gfx/d3d11/d3d11-helper-functions.cpp +++ b/tools/gfx/d3d11/d3d11-helper-functions.cpp @@ -337,7 +337,7 @@ namespace d3d11 default: assert(!"Unknown dimension"); } - descOut.Texture2DArray.ArraySize = max(textureDesc.size.depth, arraySize); + descOut.Texture2DArray.ArraySize = std::max(textureDesc.size.depth, arraySize); descOut.Texture2DArray.MostDetailedMip = 0; descOut.Texture2DArray.MipLevels = textureDesc.numMipLevels; descOut.Texture2DArray.FirstArraySlice = 0; |
