Take the max of dedicated and system shared memory heap for UMA arch
This is more accurate for UMA architectures.
Bug: dawn:2249
Change-Id: I48359bab86f2bea97907605841c63d18556fa1df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/163222
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp b/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp
index f1d8bda..8493cb8 100644
--- a/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp
+++ b/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp
@@ -27,6 +27,7 @@
#include "dawn/native/d3d11/PhysicalDeviceD3D11.h"
+#include <algorithm>
#include <string>
#include <utility>
@@ -335,8 +336,8 @@
memoryHeapProperties->heapCount = 1;
memoryHeapProperties->heapInfo = heapInfo;
- heapInfo[0].size = mDeviceInfo.dedicatedVideoMemory != 0 ? mDeviceInfo.dedicatedVideoMemory
- : mDeviceInfo.sharedSystemMemory;
+ heapInfo[0].size =
+ std::max(mDeviceInfo.dedicatedVideoMemory, mDeviceInfo.sharedSystemMemory);
heapInfo[0].properties = wgpu::HeapProperty::DeviceLocal | wgpu::HeapProperty::HostVisible |
wgpu::HeapProperty::HostUncached | wgpu::HeapProperty::HostCached;
} else {
diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
index 2f229b5..de55eb4 100644
--- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
@@ -27,6 +27,7 @@
#include "dawn/native/d3d12/PhysicalDeviceD3D12.h"
+#include <algorithm>
#include <string>
#include <utility>
@@ -720,8 +721,8 @@
memoryHeapProperties->heapCount = 1;
memoryHeapProperties->heapInfo = heapInfo;
- heapInfo[0].size = mDeviceInfo.dedicatedVideoMemory != 0 ? mDeviceInfo.dedicatedVideoMemory
- : mDeviceInfo.sharedSystemMemory;
+ heapInfo[0].size =
+ std::max(mDeviceInfo.dedicatedVideoMemory, mDeviceInfo.sharedSystemMemory);
if (mDeviceInfo.isCacheCoherentUMA) {
heapInfo[0].properties =