dawn/native/d3d12: improve constexpr compatability with clang
In Mach engine we compile Dawn's d3d12 backend using Zig as a C/C++
compiler, effectively clang with MinGW windows headers. Unfortunately,
this `static constexpr` fails to compile:
```
error: constexpr variable 'kD3D12PromotableReadOnlyStates' must be initialized by a constant expression
```
As kangz previously noted, the reason appears to be because `D3D12_RESOURCE_STATE_COPY_SOURCE`
is not `constexpr` [in MinGW headers](1de9cc347d/mingw-w64-headers/include/winnt.h (L682)
).
The thought process is that making this just `const` is fine because
constant propagation would make it a constant anyway.
If we're comfortable merging this, it'd be one less change we have to
maintain on our side - and probably no impact otherwise. On the other
hand, I understand the most-correct fix would be in MinGW headers
themselves. I'd love to land this change, but it's no big deal if you
prefer not.
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Change-Id: I772f1cb7e2b4f1b200820cd50f6b7df45850abbb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87381
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
a3f4a32022
commit
9514098b31
|
@ -824,7 +824,7 @@ void Texture::TransitionSubresourceRange(std::vector<D3D12_RESOURCE_BARRIER>* ba
|
||||||
// non-simultaneous-access texture: NON_PIXEL_SHADER_RESOURCE,
|
// non-simultaneous-access texture: NON_PIXEL_SHADER_RESOURCE,
|
||||||
// PIXEL_SHADER_RESOURCE, COPY_SRC, COPY_DEST.
|
// PIXEL_SHADER_RESOURCE, COPY_SRC, COPY_DEST.
|
||||||
{
|
{
|
||||||
static constexpr D3D12_RESOURCE_STATES kD3D12PromotableReadOnlyStates =
|
const D3D12_RESOURCE_STATES kD3D12PromotableReadOnlyStates =
|
||||||
D3D12_RESOURCE_STATE_COPY_SOURCE | D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
|
D3D12_RESOURCE_STATE_COPY_SOURCE | D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
|
||||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
|
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue