Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: src/gpu/vk/GrVkImage.h

Issue 1718693002: Add vulkan files into skia repo. (Closed) Base URL: https://skia.googlesource.com/skia.git@merge
Patch Set: fix path Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkImage.h
diff --git a/src/gpu/vk/GrVkImage.h b/src/gpu/vk/GrVkImage.h
new file mode 100644
index 0000000000000000000000000000000000000000..3467a61f2bb735a9ec5ae89dcf53376c8e344490
--- /dev/null
+++ b/src/gpu/vk/GrVkImage.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrVkImage_DEFINED
+#define GrVkImage_DEFINED
+
+#include "GrVkResource.h"
+#include "SkTypes.h"
+
+#include "vulkan/vulkan.h"
+
+class GrVkGpu;
+
+class GrVkImage : SkNoncopyable {
+public:
+ // unlike GrVkBuffer, this needs to be public so GrVkStencilAttachment can use it
+ class Resource : public GrVkResource {
+ public:
+ enum Flags {
+ kNo_Flags = 0,
+ kLinearTiling_Flag = 0x01
+ };
+
+ VkImage fImage;
+ VkDeviceMemory fAlloc;
+ Flags fFlags;
+
+ Resource() : INHERITED(), fImage(nullptr), fAlloc(nullptr), fFlags(kNo_Flags) {}
+
+ Resource(VkImage image, VkDeviceMemory alloc, Flags flags)
+ : fImage(image), fAlloc(alloc), fFlags(flags) {}
+
+ ~Resource() override {}
+ private:
+ void freeGPUData(const GrVkGpu* gpu) const override;
+
+ typedef GrVkResource INHERITED;
+ };
+
+
+ GrVkImage(const Resource* imageResource) : fResource(imageResource) {
+ if (imageResource->fFlags & Resource::kLinearTiling_Flag) {
+ fCurrentLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
+ } else {
+ fCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED;
+ }
+ imageResource->ref();
+ }
+
+ virtual ~GrVkImage();
+
+ VkImage textureImage() const { return fResource->fImage; }
+ VkDeviceMemory textureMemory() const { return fResource->fAlloc; }
+ const Resource* resource() const { return fResource; }
+ bool isLinearTiled() const {
+ return SkToBool(fResource->fFlags & Resource::kLinearTiling_Flag);
+ }
+
+ VkImageLayout currentLayout() const { return fCurrentLayout; }
+
+ void setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout,
+ VkAccessFlags srcAccessMask,
+ VkAccessFlags dstAccessMask,
+ VkPipelineStageFlags srcStageMask,
+ VkPipelineStageFlags dstStageMask,
+ bool byRegion);
+
+ struct ImageDesc {
+ VkImageType fImageType;
+ VkFormat fFormat;
+ uint32_t fWidth;
+ uint32_t fHeight;
+ uint32_t fLevels;
+ uint32_t fSamples;
+ VkImageTiling fImageTiling;
+ VkImageUsageFlags fUsageFlags;
+ VkFlags fMemProps;
+
+ ImageDesc()
+ : fImageType(VK_IMAGE_TYPE_2D)
+ , fFormat(VK_FORMAT_UNDEFINED)
+ , fWidth(0)
+ , fHeight(0)
+ , fLevels(1)
+ , fSamples(1)
+ , fImageTiling(VK_IMAGE_TILING_OPTIMAL)
+ , fUsageFlags(0)
+ , fMemProps(VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {}
+ };
+
+ static const Resource* CreateResource(const GrVkGpu* gpu, const ImageDesc& imageDesc);
+
+protected:
+
+ void releaseImage(const GrVkGpu* gpu);
+ void abandonImage();
+
+ const Resource* fResource;
+
+ VkImageLayout fCurrentLayout;
+
+};
+
+#endif
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698