D3D12: Initialize mD3D12ResourceFlags for swapchain textures
This patch adds the missing initializations on mD3D12ResourceFlags
for D3D12 swapchain textures so that it won't have an undefined value
and cause unexpected behaviors when we use it.
Bug: dawn:697
Change-Id: I2349483c9e10ac158888700551adf08f792fa842
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/146080
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp
index 97b4e6e..bcc7886 100644
--- a/src/dawn/native/d3d12/TextureD3D12.cpp
+++ b/src/dawn/native/d3d12/TextureD3D12.cpp
@@ -306,6 +306,10 @@
MaybeError Texture::InitializeAsSwapChainTexture(ComPtr<ID3D12Resource> d3d12Texture) {
AllocationInfo info;
info.mMethod = AllocationMethod::kExternal;
+
+ D3D12_RESOURCE_DESC desc = d3d12Texture->GetDesc();
+ mD3D12ResourceFlags = desc.Flags;
+
// When creating the ResourceHeapAllocation, the resource heap is set to nullptr because the
// texture is owned externally. The texture's owning entity must remain responsible for
// memory management.