| OLD | NEW | 
|---|
| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 349     memset(colorBlendInfo, 0, sizeof(VkPipelineColorBlendStateCreateInfo)); | 349     memset(colorBlendInfo, 0, sizeof(VkPipelineColorBlendStateCreateInfo)); | 
| 350     colorBlendInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_
     INFO; | 350     colorBlendInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_
     INFO; | 
| 351     colorBlendInfo->pNext = nullptr; | 351     colorBlendInfo->pNext = nullptr; | 
| 352     colorBlendInfo->flags = 0; | 352     colorBlendInfo->flags = 0; | 
| 353     colorBlendInfo->logicOpEnable = VK_FALSE; | 353     colorBlendInfo->logicOpEnable = VK_FALSE; | 
| 354     colorBlendInfo->attachmentCount = 1; | 354     colorBlendInfo->attachmentCount = 1; | 
| 355     colorBlendInfo->pAttachments = attachmentState; | 355     colorBlendInfo->pAttachments = attachmentState; | 
| 356     // colorBlendInfo->blendConstants is set dynamically | 356     // colorBlendInfo->blendConstants is set dynamically | 
| 357 } | 357 } | 
| 358 | 358 | 
| 359 VkCullModeFlags draw_face_to_vk_cull_mode(GrDrawFace drawFace) { | 359 VkCullModeFlags draw_face_to_vk_cull_mode(GrPipelineBuilder::DrawFace drawFace) 
     { | 
| 360     // Assumes that we've set the front face to be ccw | 360     // Assumes that we've set the front face to be ccw | 
| 361     static const VkCullModeFlags gTable[] = { | 361     static const VkCullModeFlags gTable[] = { | 
| 362         VK_CULL_MODE_NONE,              // kBoth_DrawFace | 362         VK_CULL_MODE_NONE,              // kBoth_DrawFace | 
| 363         VK_CULL_MODE_BACK_BIT,          // kCCW_DrawFace, cull back face | 363         VK_CULL_MODE_BACK_BIT,          // kCCW_DrawFace, cull back face | 
| 364         VK_CULL_MODE_FRONT_BIT,         // kCW_DrawFace, cull front face | 364         VK_CULL_MODE_FRONT_BIT,         // kCW_DrawFace, cull front face | 
| 365     }; | 365     }; | 
| 366     GR_STATIC_ASSERT(0 == GrDrawFace::kBoth); | 366     GR_STATIC_ASSERT(0 == GrPipelineBuilder::kBoth_DrawFace); | 
| 367     GR_STATIC_ASSERT(1 == GrDrawFace::kCCW); | 367     GR_STATIC_ASSERT(1 == GrPipelineBuilder::kCCW_DrawFace); | 
| 368     GR_STATIC_ASSERT(2 == GrDrawFace::kCW); | 368     GR_STATIC_ASSERT(2 == GrPipelineBuilder::kCW_DrawFace); | 
| 369     SkASSERT((unsigned)drawFace <= 2); | 369     SkASSERT((unsigned)drawFace <= 2); | 
| 370 | 370 | 
| 371     return gTable[drawFace]; | 371     return gTable[drawFace]; | 
| 372 } | 372 } | 
| 373 | 373 | 
| 374 void setup_raster_state(const GrVkGpu* gpu, | 374 void setup_raster_state(const GrVkGpu* gpu, | 
| 375     const GrPipeline& pipeline, | 375     const GrPipeline& pipeline, | 
| 376     VkPipelineRasterizationStateCreateInfo* rasterInfo) { | 376     VkPipelineRasterizationStateCreateInfo* rasterInfo) { | 
| 377     memset(rasterInfo, 0, sizeof(VkPipelineRasterizationStateCreateInfo)); | 377     memset(rasterInfo, 0, sizeof(VkPipelineRasterizationStateCreateInfo)); | 
| 378     rasterInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_IN
     FO; | 378     rasterInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_IN
     FO; | 
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 549 } | 549 } | 
| 550 | 550 | 
| 551 void GrVkPipeline::SetDynamicState(GrVkGpu* gpu, | 551 void GrVkPipeline::SetDynamicState(GrVkGpu* gpu, | 
| 552                                    GrVkCommandBuffer* cmdBuffer, | 552                                    GrVkCommandBuffer* cmdBuffer, | 
| 553                                    const GrPipeline& pipeline) { | 553                                    const GrPipeline& pipeline) { | 
| 554     const GrRenderTarget& target = *pipeline.getRenderTarget(); | 554     const GrRenderTarget& target = *pipeline.getRenderTarget(); | 
| 555     set_dynamic_scissor_state(gpu, cmdBuffer, pipeline, target); | 555     set_dynamic_scissor_state(gpu, cmdBuffer, pipeline, target); | 
| 556     set_dynamic_viewport_state(gpu, cmdBuffer, target); | 556     set_dynamic_viewport_state(gpu, cmdBuffer, target); | 
| 557     set_dynamic_blend_constant_state(gpu, cmdBuffer, pipeline); | 557     set_dynamic_blend_constant_state(gpu, cmdBuffer, pipeline); | 
| 558 } | 558 } | 
| OLD | NEW | 
|---|