Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrBackendSurface_DEFINED |
| 9 | #define GrBackendSurface_DEFINED |
| 10 | |
| 11 | #include "GrTypes.h" |
Greg Daniel | bcf612b | 2017-05-01 13:50:58 +0000 | [diff] [blame] | 12 | #include "gl/GrGLTypes.h" |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 13 | #include "mock/GrMockTypes.h" |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 14 | |
| 15 | #ifdef SK_VULKAN |
Greg Daniel | bcf612b | 2017-05-01 13:50:58 +0000 | [diff] [blame] | 16 | #include "vk/GrVkTypes.h" |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 17 | #include "../private/GrVkTypesPriv.h" |
| 18 | |
| 19 | class GrVkImageLayout; |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 20 | #endif |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 21 | |
Robert Phillips | 8caf85f | 2018-04-05 09:30:38 -0400 | [diff] [blame] | 22 | #if !SK_SUPPORT_GPU |
| 23 | |
| 24 | // SkSurface and SkImage rely on a minimal version of these always being available |
| 25 | class SK_API GrBackendTexture { |
| 26 | public: |
| 27 | GrBackendTexture() {} |
| 28 | |
| 29 | bool isValid() const { return false; } |
| 30 | }; |
| 31 | |
| 32 | class SK_API GrBackendRenderTarget { |
| 33 | public: |
| 34 | GrBackendRenderTarget() {} |
| 35 | |
| 36 | bool isValid() const { return false; } |
| 37 | }; |
| 38 | #else |
| 39 | |
Robert Phillips | fc711a2 | 2018-02-13 17:03:00 -0500 | [diff] [blame] | 40 | class SK_API GrBackendFormat { |
| 41 | public: |
| 42 | // Creates an invalid backend format. |
| 43 | GrBackendFormat() : fValid(false) {} |
| 44 | |
| 45 | static GrBackendFormat MakeGL(GrGLenum format, GrGLenum target) { |
| 46 | return GrBackendFormat(format, target); |
| 47 | } |
| 48 | |
| 49 | #ifdef SK_VULKAN |
Greg Daniel | a8d9211 | 2018-03-09 12:05:04 -0500 | [diff] [blame] | 50 | static GrBackendFormat MakeVk(VkFormat format) { |
Robert Phillips | fc711a2 | 2018-02-13 17:03:00 -0500 | [diff] [blame] | 51 | return GrBackendFormat(format); |
| 52 | } |
| 53 | #endif |
| 54 | |
| 55 | static GrBackendFormat MakeMock(GrPixelConfig config) { |
| 56 | return GrBackendFormat(config); |
| 57 | } |
| 58 | |
| 59 | GrBackend backend() const {return fBackend; } |
| 60 | |
| 61 | // If the backend API is GL, these return a pointer to the format and target. Otherwise |
| 62 | // it returns nullptr. |
| 63 | const GrGLenum* getGLFormat() const; |
| 64 | const GrGLenum* getGLTarget() const; |
| 65 | |
| 66 | #ifdef SK_VULKAN |
| 67 | // If the backend API is Vulkan, this returns a pointer to a VkFormat. Otherwise |
| 68 | // it returns nullptr |
| 69 | const VkFormat* getVkFormat() const; |
| 70 | #endif |
| 71 | |
| 72 | // If the backend API is Mock, this returns a pointer to a GrPixelConfig. Otherwise |
| 73 | // it returns nullptr. |
| 74 | const GrPixelConfig* getMockFormat() const; |
| 75 | |
| 76 | // Returns true if the backend format has been initialized. |
| 77 | bool isValid() const { return fValid; } |
| 78 | |
| 79 | private: |
| 80 | GrBackendFormat(GrGLenum format, GrGLenum target); |
| 81 | |
| 82 | #ifdef SK_VULKAN |
| 83 | GrBackendFormat(const VkFormat vkFormat); |
| 84 | #endif |
| 85 | |
| 86 | GrBackendFormat(const GrPixelConfig config); |
| 87 | |
| 88 | GrBackend fBackend; |
| 89 | bool fValid; |
| 90 | |
| 91 | union { |
| 92 | struct { |
| 93 | GrGLenum fTarget; // GL_TEXTURE_2D, GL_TEXTURE_EXTERNAL or GL_TEXTURE_RECTANGLE |
| 94 | GrGLenum fFormat; // the sized, internal format of the GL resource |
| 95 | } fGL; |
| 96 | #ifdef SK_VULKAN |
| 97 | VkFormat fVkFormat; |
| 98 | #endif |
| 99 | GrPixelConfig fMockFormat; |
| 100 | }; |
| 101 | }; |
| 102 | |
Brian Salomon | ec045b4 | 2017-07-07 10:34:40 -0400 | [diff] [blame] | 103 | class SK_API GrBackendTexture { |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 104 | public: |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 105 | // Creates an invalid backend texture. |
Greg Daniel | 9ca3065 | 2018-04-06 09:27:20 -0400 | [diff] [blame] | 106 | GrBackendTexture() : fIsValid(false) {} |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 107 | |
Brian Salomon | 34df0d3 | 2018-03-23 18:23:23 -0400 | [diff] [blame] | 108 | #if GR_TEST_UTILS |
Greg Daniel | e7d8da4 | 2017-12-04 11:23:19 -0500 | [diff] [blame] | 109 | // GrGLTextureInfo::fFormat is ignored |
| 110 | // Deprecated: Should use version that does not take a GrPixelConfig instead |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 111 | GrBackendTexture(int width, |
| 112 | int height, |
Robert Phillips | fad9e3f | 2017-06-13 22:16:08 +0000 | [diff] [blame] | 113 | GrPixelConfig config, |
| 114 | const GrGLTextureInfo& glInfo); |
Greg Daniel | c0f8e42 | 2017-06-13 13:47:53 -0400 | [diff] [blame] | 115 | |
Greg Daniel | e7d8da4 | 2017-12-04 11:23:19 -0500 | [diff] [blame] | 116 | // GrGLTextureInfo::fFormat is ignored |
| 117 | // Deprecated: Should use version that does not take a GrPixelConfig instead |
Greg Daniel | 177e695 | 2017-10-12 12:27:11 -0400 | [diff] [blame] | 118 | GrBackendTexture(int width, |
| 119 | int height, |
| 120 | GrPixelConfig config, |
| 121 | GrMipMapped, |
| 122 | const GrGLTextureInfo& glInfo); |
Brian Salomon | 34df0d3 | 2018-03-23 18:23:23 -0400 | [diff] [blame] | 123 | #endif |
Greg Daniel | 177e695 | 2017-10-12 12:27:11 -0400 | [diff] [blame] | 124 | |
Greg Daniel | e7d8da4 | 2017-12-04 11:23:19 -0500 | [diff] [blame] | 125 | // The GrGLTextureInfo must have a valid fFormat. |
| 126 | GrBackendTexture(int width, |
| 127 | int height, |
| 128 | GrMipMapped, |
| 129 | const GrGLTextureInfo& glInfo); |
| 130 | |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 131 | #ifdef SK_VULKAN |
| 132 | GrBackendTexture(int width, |
| 133 | int height, |
| 134 | const GrVkImageInfo& vkInfo); |
| 135 | #endif |
| 136 | |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 137 | GrBackendTexture(int width, |
| 138 | int height, |
Greg Daniel | 177e695 | 2017-10-12 12:27:11 -0400 | [diff] [blame] | 139 | GrMipMapped, |
| 140 | const GrMockTextureInfo& mockInfo); |
| 141 | |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 142 | GrBackendTexture(const GrBackendTexture& that); |
| 143 | |
| 144 | ~GrBackendTexture(); |
| 145 | |
| 146 | GrBackendTexture& operator=(const GrBackendTexture& that); |
| 147 | |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 148 | int width() const { return fWidth; } |
| 149 | int height() const { return fHeight; } |
Greg Daniel | 177e695 | 2017-10-12 12:27:11 -0400 | [diff] [blame] | 150 | bool hasMipMaps() const { return GrMipMapped::kYes == fMipMapped; } |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 151 | GrBackend backend() const {return fBackend; } |
| 152 | |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 153 | // If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in |
| 154 | // pointer and returns true. Otherwise returns false if the backend API is not GL. |
| 155 | bool getGLTextureInfo(GrGLTextureInfo*) const; |
Greg Daniel | c0f8e42 | 2017-06-13 13:47:53 -0400 | [diff] [blame] | 156 | |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 157 | #ifdef SK_VULKAN |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 158 | // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 159 | // in pointer and returns true. This snapshot will set the fImageLayout to the current layout |
| 160 | // state. Otherwise returns false if the backend API is not Vulkan. |
| 161 | bool getVkImageInfo(GrVkImageInfo*) const; |
| 162 | |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 163 | // Anytime the client changes the VkImageLayout of the VkImage captured by this |
| 164 | // GrBackendTexture, they must call this function to notify Skia of the changed layout. |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 165 | void setVkImageLayout(VkImageLayout); |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 166 | #endif |
| 167 | |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 168 | // If the backend API is Mock, copies a snapshot of the GrMockTextureInfo struct into the passed |
| 169 | // in pointer and returns true. Otherwise returns false if the backend API is not Mock. |
| 170 | bool getMockTextureInfo(GrMockTextureInfo*) const; |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 171 | |
Eric Karl | 914a36b | 2017-10-12 12:44:50 -0700 | [diff] [blame] | 172 | // Returns true if the backend texture has been initialized. |
Greg Daniel | 9ca3065 | 2018-04-06 09:27:20 -0400 | [diff] [blame] | 173 | bool isValid() const { return fIsValid; } |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 174 | |
Robert Phillips | 7f44196 | 2018-03-15 11:15:19 -0400 | [diff] [blame] | 175 | /** |
| 176 | * Create a GrBackendFormat object that matches this texture |
| 177 | */ |
| 178 | GrBackendFormat format() const; |
| 179 | |
Robert Phillips | c550995 | 2018-04-04 15:54:55 -0400 | [diff] [blame] | 180 | #if GR_TEST_UTILS |
Greg Daniel | 8a3f55c | 2018-03-14 17:32:12 +0000 | [diff] [blame] | 181 | GrPixelConfig testingOnly_getPixelConfig() const; |
Robert Phillips | c550995 | 2018-04-04 15:54:55 -0400 | [diff] [blame] | 182 | static bool TestingOnly_Equals(const GrBackendTexture& , const GrBackendTexture&); |
| 183 | #endif |
Greg Daniel | 2a30390 | 2018-02-20 10:25:54 -0500 | [diff] [blame] | 184 | |
Eric Karl | 914a36b | 2017-10-12 12:44:50 -0700 | [diff] [blame] | 185 | private: |
Greg Daniel | 5254ccc | 2017-11-13 11:05:52 -0500 | [diff] [blame] | 186 | // Friending for access to the GrPixelConfig |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 187 | friend class SkImage; |
Brian Salomon | 6a426c1 | 2018-03-15 12:16:02 -0400 | [diff] [blame] | 188 | friend class SkImage_Gpu; |
Greg Daniel | 5254ccc | 2017-11-13 11:05:52 -0500 | [diff] [blame] | 189 | friend class SkSurface; |
Greg Daniel | e728f67 | 2018-01-17 10:52:04 -0500 | [diff] [blame] | 190 | friend class GrBackendTextureImageGenerator; |
Greg Daniel | f2336e4 | 2018-01-23 16:38:14 -0500 | [diff] [blame] | 191 | friend class GrProxyProvider; |
Greg Daniel | 5254ccc | 2017-11-13 11:05:52 -0500 | [diff] [blame] | 192 | friend class GrGpu; |
| 193 | friend class GrGLGpu; |
| 194 | friend class GrVkGpu; |
Greg Daniel | 057627f | 2018-03-14 15:51:58 -0400 | [diff] [blame] | 195 | friend class PromiseImageHelper; |
Robert Phillips | c550995 | 2018-04-04 15:54:55 -0400 | [diff] [blame] | 196 | |
Greg Daniel | 5254ccc | 2017-11-13 11:05:52 -0500 | [diff] [blame] | 197 | GrPixelConfig config() const { return fConfig; } |
| 198 | |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 199 | #ifdef SK_VULKAN |
| 200 | // Requires friending of GrVkGpu (done above already) |
| 201 | sk_sp<GrVkImageLayout> getGrVkImageLayout() const; |
| 202 | |
| 203 | friend class GrVkTexture; |
| 204 | GrBackendTexture(int width, |
| 205 | int height, |
| 206 | const GrVkImageInfo& vkInfo, |
| 207 | sk_sp<GrVkImageLayout> layout); |
| 208 | #endif |
| 209 | |
| 210 | // Free and release and resources being held by the GrBackendTexture. |
| 211 | void cleanup(); |
| 212 | |
Greg Daniel | 9ca3065 | 2018-04-06 09:27:20 -0400 | [diff] [blame] | 213 | bool fIsValid; |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 214 | int fWidth; //<! width in pixels |
| 215 | int fHeight; //<! height in pixels |
| 216 | GrPixelConfig fConfig; |
Greg Daniel | 177e695 | 2017-10-12 12:27:11 -0400 | [diff] [blame] | 217 | GrMipMapped fMipMapped; |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 218 | GrBackend fBackend; |
| 219 | |
| 220 | union { |
Robert Phillips | fad9e3f | 2017-06-13 22:16:08 +0000 | [diff] [blame] | 221 | GrGLTextureInfo fGLInfo; |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 222 | #ifdef SK_VULKAN |
Greg Daniel | 52e16d9 | 2018-04-10 09:34:07 -0400 | [diff] [blame] | 223 | GrVkBackendSurfaceInfo fVkInfo; |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 224 | #endif |
Brian Salomon | 8fe2427 | 2017-07-07 12:56:11 -0400 | [diff] [blame] | 225 | GrMockTextureInfo fMockInfo; |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 226 | }; |
| 227 | }; |
| 228 | |
Brian Salomon | ec045b4 | 2017-07-07 10:34:40 -0400 | [diff] [blame] | 229 | class SK_API GrBackendRenderTarget { |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 230 | public: |
Robert Phillips | 57e0828 | 2017-11-16 14:59:48 -0500 | [diff] [blame] | 231 | // Creates an invalid backend texture. |
Greg Daniel | 9ca3065 | 2018-04-06 09:27:20 -0400 | [diff] [blame] | 232 | GrBackendRenderTarget() : fIsValid(false) {} |
Robert Phillips | 57e0828 | 2017-11-16 14:59:48 -0500 | [diff] [blame] | 233 | |
Brian Salomon | 34df0d3 | 2018-03-23 18:23:23 -0400 | [diff] [blame] | 234 | #if GR_TEST_UTILS |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 235 | // GrGLTextureInfo::fFormat is ignored |
| 236 | // Deprecated: Should use version that does not take a GrPixelConfig instead |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 237 | GrBackendRenderTarget(int width, |
| 238 | int height, |
| 239 | int sampleCnt, |
| 240 | int stencilBits, |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 241 | GrPixelConfig config, |
| 242 | const GrGLFramebufferInfo& glInfo); |
Brian Salomon | 34df0d3 | 2018-03-23 18:23:23 -0400 | [diff] [blame] | 243 | #endif |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 244 | |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 245 | // The GrGLTextureInfo must have a valid fFormat. |
| 246 | GrBackendRenderTarget(int width, |
| 247 | int height, |
| 248 | int sampleCnt, |
| 249 | int stencilBits, |
| 250 | const GrGLFramebufferInfo& glInfo); |
| 251 | |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 252 | #ifdef SK_VULKAN |
Brian Salomon | afdc6b1 | 2018-03-09 12:02:32 -0500 | [diff] [blame] | 253 | /** Deprecated, use version that does not take stencil bits. */ |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 254 | GrBackendRenderTarget(int width, |
| 255 | int height, |
| 256 | int sampleCnt, |
| 257 | int stencilBits, |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 258 | const GrVkImageInfo& vkInfo); |
Brian Salomon | afdc6b1 | 2018-03-09 12:02:32 -0500 | [diff] [blame] | 259 | GrBackendRenderTarget(int width, int height, int sampleCnt, const GrVkImageInfo& vkInfo); |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 260 | #endif |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 261 | |
Brian Salomon | 0c51eea | 2018-03-09 17:02:09 -0500 | [diff] [blame] | 262 | GrBackendRenderTarget(int width, |
| 263 | int height, |
| 264 | int sampleCnt, |
| 265 | int stencilBits, |
| 266 | const GrMockRenderTargetInfo& mockInfo); |
| 267 | |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 268 | ~GrBackendRenderTarget(); |
| 269 | |
| 270 | GrBackendRenderTarget(const GrBackendRenderTarget& that); |
| 271 | GrBackendRenderTarget& operator=(const GrBackendRenderTarget&); |
| 272 | |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 273 | int width() const { return fWidth; } |
| 274 | int height() const { return fHeight; } |
| 275 | int sampleCnt() const { return fSampleCnt; } |
| 276 | int stencilBits() const { return fStencilBits; } |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 277 | GrBackend backend() const {return fBackend; } |
| 278 | |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 279 | // If the backend API is GL, copies a snapshot of the GrGLFramebufferInfo struct into the passed |
| 280 | // in pointer and returns true. Otherwise returns false if the backend API is not GL. |
| 281 | bool getGLFramebufferInfo(GrGLFramebufferInfo*) const; |
Greg Daniel | c0f8e42 | 2017-06-13 13:47:53 -0400 | [diff] [blame] | 282 | |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 283 | #ifdef SK_VULKAN |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 284 | // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed |
| 285 | // in pointer and returns true. This snapshot will set the fImageLayout to the current layout |
| 286 | // state. Otherwise returns false if the backend API is not Vulkan. |
| 287 | bool getVkImageInfo(GrVkImageInfo*) const; |
| 288 | |
| 289 | // Anytime the client changes the VkImageLayout of the VkImage captured by this |
| 290 | // GrBackendRenderTarget, they must call this function to notify Skia of the changed layout. |
| 291 | void setVkImageLayout(VkImageLayout); |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 292 | #endif |
| 293 | |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 294 | // If the backend API is Mock, copies a snapshot of the GrMockTextureInfo struct into the passed |
| 295 | // in pointer and returns true. Otherwise returns false if the backend API is not Mock. |
| 296 | bool getMockRenderTargetInfo(GrMockRenderTargetInfo*) const; |
Brian Salomon | 0c51eea | 2018-03-09 17:02:09 -0500 | [diff] [blame] | 297 | |
Robert Phillips | 57e0828 | 2017-11-16 14:59:48 -0500 | [diff] [blame] | 298 | // Returns true if the backend texture has been initialized. |
Greg Daniel | 9ca3065 | 2018-04-06 09:27:20 -0400 | [diff] [blame] | 299 | bool isValid() const { return fIsValid; } |
Robert Phillips | 57e0828 | 2017-11-16 14:59:48 -0500 | [diff] [blame] | 300 | |
Robert Phillips | 8caf85f | 2018-04-05 09:30:38 -0400 | [diff] [blame] | 301 | |
| 302 | #if GR_TEST_UTILS |
Greg Daniel | 8a3f55c | 2018-03-14 17:32:12 +0000 | [diff] [blame] | 303 | GrPixelConfig testingOnly_getPixelConfig() const; |
Robert Phillips | 8caf85f | 2018-04-05 09:30:38 -0400 | [diff] [blame] | 304 | static bool TestingOnly_Equals(const GrBackendRenderTarget&, const GrBackendRenderTarget&); |
| 305 | #endif |
Greg Daniel | 2a30390 | 2018-02-20 10:25:54 -0500 | [diff] [blame] | 306 | |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 307 | private: |
Greg Daniel | 5254ccc | 2017-11-13 11:05:52 -0500 | [diff] [blame] | 308 | // Friending for access to the GrPixelConfig |
| 309 | friend class SkSurface; |
Greg Daniel | faa095e | 2017-12-19 13:15:02 -0500 | [diff] [blame] | 310 | friend class SkSurface_Gpu; |
| 311 | friend class SkImage_Gpu; |
Greg Daniel | 5254ccc | 2017-11-13 11:05:52 -0500 | [diff] [blame] | 312 | friend class GrGpu; |
| 313 | friend class GrGLGpu; |
Greg Daniel | 2a30390 | 2018-02-20 10:25:54 -0500 | [diff] [blame] | 314 | friend class GrProxyProvider; |
Greg Daniel | 5254ccc | 2017-11-13 11:05:52 -0500 | [diff] [blame] | 315 | friend class GrVkGpu; |
| 316 | GrPixelConfig config() const { return fConfig; } |
| 317 | |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 318 | #ifdef SK_VULKAN |
| 319 | // Requires friending of GrVkGpu (done above already) |
| 320 | sk_sp<GrVkImageLayout> getGrVkImageLayout() const; |
| 321 | |
| 322 | friend class GrVkRenderTarget; |
| 323 | GrBackendRenderTarget(int width, int height, int sampleCnt, const GrVkImageInfo& vkInfo, |
| 324 | sk_sp<GrVkImageLayout> layout); |
| 325 | #endif |
| 326 | |
| 327 | // Free and release and resources being held by the GrBackendTexture. |
| 328 | void cleanup(); |
| 329 | |
Greg Daniel | 9ca3065 | 2018-04-06 09:27:20 -0400 | [diff] [blame] | 330 | bool fIsValid; |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 331 | int fWidth; //<! width in pixels |
| 332 | int fHeight; //<! height in pixels |
| 333 | |
| 334 | int fSampleCnt; |
| 335 | int fStencilBits; |
| 336 | GrPixelConfig fConfig; |
| 337 | |
| 338 | GrBackend fBackend; |
| 339 | |
| 340 | union { |
Robert Phillips | fad9e3f | 2017-06-13 22:16:08 +0000 | [diff] [blame] | 341 | GrGLFramebufferInfo fGLInfo; |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 342 | #ifdef SK_VULKAN |
Greg Daniel | 323fbcf | 2018-04-10 13:46:30 -0400 | [diff] [blame^] | 343 | GrVkBackendSurfaceInfo fVkInfo; |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 344 | #endif |
Brian Salomon | 0c51eea | 2018-03-09 17:02:09 -0500 | [diff] [blame] | 345 | GrMockRenderTargetInfo fMockInfo; |
Greg Daniel | 9440345 | 2017-04-18 15:52:36 -0400 | [diff] [blame] | 346 | }; |
| 347 | }; |
| 348 | |
| 349 | #endif |
| 350 | |
Robert Phillips | 8caf85f | 2018-04-05 09:30:38 -0400 | [diff] [blame] | 351 | #endif |
| 352 | |