diff options
author | 2017-05-08 13:58:38 -0400 | |
---|---|---|
committer | 2017-05-08 18:27:47 +0000 | |
commit | 6f24180a99bc486cf4cee5da1a45225e7ff263d7 (patch) | |
tree | 2d9cc74c981c44b61d55052b478f9c1d75103e51 /src | |
parent | b37208f11a022dfbff0e54eb8246ed9b7951c58e (diff) |
vk: don't re-check the primitive type for each batch of a mesh
Bug: skia:
Change-Id: I00561d0a2d6296924ef0d8ee25fc7215832338d8
Reviewed-on: https://skia-review.googlesource.com/15832
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/vk/GrVkGpuCommandBuffer.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp index 475480b08a..0a5e0b8fa3 100644 --- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp +++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp @@ -549,21 +549,21 @@ void GrVkGpuCommandBuffer::onDraw(const GrPipeline& pipeline, for (int i = 0; i < meshCount; ++i) { const GrMesh& mesh = meshes[i]; - for (GrMesh::PatternBatch batch : mesh) { - if (mesh.fPrimitiveType != primitiveType) { - // Technically we don't have to call this here (since there is a safety check in - // pipelineState:setData but this will allow for quicker freeing of resources if the - // pipelineState sits in a cache for a while. - pipelineState->freeTempResources(fGpu); - SkDEBUGCODE(pipelineState = nullptr); - primitiveType = mesh.fPrimitiveType; - pipelineState = this->prepareDrawState(pipeline, - primProc, - primitiveType); - if (!pipelineState) { - return; - } + if (mesh.fPrimitiveType != primitiveType) { + // Technically we don't have to call this here (since there is a safety check in + // pipelineState:setData but this will allow for quicker freeing of resources if the + // pipelineState sits in a cache for a while. + pipelineState->freeTempResources(fGpu); + SkDEBUGCODE(pipelineState = nullptr); + primitiveType = mesh.fPrimitiveType; + pipelineState = this->prepareDrawState(pipeline, + primProc, + primitiveType); + if (!pipelineState) { + return; } + } + for (GrMesh::PatternBatch batch : mesh) { SkASSERT(pipelineState); this->bindGeometry(primProc, mesh.fIndexBuffer.get(), mesh.fVertexBuffer.get()); |