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

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

Issue 1824123002: Fix borrowed GrVkImage::Resource. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | src/gpu/vk/GrVkImage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 Resource(VkImage image, VkDeviceMemory alloc, Flags flags) 34 Resource(VkImage image, VkDeviceMemory alloc, Flags flags)
35 : fImage(image), fAlloc(alloc), fFlags(flags) {} 35 : fImage(image), fAlloc(alloc), fFlags(flags) {}
36 36
37 ~Resource() override {} 37 ~Resource() override {}
38 private: 38 private:
39 void freeGPUData(const GrVkGpu* gpu) const override; 39 void freeGPUData(const GrVkGpu* gpu) const override;
40 40
41 typedef GrVkResource INHERITED; 41 typedef GrVkResource INHERITED;
42 }; 42 };
43 43
44 // for wrapped textures
45 class BorrowedResource : public Resource {
46 public:
47 BorrowedResource(VkImage image, VkDeviceMemory alloc, Flags flags)
48 : Resource(image, alloc, flags) {}
49 private:
50 void freeGPUData(const GrVkGpu* gpu) const override;
51 };
44 52
45 GrVkImage(const Resource* imageResource) : fResource(imageResource) { 53 GrVkImage(const Resource* imageResource) : fResource(imageResource) {
46 if (imageResource->fFlags & Resource::kLinearTiling_Flag) { 54 if (imageResource->fFlags & Resource::kLinearTiling_Flag) {
47 fCurrentLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; 55 fCurrentLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
48 } else { 56 } else {
49 fCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED; 57 fCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED;
50 } 58 }
51 imageResource->ref(); 59 imageResource->ref();
52 } 60 }
53 61
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void releaseImage(const GrVkGpu* gpu); 107 void releaseImage(const GrVkGpu* gpu);
100 void abandonImage(); 108 void abandonImage();
101 109
102 const Resource* fResource; 110 const Resource* fResource;
103 111
104 VkImageLayout fCurrentLayout; 112 VkImageLayout fCurrentLayout;
105 113
106 }; 114 };
107 115
108 #endif 116 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698