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/GrVkPipeline.cpp

Issue 1756493002: Use VkPipelineCaches during VkPipeline creation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // TODO: mask out any state we might want to set dynamically 423 // TODO: mask out any state we might want to set dynamically
424 dynamicInfo->dynamicStateCount = 0; 424 dynamicInfo->dynamicStateCount = 0;
425 } 425 }
426 426
427 GrVkPipeline* GrVkPipeline::Create(GrVkGpu* gpu, const GrPipeline& pipeline, 427 GrVkPipeline* GrVkPipeline::Create(GrVkGpu* gpu, const GrPipeline& pipeline,
428 const GrPrimitiveProcessor& primProc, 428 const GrPrimitiveProcessor& primProc,
429 VkPipelineShaderStageCreateInfo* shaderStageI nfo, 429 VkPipelineShaderStageCreateInfo* shaderStageI nfo,
430 int shaderStageCount, 430 int shaderStageCount,
431 GrPrimitiveType primitiveType, 431 GrPrimitiveType primitiveType,
432 const GrVkRenderPass& renderPass, 432 const GrVkRenderPass& renderPass,
433 VkPipelineLayout layout) { 433 VkPipelineLayout layout,
434 VkPipelineCache cache) {
434 VkPipelineVertexInputStateCreateInfo vertexInputInfo; 435 VkPipelineVertexInputStateCreateInfo vertexInputInfo;
435 VkVertexInputBindingDescription bindingDesc; 436 VkVertexInputBindingDescription bindingDesc;
436 // TODO: allocate this based on VkPhysicalDeviceLimits::maxVertexInputAttrib utes 437 // TODO: allocate this based on VkPhysicalDeviceLimits::maxVertexInputAttrib utes
437 static const int kMaxVertexAttributes = 16; 438 static const int kMaxVertexAttributes = 16;
438 static VkVertexInputAttributeDescription attributeDesc[kMaxVertexAttributes] ; 439 static VkVertexInputAttributeDescription attributeDesc[kMaxVertexAttributes] ;
439 setup_vertex_input_state(primProc, &vertexInputInfo, &bindingDesc, 1, 440 setup_vertex_input_state(primProc, &vertexInputInfo, &bindingDesc, 1,
440 attributeDesc, kMaxVertexAttributes); 441 attributeDesc, kMaxVertexAttributes);
441 442
442 VkPipelineInputAssemblyStateCreateInfo inputAssemblyInfo; 443 VkPipelineInputAssemblyStateCreateInfo inputAssemblyInfo;
443 setup_input_assembly_state(primitiveType, &inputAssemblyInfo); 444 setup_input_assembly_state(primitiveType, &inputAssemblyInfo);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 pipelineCreateInfo.pColorBlendState = &colorBlendInfo; 484 pipelineCreateInfo.pColorBlendState = &colorBlendInfo;
484 pipelineCreateInfo.pDynamicState = &dynamicInfo; 485 pipelineCreateInfo.pDynamicState = &dynamicInfo;
485 pipelineCreateInfo.layout = layout; 486 pipelineCreateInfo.layout = layout;
486 pipelineCreateInfo.renderPass = renderPass.vkRenderPass(); 487 pipelineCreateInfo.renderPass = renderPass.vkRenderPass();
487 pipelineCreateInfo.subpass = 0; 488 pipelineCreateInfo.subpass = 0;
488 pipelineCreateInfo.basePipelineHandle = VK_NULL_HANDLE; 489 pipelineCreateInfo.basePipelineHandle = VK_NULL_HANDLE;
489 pipelineCreateInfo.basePipelineIndex = -1; 490 pipelineCreateInfo.basePipelineIndex = -1;
490 491
491 VkPipeline vkPipeline; 492 VkPipeline vkPipeline;
492 VkResult err = GR_VK_CALL(gpu->vkInterface(), CreateGraphicsPipelines(gpu->d evice(), 493 VkResult err = GR_VK_CALL(gpu->vkInterface(), CreateGraphicsPipelines(gpu->d evice(),
493 nullpt r, 1, 494 cache, 1,
494 &pipel ineCreateInfo, 495 &pipel ineCreateInfo,
495 nullpt r, &vkPipeline)); 496 nullpt r, &vkPipeline));
496 if (err) { 497 if (err) {
497 return nullptr; 498 return nullptr;
498 } 499 }
499 500
500 return new GrVkPipeline(vkPipeline); 501 return new GrVkPipeline(vkPipeline);
501 } 502 }
502 503
503 void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const { 504 void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const {
504 GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nul lptr)); 505 GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nul lptr));
505 } 506 }
506 507
507 508
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698