CMake: fix clang-cl build

Fails to compile this reinterpret_cast with:

error : cast from 'FARPROC' (aka 'long long (*)()') to 'pD3DCompile' (aka 'long (*)(const void *, unsigned long long, const char *, const _D3D_SHADER_MACRO *, ID3DInclude *, const char *, const char *, unsigned int, unsigned int, ID3D10Blob **, ID3D10Blob **)') converts to incompatible function type [-Werror,-Wcast-function-type]
    pD3DCompile d3dCompile = reinterpret_cast<pD3DCompile>(
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Casting the result of GetProcAddress to void* fixes this. Note that this
is the same thing Dawn does.

Change-Id: Ib185a4fe96c60163cb66cd9591679856ae95d7f2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/83360
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2022-03-15 13:37:33 +00:00 committed by Tint LUCI CQ
parent 30747f607d
commit 400c59ae0c
1 changed files with 2 additions and 2 deletions

View File

@ -110,8 +110,8 @@ Result HlslUsingFXC(const std::string& source,
return result;
}
pD3DCompile d3dCompile =
reinterpret_cast<pD3DCompile>(GetProcAddress(fxcLib, "D3DCompile"));
pD3DCompile d3dCompile = reinterpret_cast<pD3DCompile>(
reinterpret_cast<void*>(GetProcAddress(fxcLib, "D3DCompile")));
if (d3dCompile == nullptr) {
result.output = "Couldn't load D3DCompile from FXC";
result.failed = true;