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

Side by Side Diff: src/gpu/vk/GrVkImage.h

Issue 1943933002: Apply setImageLayout() to all of a VkImage's subresources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrVkImage_DEFINED 8 #ifndef GrVkImage_DEFINED
9 #define GrVkImage_DEFINED 9 #define GrVkImage_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 enum Flags { 25 enum Flags {
26 kNo_Flags = 0, 26 kNo_Flags = 0,
27 kLinearTiling_Flag = 0x01, 27 kLinearTiling_Flag = 0x01,
28 kBorrowed_Flag = 0x02 28 kBorrowed_Flag = 0x02
29 }; 29 };
30 30
31 VkImage fImage; 31 VkImage fImage;
32 VkDeviceMemory fAlloc; 32 VkDeviceMemory fAlloc;
33 VkFormat fFormat; 33 VkFormat fFormat;
34 uint32_t fLevelCount;
34 uint32_t fFlags; 35 uint32_t fFlags;
35 36
36 Resource() 37 Resource()
37 : INHERITED() 38 : INHERITED()
38 , fImage(VK_NULL_HANDLE) 39 , fImage(VK_NULL_HANDLE)
39 , fAlloc(VK_NULL_HANDLE) 40 , fAlloc(VK_NULL_HANDLE)
40 , fFormat(VK_FORMAT_UNDEFINED) 41 , fFormat(VK_FORMAT_UNDEFINED)
42 , fLevelCount(0)
41 , fFlags(kNo_Flags) {} 43 , fFlags(kNo_Flags) {}
42 44
43 Resource(VkImage image, VkDeviceMemory alloc, uint32_t flags, VkFormat f ormat) 45 Resource(VkImage image, VkDeviceMemory alloc, VkFormat format, uint32_t levelCount,
44 : fImage(image), fAlloc(alloc), fFormat(format), fFlags(flags) {} 46 uint32_t flags)
47 : fImage(image), fAlloc(alloc), fFormat(format), fLevelCount(levelCo unt)
48 , fFlags(flags) {}
45 49
46 ~Resource() override {} 50 ~Resource() override {}
47 51
48 private: 52 private:
49 void freeGPUData(const GrVkGpu* gpu) const override; 53 void freeGPUData(const GrVkGpu* gpu) const override;
50 54
51 typedef GrVkResource INHERITED; 55 typedef GrVkResource INHERITED;
52 }; 56 };
53 57
54 // for wrapped textures 58 // for wrapped textures
55 class BorrowedResource : public Resource { 59 class BorrowedResource : public Resource {
56 public: 60 public:
57 BorrowedResource(VkImage image, VkDeviceMemory alloc, uint32_t flags, Vk Format format) 61 BorrowedResource(VkImage image, VkDeviceMemory alloc, VkFormat format, u int32_t levelCount,
58 : Resource(image, alloc, (flags | kBorrowed_Flag), format) { 62 uint32_t flags)
63 : Resource(image, alloc, format, levelCount, (flags | kBorrowed_Flag )) {
59 } 64 }
60 private: 65 private:
61 void freeGPUData(const GrVkGpu* gpu) const override; 66 void freeGPUData(const GrVkGpu* gpu) const override;
62 }; 67 };
63 68
64 GrVkImage(const Resource* imageResource) : fResource(imageResource) { 69 GrVkImage(const Resource* imageResource) : fResource(imageResource) {
65 if (imageResource->fFlags & Resource::kLinearTiling_Flag) { 70 if (imageResource->fFlags & Resource::kLinearTiling_Flag) {
66 fCurrentLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; 71 fCurrentLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
67 } else { 72 } else {
68 fCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED; 73 fCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 static const Resource* CreateResource(const GrVkGpu* gpu, const ImageDesc& i mageDesc); 120 static const Resource* CreateResource(const GrVkGpu* gpu, const ImageDesc& i mageDesc);
116 121
117 protected: 122 protected:
118 123
119 void releaseImage(const GrVkGpu* gpu); 124 void releaseImage(const GrVkGpu* gpu);
120 void abandonImage(); 125 void abandonImage();
121 126
122 const Resource* fResource; 127 const Resource* fResource;
123 128
124 VkImageLayout fCurrentLayout; 129 VkImageLayout fCurrentLayout;
125
126 }; 130 };
127 131
128 #endif 132 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkImage.cpp » ('j') | src/gpu/vk/GrVkImage.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698