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

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

Issue 1906623002: Update min Vulkan version to 1.0.8.0, and fix various bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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 | « src/gpu/vk/GrVkGpu.cpp ('k') | 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 10 matching lines...) Expand all
21 class Resource : public GrVkResource { 21 class Resource : public GrVkResource {
22 public: 22 public:
23 enum Flags { 23 enum Flags {
24 kNo_Flags = 0, 24 kNo_Flags = 0,
25 kLinearTiling_Flag = 0x01 25 kLinearTiling_Flag = 0x01
26 }; 26 };
27 27
28 VkImage fImage; 28 VkImage fImage;
29 VkDeviceMemory fAlloc; 29 VkDeviceMemory fAlloc;
30 Flags fFlags; 30 Flags fFlags;
31 VkFormat fFormat;
31 32
32 Resource() : INHERITED(), fImage(VK_NULL_HANDLE), fAlloc(VK_NULL_HANDLE) , fFlags(kNo_Flags) {} 33 Resource()
34 : INHERITED()
35 , fImage(VK_NULL_HANDLE)
36 , fAlloc(VK_NULL_HANDLE)
37 , fFlags(kNo_Flags)
38 , fFormat(VK_FORMAT_UNDEFINED) {}
33 39
34 Resource(VkImage image, VkDeviceMemory alloc, Flags flags) 40 Resource(VkImage image, VkDeviceMemory alloc, Flags flags, VkFormat form at)
35 : fImage(image), fAlloc(alloc), fFlags(flags) {} 41 : fImage(image), fAlloc(alloc), fFlags(flags), fFormat(format) {}
36 42
37 ~Resource() override {} 43 ~Resource() override {}
38 private: 44 private:
39 void freeGPUData(const GrVkGpu* gpu) const override; 45 void freeGPUData(const GrVkGpu* gpu) const override;
40 46
41 typedef GrVkResource INHERITED; 47 typedef GrVkResource INHERITED;
42 }; 48 };
43 49
44 // for wrapped textures 50 // for wrapped textures
45 class BorrowedResource : public Resource { 51 class BorrowedResource : public Resource {
46 public: 52 public:
47 BorrowedResource(VkImage image, VkDeviceMemory alloc, Flags flags) 53 BorrowedResource(VkImage image, VkDeviceMemory alloc, Flags flags, VkFor mat format)
48 : Resource(image, alloc, flags) {} 54 : Resource(image, alloc, flags, format) {}
49 private: 55 private:
50 void freeGPUData(const GrVkGpu* gpu) const override; 56 void freeGPUData(const GrVkGpu* gpu) const override;
51 }; 57 };
52 58
53 GrVkImage(const Resource* imageResource) : fResource(imageResource) { 59 GrVkImage(const Resource* imageResource) : fResource(imageResource) {
54 if (imageResource->fFlags & Resource::kLinearTiling_Flag) { 60 if (imageResource->fFlags & Resource::kLinearTiling_Flag) {
55 fCurrentLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; 61 fCurrentLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
56 } else { 62 } else {
57 fCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED; 63 fCurrentLayout = VK_IMAGE_LAYOUT_UNDEFINED;
58 } 64 }
59 imageResource->ref(); 65 imageResource->ref();
60 } 66 }
61 67
62 virtual ~GrVkImage(); 68 virtual ~GrVkImage();
63 69
64 VkImage textureImage() const { return fResource->fImage; } 70 VkImage textureImage() const { return fResource->fImage; }
65 VkDeviceMemory textureMemory() const { return fResource->fAlloc; } 71 VkDeviceMemory textureMemory() const { return fResource->fAlloc; }
66 const Resource* resource() const { return fResource; } 72 const Resource* resource() const { return fResource; }
67 bool isLinearTiled() const { 73 bool isLinearTiled() const {
68 return SkToBool(fResource->fFlags & Resource::kLinearTiling_Flag); 74 return SkToBool(fResource->fFlags & Resource::kLinearTiling_Flag);
69 } 75 }
70 76
71 VkImageLayout currentLayout() const { return fCurrentLayout; } 77 VkImageLayout currentLayout() const { return fCurrentLayout; }
72 78
73 void setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout, 79 void setImageLayout(const GrVkGpu* gpu,
80 VkImageLayout newLayout,
74 VkAccessFlags srcAccessMask, 81 VkAccessFlags srcAccessMask,
75 VkAccessFlags dstAccessMask, 82 VkAccessFlags dstAccessMask,
76 VkPipelineStageFlags srcStageMask, 83 VkPipelineStageFlags srcStageMask,
77 VkPipelineStageFlags dstStageMask, 84 VkPipelineStageFlags dstStageMask,
78 bool byRegion); 85 bool byRegion);
79 86
80 struct ImageDesc { 87 struct ImageDesc {
81 VkImageType fImageType; 88 VkImageType fImageType;
82 VkFormat fFormat; 89 VkFormat fFormat;
83 uint32_t fWidth; 90 uint32_t fWidth;
(...skipping 23 matching lines...) Expand all
107 void releaseImage(const GrVkGpu* gpu); 114 void releaseImage(const GrVkGpu* gpu);
108 void abandonImage(); 115 void abandonImage();
109 116
110 const Resource* fResource; 117 const Resource* fResource;
111 118
112 VkImageLayout fCurrentLayout; 119 VkImageLayout fCurrentLayout;
113 120
114 }; 121 };
115 122
116 #endif 123 #endif
OLDNEW
« 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