Rename ContextLost to DeviceLost

DeviceLost is a better name because we don't have a "context" as in
OpenGL.

Bug: dawn:153
Change-Id: Idf7fcb731a0e138f46a81fb31f0d11ff58b4fa96
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10541
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-08-27 18:10:03 +00:00 committed by Commit Bot service account
parent 4078ed8b62
commit 5603dc9044
21 changed files with 69 additions and 70 deletions

View File

@ -196,7 +196,7 @@
{"value": 0, "name": "success"}, {"value": 0, "name": "success"},
{"value": 1, "name": "error"}, {"value": 1, "name": "error"},
{"value": 2, "name": "unknown"}, {"value": 2, "name": "unknown"},
{"value": 3, "name": "context lost"} {"value": 3, "name": "device lost"}
] ]
}, },
"buffer usage": { "buffer usage": {
@ -580,7 +580,7 @@
{"value": 0, "name": "success"}, {"value": 0, "name": "success"},
{"value": 1, "name": "error"}, {"value": 1, "name": "error"},
{"value": 2, "name": "unknown"}, {"value": 2, "name": "unknown"},
{"value": 3, "name": "context lost"} {"value": 3, "name": "device lost"}
] ]
}, },
"fence descriptor": { "fence descriptor": {

View File

@ -20,7 +20,7 @@ template<typename T>
MaybeError OpenGLFunctionsBase::LoadProc(GetProcAddress getProc, T* memberProc, const char* name) { MaybeError OpenGLFunctionsBase::LoadProc(GetProcAddress getProc, T* memberProc, const char* name) {
*memberProc = reinterpret_cast<T>(getProc(name)); *memberProc = reinterpret_cast<T>(getProc(name));
if (DAWN_UNLIKELY(memberProc == nullptr)) { if (DAWN_UNLIKELY(memberProc == nullptr)) {
return DAWN_CONTEXT_LOST_ERROR(std::string("Couldn't load GL proc: ") + name); return DAWN_DEVICE_LOST_ERROR(std::string("Couldn't load GL proc: ") + name);
} }
return {}; return {};
} }

View File

@ -25,7 +25,7 @@ namespace dawn_native {
// file to avoid having all files including headers like <string> and <vector> // file to avoid having all files including headers like <string> and <vector>
class ErrorData; class ErrorData;
enum class ErrorType : uint32_t { Validation, ContextLost, Unimplemented, OutOfMemory }; enum class ErrorType : uint32_t { Validation, DeviceLost, Unimplemented, OutOfMemory };
// MaybeError and ResultOrError are meant to be used as return value for function that are not // MaybeError and ResultOrError are meant to be used as return value for function that are not
// expected to, but might fail. The handling of error is potentially much slower than successes. // expected to, but might fail. The handling of error is potentially much slower than successes.
@ -46,7 +46,7 @@ namespace dawn_native {
#define DAWN_MAKE_ERROR(TYPE, MESSAGE) \ #define DAWN_MAKE_ERROR(TYPE, MESSAGE) \
::dawn_native::MakeError(TYPE, MESSAGE, __FILE__, __func__, __LINE__) ::dawn_native::MakeError(TYPE, MESSAGE, __FILE__, __func__, __LINE__)
#define DAWN_VALIDATION_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Validation, MESSAGE) #define DAWN_VALIDATION_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Validation, MESSAGE)
#define DAWN_CONTEXT_LOST_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::ContextLost, MESSAGE) #define DAWN_DEVICE_LOST_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::DeviceLost, MESSAGE)
#define DAWN_UNIMPLEMENTED_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Unimplemented, MESSAGE) #define DAWN_UNIMPLEMENTED_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::Unimplemented, MESSAGE)
#define DAWN_OUT_OF_MEMORY_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::OutOfMemory, MESSAGE) #define DAWN_OUT_OF_MEMORY_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::OutOfMemory, MESSAGE)

View File

@ -63,7 +63,7 @@ namespace dawn_native { namespace d3d12 {
const PlatformFunctions* functions = GetBackend()->GetFunctions(); const PlatformFunctions* functions = GetBackend()->GetFunctions();
if (FAILED(functions->d3d12CreateDevice(GetHardwareAdapter(), D3D_FEATURE_LEVEL_11_0, if (FAILED(functions->d3d12CreateDevice(GetHardwareAdapter(), D3D_FEATURE_LEVEL_11_0,
_uuidof(ID3D12Device), &mD3d12Device))) { _uuidof(ID3D12Device), &mD3d12Device))) {
return DAWN_CONTEXT_LOST_ERROR("D3D12CreateDevice failed"); return DAWN_DEVICE_LOST_ERROR("D3D12CreateDevice failed");
} }
DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this)); DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this));

View File

@ -61,7 +61,7 @@ namespace dawn_native { namespace d3d12 {
} }
if (FAILED(functions->createDxgiFactory2(dxgiFactoryFlags, IID_PPV_ARGS(&factory)))) { if (FAILED(functions->createDxgiFactory2(dxgiFactoryFlags, IID_PPV_ARGS(&factory)))) {
return DAWN_CONTEXT_LOST_ERROR("Failed to create a DXGI factory"); return DAWN_DEVICE_LOST_ERROR("Failed to create a DXGI factory");
} }
ASSERT(factory != nullptr); ASSERT(factory != nullptr);

View File

@ -33,7 +33,7 @@ namespace dawn_native { namespace d3d12 {
D3D12_FEATURE_DATA_ARCHITECTURE arch = {}; D3D12_FEATURE_DATA_ARCHITECTURE arch = {};
if (FAILED(adapter.GetDevice()->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &arch, if (FAILED(adapter.GetDevice()->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &arch,
sizeof(arch)))) { sizeof(arch)))) {
return DAWN_CONTEXT_LOST_ERROR("CheckFeatureSupport failed"); return DAWN_DEVICE_LOST_ERROR("CheckFeatureSupport failed");
} }
info.isUMA = arch.UMA; info.isUMA = arch.UMA;

View File

@ -44,7 +44,7 @@ namespace dawn_native { namespace d3d12 {
"D3D12SerializeVersionedRootSignature", &error) || "D3D12SerializeVersionedRootSignature", &error) ||
!mD3D12Lib.GetProc(&d3d12CreateVersionedRootSignatureDeserializer, !mD3D12Lib.GetProc(&d3d12CreateVersionedRootSignatureDeserializer,
"D3D12CreateVersionedRootSignatureDeserializer", &error)) { "D3D12CreateVersionedRootSignatureDeserializer", &error)) {
return DAWN_CONTEXT_LOST_ERROR(error.c_str()); return DAWN_DEVICE_LOST_ERROR(error.c_str());
} }
return {}; return {};
@ -55,7 +55,7 @@ namespace dawn_native { namespace d3d12 {
if (!mDXGILib.Open("dxgi.dll", &error) || if (!mDXGILib.Open("dxgi.dll", &error) ||
!mDXGILib.GetProc(&dxgiGetDebugInterface1, "DXGIGetDebugInterface1", &error) || !mDXGILib.GetProc(&dxgiGetDebugInterface1, "DXGIGetDebugInterface1", &error) ||
!mDXGILib.GetProc(&createDxgiFactory2, "CreateDXGIFactory2", &error)) { !mDXGILib.GetProc(&createDxgiFactory2, "CreateDXGIFactory2", &error)) {
return DAWN_CONTEXT_LOST_ERROR(error.c_str()); return DAWN_DEVICE_LOST_ERROR(error.c_str());
} }
return {}; return {};
@ -65,7 +65,7 @@ namespace dawn_native { namespace d3d12 {
std::string error; std::string error;
if (!mD3DCompilerLib.Open("d3dcompiler_47.dll", &error) || if (!mD3DCompilerLib.Open("d3dcompiler_47.dll", &error) ||
!mD3DCompilerLib.GetProc(&d3dCompile, "D3DCompile", &error)) { !mD3DCompilerLib.GetProc(&d3dCompile, "D3DCompile", &error)) {
return DAWN_CONTEXT_LOST_ERROR(error.c_str()); return DAWN_DEVICE_LOST_ERROR(error.c_str());
} }
return {}; return {};

View File

@ -42,7 +42,7 @@ namespace dawn_native { namespace d3d12 {
// TODO(bryan.bernhart@intel.com): Record the GPU pointer for generic non-upload usage. // TODO(bryan.bernhart@intel.com): Record the GPU pointer for generic non-upload usage.
if (FAILED(mUploadHeap->Map(0, nullptr, &mMappedPointer))) { if (FAILED(mUploadHeap->Map(0, nullptr, &mMappedPointer))) {
return DAWN_CONTEXT_LOST_ERROR("Unable to map staging buffer."); return DAWN_DEVICE_LOST_ERROR("Unable to map staging buffer.");
} }
return {}; return {};
@ -60,4 +60,4 @@ namespace dawn_native { namespace d3d12 {
return mUploadHeap.Get(); return mUploadHeap.Get();
} }
}} // namespace dawn_native::d3d12 }} // namespace dawn_native::d3d12

View File

@ -52,7 +52,7 @@ namespace dawn_native { namespace metal {
} }
if (vendorId == 0) { if (vendorId == 0) {
return DAWN_CONTEXT_LOST_ERROR("Failed to find vendor id with the device"); return DAWN_DEVICE_LOST_ERROR("Failed to find vendor id with the device");
} }
// Set vendor id with 0 // Set vendor id with 0
@ -102,7 +102,7 @@ namespace dawn_native { namespace metal {
// Get a matching dictionary for the IOGraphicsAccelerator2 // Get a matching dictionary for the IOGraphicsAccelerator2
CFMutableDictionaryRef matchingDict = IORegistryEntryIDMatching([device registryID]); CFMutableDictionaryRef matchingDict = IORegistryEntryIDMatching([device registryID]);
if (matchingDict == nullptr) { if (matchingDict == nullptr) {
return DAWN_CONTEXT_LOST_ERROR("Failed to create the matching dict for the device"); return DAWN_DEVICE_LOST_ERROR("Failed to create the matching dict for the device");
} }
// IOServiceGetMatchingService will consume the reference on the matching dictionary, // IOServiceGetMatchingService will consume the reference on the matching dictionary,
@ -110,7 +110,7 @@ namespace dawn_native { namespace metal {
io_registry_entry_t acceleratorEntry = io_registry_entry_t acceleratorEntry =
IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict); IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict);
if (acceleratorEntry == IO_OBJECT_NULL) { if (acceleratorEntry == IO_OBJECT_NULL) {
return DAWN_CONTEXT_LOST_ERROR( return DAWN_DEVICE_LOST_ERROR(
"Failed to get the IO registry entry for the accelerator"); "Failed to get the IO registry entry for the accelerator");
} }
@ -119,8 +119,7 @@ namespace dawn_native { namespace metal {
if (IORegistryEntryGetParentEntry(acceleratorEntry, kIOServicePlane, &deviceEntry) != if (IORegistryEntryGetParentEntry(acceleratorEntry, kIOServicePlane, &deviceEntry) !=
kIOReturnSuccess) { kIOReturnSuccess) {
IOObjectRelease(acceleratorEntry); IOObjectRelease(acceleratorEntry);
return DAWN_CONTEXT_LOST_ERROR( return DAWN_DEVICE_LOST_ERROR("Failed to get the IO registry entry for the device");
"Failed to get the IO registry entry for the device");
} }
ASSERT(deviceEntry != IO_OBJECT_NULL); ASSERT(deviceEntry != IO_OBJECT_NULL);

View File

@ -32,7 +32,7 @@ namespace dawn_native { namespace metal {
mMappedPointer = [mBuffer contents]; mMappedPointer = [mBuffer contents];
if (mMappedPointer == nullptr) { if (mMappedPointer == nullptr) {
return DAWN_CONTEXT_LOST_ERROR("Unable to map staging buffer."); return DAWN_DEVICE_LOST_ERROR("Unable to map staging buffer.");
} }
return {}; return {};
@ -47,4 +47,4 @@ namespace dawn_native { namespace metal {
return mBuffer; return mBuffer;
} }
}} // namespace dawn_native::metal }} // namespace dawn_native::metal

View File

@ -173,7 +173,7 @@ namespace dawn_native { namespace null {
MaybeError Device::IncrementMemoryUsage(size_t bytes) { MaybeError Device::IncrementMemoryUsage(size_t bytes) {
static_assert(kMaxMemoryUsage <= std::numeric_limits<size_t>::max() / 2, ""); static_assert(kMaxMemoryUsage <= std::numeric_limits<size_t>::max() / 2, "");
if (bytes > kMaxMemoryUsage || mMemoryUsage + bytes > kMaxMemoryUsage) { if (bytes > kMaxMemoryUsage || mMemoryUsage + bytes > kMaxMemoryUsage) {
return DAWN_CONTEXT_LOST_ERROR("Out of memory."); return DAWN_DEVICE_LOST_ERROR("Out of memory.");
} }
mMemoryUsage += bytes; mMemoryUsage += bytes;
return {}; return {};

View File

@ -22,7 +22,7 @@ namespace dawn_native { namespace opengl {
MaybeError OpenGLFunctions::Initialize(GetProcAddress getProc) { MaybeError OpenGLFunctions::Initialize(GetProcAddress getProc) {
PFNGLGETSTRINGPROC getString = reinterpret_cast<PFNGLGETSTRINGPROC>(getProc("glGetString")); PFNGLGETSTRINGPROC getString = reinterpret_cast<PFNGLGETSTRINGPROC>(getProc("glGetString"));
if (getString == nullptr) { if (getString == nullptr) {
return DAWN_CONTEXT_LOST_ERROR("Couldn't load glGetString"); return DAWN_DEVICE_LOST_ERROR("Couldn't load glGetString");
} }
std::string version = reinterpret_cast<const char*>(getString(GL_VERSION)); std::string version = reinterpret_cast<const char*>(getString(GL_VERSION));

View File

@ -61,7 +61,7 @@ namespace dawn_native { namespace vulkan {
MaybeError Backend::Initialize() { MaybeError Backend::Initialize() {
if (!mVulkanLib.Open(kVulkanLibName)) { if (!mVulkanLib.Open(kVulkanLibName)) {
return DAWN_CONTEXT_LOST_ERROR(std::string("Couldn't open ") + kVulkanLibName); return DAWN_DEVICE_LOST_ERROR(std::string("Couldn't open ") + kVulkanLibName);
} }
DAWN_TRY(mFunctions.LoadGlobalProcs(mVulkanLib)); DAWN_TRY(mFunctions.LoadGlobalProcs(mVulkanLib));

View File

@ -397,7 +397,7 @@ namespace dawn_native { namespace vulkan {
} }
if (universalQueueFamily == -1) { if (universalQueueFamily == -1) {
return DAWN_CONTEXT_LOST_ERROR("No universal queue family"); return DAWN_DEVICE_LOST_ERROR("No universal queue family");
} }
mQueueFamily = static_cast<uint32_t>(universalQueueFamily); mQueueFamily = static_cast<uint32_t>(universalQueueFamily);
} }

View File

@ -36,24 +36,24 @@ namespace dawn_native { namespace vulkan {
if (mDevice->fn.CreateBuffer(mDevice->GetVkDevice(), &createInfo, nullptr, &mBuffer) != if (mDevice->fn.CreateBuffer(mDevice->GetVkDevice(), &createInfo, nullptr, &mBuffer) !=
VK_SUCCESS) { VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("Unable to create staging buffer."); return DAWN_DEVICE_LOST_ERROR("Unable to create staging buffer.");
} }
VkMemoryRequirements requirements; VkMemoryRequirements requirements;
mDevice->fn.GetBufferMemoryRequirements(mDevice->GetVkDevice(), mBuffer, &requirements); mDevice->fn.GetBufferMemoryRequirements(mDevice->GetVkDevice(), mBuffer, &requirements);
if (!mDevice->GetMemoryAllocator()->Allocate(requirements, true, &mAllocation)) { if (!mDevice->GetMemoryAllocator()->Allocate(requirements, true, &mAllocation)) {
return DAWN_CONTEXT_LOST_ERROR("Unable to allocate memory for staging buffer."); return DAWN_DEVICE_LOST_ERROR("Unable to allocate memory for staging buffer.");
} }
if (mDevice->fn.BindBufferMemory(mDevice->GetVkDevice(), mBuffer, mAllocation.GetMemory(), if (mDevice->fn.BindBufferMemory(mDevice->GetVkDevice(), mBuffer, mAllocation.GetMemory(),
mAllocation.GetMemoryOffset()) != VK_SUCCESS) { mAllocation.GetMemoryOffset()) != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("Unable to attach memory to the staging buffer."); return DAWN_DEVICE_LOST_ERROR("Unable to attach memory to the staging buffer.");
} }
mMappedPointer = mAllocation.GetMappedPointer(); mMappedPointer = mAllocation.GetMappedPointer();
if (mMappedPointer == nullptr) { if (mMappedPointer == nullptr) {
return DAWN_CONTEXT_LOST_ERROR("Unable to map staging buffer."); return DAWN_DEVICE_LOST_ERROR("Unable to map staging buffer.");
} }
return {}; return {};
@ -69,4 +69,4 @@ namespace dawn_native { namespace vulkan {
return mBuffer; return mBuffer;
} }
}} // namespace dawn_native::vulkan }} // namespace dawn_native::vulkan

View File

@ -67,7 +67,7 @@ namespace dawn_native { namespace vulkan {
} }
std::string message = std::string(context) + " failed with " + VkResultAsString(result); std::string message = std::string(context) + " failed with " + VkResultAsString(result);
return DAWN_CONTEXT_LOST_ERROR(message); return DAWN_DEVICE_LOST_ERROR(message);
} }
}} // namespace dawn_native::vulkan }} // namespace dawn_native::vulkan

View File

@ -22,12 +22,12 @@ namespace dawn_native { namespace vulkan {
#define GET_GLOBAL_PROC(name) \ #define GET_GLOBAL_PROC(name) \
name = reinterpret_cast<decltype(name)>(GetInstanceProcAddr(nullptr, "vk" #name)); \ name = reinterpret_cast<decltype(name)>(GetInstanceProcAddr(nullptr, "vk" #name)); \
if (name == nullptr) { \ if (name == nullptr) { \
return DAWN_CONTEXT_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \ return DAWN_DEVICE_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \
} }
MaybeError VulkanFunctions::LoadGlobalProcs(const DynamicLib& vulkanLib) { MaybeError VulkanFunctions::LoadGlobalProcs(const DynamicLib& vulkanLib) {
if (!vulkanLib.GetProc(&GetInstanceProcAddr, "vkGetInstanceProcAddr")) { if (!vulkanLib.GetProc(&GetInstanceProcAddr, "vkGetInstanceProcAddr")) {
return DAWN_CONTEXT_LOST_ERROR("Couldn't get vkGetInstanceProcAddr"); return DAWN_DEVICE_LOST_ERROR("Couldn't get vkGetInstanceProcAddr");
} }
GET_GLOBAL_PROC(CreateInstance); GET_GLOBAL_PROC(CreateInstance);
@ -44,7 +44,7 @@ namespace dawn_native { namespace vulkan {
#define GET_INSTANCE_PROC(name) \ #define GET_INSTANCE_PROC(name) \
name = reinterpret_cast<decltype(name)>(GetInstanceProcAddr(instance, "vk" #name)); \ name = reinterpret_cast<decltype(name)>(GetInstanceProcAddr(instance, "vk" #name)); \
if (name == nullptr) { \ if (name == nullptr) { \
return DAWN_CONTEXT_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \ return DAWN_DEVICE_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \
} }
MaybeError VulkanFunctions::LoadInstanceProcs(VkInstance instance, MaybeError VulkanFunctions::LoadInstanceProcs(VkInstance instance,
@ -106,10 +106,10 @@ namespace dawn_native { namespace vulkan {
return {}; return {};
} }
#define GET_DEVICE_PROC(name) \ #define GET_DEVICE_PROC(name) \
name = reinterpret_cast<decltype(name)>(GetDeviceProcAddr(device, "vk" #name)); \ name = reinterpret_cast<decltype(name)>(GetDeviceProcAddr(device, "vk" #name)); \
if (name == nullptr) { \ if (name == nullptr) { \
return DAWN_CONTEXT_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \ return DAWN_DEVICE_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \
} }
MaybeError VulkanFunctions::LoadDeviceProcs(VkDevice device, MaybeError VulkanFunctions::LoadDeviceProcs(VkDevice device,

View File

@ -67,13 +67,13 @@ namespace dawn_native { namespace vulkan {
// incomplete otherwise. This means that both values represent a success. // incomplete otherwise. This means that both values represent a success.
// This is the same for all Enumarte functions // This is the same for all Enumarte functions
if (result != VK_SUCCESS && result != VK_INCOMPLETE) { if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceLayerProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceLayerProperties");
} }
info.layers.resize(count); info.layers.resize(count);
result = vkFunctions.EnumerateInstanceLayerProperties(&count, info.layers.data()); result = vkFunctions.EnumerateInstanceLayerProperties(&count, info.layers.data());
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceLayerProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceLayerProperties");
} }
for (const auto& layer : info.layers) { for (const auto& layer : info.layers) {
@ -95,14 +95,14 @@ namespace dawn_native { namespace vulkan {
VkResult result = VkResult result =
vkFunctions.EnumerateInstanceExtensionProperties(nullptr, &count, nullptr); vkFunctions.EnumerateInstanceExtensionProperties(nullptr, &count, nullptr);
if (result != VK_SUCCESS && result != VK_INCOMPLETE) { if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceExtensionProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceExtensionProperties");
} }
info.extensions.resize(count); info.extensions.resize(count);
result = vkFunctions.EnumerateInstanceExtensionProperties(nullptr, &count, result = vkFunctions.EnumerateInstanceExtensionProperties(nullptr, &count,
info.extensions.data()); info.extensions.data());
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceExtensionProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceExtensionProperties");
} }
for (const auto& extension : info.extensions) { for (const auto& extension : info.extensions) {
@ -164,13 +164,13 @@ namespace dawn_native { namespace vulkan {
uint32_t count = 0; uint32_t count = 0;
VkResult result = vkFunctions.EnumeratePhysicalDevices(instance, &count, nullptr); VkResult result = vkFunctions.EnumeratePhysicalDevices(instance, &count, nullptr);
if (result != VK_SUCCESS && result != VK_INCOMPLETE) { if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumeratePhysicalDevices"); return DAWN_DEVICE_LOST_ERROR("vkEnumeratePhysicalDevices");
} }
std::vector<VkPhysicalDevice> physicalDevices(count); std::vector<VkPhysicalDevice> physicalDevices(count);
result = vkFunctions.EnumeratePhysicalDevices(instance, &count, physicalDevices.data()); result = vkFunctions.EnumeratePhysicalDevices(instance, &count, physicalDevices.data());
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumeratePhysicalDevices"); return DAWN_DEVICE_LOST_ERROR("vkEnumeratePhysicalDevices");
} }
return physicalDevices; return physicalDevices;
@ -212,14 +212,14 @@ namespace dawn_native { namespace vulkan {
VkResult result = VkResult result =
vkFunctions.EnumerateDeviceLayerProperties(physicalDevice, &count, nullptr); vkFunctions.EnumerateDeviceLayerProperties(physicalDevice, &count, nullptr);
if (result != VK_SUCCESS && result != VK_INCOMPLETE) { if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateDeviceLayerProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateDeviceLayerProperties");
} }
info.layers.resize(count); info.layers.resize(count);
result = vkFunctions.EnumerateDeviceLayerProperties(physicalDevice, &count, result = vkFunctions.EnumerateDeviceLayerProperties(physicalDevice, &count,
info.layers.data()); info.layers.data());
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateDeviceLayerProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateDeviceLayerProperties");
} }
} }
@ -229,14 +229,14 @@ namespace dawn_native { namespace vulkan {
VkResult result = vkFunctions.EnumerateDeviceExtensionProperties( VkResult result = vkFunctions.EnumerateDeviceExtensionProperties(
physicalDevice, nullptr, &count, nullptr); physicalDevice, nullptr, &count, nullptr);
if (result != VK_SUCCESS && result != VK_INCOMPLETE) { if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateDeviceExtensionProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateDeviceExtensionProperties");
} }
info.extensions.resize(count); info.extensions.resize(count);
result = vkFunctions.EnumerateDeviceExtensionProperties(physicalDevice, nullptr, &count, result = vkFunctions.EnumerateDeviceExtensionProperties(physicalDevice, nullptr, &count,
info.extensions.data()); info.extensions.data());
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkEnumerateDeviceExtensionProperties"); return DAWN_DEVICE_LOST_ERROR("vkEnumerateDeviceExtensionProperties");
} }
for (const auto& extension : info.extensions) { for (const auto& extension : info.extensions) {
@ -277,7 +277,7 @@ namespace dawn_native { namespace vulkan {
VkResult result = vkFunctions.GetPhysicalDeviceSurfaceCapabilitiesKHR( VkResult result = vkFunctions.GetPhysicalDeviceSurfaceCapabilitiesKHR(
physicalDevice, surface, &info->capabilities); physicalDevice, surface, &info->capabilities);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
} }
} }
@ -292,7 +292,7 @@ namespace dawn_native { namespace vulkan {
physicalDevice, i, surface, &supported); physicalDevice, i, surface, &supported);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfaceSupportKHR"); return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfaceSupportKHR");
} }
info->supportedQueueFamilies[i] = (supported == VK_TRUE); info->supportedQueueFamilies[i] = (supported == VK_TRUE);
@ -305,14 +305,14 @@ namespace dawn_native { namespace vulkan {
VkResult result = vkFunctions.GetPhysicalDeviceSurfaceFormatsKHR( VkResult result = vkFunctions.GetPhysicalDeviceSurfaceFormatsKHR(
physicalDevice, surface, &count, nullptr); physicalDevice, surface, &count, nullptr);
if (result != VK_SUCCESS && result != VK_INCOMPLETE) { if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfaceFormatsKHR"); return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfaceFormatsKHR");
} }
info->formats.resize(count); info->formats.resize(count);
result = vkFunctions.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &count, result = vkFunctions.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &count,
info->formats.data()); info->formats.data());
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfaceFormatsKHR"); return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfaceFormatsKHR");
} }
} }
@ -322,14 +322,14 @@ namespace dawn_native { namespace vulkan {
VkResult result = vkFunctions.GetPhysicalDeviceSurfacePresentModesKHR( VkResult result = vkFunctions.GetPhysicalDeviceSurfacePresentModesKHR(
physicalDevice, surface, &count, nullptr); physicalDevice, surface, &count, nullptr);
if (result != VK_SUCCESS && result != VK_INCOMPLETE) { if (result != VK_SUCCESS && result != VK_INCOMPLETE) {
return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR"); return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR");
} }
info->presentModes.resize(count); info->presentModes.resize(count);
result = vkFunctions.GetPhysicalDeviceSurfacePresentModesKHR( result = vkFunctions.GetPhysicalDeviceSurfacePresentModesKHR(
physicalDevice, surface, &count, info->presentModes.data()); physicalDevice, surface, &count, info->presentModes.data());
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR"); return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR");
} }
} }

View File

@ -59,7 +59,7 @@ namespace dawn_wire { namespace client {
MemoryTransferService::ReadHandle* readHandle = MemoryTransferService::ReadHandle* readHandle =
buffer->device->GetClient()->GetMemoryTransferService()->CreateReadHandle(buffer->size); buffer->device->GetClient()->GetMemoryTransferService()->CreateReadHandle(buffer->size);
if (readHandle == nullptr) { if (readHandle == nullptr) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, userdata); callback(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0, userdata);
return; return;
} }
@ -90,7 +90,7 @@ namespace dawn_wire { namespace client {
buffer->device->GetClient()->GetMemoryTransferService()->CreateWriteHandle( buffer->device->GetClient()->GetMemoryTransferService()->CreateWriteHandle(
buffer->size); buffer->size);
if (writeHandle == nullptr) { if (writeHandle == nullptr) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, userdata); callback(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0, userdata);
return; return;
} }
@ -223,7 +223,7 @@ namespace dawn_wire { namespace client {
result.buffer = reinterpret_cast<DawnBuffer>(buffer); result.buffer = reinterpret_cast<DawnBuffer>(buffer);
result.data = nullptr; result.data = nullptr;
result.dataLength = 0; result.dataLength = 0;
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, result, userdata); callback(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, result, userdata);
return; return;
} }

View File

@ -88,7 +88,7 @@ namespace dawn_wire { namespace client {
if (!GetMappedData()) { if (!GetMappedData()) {
// Dawn promises that all callbacks are called in finite time. Even if a fatal error // Dawn promises that all callbacks are called in finite time. Even if a fatal error
// occurs, the callback is called. // occurs, the callback is called.
request.readCallback(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, request.readCallback(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0,
request.userdata); request.userdata);
return false; return false;
} else { } else {
@ -152,7 +152,7 @@ namespace dawn_wire { namespace client {
if (!GetMappedData()) { if (!GetMappedData()) {
// Dawn promises that all callbacks are called in finite time. Even if a fatal error // Dawn promises that all callbacks are called in finite time. Even if a fatal error
// occurs, the callback is called. // occurs, the callback is called.
request.writeCallback(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, request.writeCallback(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0,
request.userdata); request.userdata);
return false; return false;
} else { } else {

View File

@ -513,9 +513,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapReadHandleCreationFailure) {
MockReadHandleCreationFailure(); MockReadHandleCreationFailure();
// Failed creation of a ReadHandle is a fatal failure and the client synchronously receives a // Failed creation of a ReadHandle is a fatal failure and the client synchronously receives a
// CONTEXT_LOST callback. // DEVICE_LOST callback.
EXPECT_CALL(*mockBufferMapReadCallback, EXPECT_CALL(*mockBufferMapReadCallback,
Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, _)) Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0, _))
.Times(1); .Times(1);
dawnBufferMapReadAsync(buffer, ToMockBufferMapReadCallback, nullptr); dawnBufferMapReadAsync(buffer, ToMockBufferMapReadCallback, nullptr);
@ -580,9 +580,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapReadDeserializeInitialDataFailur
MockClientReadHandleDeserializeInitializeFailure(clientHandle); MockClientReadHandleDeserializeInitializeFailure(clientHandle);
// Failed deserialization is a fatal failure and the client synchronously receives a // Failed deserialization is a fatal failure and the client synchronously receives a
// CONTEXT_LOST callback. // DEVICE_LOST callback.
EXPECT_CALL(*mockBufferMapReadCallback, EXPECT_CALL(*mockBufferMapReadCallback,
Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, _)) Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0, _))
.Times(1); .Times(1);
// The handle will be destroyed since deserializing failed. // The handle will be destroyed since deserializing failed.
@ -702,9 +702,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapWriteHandleCreationFailure) {
MockWriteHandleCreationFailure(); MockWriteHandleCreationFailure();
// Failed creation of a WriteHandle is a fatal failure and the client synchronously receives a // Failed creation of a WriteHandle is a fatal failure and the client synchronously receives a
// CONTEXT_LOST callback. // DEVICE_LOST callback.
EXPECT_CALL(*mockBufferMapWriteCallback, EXPECT_CALL(*mockBufferMapWriteCallback,
Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, _)) Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0, _))
.Times(1); .Times(1);
dawnBufferMapWriteAsync(buffer, ToMockBufferMapWriteCallback, nullptr); dawnBufferMapWriteAsync(buffer, ToMockBufferMapWriteCallback, nullptr);
@ -765,9 +765,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapWriteHandleOpenFailure) {
// Mock a failure. // Mock a failure.
MockClientWriteHandleOpenFailure(clientHandle); MockClientWriteHandleOpenFailure(clientHandle);
// Failing to open a handle is a fatal failure and the client receives a CONTEXT_LOST callback. // Failing to open a handle is a fatal failure and the client receives a DEVICE_LOST callback.
EXPECT_CALL(*mockBufferMapWriteCallback, EXPECT_CALL(*mockBufferMapWriteCallback,
Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, _)) Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0, _))
.Times(1); .Times(1);
// Since opening the handle fails, it gets destroyed immediately. // Since opening the handle fails, it gets destroyed immediately.
@ -885,9 +885,9 @@ TEST_F(WireMemoryTransferServiceTests, CreateBufferMappedAsyncWriteHandleCreatio
descriptor.size = sizeof(mBufferContent); descriptor.size = sizeof(mBufferContent);
// Failed creation of a WriteHandle is a fatal failure. The client synchronously receives // Failed creation of a WriteHandle is a fatal failure. The client synchronously receives
// a CONTEXT_LOST callback. // a DEVICE_LOST callback.
EXPECT_CALL(*mockCreateBufferMappedCallback, EXPECT_CALL(*mockCreateBufferMappedCallback,
Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, _, nullptr, 0, _)) Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, _, nullptr, 0, _))
.Times(1); .Times(1);
dawnDeviceCreateBufferMappedAsync(device, &descriptor, ToMockCreateBufferMappedCallback, nullptr); dawnDeviceCreateBufferMappedAsync(device, &descriptor, ToMockCreateBufferMappedCallback, nullptr);
@ -934,9 +934,9 @@ TEST_F(WireMemoryTransferServiceTests, CreateBufferMappedAsyncHandleOpenFailure)
// Since the mapping succeeds, the client opens the WriteHandle. // Since the mapping succeeds, the client opens the WriteHandle.
MockClientWriteHandleOpenFailure(clientHandle); MockClientWriteHandleOpenFailure(clientHandle);
// Failing to open a handle is a fatal failure. The client receives a CONTEXT_LOST callback. // Failing to open a handle is a fatal failure. The client receives a DEVICE_LOST callback.
EXPECT_CALL(*mockCreateBufferMappedCallback, EXPECT_CALL(*mockCreateBufferMappedCallback,
Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, _, nullptr, 0, _)) Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, _, nullptr, 0, _))
.Times(1); .Times(1);
// Since opening the handle fails, it is destroyed immediately. // Since opening the handle fails, it is destroyed immediately.