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 "GrVkRenderTarget.h" | 8 #include "GrVkRenderTarget.h" |
9 | 9 |
10 #include "GrRenderTargetPriv.h" | 10 #include "GrRenderTargetPriv.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 SkBudgeted budgeted, | 25 SkBudgeted budgeted, |
26 const GrSurfaceDesc& desc, | 26 const GrSurfaceDesc& desc, |
27 const GrVkImageInfo& info, | 27 const GrVkImageInfo& info, |
28 const GrVkImageInfo& msaaInfo, | 28 const GrVkImageInfo& msaaInfo, |
29 const GrVkImageView* colorAttachmentView, | 29 const GrVkImageView* colorAttachmentView, |
30 const GrVkImageView* resolveAttachmentView, | 30 const GrVkImageView* resolveAttachmentView, |
31 GrVkImage::Wrapped wrapped) | 31 GrVkImage::Wrapped wrapped) |
32 : GrSurface(gpu, desc) | 32 : GrSurface(gpu, desc) |
33 , GrVkImage(info, wrapped) | 33 , GrVkImage(info, wrapped) |
34 // for the moment we only support 1:1 color to stencil | 34 // for the moment we only support 1:1 color to stencil |
35 , GrRenderTarget(gpu, desc, kUnified_SampleConfig) | 35 , GrRenderTarget(gpu, desc) |
36 , fColorAttachmentView(colorAttachmentView) | 36 , fColorAttachmentView(colorAttachmentView) |
37 , fMSAAImage(new GrVkImage(msaaInfo, GrVkImage::kNot_Wrapped)) | 37 , fMSAAImage(new GrVkImage(msaaInfo, GrVkImage::kNot_Wrapped)) |
38 , fResolveAttachmentView(resolveAttachmentView) | 38 , fResolveAttachmentView(resolveAttachmentView) |
39 , fFramebuffer(nullptr) | 39 , fFramebuffer(nullptr) |
40 , fCachedSimpleRenderPass(nullptr) { | 40 , fCachedSimpleRenderPass(nullptr) { |
41 SkASSERT(desc.fSampleCnt); | 41 SkASSERT(desc.fSampleCnt); |
42 // The plus 1 is to account for the resolve texture. | 42 // The plus 1 is to account for the resolve texture. |
43 fColorValuesPerPixel = desc.fSampleCnt + 1; // TODO: this still correct? | 43 fColorValuesPerPixel = desc.fSampleCnt + 1; // TODO: this still correct? |
44 this->createFramebuffer(gpu); | 44 this->createFramebuffer(gpu); |
45 this->registerWithCache(budgeted); | 45 this->registerWithCache(budgeted); |
46 } | 46 } |
47 | 47 |
48 // We're virtually derived from GrSurface (via GrRenderTarget) so its | 48 // We're virtually derived from GrSurface (via GrRenderTarget) so its |
49 // constructor must be explicitly called. | 49 // constructor must be explicitly called. |
50 GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, | 50 GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, |
51 const GrSurfaceDesc& desc, | 51 const GrSurfaceDesc& desc, |
52 const GrVkImageInfo& info, | 52 const GrVkImageInfo& info, |
53 const GrVkImageInfo& msaaInfo, | 53 const GrVkImageInfo& msaaInfo, |
54 const GrVkImageView* colorAttachmentView, | 54 const GrVkImageView* colorAttachmentView, |
55 const GrVkImageView* resolveAttachmentView, | 55 const GrVkImageView* resolveAttachmentView, |
56 GrVkImage::Wrapped wrapped) | 56 GrVkImage::Wrapped wrapped) |
57 : GrSurface(gpu, desc) | 57 : GrSurface(gpu, desc) |
58 , GrVkImage(info, wrapped) | 58 , GrVkImage(info, wrapped) |
59 // for the moment we only support 1:1 color to stencil | 59 // for the moment we only support 1:1 color to stencil |
60 , GrRenderTarget(gpu, desc, kUnified_SampleConfig) | 60 , GrRenderTarget(gpu, desc) |
61 , fColorAttachmentView(colorAttachmentView) | 61 , fColorAttachmentView(colorAttachmentView) |
62 , fMSAAImage(new GrVkImage(msaaInfo, GrVkImage::kNot_Wrapped)) | 62 , fMSAAImage(new GrVkImage(msaaInfo, GrVkImage::kNot_Wrapped)) |
63 , fResolveAttachmentView(resolveAttachmentView) | 63 , fResolveAttachmentView(resolveAttachmentView) |
64 , fFramebuffer(nullptr) | 64 , fFramebuffer(nullptr) |
65 , fCachedSimpleRenderPass(nullptr) { | 65 , fCachedSimpleRenderPass(nullptr) { |
66 SkASSERT(desc.fSampleCnt); | 66 SkASSERT(desc.fSampleCnt); |
67 // The plus 1 is to account for the resolve texture. | 67 // The plus 1 is to account for the resolve texture. |
68 fColorValuesPerPixel = desc.fSampleCnt + 1; // TODO: this still correct? | 68 fColorValuesPerPixel = desc.fSampleCnt + 1; // TODO: this still correct? |
69 this->createFramebuffer(gpu); | 69 this->createFramebuffer(gpu); |
70 } | 70 } |
71 | 71 |
72 // We're virtually derived from GrSurface (via GrRenderTarget) so its | 72 // We're virtually derived from GrSurface (via GrRenderTarget) so its |
73 // constructor must be explicitly called. | 73 // constructor must be explicitly called. |
74 GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, | 74 GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, |
75 SkBudgeted budgeted, | 75 SkBudgeted budgeted, |
76 const GrSurfaceDesc& desc, | 76 const GrSurfaceDesc& desc, |
77 const GrVkImageInfo& info, | 77 const GrVkImageInfo& info, |
78 const GrVkImageView* colorAttachmentView, | 78 const GrVkImageView* colorAttachmentView, |
79 GrVkImage::Wrapped wrapped) | 79 GrVkImage::Wrapped wrapped) |
80 : GrSurface(gpu, desc) | 80 : GrSurface(gpu, desc) |
81 , GrVkImage(info, wrapped) | 81 , GrVkImage(info, wrapped) |
82 , GrRenderTarget(gpu, desc, kUnified_SampleConfig) | 82 , GrRenderTarget(gpu, desc) |
83 , fColorAttachmentView(colorAttachmentView) | 83 , fColorAttachmentView(colorAttachmentView) |
84 , fMSAAImage(nullptr) | 84 , fMSAAImage(nullptr) |
85 , fResolveAttachmentView(nullptr) | 85 , fResolveAttachmentView(nullptr) |
86 , fFramebuffer(nullptr) | 86 , fFramebuffer(nullptr) |
87 , fCachedSimpleRenderPass(nullptr) { | 87 , fCachedSimpleRenderPass(nullptr) { |
88 SkASSERT(!desc.fSampleCnt); | 88 SkASSERT(!desc.fSampleCnt); |
89 fColorValuesPerPixel = 1; | 89 fColorValuesPerPixel = 1; |
90 this->createFramebuffer(gpu); | 90 this->createFramebuffer(gpu); |
91 this->registerWithCache(budgeted); | 91 this->registerWithCache(budgeted); |
92 } | 92 } |
93 | 93 |
94 // We're virtually derived from GrSurface (via GrRenderTarget) so its | 94 // We're virtually derived from GrSurface (via GrRenderTarget) so its |
95 // constructor must be explicitly called. | 95 // constructor must be explicitly called. |
96 GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, | 96 GrVkRenderTarget::GrVkRenderTarget(GrVkGpu* gpu, |
97 const GrSurfaceDesc& desc, | 97 const GrSurfaceDesc& desc, |
98 const GrVkImageInfo& info, | 98 const GrVkImageInfo& info, |
99 const GrVkImageView* colorAttachmentView, | 99 const GrVkImageView* colorAttachmentView, |
100 GrVkImage::Wrapped wrapped) | 100 GrVkImage::Wrapped wrapped) |
101 : GrSurface(gpu, desc) | 101 : GrSurface(gpu, desc) |
102 , GrVkImage(info, wrapped) | 102 , GrVkImage(info, wrapped) |
103 , GrRenderTarget(gpu, desc, kUnified_SampleConfig) | 103 , GrRenderTarget(gpu, desc) |
104 , fColorAttachmentView(colorAttachmentView) | 104 , fColorAttachmentView(colorAttachmentView) |
105 , fMSAAImage(nullptr) | 105 , fMSAAImage(nullptr) |
106 , fResolveAttachmentView(nullptr) | 106 , fResolveAttachmentView(nullptr) |
107 , fFramebuffer(nullptr) | 107 , fFramebuffer(nullptr) |
108 , fCachedSimpleRenderPass(nullptr) { | 108 , fCachedSimpleRenderPass(nullptr) { |
109 SkASSERT(!desc.fSampleCnt); | 109 SkASSERT(!desc.fSampleCnt); |
110 fColorValuesPerPixel = 1; | 110 fColorValuesPerPixel = 1; |
111 this->createFramebuffer(gpu); | 111 this->createFramebuffer(gpu); |
112 } | 112 } |
113 | 113 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 | 383 |
384 return nullptr; | 384 return nullptr; |
385 } | 385 } |
386 | 386 |
387 | 387 |
388 GrVkGpu* GrVkRenderTarget::getVkGpu() const { | 388 GrVkGpu* GrVkRenderTarget::getVkGpu() const { |
389 SkASSERT(!this->wasDestroyed()); | 389 SkASSERT(!this->wasDestroyed()); |
390 return static_cast<GrVkGpu*>(this->getGpu()); | 390 return static_cast<GrVkGpu*>(this->getGpu()); |
391 } | 391 } |
OLD | NEW |