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

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

Issue 1755753002: Implement various vulkan stencil clears and fix various stenciling bugs. (Closed) Base URL: https://skia.googlesource.com/skia.git@stencilImage
Patch Set: Review Nits 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/GrVkRenderPass.cpp » ('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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 stencilInfo->depthBoundsTestEnable = VK_FALSE; 161 stencilInfo->depthBoundsTestEnable = VK_FALSE;
162 stencilInfo->stencilTestEnable = !stencilSettings.isDisabled(); 162 stencilInfo->stencilTestEnable = !stencilSettings.isDisabled();
163 if (!stencilSettings.isDisabled()) { 163 if (!stencilSettings.isDisabled()) {
164 // Set front face 164 // Set front face
165 GrStencilSettings::Face face = GrStencilSettings::kFront_Face; 165 GrStencilSettings::Face face = GrStencilSettings::kFront_Face;
166 stencilInfo->front.failOp = stencil_op_to_vk_stencil_op(stencilSettings. failOp(face)); 166 stencilInfo->front.failOp = stencil_op_to_vk_stencil_op(stencilSettings. failOp(face));
167 stencilInfo->front.passOp = stencil_op_to_vk_stencil_op(stencilSettings. passOp(face)); 167 stencilInfo->front.passOp = stencil_op_to_vk_stencil_op(stencilSettings. passOp(face));
168 stencilInfo->front.depthFailOp = stencilInfo->front.failOp; 168 stencilInfo->front.depthFailOp = stencilInfo->front.failOp;
169 stencilInfo->front.compareOp = stencil_func_to_vk_compare_op(stencilSett ings.func(face)); 169 stencilInfo->front.compareOp = stencil_func_to_vk_compare_op(stencilSett ings.func(face));
170 stencilInfo->front.compareMask = stencilSettings.funcMask(face); 170 stencilInfo->front.compareMask = stencilSettings.funcMask(face);
171 stencilInfo->front.writeMask = 0; 171 stencilInfo->front.writeMask = stencilSettings.writeMask(face);
172 stencilInfo->front.reference = 0; 172 stencilInfo->front.reference = stencilSettings.funcRef(face);
173 173
174 // Set back face 174 // Set back face
175 face = GrStencilSettings::kBack_Face; 175 face = GrStencilSettings::kBack_Face;
176 stencilInfo->back.failOp = stencil_op_to_vk_stencil_op(stencilSettings.f ailOp(face)); 176 stencilInfo->back.failOp = stencil_op_to_vk_stencil_op(stencilSettings.f ailOp(face));
177 stencilInfo->back.passOp = stencil_op_to_vk_stencil_op(stencilSettings.p assOp(face)); 177 stencilInfo->back.passOp = stencil_op_to_vk_stencil_op(stencilSettings.p assOp(face));
178 stencilInfo->back.depthFailOp = stencilInfo->front.failOp; 178 stencilInfo->back.depthFailOp = stencilInfo->front.failOp;
179 stencilInfo->back.compareOp = stencil_func_to_vk_compare_op(stencilSetti ngs.func(face)); 179 stencilInfo->back.compareOp = stencil_func_to_vk_compare_op(stencilSetti ngs.func(face));
180 stencilInfo->back.compareMask = stencilSettings.funcMask(face); 180 stencilInfo->back.compareMask = stencilSettings.funcMask(face);
181 stencilInfo->back.writeMask = 0; 181 stencilInfo->back.writeMask = stencilSettings.writeMask(face);
182 stencilInfo->back.reference = 0; 182 stencilInfo->back.reference = stencilSettings.funcRef(face);
183 } 183 }
184 stencilInfo->minDepthBounds = 0.0f; 184 stencilInfo->minDepthBounds = 0.0f;
185 stencilInfo->maxDepthBounds = 1.0f; 185 stencilInfo->maxDepthBounds = 1.0f;
186 } 186 }
187 187
188 void setup_viewport_scissor_state(const GrVkGpu* gpu, 188 void setup_viewport_scissor_state(const GrVkGpu* gpu,
189 const GrPipeline& pipeline, 189 const GrPipeline& pipeline,
190 const GrVkRenderTarget* vkRT, 190 const GrVkRenderTarget* vkRT,
191 VkPipelineViewportStateCreateInfo* viewportInf o, 191 VkPipelineViewportStateCreateInfo* viewportInf o,
192 VkViewport* viewport, 192 VkViewport* viewport,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 memset(attachmentState, 0, sizeof(VkPipelineColorBlendAttachmentState)); 359 memset(attachmentState, 0, sizeof(VkPipelineColorBlendAttachmentState));
360 attachmentState->blendEnable = !blendOff; 360 attachmentState->blendEnable = !blendOff;
361 if (!blendOff) { 361 if (!blendOff) {
362 attachmentState->srcColorBlendFactor = blend_coeff_to_vk_blend(srcCoeff) ; 362 attachmentState->srcColorBlendFactor = blend_coeff_to_vk_blend(srcCoeff) ;
363 attachmentState->dstColorBlendFactor = blend_coeff_to_vk_blend(dstCoeff) ; 363 attachmentState->dstColorBlendFactor = blend_coeff_to_vk_blend(dstCoeff) ;
364 attachmentState->colorBlendOp = blend_equation_to_vk_blend_op(equation); 364 attachmentState->colorBlendOp = blend_equation_to_vk_blend_op(equation);
365 attachmentState->srcAlphaBlendFactor = blend_coeff_to_vk_blend(srcCoeff) ; 365 attachmentState->srcAlphaBlendFactor = blend_coeff_to_vk_blend(srcCoeff) ;
366 attachmentState->dstAlphaBlendFactor = blend_coeff_to_vk_blend(dstCoeff) ; 366 attachmentState->dstAlphaBlendFactor = blend_coeff_to_vk_blend(dstCoeff) ;
367 attachmentState->alphaBlendOp = blend_equation_to_vk_blend_op(equation); 367 attachmentState->alphaBlendOp = blend_equation_to_vk_blend_op(equation);
368 } 368 }
369 attachmentState->colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPON ENT_G_BIT | 369
370 VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPON ENT_A_BIT; 370 if (!blendInfo.fWriteColor) {
371 attachmentState->colorWriteMask = 0;
372 } else {
373 attachmentState->colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_CO MPONENT_G_BIT |
374 VK_COLOR_COMPONENT_B_BIT | VK_COLOR_CO MPONENT_A_BIT;
375 }
371 376
372 memset(colorBlendInfo, 0, sizeof(VkPipelineColorBlendStateCreateInfo)); 377 memset(colorBlendInfo, 0, sizeof(VkPipelineColorBlendStateCreateInfo));
373 colorBlendInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_ INFO; 378 colorBlendInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_ INFO;
374 colorBlendInfo->pNext = nullptr; 379 colorBlendInfo->pNext = nullptr;
375 colorBlendInfo->flags = 0; 380 colorBlendInfo->flags = 0;
376 colorBlendInfo->logicOpEnable = VK_FALSE; 381 colorBlendInfo->logicOpEnable = VK_FALSE;
377 colorBlendInfo->attachmentCount = 1; 382 colorBlendInfo->attachmentCount = 1;
378 colorBlendInfo->pAttachments = attachmentState; 383 colorBlendInfo->pAttachments = attachmentState;
379 if (blend_coeff_refs_constant(srcCoeff) || blend_coeff_refs_constant(dstCoef f)) { 384 if (blend_coeff_refs_constant(srcCoeff) || blend_coeff_refs_constant(dstCoef f)) {
380 GrColorToRGBAFloat(blendInfo.fBlendConstant, colorBlendInfo->blendConsta nts); 385 GrColorToRGBAFloat(blendInfo.fBlendConstant, colorBlendInfo->blendConsta nts);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 503 }
499 504
500 return new GrVkPipeline(vkPipeline); 505 return new GrVkPipeline(vkPipeline);
501 } 506 }
502 507
503 void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const { 508 void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const {
504 GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nul lptr)); 509 GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nul lptr));
505 } 510 }
506 511
507 512
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkRenderPass.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698