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

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

Issue 1816153002: Set up cache in vulkan to reuse GrVkPrograms (aka VkPipelines) (Closed) Base URL: https://skia.googlesource.com/skia.git@progSamplers
Patch Set: rebase 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/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkPipelineState.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 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 "GrVkPipeline.h" 8 #include "GrVkPipeline.h"
9 9
10 #include "GrGeometryProcessor.h" 10 #include "GrGeometryProcessor.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 return nullptr; 472 return nullptr;
473 } 473 }
474 474
475 return new GrVkPipeline(vkPipeline); 475 return new GrVkPipeline(vkPipeline);
476 } 476 }
477 477
478 void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const { 478 void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const {
479 GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nul lptr)); 479 GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nul lptr));
480 } 480 }
481 481
482
483 void set_dynamic_scissor_state(GrVkGpu* gpu, 482 void set_dynamic_scissor_state(GrVkGpu* gpu,
484 GrVkCommandBuffer* cmdBuffer, 483 GrVkCommandBuffer* cmdBuffer,
485 const GrPipeline& pipeline, 484 const GrPipeline& pipeline,
486 const GrRenderTarget& target) { 485 const GrRenderTarget& target) {
487 // We always use one scissor and if it is disabled we just make it the size of the RT 486 // We always use one scissor and if it is disabled we just make it the size of the RT
488 const GrScissorState& scissorState = pipeline.getScissorState(); 487 const GrScissorState& scissorState = pipeline.getScissorState();
489 VkRect2D scissor; 488 VkRect2D scissor;
490 if (scissorState.enabled() && 489 if (scissorState.enabled() &&
491 !scissorState.rect().contains(0, 0, target.width(), target.height())) { 490 !scissorState.rect().contains(0, 0, target.width(), target.height())) {
492 // This all assumes the scissorState has previously been clipped to the device space render 491 // This all assumes the scissorState has previously been clipped to the device space render
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 GrBlendCoeff dstCoeff = blendInfo.fDstBlend; 536 GrBlendCoeff dstCoeff = blendInfo.fDstBlend;
538 float floatColors[4]; 537 float floatColors[4];
539 if (blend_coeff_refs_constant(srcCoeff) || blend_coeff_refs_constant(dstCoef f)) { 538 if (blend_coeff_refs_constant(srcCoeff) || blend_coeff_refs_constant(dstCoef f)) {
540 GrColorToRGBAFloat(blendInfo.fBlendConstant, floatColors); 539 GrColorToRGBAFloat(blendInfo.fBlendConstant, floatColors);
541 } else { 540 } else {
542 memset(floatColors, 0, 4 * sizeof(float)); 541 memset(floatColors, 0, 4 * sizeof(float));
543 } 542 }
544 cmdBuffer->setBlendConstants(gpu, floatColors); 543 cmdBuffer->setBlendConstants(gpu, floatColors);
545 } 544 }
546 545
547
548
549 void GrVkPipeline::SetDynamicState(GrVkGpu* gpu, 546 void GrVkPipeline::SetDynamicState(GrVkGpu* gpu,
550 GrVkCommandBuffer* cmdBuffer, 547 GrVkCommandBuffer* cmdBuffer,
551 const GrPipeline& pipeline) { 548 const GrPipeline& pipeline) {
552 const GrRenderTarget& target = *pipeline.getRenderTarget(); 549 const GrRenderTarget& target = *pipeline.getRenderTarget();
553 set_dynamic_scissor_state(gpu, cmdBuffer, pipeline, target); 550 set_dynamic_scissor_state(gpu, cmdBuffer, pipeline, target);
554 set_dynamic_viewport_state(gpu, cmdBuffer, target); 551 set_dynamic_viewport_state(gpu, cmdBuffer, target);
555 set_dynamic_blend_constant_state(gpu, cmdBuffer, pipeline); 552 set_dynamic_blend_constant_state(gpu, cmdBuffer, pipeline);
556 } 553 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkPipelineState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698