aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/GrVkTypesPriv.h
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-04-10 09:34:07 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-10 14:20:22 +0000
commit52e16d984898f18c84de773507da875a7954b922 (patch)
tree61dc6aaa14903f6b8c2e7e55d5d40c136e653354 /include/private/GrVkTypesPriv.h
parent58627cb8eb559670b86f06225eb87e6c1c5e8504 (diff)
Update getBackendInfo calls on GrBackendTexture to support VkImageLayout better.
The big api level change here is that the getBackendInfo calls now return by value instead of a pointer. These changes are being made in support of Vulkan so that the client can update the VkImageLayout on the GrBackendTexture and have that update get reflected in our internal tracking of the image. This is done by storing a ref counted GrVkImageLayout object on the GrBackendTexture and the GrVkImage. Bug: skia: Change-Id: I8c6158fd3a66eb61fef97ebf09ea5364bca3f1ae Reviewed-on: https://skia-review.googlesource.com/119101 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include/private/GrVkTypesPriv.h')
-rw-r--r--include/private/GrVkTypesPriv.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/private/GrVkTypesPriv.h b/include/private/GrVkTypesPriv.h
new file mode 100644
index 0000000000..20b6953d0d
--- /dev/null
+++ b/include/private/GrVkTypesPriv.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrVkTypesPriv_DEFINED
+#define GrVkTypesPriv_DEFINED
+
+#include "GrVkTypes.h"
+#include "SkRefCnt.h"
+
+class GrVkImageLayout;
+
+// This struct is to used to store the the actual information about the vulkan backend image on the
+// GrBackendTexture and GrBackendRenderTarget. When a client calls getVkImageInfo on a
+// GrBackendTexture/RenderTarget, we use the GrVkBackendSurfaceInfo to create a snapshot
+// GrVkImgeInfo object. Internally, this uses a ref count GrVkImageLayout object to track the
+// current VkImageLayout which can be shared with an internal GrVkImage so that layout updates can
+// be seen by all users of the image.
+struct GrVkBackendSurfaceInfo {
+ GrVkBackendSurfaceInfo(GrVkImageInfo info, GrVkImageLayout* layout)
+ : fImageInfo(info), fLayout(layout) {}
+
+ void cleanup();
+
+ GrVkBackendSurfaceInfo& operator=(const GrVkBackendSurfaceInfo&) = delete;
+
+ // Assigns the passed in GrVkBackendSurfaceInfo to this object. if isValid is true we will also
+ // attempt to unref the old fLayout on this object.
+ void assign(const GrVkBackendSurfaceInfo&, bool isValid);
+
+ void setImageLayout(VkImageLayout layout);
+
+ sk_sp<GrVkImageLayout> getGrVkImageLayout() const;
+
+ GrVkImageInfo snapImageInfo() const;
+
+#if GR_TEST_UTILS
+ bool operator==(const GrVkBackendSurfaceInfo& that) const;
+#endif
+
+private:
+ GrVkImageInfo fImageInfo;
+ GrVkImageLayout* fLayout;
+};
+
+#endif