OLD | NEW |
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 #include "GrVkTexture.h" | 8 #include "GrVkTexture.h" |
9 #include "GrVkGpu.h" | 9 #include "GrVkGpu.h" |
10 #include "GrVkImageView.h" | 10 #include "GrVkImageView.h" |
11 #include "GrVkUtil.h" | 11 #include "GrVkUtil.h" |
12 | 12 |
13 #define VK_CALL(GPU, X) GR_VK_CALL(GPU->vkInterface(), X) | 13 #define VK_CALL(GPU, X) GR_VK_CALL(GPU->vkInterface(), X) |
14 | 14 |
15 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. | 15 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. |
16 GrVkTexture::GrVkTexture(GrVkGpu* gpu, | 16 GrVkTexture::GrVkTexture(GrVkGpu* gpu, |
17 const GrSurfaceDesc& desc, | 17 const GrSurfaceDesc& desc, |
18 GrGpuResource::LifeCycle lifeCycle, | 18 GrGpuResource::LifeCycle lifeCycle, |
19 const GrVkImage::Resource* imageResource, | 19 const GrVkImage::Resource* imageResource, |
20 const GrVkImageView* view) | 20 const GrVkImageView* view) |
21 : GrSurface(gpu, lifeCycle, desc) | 21 : GrSurface(gpu, lifeCycle, desc) |
22 , GrVkImage(imageResource) | 22 , GrVkImage(imageResource) |
23 , INHERITED(gpu, lifeCycle, desc) | 23 , INHERITED(gpu, lifeCycle, desc, false) // false because we don't upload MI
P data in Vk yet |
24 , fTextureView(view) { | 24 , fTextureView(view) { |
25 this->registerWithCache(); | 25 this->registerWithCache(); |
26 } | 26 } |
27 | 27 |
28 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. | 28 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. |
29 GrVkTexture::GrVkTexture(GrVkGpu* gpu, | 29 GrVkTexture::GrVkTexture(GrVkGpu* gpu, |
30 const GrSurfaceDesc& desc, | 30 const GrSurfaceDesc& desc, |
31 GrGpuResource::LifeCycle lifeCycle, | 31 GrGpuResource::LifeCycle lifeCycle, |
32 const GrVkImage::Resource* imageResource, | 32 const GrVkImage::Resource* imageResource, |
33 const GrVkImageView* view, | 33 const GrVkImageView* view, |
34 Derived) | 34 Derived) |
35 : GrSurface(gpu, lifeCycle, desc) | 35 : GrSurface(gpu, lifeCycle, desc) |
36 , GrVkImage(imageResource) | 36 , GrVkImage(imageResource) |
37 , INHERITED(gpu, lifeCycle, desc) | 37 , INHERITED(gpu, lifeCycle, desc, false) // false because we don't upload MI
P data in Vk yet |
38 , fTextureView(view) {} | 38 , fTextureView(view) {} |
39 | 39 |
40 | 40 |
41 GrVkTexture* GrVkTexture::Create(GrVkGpu* gpu, | 41 GrVkTexture* GrVkTexture::Create(GrVkGpu* gpu, |
42 const GrSurfaceDesc& desc, | 42 const GrSurfaceDesc& desc, |
43 GrGpuResource::LifeCycle lifeCycle, | 43 GrGpuResource::LifeCycle lifeCycle, |
44 VkFormat format, | 44 VkFormat format, |
45 const GrVkImage::Resource* imageResource) { | 45 const GrVkImage::Resource* imageResource) { |
46 VkImage image = imageResource->fImage; | 46 VkImage image = imageResource->fImage; |
47 const GrVkImageView* imageView = GrVkImageView::Create(gpu, image, format, | 47 const GrVkImageView* imageView = GrVkImageView::Create(gpu, image, format, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 GrBackendObject GrVkTexture::getTextureHandle() const { | 115 GrBackendObject GrVkTexture::getTextureHandle() const { |
116 // Currently just passing back the pointer to the Resource as the handle | 116 // Currently just passing back the pointer to the Resource as the handle |
117 return (GrBackendObject)&fResource; | 117 return (GrBackendObject)&fResource; |
118 } | 118 } |
119 | 119 |
120 GrVkGpu* GrVkTexture::getVkGpu() const { | 120 GrVkGpu* GrVkTexture::getVkGpu() const { |
121 SkASSERT(!this->wasDestroyed()); | 121 SkASSERT(!this->wasDestroyed()); |
122 return static_cast<GrVkGpu*>(this->getGpu()); | 122 return static_cast<GrVkGpu*>(this->getGpu()); |
123 } | 123 } |
124 | 124 |
OLD | NEW |