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 17 matching lines...) Expand all Loading... |
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, kUnified_SampleConfig) |
36 , fFramebuffer(nullptr) | 36 , fFramebuffer(nullptr) |
37 , fColorAttachmentView(colorAttachmentView) | 37 , fColorAttachmentView(colorAttachmentView) |
38 , fMSAAImage(new GrVkImage(info, GrVkImage::kNot_Wrapped)) | 38 , fMSAAImage(new GrVkImage(msaaInfo, GrVkImage::kNot_Wrapped)) |
39 , fResolveAttachmentView(resolveAttachmentView) | 39 , fResolveAttachmentView(resolveAttachmentView) |
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, kUnified_SampleConfig) |
61 , fFramebuffer(nullptr) | 61 , fFramebuffer(nullptr) |
62 , fColorAttachmentView(colorAttachmentView) | 62 , fColorAttachmentView(colorAttachmentView) |
63 , fMSAAImage(new GrVkImage(info, GrVkImage::kNot_Wrapped)) | 63 , fMSAAImage(new GrVkImage(msaaInfo, GrVkImage::kNot_Wrapped)) |
64 , fResolveAttachmentView(resolveAttachmentView) | 64 , fResolveAttachmentView(resolveAttachmentView) |
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. |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 return nullptr; | 382 return nullptr; |
383 } | 383 } |
384 | 384 |
385 | 385 |
386 GrVkGpu* GrVkRenderTarget::getVkGpu() const { | 386 GrVkGpu* GrVkRenderTarget::getVkGpu() const { |
387 SkASSERT(!this->wasDestroyed()); | 387 SkASSERT(!this->wasDestroyed()); |
388 return static_cast<GrVkGpu*>(this->getGpu()); | 388 return static_cast<GrVkGpu*>(this->getGpu()); |
389 } | 389 } |
OLD | NEW |