Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Side by Side Diff: src/gpu/vk/GrVkGpu.cpp

Issue 1813913002: Use dynamic state from vulkan pipelines (Closed) Base URL: https://skia.googlesource.com/skia.git@drawInterface
Patch Set: cache dynamic state updates Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkCommandBuffer.cpp ('k') | src/gpu/vk/GrVkPipeline.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 9
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 primitiveType, 1333 primitiveType,
1334 desc, 1334 desc,
1335 renderPass); 1335 renderPass);
1336 if (!program) { 1336 if (!program) {
1337 return false; 1337 return false;
1338 } 1338 }
1339 1339
1340 (*program)->setData(this, primProc, pipeline); 1340 (*program)->setData(this, primProc, pipeline);
1341 1341
1342 (*program)->bind(this, fCurrentCmdBuffer); 1342 (*program)->bind(this, fCurrentCmdBuffer);
1343
1344 GrVkPipeline::SetDynamicState(this, fCurrentCmdBuffer, pipeline);
1345
1343 return true; 1346 return true;
1344 } 1347 }
1345 1348
1346 void GrVkGpu::onDraw(const GrPipeline& pipeline, 1349 void GrVkGpu::onDraw(const GrPipeline& pipeline,
1347 const GrPrimitiveProcessor& primProc, 1350 const GrPrimitiveProcessor& primProc,
1348 const GrMesh* meshes, 1351 const GrMesh* meshes,
1349 int meshCount) { 1352 int meshCount) {
1350 if (!meshCount) { 1353 if (!meshCount) {
1351 return; 1354 return;
1352 } 1355 }
1353 GrRenderTarget* rt = pipeline.getRenderTarget(); 1356 GrRenderTarget* rt = pipeline.getRenderTarget();
1354 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt); 1357 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt);
1355 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass(); 1358 const GrVkRenderPass* renderPass = vkRT->simpleRenderPass();
1356 SkASSERT(renderPass); 1359 SkASSERT(renderPass);
1357 1360
1361 fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT);
1362
1358 GrVkProgram* program = nullptr; 1363 GrVkProgram* program = nullptr;
1359 GrPrimitiveType primitiveType = meshes[0].primitiveType(); 1364 GrPrimitiveType primitiveType = meshes[0].primitiveType();
1360 if (!this->prepareDrawState(pipeline, primProc, primitiveType, *renderPass, &program)) { 1365 if (!this->prepareDrawState(pipeline, primProc, primitiveType, *renderPass, &program)) {
1361 return; 1366 return;
1362 } 1367 }
1363 1368
1364 // Change layout of our render target so it can be used as the color attachm ent 1369 // Change layout of our render target so it can be used as the color attachm ent
1365 VkImageLayout layout = vkRT->currentLayout(); 1370 VkImageLayout layout = vkRT->currentLayout();
1366 // Our color attachment is purely a destination and won't be read so don't n eed to flush or 1371 // Our color attachment is purely a destination and won't be read so don't n eed to flush or
1367 // invalidate any caches 1372 // invalidate any caches
(...skipping 22 matching lines...) Expand all
1390 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; 1395 VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
1391 vkStencil->setImageLayout(this, 1396 vkStencil->setImageLayout(this,
1392 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIM AL, 1397 VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIM AL,
1393 srcAccessMask, 1398 srcAccessMask,
1394 dstAccessMask, 1399 dstAccessMask,
1395 srcStageMask, 1400 srcStageMask,
1396 dstStageMask, 1401 dstStageMask,
1397 false); 1402 false);
1398 } 1403 }
1399 1404
1400 fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT);
1401 1405
1402 for (int i = 0; i < meshCount; ++i) { 1406 for (int i = 0; i < meshCount; ++i) {
1403 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*this->caps ())) { 1407 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*this->caps ())) {
1404 this->xferBarrier(pipeline.getRenderTarget(), barrierType); 1408 this->xferBarrier(pipeline.getRenderTarget(), barrierType);
1405 } 1409 }
1406 1410
1407 const GrMesh& mesh = meshes[i]; 1411 const GrMesh& mesh = meshes[i];
1408 GrMesh::Iterator iter; 1412 GrMesh::Iterator iter;
1409 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); 1413 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh);
1410 do { 1414 do {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 int set_a_break_pt_here = 9; 1468 int set_a_break_pt_here = 9;
1465 aglSwapBuffers(aglGetCurrentContext()); 1469 aglSwapBuffers(aglGetCurrentContext());
1466 #elif defined(SK_BUILD_FOR_WIN32) 1470 #elif defined(SK_BUILD_FOR_WIN32)
1467 SwapBuf(); 1471 SwapBuf();
1468 int set_a_break_pt_here = 9; 1472 int set_a_break_pt_here = 9;
1469 SwapBuf(); 1473 SwapBuf();
1470 #endif 1474 #endif
1471 #endif 1475 #endif
1472 } 1476 }
1473 1477
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkCommandBuffer.cpp ('k') | src/gpu/vk/GrVkPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698