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

Side by Side Diff: src/gpu/vk/GrVkCommandBuffer.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/GrVkCommandBuffer.h ('k') | src/gpu/vk/GrVkGpu.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 "GrVkCommandBuffer.h" 8 #include "GrVkCommandBuffer.h"
9 9
10 #include "GrVkFramebuffer.h" 10 #include "GrVkFramebuffer.h"
11 #include "GrVkImageView.h" 11 #include "GrVkImageView.h"
12 #include "GrVkPipeline.h" 12 #include "GrVkPipeline.h"
13 #include "GrVkRenderPass.h" 13 #include "GrVkRenderPass.h"
14 #include "GrVkRenderTarget.h" 14 #include "GrVkRenderTarget.h"
15 #include "GrVkProgram.h" 15 #include "GrVkPipelineState.h"
16 #include "GrVkTransferBuffer.h" 16 #include "GrVkTransferBuffer.h"
17 #include "GrVkUtil.h" 17 #include "GrVkUtil.h"
18 18
19 GrVkCommandBuffer* GrVkCommandBuffer::Create(const GrVkGpu* gpu, VkCommandPool c mdPool) { 19 GrVkCommandBuffer* GrVkCommandBuffer::Create(const GrVkGpu* gpu, VkCommandPool c mdPool) {
20 const VkCommandBufferAllocateInfo cmdInfo = { 20 const VkCommandBufferAllocateInfo cmdInfo = {
21 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // sType 21 VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // sType
22 NULL, // pNext 22 NULL, // pNext
23 cmdPool, // commandPool 23 cmdPool, // commandPool
24 VK_COMMAND_BUFFER_LEVEL_PRIMARY, // level 24 VK_COMMAND_BUFFER_LEVEL_PRIMARY, // level
25 1 // bufferCount 25 1 // bufferCount
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 340 }
341 #endif 341 #endif
342 GR_VK_CALL(gpu->vkInterface(), CmdClearAttachments(fCmdBuffer, 342 GR_VK_CALL(gpu->vkInterface(), CmdClearAttachments(fCmdBuffer,
343 numAttachments, 343 numAttachments,
344 attachments, 344 attachments,
345 numRects, 345 numRects,
346 clearRects)); 346 clearRects));
347 } 347 }
348 348
349 void GrVkCommandBuffer::bindDescriptorSets(const GrVkGpu* gpu, 349 void GrVkCommandBuffer::bindDescriptorSets(const GrVkGpu* gpu,
350 GrVkProgram* program, 350 GrVkPipelineState* pipelineState,
351 VkPipelineLayout layout, 351 VkPipelineLayout layout,
352 uint32_t firstSet, 352 uint32_t firstSet,
353 uint32_t setCount, 353 uint32_t setCount,
354 const VkDescriptorSet* descriptorSets , 354 const VkDescriptorSet* descriptorSets ,
355 uint32_t dynamicOffsetCount, 355 uint32_t dynamicOffsetCount,
356 const uint32_t* dynamicOffsets) { 356 const uint32_t* dynamicOffsets) {
357 SkASSERT(fIsActive); 357 SkASSERT(fIsActive);
358 GR_VK_CALL(gpu->vkInterface(), CmdBindDescriptorSets(fCmdBuffer, 358 GR_VK_CALL(gpu->vkInterface(), CmdBindDescriptorSets(fCmdBuffer,
359 VK_PIPELINE_BIND_POINT_ GRAPHICS, 359 VK_PIPELINE_BIND_POINT_ GRAPHICS,
360 layout, 360 layout,
361 firstSet, 361 firstSet,
362 setCount, 362 setCount,
363 descriptorSets, 363 descriptorSets,
364 dynamicOffsetCount, 364 dynamicOffsetCount,
365 dynamicOffsets)); 365 dynamicOffsets));
366 program->addUniformResources(*this); 366 pipelineState->addUniformResources(*this);
367 } 367 }
368 368
369 void GrVkCommandBuffer::bindPipeline(const GrVkGpu* gpu, const GrVkPipeline* pip eline) { 369 void GrVkCommandBuffer::bindPipeline(const GrVkGpu* gpu, const GrVkPipeline* pip eline) {
370 SkASSERT(fIsActive); 370 SkASSERT(fIsActive);
371 SkASSERT(fActiveRenderPass); 371 SkASSERT(fActiveRenderPass);
372 GR_VK_CALL(gpu->vkInterface(), CmdBindPipeline(fCmdBuffer, 372 GR_VK_CALL(gpu->vkInterface(), CmdBindPipeline(fCmdBuffer,
373 VK_PIPELINE_BIND_POINT_GRAPHI CS, 373 VK_PIPELINE_BIND_POINT_GRAPHI CS,
374 pipeline->pipeline())); 374 pipeline->pipeline()));
375 addResource(pipeline); 375 addResource(pipeline);
376 } 376 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 436 }
437 437
438 void GrVkCommandBuffer::setBlendConstants(const GrVkGpu* gpu, 438 void GrVkCommandBuffer::setBlendConstants(const GrVkGpu* gpu,
439 const float blendConstants[4]) { 439 const float blendConstants[4]) {
440 SkASSERT(fIsActive); 440 SkASSERT(fIsActive);
441 if (memcmp(blendConstants, fCachedBlendConstant, 4 * sizeof(float))) { 441 if (memcmp(blendConstants, fCachedBlendConstant, 4 * sizeof(float))) {
442 GR_VK_CALL(gpu->vkInterface(), CmdSetBlendConstants(fCmdBuffer, blendCon stants)); 442 GR_VK_CALL(gpu->vkInterface(), CmdSetBlendConstants(fCmdBuffer, blendCon stants));
443 memcpy(fCachedBlendConstant, blendConstants, 4 * sizeof(float)); 443 memcpy(fCachedBlendConstant, blendConstants, 4 * sizeof(float));
444 } 444 }
445 } 445 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkCommandBuffer.h ('k') | src/gpu/vk/GrVkGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698