OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrVkGpuCommandBuffer.h" | 8 #include "GrVkGpuCommandBuffer.h" |
9 | 9 |
10 #include "GrMesh.h" | 10 #include "GrMesh.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 const GrMesh* meshes, | 364 const GrMesh* meshes, |
365 int meshCount) { | 365 int meshCount) { |
366 if (!meshCount) { | 366 if (!meshCount) { |
367 return; | 367 return; |
368 } | 368 } |
369 GrRenderTarget* rt = pipeline.getRenderTarget(); | 369 GrRenderTarget* rt = pipeline.getRenderTarget(); |
370 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt); | 370 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt); |
371 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass(); | 371 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass(); |
372 SkASSERT(renderPass); | 372 SkASSERT(renderPass); |
373 | 373 |
| 374 append_sampled_images(primProc, fGpu, &fSampledImages); |
| 375 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) { |
| 376 append_sampled_images(pipeline.getFragmentProcessor(i), fGpu, &fSampledI
mages); |
| 377 } |
| 378 append_sampled_images(pipeline.getXferProcessor(), fGpu, &fSampledImages); |
| 379 |
374 GrPrimitiveType primitiveType = meshes[0].primitiveType(); | 380 GrPrimitiveType primitiveType = meshes[0].primitiveType(); |
375 sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline, | 381 sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline, |
376 primProc, | 382 primProc, |
377 primitiveTyp
e, | 383 primitiveTyp
e, |
378 *renderPass)
; | 384 *renderPass)
; |
379 if (!pipelineState) { | 385 if (!pipelineState) { |
380 return; | 386 return; |
381 } | 387 } |
382 | 388 |
383 append_sampled_images(primProc, fGpu, &fSampledImages); | |
384 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) { | |
385 append_sampled_images(pipeline.getFragmentProcessor(i), fGpu, &fSampledI
mages); | |
386 } | |
387 append_sampled_images(pipeline.getXferProcessor(), fGpu, &fSampledImages); | |
388 | |
389 for (int i = 0; i < meshCount; ++i) { | 389 for (int i = 0; i < meshCount; ++i) { |
390 const GrMesh& mesh = meshes[i]; | 390 const GrMesh& mesh = meshes[i]; |
391 GrMesh::Iterator iter; | 391 GrMesh::Iterator iter; |
392 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); | 392 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); |
393 do { | 393 do { |
394 if (nonIdxMesh->primitiveType() != primitiveType) { | 394 if (nonIdxMesh->primitiveType() != primitiveType) { |
395 // Technically we don't have to call this here (since there is a
safety check in | 395 // Technically we don't have to call this here (since there is a
safety check in |
396 // pipelineState:setData but this will allow for quicker freeing
of resources if the | 396 // pipelineState:setData but this will allow for quicker freeing
of resources if the |
397 // pipelineState sits in a cache for a while. | 397 // pipelineState sits in a cache for a while. |
398 pipelineState->freeTempResources(fGpu); | 398 pipelineState->freeTempResources(fGpu); |
(...skipping 29 matching lines...) Expand all Loading... |
428 fGpu->stats()->incNumDraws(); | 428 fGpu->stats()->incNumDraws(); |
429 } while ((nonIdxMesh = iter.next())); | 429 } while ((nonIdxMesh = iter.next())); |
430 } | 430 } |
431 | 431 |
432 // Technically we don't have to call this here (since there is a safety chec
k in | 432 // Technically we don't have to call this here (since there is a safety chec
k in |
433 // pipelineState:setData but this will allow for quicker freeing of resource
s if the | 433 // pipelineState:setData but this will allow for quicker freeing of resource
s if the |
434 // pipelineState sits in a cache for a while. | 434 // pipelineState sits in a cache for a while. |
435 pipelineState->freeTempResources(fGpu); | 435 pipelineState->freeTempResources(fGpu); |
436 } | 436 } |
437 | 437 |
OLD | NEW |