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 "GrVkRenderPass.h" | 8 #include "GrVkRenderPass.h" |
9 | 9 |
10 #include "GrProcessor.h" | 10 #include "GrProcessor.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 beginInfo->framebuffer = target.framebuffer()->framebuffer(); | 225 beginInfo->framebuffer = target.framebuffer()->framebuffer(); |
226 beginInfo->renderArea = renderArea; | 226 beginInfo->renderArea = renderArea; |
227 beginInfo->clearValueCount = 0; | 227 beginInfo->clearValueCount = 0; |
228 beginInfo->pClearValues = nullptr; | 228 beginInfo->pClearValues = nullptr; |
229 | 229 |
230 // Currently just assuming no secondary cmd buffers. This value will need to
be update if we | 230 // Currently just assuming no secondary cmd buffers. This value will need to
be update if we |
231 // have them. | 231 // have them. |
232 *contents = VK_SUBPASS_CONTENTS_INLINE; | 232 *contents = VK_SUBPASS_CONTENTS_INLINE; |
233 } | 233 } |
234 | 234 |
235 bool GrVkRenderPass::isCompatible(const GrVkRenderTarget& target) const { | 235 bool GrVkRenderPass::isCompatible(const AttachmentsDescriptor& desc, |
236 AttachmentsDescriptor desc; | 236 const AttachmentFlags& flags) const { |
237 AttachmentFlags flags; | |
238 target.getAttachmentsDescriptor(&desc, &flags); | |
239 | |
240 if (flags != fAttachmentFlags) { | 237 if (flags != fAttachmentFlags) { |
241 return false; | 238 return false; |
242 } | 239 } |
243 | 240 |
244 if (fAttachmentFlags & kColor_AttachmentFlag) { | 241 if (fAttachmentFlags & kColor_AttachmentFlag) { |
245 if (!fAttachmentsDescriptor.fColor.isCompatible(desc.fColor)) { | 242 if (!fAttachmentsDescriptor.fColor.isCompatible(desc.fColor)) { |
246 return false; | 243 return false; |
247 } | 244 } |
248 } | 245 } |
249 if (fAttachmentFlags & kResolve_AttachmentFlag) { | 246 if (fAttachmentFlags & kResolve_AttachmentFlag) { |
250 if (!fAttachmentsDescriptor.fResolve.isCompatible(desc.fResolve)) { | 247 if (!fAttachmentsDescriptor.fResolve.isCompatible(desc.fResolve)) { |
251 return false; | 248 return false; |
252 } | 249 } |
253 } | 250 } |
254 if (fAttachmentFlags & kStencil_AttachmentFlag) { | 251 if (fAttachmentFlags & kStencil_AttachmentFlag) { |
255 if (!fAttachmentsDescriptor.fStencil.isCompatible(desc.fStencil)) { | 252 if (!fAttachmentsDescriptor.fStencil.isCompatible(desc.fStencil)) { |
256 return false; | 253 return false; |
257 } | 254 } |
258 } | 255 } |
259 | 256 |
260 return true; | 257 return true; |
261 } | 258 } |
262 | 259 |
| 260 bool GrVkRenderPass::isCompatible(const GrVkRenderTarget& target) const { |
| 261 AttachmentsDescriptor desc; |
| 262 AttachmentFlags flags; |
| 263 target.getAttachmentsDescriptor(&desc, &flags); |
| 264 |
| 265 return this->isCompatible(desc, flags); |
| 266 } |
| 267 |
| 268 bool GrVkRenderPass::isCompatible(const GrVkRenderPass& renderPass) const { |
| 269 return this->isCompatible(renderPass.fAttachmentsDescriptor, renderPass.fAtt
achmentFlags); |
| 270 } |
| 271 |
263 bool GrVkRenderPass::equalLoadStoreOps(const LoadStoreOps& colorOps, | 272 bool GrVkRenderPass::equalLoadStoreOps(const LoadStoreOps& colorOps, |
264 const LoadStoreOps& resolveOps, | 273 const LoadStoreOps& resolveOps, |
265 const LoadStoreOps& stencilOps) const { | 274 const LoadStoreOps& stencilOps) const { |
266 if (fAttachmentFlags & kColor_AttachmentFlag) { | 275 if (fAttachmentFlags & kColor_AttachmentFlag) { |
267 if (fAttachmentsDescriptor.fColor.fLoadStoreOps != colorOps) { | 276 if (fAttachmentsDescriptor.fColor.fLoadStoreOps != colorOps) { |
268 return false; | 277 return false; |
269 } | 278 } |
270 } | 279 } |
271 if (fAttachmentFlags & kResolve_AttachmentFlag) { | 280 if (fAttachmentFlags & kResolve_AttachmentFlag) { |
272 if (fAttachmentsDescriptor.fResolve.fLoadStoreOps != resolveOps) { | 281 if (fAttachmentsDescriptor.fResolve.fLoadStoreOps != resolveOps) { |
(...skipping 16 matching lines...) Expand all Loading... |
289 } | 298 } |
290 if (fAttachmentFlags & kResolve_AttachmentFlag) { | 299 if (fAttachmentFlags & kResolve_AttachmentFlag) { |
291 b->add32(fAttachmentsDescriptor.fResolve.fFormat); | 300 b->add32(fAttachmentsDescriptor.fResolve.fFormat); |
292 b->add32(fAttachmentsDescriptor.fResolve.fSamples); | 301 b->add32(fAttachmentsDescriptor.fResolve.fSamples); |
293 } | 302 } |
294 if (fAttachmentFlags & kStencil_AttachmentFlag) { | 303 if (fAttachmentFlags & kStencil_AttachmentFlag) { |
295 b->add32(fAttachmentsDescriptor.fStencil.fFormat); | 304 b->add32(fAttachmentsDescriptor.fStencil.fFormat); |
296 b->add32(fAttachmentsDescriptor.fStencil.fSamples); | 305 b->add32(fAttachmentsDescriptor.fStencil.fSamples); |
297 } | 306 } |
298 } | 307 } |
OLD | NEW |