aboutsummaryrefslogtreecommitdiff
path: root/src/gpu/ganesh/vk/GrVkUtil.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ganesh/vk/GrVkUtil.h')
-rw-r--r--src/gpu/ganesh/vk/GrVkUtil.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gpu/ganesh/vk/GrVkUtil.h b/src/gpu/ganesh/vk/GrVkUtil.h
index a64a93b14a..c2e565e3be 100644
--- a/src/gpu/ganesh/vk/GrVkUtil.h
+++ b/src/gpu/ganesh/vk/GrVkUtil.h
@@ -22,13 +22,20 @@ class GrVkGpu;
// makes a Vk call on the interface
#define GR_VK_CALL(IFACE, X) (IFACE)->fFunctions.f##X
+// Note: must be called before checkVkResult, since this does not log if the GPU is already
+// considering the device to be lost.
+#define GR_VK_LOG_IF_NOT_SUCCESS(GPU, RESULT, X, ...) \
+ do { \
+ if (RESULT != VK_SUCCESS && !GPU->isDeviceLost()) { \
+ SkDebugf("Failed vulkan call. Error: %d, " X "\n", RESULT, ##__VA_ARGS__); \
+ } \
+ } while (false)
+
#define GR_VK_CALL_RESULT(GPU, RESULT, X) \
do { \
(RESULT) = GR_VK_CALL(GPU->vkInterface(), X); \
SkASSERT(VK_SUCCESS == RESULT || VK_ERROR_DEVICE_LOST == RESULT); \
- if (RESULT != VK_SUCCESS && !GPU->isDeviceLost()) { \
- SkDebugf("Failed vulkan call. Error: %d," #X "\n", RESULT); \
- } \
+ GR_VK_LOG_IF_NOT_SUCCESS(GPU, RESULT, #X); \
GPU->checkVkResult(RESULT); \
} while (false)