diff --git a/dawn.json b/dawn.json index 9370c6488f..8f8f8fc12e 100644 --- a/dawn.json +++ b/dawn.json @@ -196,7 +196,7 @@ {"value": 0, "name": "success"}, {"value": 1, "name": "error"}, {"value": 2, "name": "unknown"}, - {"value": 3, "name": "context lost"} + {"value": 3, "name": "device lost"} ] }, "buffer usage": { @@ -580,7 +580,7 @@ {"value": 0, "name": "success"}, {"value": 1, "name": "error"}, {"value": 2, "name": "unknown"}, - {"value": 3, "name": "context lost"} + {"value": 3, "name": "device lost"} ] }, "fence descriptor": { diff --git a/generator/templates/opengl/OpenGLFunctionsBase.cpp b/generator/templates/opengl/OpenGLFunctionsBase.cpp index 81e6f9f0a7..bf5246f8f0 100644 --- a/generator/templates/opengl/OpenGLFunctionsBase.cpp +++ b/generator/templates/opengl/OpenGLFunctionsBase.cpp @@ -20,7 +20,7 @@ template MaybeError OpenGLFunctionsBase::LoadProc(GetProcAddress getProc, T* memberProc, const char* name) { *memberProc = reinterpret_cast(getProc(name)); 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 {}; } diff --git a/src/dawn_native/Error.h b/src/dawn_native/Error.h index 50ff9f0e80..82efbee514 100644 --- a/src/dawn_native/Error.h +++ b/src/dawn_native/Error.h @@ -25,7 +25,7 @@ namespace dawn_native { // file to avoid having all files including headers like and 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 // 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) \ ::dawn_native::MakeError(TYPE, MESSAGE, __FILE__, __func__, __LINE__) #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_OUT_OF_MEMORY_ERROR(MESSAGE) DAWN_MAKE_ERROR(ErrorType::OutOfMemory, MESSAGE) diff --git a/src/dawn_native/d3d12/AdapterD3D12.cpp b/src/dawn_native/d3d12/AdapterD3D12.cpp index bb14171757..c39791a876 100644 --- a/src/dawn_native/d3d12/AdapterD3D12.cpp +++ b/src/dawn_native/d3d12/AdapterD3D12.cpp @@ -63,7 +63,7 @@ namespace dawn_native { namespace d3d12 { const PlatformFunctions* functions = GetBackend()->GetFunctions(); if (FAILED(functions->d3d12CreateDevice(GetHardwareAdapter(), D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), &mD3d12Device))) { - return DAWN_CONTEXT_LOST_ERROR("D3D12CreateDevice failed"); + return DAWN_DEVICE_LOST_ERROR("D3D12CreateDevice failed"); } DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this)); diff --git a/src/dawn_native/d3d12/BackendD3D12.cpp b/src/dawn_native/d3d12/BackendD3D12.cpp index 473eedbb6a..71beb6c5be 100644 --- a/src/dawn_native/d3d12/BackendD3D12.cpp +++ b/src/dawn_native/d3d12/BackendD3D12.cpp @@ -61,7 +61,7 @@ namespace dawn_native { namespace d3d12 { } 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); diff --git a/src/dawn_native/d3d12/D3D12Info.cpp b/src/dawn_native/d3d12/D3D12Info.cpp index 3b2b57d823..1431b34c40 100644 --- a/src/dawn_native/d3d12/D3D12Info.cpp +++ b/src/dawn_native/d3d12/D3D12Info.cpp @@ -33,7 +33,7 @@ namespace dawn_native { namespace d3d12 { D3D12_FEATURE_DATA_ARCHITECTURE arch = {}; if (FAILED(adapter.GetDevice()->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &arch, sizeof(arch)))) { - return DAWN_CONTEXT_LOST_ERROR("CheckFeatureSupport failed"); + return DAWN_DEVICE_LOST_ERROR("CheckFeatureSupport failed"); } info.isUMA = arch.UMA; diff --git a/src/dawn_native/d3d12/PlatformFunctions.cpp b/src/dawn_native/d3d12/PlatformFunctions.cpp index b3354b182f..747cb68dbf 100644 --- a/src/dawn_native/d3d12/PlatformFunctions.cpp +++ b/src/dawn_native/d3d12/PlatformFunctions.cpp @@ -44,7 +44,7 @@ namespace dawn_native { namespace d3d12 { "D3D12SerializeVersionedRootSignature", &error) || !mD3D12Lib.GetProc(&d3d12CreateVersionedRootSignatureDeserializer, "D3D12CreateVersionedRootSignatureDeserializer", &error)) { - return DAWN_CONTEXT_LOST_ERROR(error.c_str()); + return DAWN_DEVICE_LOST_ERROR(error.c_str()); } return {}; @@ -55,7 +55,7 @@ namespace dawn_native { namespace d3d12 { if (!mDXGILib.Open("dxgi.dll", &error) || !mDXGILib.GetProc(&dxgiGetDebugInterface1, "DXGIGetDebugInterface1", &error) || !mDXGILib.GetProc(&createDxgiFactory2, "CreateDXGIFactory2", &error)) { - return DAWN_CONTEXT_LOST_ERROR(error.c_str()); + return DAWN_DEVICE_LOST_ERROR(error.c_str()); } return {}; @@ -65,7 +65,7 @@ namespace dawn_native { namespace d3d12 { std::string error; if (!mD3DCompilerLib.Open("d3dcompiler_47.dll", &error) || !mD3DCompilerLib.GetProc(&d3dCompile, "D3DCompile", &error)) { - return DAWN_CONTEXT_LOST_ERROR(error.c_str()); + return DAWN_DEVICE_LOST_ERROR(error.c_str()); } return {}; diff --git a/src/dawn_native/d3d12/StagingBufferD3D12.cpp b/src/dawn_native/d3d12/StagingBufferD3D12.cpp index da5db48539..6b6adfa4d8 100644 --- a/src/dawn_native/d3d12/StagingBufferD3D12.cpp +++ b/src/dawn_native/d3d12/StagingBufferD3D12.cpp @@ -42,7 +42,7 @@ namespace dawn_native { namespace d3d12 { // TODO(bryan.bernhart@intel.com): Record the GPU pointer for generic non-upload usage. 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 {}; @@ -60,4 +60,4 @@ namespace dawn_native { namespace d3d12 { return mUploadHeap.Get(); } -}} // namespace dawn_native::d3d12 \ No newline at end of file +}} // namespace dawn_native::d3d12 diff --git a/src/dawn_native/metal/BackendMTL.mm b/src/dawn_native/metal/BackendMTL.mm index febe38a6b4..80287ddbb3 100644 --- a/src/dawn_native/metal/BackendMTL.mm +++ b/src/dawn_native/metal/BackendMTL.mm @@ -52,7 +52,7 @@ namespace dawn_native { namespace metal { } 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 @@ -102,7 +102,7 @@ namespace dawn_native { namespace metal { // Get a matching dictionary for the IOGraphicsAccelerator2 CFMutableDictionaryRef matchingDict = IORegistryEntryIDMatching([device registryID]); 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, @@ -110,7 +110,7 @@ namespace dawn_native { namespace metal { io_registry_entry_t acceleratorEntry = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict); 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"); } @@ -119,8 +119,7 @@ namespace dawn_native { namespace metal { if (IORegistryEntryGetParentEntry(acceleratorEntry, kIOServicePlane, &deviceEntry) != kIOReturnSuccess) { IOObjectRelease(acceleratorEntry); - return DAWN_CONTEXT_LOST_ERROR( - "Failed to get the IO registry entry for the device"); + return DAWN_DEVICE_LOST_ERROR("Failed to get the IO registry entry for the device"); } ASSERT(deviceEntry != IO_OBJECT_NULL); diff --git a/src/dawn_native/metal/StagingBufferMTL.mm b/src/dawn_native/metal/StagingBufferMTL.mm index 114b01dbfb..491b35cf79 100644 --- a/src/dawn_native/metal/StagingBufferMTL.mm +++ b/src/dawn_native/metal/StagingBufferMTL.mm @@ -32,7 +32,7 @@ namespace dawn_native { namespace metal { mMappedPointer = [mBuffer contents]; if (mMappedPointer == nullptr) { - return DAWN_CONTEXT_LOST_ERROR("Unable to map staging buffer."); + return DAWN_DEVICE_LOST_ERROR("Unable to map staging buffer."); } return {}; @@ -47,4 +47,4 @@ namespace dawn_native { namespace metal { return mBuffer; } -}} // namespace dawn_native::metal \ No newline at end of file +}} // namespace dawn_native::metal diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp index 2ea0075d81..8fcfe0ea7f 100644 --- a/src/dawn_native/null/DeviceNull.cpp +++ b/src/dawn_native/null/DeviceNull.cpp @@ -173,7 +173,7 @@ namespace dawn_native { namespace null { MaybeError Device::IncrementMemoryUsage(size_t bytes) { static_assert(kMaxMemoryUsage <= std::numeric_limits::max() / 2, ""); if (bytes > kMaxMemoryUsage || mMemoryUsage + bytes > kMaxMemoryUsage) { - return DAWN_CONTEXT_LOST_ERROR("Out of memory."); + return DAWN_DEVICE_LOST_ERROR("Out of memory."); } mMemoryUsage += bytes; return {}; diff --git a/src/dawn_native/opengl/OpenGLFunctions.cpp b/src/dawn_native/opengl/OpenGLFunctions.cpp index d4a72b396b..0bc5781a1a 100644 --- a/src/dawn_native/opengl/OpenGLFunctions.cpp +++ b/src/dawn_native/opengl/OpenGLFunctions.cpp @@ -22,7 +22,7 @@ namespace dawn_native { namespace opengl { MaybeError OpenGLFunctions::Initialize(GetProcAddress getProc) { PFNGLGETSTRINGPROC getString = reinterpret_cast(getProc("glGetString")); 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(getString(GL_VERSION)); diff --git a/src/dawn_native/vulkan/BackendVk.cpp b/src/dawn_native/vulkan/BackendVk.cpp index e7516c2b24..dff6bbea06 100644 --- a/src/dawn_native/vulkan/BackendVk.cpp +++ b/src/dawn_native/vulkan/BackendVk.cpp @@ -61,7 +61,7 @@ namespace dawn_native { namespace vulkan { MaybeError Backend::Initialize() { 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)); diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp index 57c9eebcbb..025f2c7180 100644 --- a/src/dawn_native/vulkan/DeviceVk.cpp +++ b/src/dawn_native/vulkan/DeviceVk.cpp @@ -397,7 +397,7 @@ namespace dawn_native { namespace vulkan { } if (universalQueueFamily == -1) { - return DAWN_CONTEXT_LOST_ERROR("No universal queue family"); + return DAWN_DEVICE_LOST_ERROR("No universal queue family"); } mQueueFamily = static_cast(universalQueueFamily); } diff --git a/src/dawn_native/vulkan/StagingBufferVk.cpp b/src/dawn_native/vulkan/StagingBufferVk.cpp index 4e96f85f9b..38bb84eeed 100644 --- a/src/dawn_native/vulkan/StagingBufferVk.cpp +++ b/src/dawn_native/vulkan/StagingBufferVk.cpp @@ -36,24 +36,24 @@ namespace dawn_native { namespace vulkan { if (mDevice->fn.CreateBuffer(mDevice->GetVkDevice(), &createInfo, nullptr, &mBuffer) != VK_SUCCESS) { - return DAWN_CONTEXT_LOST_ERROR("Unable to create staging buffer."); + return DAWN_DEVICE_LOST_ERROR("Unable to create staging buffer."); } VkMemoryRequirements requirements; mDevice->fn.GetBufferMemoryRequirements(mDevice->GetVkDevice(), mBuffer, &requirements); 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(), 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(); if (mMappedPointer == nullptr) { - return DAWN_CONTEXT_LOST_ERROR("Unable to map staging buffer."); + return DAWN_DEVICE_LOST_ERROR("Unable to map staging buffer."); } return {}; @@ -69,4 +69,4 @@ namespace dawn_native { namespace vulkan { return mBuffer; } -}} // namespace dawn_native::vulkan \ No newline at end of file +}} // namespace dawn_native::vulkan diff --git a/src/dawn_native/vulkan/VulkanError.cpp b/src/dawn_native/vulkan/VulkanError.cpp index a01475c23f..543c9b0964 100644 --- a/src/dawn_native/vulkan/VulkanError.cpp +++ b/src/dawn_native/vulkan/VulkanError.cpp @@ -67,7 +67,7 @@ namespace dawn_native { namespace vulkan { } 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 diff --git a/src/dawn_native/vulkan/VulkanFunctions.cpp b/src/dawn_native/vulkan/VulkanFunctions.cpp index b3e32e0691..0d36776b73 100644 --- a/src/dawn_native/vulkan/VulkanFunctions.cpp +++ b/src/dawn_native/vulkan/VulkanFunctions.cpp @@ -22,12 +22,12 @@ namespace dawn_native { namespace vulkan { #define GET_GLOBAL_PROC(name) \ name = reinterpret_cast(GetInstanceProcAddr(nullptr, "vk" #name)); \ 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) { 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); @@ -44,7 +44,7 @@ namespace dawn_native { namespace vulkan { #define GET_INSTANCE_PROC(name) \ name = reinterpret_cast(GetInstanceProcAddr(instance, "vk" #name)); \ 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, @@ -106,10 +106,10 @@ namespace dawn_native { namespace vulkan { return {}; } -#define GET_DEVICE_PROC(name) \ - name = reinterpret_cast(GetDeviceProcAddr(device, "vk" #name)); \ - if (name == nullptr) { \ - return DAWN_CONTEXT_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \ +#define GET_DEVICE_PROC(name) \ + name = reinterpret_cast(GetDeviceProcAddr(device, "vk" #name)); \ + if (name == nullptr) { \ + return DAWN_DEVICE_LOST_ERROR(std::string("Couldn't get proc vk") + #name); \ } MaybeError VulkanFunctions::LoadDeviceProcs(VkDevice device, diff --git a/src/dawn_native/vulkan/VulkanInfo.cpp b/src/dawn_native/vulkan/VulkanInfo.cpp index 217466260b..f4f0284154 100644 --- a/src/dawn_native/vulkan/VulkanInfo.cpp +++ b/src/dawn_native/vulkan/VulkanInfo.cpp @@ -67,13 +67,13 @@ namespace dawn_native { namespace vulkan { // incomplete otherwise. This means that both values represent a success. // This is the same for all Enumarte functions if (result != VK_SUCCESS && result != VK_INCOMPLETE) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceLayerProperties"); + return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceLayerProperties"); } info.layers.resize(count); result = vkFunctions.EnumerateInstanceLayerProperties(&count, info.layers.data()); if (result != VK_SUCCESS) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceLayerProperties"); + return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceLayerProperties"); } for (const auto& layer : info.layers) { @@ -95,14 +95,14 @@ namespace dawn_native { namespace vulkan { VkResult result = vkFunctions.EnumerateInstanceExtensionProperties(nullptr, &count, nullptr); if (result != VK_SUCCESS && result != VK_INCOMPLETE) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceExtensionProperties"); + return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceExtensionProperties"); } info.extensions.resize(count); result = vkFunctions.EnumerateInstanceExtensionProperties(nullptr, &count, info.extensions.data()); if (result != VK_SUCCESS) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumerateInstanceExtensionProperties"); + return DAWN_DEVICE_LOST_ERROR("vkEnumerateInstanceExtensionProperties"); } for (const auto& extension : info.extensions) { @@ -164,13 +164,13 @@ namespace dawn_native { namespace vulkan { uint32_t count = 0; VkResult result = vkFunctions.EnumeratePhysicalDevices(instance, &count, nullptr); if (result != VK_SUCCESS && result != VK_INCOMPLETE) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumeratePhysicalDevices"); + return DAWN_DEVICE_LOST_ERROR("vkEnumeratePhysicalDevices"); } std::vector physicalDevices(count); result = vkFunctions.EnumeratePhysicalDevices(instance, &count, physicalDevices.data()); if (result != VK_SUCCESS) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumeratePhysicalDevices"); + return DAWN_DEVICE_LOST_ERROR("vkEnumeratePhysicalDevices"); } return physicalDevices; @@ -212,14 +212,14 @@ namespace dawn_native { namespace vulkan { VkResult result = vkFunctions.EnumerateDeviceLayerProperties(physicalDevice, &count, nullptr); if (result != VK_SUCCESS && result != VK_INCOMPLETE) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumerateDeviceLayerProperties"); + return DAWN_DEVICE_LOST_ERROR("vkEnumerateDeviceLayerProperties"); } info.layers.resize(count); result = vkFunctions.EnumerateDeviceLayerProperties(physicalDevice, &count, info.layers.data()); 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( physicalDevice, nullptr, &count, nullptr); if (result != VK_SUCCESS && result != VK_INCOMPLETE) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumerateDeviceExtensionProperties"); + return DAWN_DEVICE_LOST_ERROR("vkEnumerateDeviceExtensionProperties"); } info.extensions.resize(count); result = vkFunctions.EnumerateDeviceExtensionProperties(physicalDevice, nullptr, &count, info.extensions.data()); if (result != VK_SUCCESS) { - return DAWN_CONTEXT_LOST_ERROR("vkEnumerateDeviceExtensionProperties"); + return DAWN_DEVICE_LOST_ERROR("vkEnumerateDeviceExtensionProperties"); } for (const auto& extension : info.extensions) { @@ -277,7 +277,7 @@ namespace dawn_native { namespace vulkan { VkResult result = vkFunctions.GetPhysicalDeviceSurfaceCapabilitiesKHR( physicalDevice, surface, &info->capabilities); 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); if (result != VK_SUCCESS) { - return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfaceSupportKHR"); + return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfaceSupportKHR"); } info->supportedQueueFamilies[i] = (supported == VK_TRUE); @@ -305,14 +305,14 @@ namespace dawn_native { namespace vulkan { VkResult result = vkFunctions.GetPhysicalDeviceSurfaceFormatsKHR( physicalDevice, surface, &count, nullptr); if (result != VK_SUCCESS && result != VK_INCOMPLETE) { - return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfaceFormatsKHR"); + return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfaceFormatsKHR"); } info->formats.resize(count); result = vkFunctions.GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &count, info->formats.data()); 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( physicalDevice, surface, &count, nullptr); if (result != VK_SUCCESS && result != VK_INCOMPLETE) { - return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR"); + return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR"); } info->presentModes.resize(count); result = vkFunctions.GetPhysicalDeviceSurfacePresentModesKHR( physicalDevice, surface, &count, info->presentModes.data()); if (result != VK_SUCCESS) { - return DAWN_CONTEXT_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR"); + return DAWN_DEVICE_LOST_ERROR("vkGetPhysicalDeviceSurfacePresentModesKHR"); } } diff --git a/src/dawn_wire/client/ApiProcs.cpp b/src/dawn_wire/client/ApiProcs.cpp index 64c2fe9a45..95d0e545a5 100644 --- a/src/dawn_wire/client/ApiProcs.cpp +++ b/src/dawn_wire/client/ApiProcs.cpp @@ -59,7 +59,7 @@ namespace dawn_wire { namespace client { MemoryTransferService::ReadHandle* readHandle = buffer->device->GetClient()->GetMemoryTransferService()->CreateReadHandle(buffer->size); 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; } @@ -90,7 +90,7 @@ namespace dawn_wire { namespace client { buffer->device->GetClient()->GetMemoryTransferService()->CreateWriteHandle( buffer->size); 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; } @@ -223,7 +223,7 @@ namespace dawn_wire { namespace client { result.buffer = reinterpret_cast(buffer); result.data = nullptr; result.dataLength = 0; - callback(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, result, userdata); + callback(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, result, userdata); return; } diff --git a/src/dawn_wire/client/ClientDoers.cpp b/src/dawn_wire/client/ClientDoers.cpp index 7cb0b5251f..abaa41c217 100644 --- a/src/dawn_wire/client/ClientDoers.cpp +++ b/src/dawn_wire/client/ClientDoers.cpp @@ -88,7 +88,7 @@ namespace dawn_wire { namespace client { if (!GetMappedData()) { // Dawn promises that all callbacks are called in finite time. Even if a fatal error // 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); return false; } else { @@ -152,7 +152,7 @@ namespace dawn_wire { namespace client { if (!GetMappedData()) { // Dawn promises that all callbacks are called in finite time. Even if a fatal error // 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); return false; } else { diff --git a/src/tests/unittests/wire/WireMemoryTransferServiceTests.cpp b/src/tests/unittests/wire/WireMemoryTransferServiceTests.cpp index 3feb809e64..21c7c94857 100644 --- a/src/tests/unittests/wire/WireMemoryTransferServiceTests.cpp +++ b/src/tests/unittests/wire/WireMemoryTransferServiceTests.cpp @@ -513,9 +513,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapReadHandleCreationFailure) { MockReadHandleCreationFailure(); // Failed creation of a ReadHandle is a fatal failure and the client synchronously receives a - // CONTEXT_LOST callback. + // DEVICE_LOST callback. 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); dawnBufferMapReadAsync(buffer, ToMockBufferMapReadCallback, nullptr); @@ -580,9 +580,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapReadDeserializeInitialDataFailur MockClientReadHandleDeserializeInitializeFailure(clientHandle); // Failed deserialization is a fatal failure and the client synchronously receives a - // CONTEXT_LOST callback. + // DEVICE_LOST callback. 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); // The handle will be destroyed since deserializing failed. @@ -702,9 +702,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapWriteHandleCreationFailure) { MockWriteHandleCreationFailure(); // Failed creation of a WriteHandle is a fatal failure and the client synchronously receives a - // CONTEXT_LOST callback. + // DEVICE_LOST callback. 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); dawnBufferMapWriteAsync(buffer, ToMockBufferMapWriteCallback, nullptr); @@ -765,9 +765,9 @@ TEST_F(WireMemoryTransferServiceTests, BufferMapWriteHandleOpenFailure) { // Mock a failure. 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, - Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, nullptr, 0, _)) + Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, nullptr, 0, _)) .Times(1); // Since opening the handle fails, it gets destroyed immediately. @@ -885,9 +885,9 @@ TEST_F(WireMemoryTransferServiceTests, CreateBufferMappedAsyncWriteHandleCreatio descriptor.size = sizeof(mBufferContent); // Failed creation of a WriteHandle is a fatal failure. The client synchronously receives - // a CONTEXT_LOST callback. + // a DEVICE_LOST callback. 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); dawnDeviceCreateBufferMappedAsync(device, &descriptor, ToMockCreateBufferMappedCallback, nullptr); @@ -934,9 +934,9 @@ TEST_F(WireMemoryTransferServiceTests, CreateBufferMappedAsyncHandleOpenFailure) // Since the mapping succeeds, the client opens the WriteHandle. 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, - Call(DAWN_BUFFER_MAP_ASYNC_STATUS_CONTEXT_LOST, _, nullptr, 0, _)) + Call(DAWN_BUFFER_MAP_ASYNC_STATUS_DEVICE_LOST, _, nullptr, 0, _)) .Times(1); // Since opening the handle fails, it is destroyed immediately.