Vulkan: Remove vk::ErrorOrResult.
The ErrorOrResult pattern doesn't help much. Removing it enables the
Error passing refactor in the Vulkan back-end.
Bug: angleproject:2713
Change-Id: I4e8277ad856c785bf22b4d37b7ae880b534ef005
Reviewed-on: https://chromium-review.googlesource.com/1128919
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 9421154..2e7d7d6 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -559,7 +559,7 @@
return vk::NoError();
}
-vk::ErrorOrResult<uint32_t> RendererVk::selectPresentQueueForSurface(VkSurfaceKHR surface)
+vk::Error RendererVk::selectPresentQueueForSurface(VkSurfaceKHR surface, uint32_t *presentQueueOut)
{
// We've already initialized a device, and can't re-create it unless it's never been used.
// TODO(jmadill): Handle the re-creation case if necessary.
@@ -572,7 +572,11 @@
ANGLE_VK_TRY(vkGetPhysicalDeviceSurfaceSupportKHR(mPhysicalDevice, mCurrentQueueFamilyIndex,
surface, &supportsPresent));
- return (supportsPresent == VK_TRUE);
+ if (supportsPresent == VK_TRUE)
+ {
+ *presentQueueOut = mCurrentQueueFamilyIndex;
+ return vk::NoError();
+ }
}
// Find a graphics and present queue.
@@ -598,7 +602,8 @@
ANGLE_VK_CHECK(newPresentQueue.valid(), VK_ERROR_INITIALIZATION_FAILED);
ANGLE_TRY(initializeDevice(newPresentQueue.value()));
- return newPresentQueue.value();
+ *presentQueueOut = newPresentQueue.value();
+ return vk::NoError();
}
std::string RendererVk::getVendorString() const
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.h b/src/libANGLE/renderer/vulkan/RendererVk.h
index d365b29..fb6f317 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.h
+++ b/src/libANGLE/renderer/vulkan/RendererVk.h
@@ -55,7 +55,7 @@
VkQueue getQueue() const { return mQueue; }
VkDevice getDevice() const { return mDevice; }
- vk::ErrorOrResult<uint32_t> selectPresentQueueForSurface(VkSurfaceKHR surface);
+ vk::Error selectPresentQueueForSurface(VkSurfaceKHR surface, uint32_t *presentQueueOut);
vk::Error finish(const gl::Context *context);
vk::Error flush(const gl::Context *context,
diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
index 75cf42d..65b1916 100644
--- a/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
+++ b/src/libANGLE/renderer/vulkan/SurfaceVk.cpp
@@ -322,10 +322,10 @@
vk::Error WindowSurfaceVk::initializeImpl(RendererVk *renderer)
{
gl::Extents windowSize;
- ANGLE_TRY_RESULT(createSurfaceVk(renderer), windowSize);
+ ANGLE_TRY(createSurfaceVk(renderer, &windowSize));
uint32_t presentQueue = 0;
- ANGLE_TRY_RESULT(renderer->selectPresentQueueForSurface(mSurface), presentQueue);
+ ANGLE_TRY(renderer->selectPresentQueueForSurface(mSurface, &presentQueue));
ANGLE_UNUSED_VARIABLE(presentQueue);
const VkPhysicalDevice &physicalDevice = renderer->getPhysicalDevice();
diff --git a/src/libANGLE/renderer/vulkan/SurfaceVk.h b/src/libANGLE/renderer/vulkan/SurfaceVk.h
index 98397f0..3d23db2 100644
--- a/src/libANGLE/renderer/vulkan/SurfaceVk.h
+++ b/src/libANGLE/renderer/vulkan/SurfaceVk.h
@@ -137,7 +137,7 @@
VkInstance mInstance;
private:
- virtual vk::ErrorOrResult<gl::Extents> createSurfaceVk(RendererVk *renderer) = 0;
+ virtual vk::Error createSurfaceVk(RendererVk *renderer, gl::Extents *extentsOut) = 0;
vk::Error initializeImpl(RendererVk *renderer);
vk::Error nextSwapchainImage(RendererVk *renderer);
diff --git a/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.cpp b/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.cpp
index a9c9734..8eefe55 100644
--- a/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.cpp
+++ b/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.cpp
@@ -24,7 +24,7 @@
{
}
-vk::ErrorOrResult<gl::Extents> WindowSurfaceVkAndroid::createSurfaceVk(RendererVk *renderer)
+vk::Error WindowSurfaceVkAndroid::createSurfaceVk(RendererVk *renderer, gl::Extents *extentsOut)
{
VkAndroidSurfaceCreateInfoKHR createInfo;
@@ -39,7 +39,8 @@
int32_t height = ANativeWindow_getHeight(mNativeWindowType);
ANGLE_VK_CHECK(width > 0 && height > 0, VK_ERROR_INITIALIZATION_FAILED);
- return gl::Extents(width, height, 0);
+ *extentsOut = gl::Extents(width, height, 0);
+ return vk::NoError();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.h b/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.h
index d2263f2..b20ad48 100644
--- a/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.h
+++ b/src/libANGLE/renderer/vulkan/android/WindowSurfaceVkAndroid.h
@@ -24,7 +24,7 @@
EGLint height);
private:
- vk::ErrorOrResult<gl::Extents> createSurfaceVk(RendererVk *renderer) override;
+ vk::Error createSurfaceVk(RendererVk *renderer, gl::Extents *extentsOut) override;
};
} // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.h b/src/libANGLE/renderer/vulkan/vk_utils.h
index fc11cc8..16878ab 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_utils.h
@@ -150,9 +150,6 @@
unsigned int mLine;
};
-template <typename ResultT>
-using ErrorOrResult = angle::ErrorOrResultBase<Error, ResultT, VkResult, VK_SUCCESS>;
-
// Avoid conflicting with X headers which define "Success".
inline Error NoError()
{
diff --git a/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.cpp b/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.cpp
index b9de8d8..0c952d2 100644
--- a/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.cpp
+++ b/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.cpp
@@ -22,7 +22,7 @@
{
}
-vk::ErrorOrResult<gl::Extents> WindowSurfaceVkWin32::createSurfaceVk(RendererVk *renderer)
+vk::Error WindowSurfaceVkWin32::createSurfaceVk(RendererVk *renderer, gl::Extents *extentsOut)
{
VkWin32SurfaceCreateInfoKHR createInfo;
@@ -36,7 +36,8 @@
RECT rect;
ANGLE_VK_CHECK(GetClientRect(mNativeWindowType, &rect) == TRUE, VK_ERROR_INITIALIZATION_FAILED);
- return gl::Extents(rect.right - rect.left, rect.bottom - rect.top, 0);
+ *extentsOut = gl::Extents(rect.right - rect.left, rect.bottom - rect.top, 0);
+ return vk::NoError();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.h b/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.h
index 5d0c978..493cdfb 100644
--- a/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.h
+++ b/src/libANGLE/renderer/vulkan/win32/WindowSurfaceVkWin32.h
@@ -24,7 +24,7 @@
EGLint height);
private:
- vk::ErrorOrResult<gl::Extents> createSurfaceVk(RendererVk *renderer) override;
+ vk::Error createSurfaceVk(RendererVk *renderer, gl::Extents *extentsOut) override;
};
} // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.cpp b/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.cpp
index b486b74..26ec8ce 100644
--- a/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.cpp
+++ b/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.cpp
@@ -23,7 +23,7 @@
{
}
-vk::ErrorOrResult<gl::Extents> WindowSurfaceVkXcb::createSurfaceVk(RendererVk *renderer)
+vk::Error WindowSurfaceVkXcb::createSurfaceVk(RendererVk *renderer, gl::Extents *extentsOut)
{
VkXcbSurfaceCreateInfoKHR createInfo;
@@ -37,9 +37,10 @@
xcb_get_geometry_cookie_t cookie = xcb_get_geometry(mXcbConnection, mNativeWindowType);
xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(mXcbConnection, cookie, nullptr);
ASSERT(reply);
- gl::Extents result(reply->width, reply->height, 0);
free(reply);
- return result;
+
+ *extentsOut = gl::Extents(reply->width, reply->height, 0);
+ return vk::NoError();
}
} // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.h b/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.h
index 1d3cdc0..b8daf86 100644
--- a/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.h
+++ b/src/libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.h
@@ -27,7 +27,7 @@
xcb_connection_t *conn);
private:
- vk::ErrorOrResult<gl::Extents> createSurfaceVk(RendererVk *renderer) override;
+ vk::Error createSurfaceVk(RendererVk *renderer, gl::Extents *extentsOut) override;
xcb_connection_t *mXcbConnection;
};