From 400c59ae0cee518105c1946020cacf7ea0224604 Mon Sep 17 00:00:00 2001 From: Antonio Maiorano Date: Tue, 15 Mar 2022 13:37:33 +0000 Subject: [PATCH] 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( ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 Reviewed-by: Ben Clayton Commit-Queue: Antonio Maiorano --- src/tint/val/hlsl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tint/val/hlsl.cc b/src/tint/val/hlsl.cc index 56ee061da7..3bdf6d340c 100644 --- a/src/tint/val/hlsl.cc +++ b/src/tint/val/hlsl.cc @@ -110,8 +110,8 @@ Result HlslUsingFXC(const std::string& source, return result; } - pD3DCompile d3dCompile = - reinterpret_cast(GetProcAddress(fxcLib, "D3DCompile")); + pD3DCompile d3dCompile = reinterpret_cast( + reinterpret_cast(GetProcAddress(fxcLib, "D3DCompile"))); if (d3dCompile == nullptr) { result.output = "Couldn't load D3DCompile from FXC"; result.failed = true;