From: Jean-Philippe Bruyère Date: Wed, 14 Jul 2021 20:06:37 +0000 (+0200) Subject: implement clear operator with substract blending X-Git-Tag: v0.2.0~65 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=155dc1476f2dc67dd880555ebf9bc0d2bcb9b509;p=jp%2Fvkvg.git implement clear operator with substract blending --- diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index f06245f..48daab0 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -491,7 +491,7 @@ void _bind_draw_pipeline (VkvgContext ctx) { case VKVG_OPERATOR_OVER: CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER); break; - case VKVG_OPERATOR_CLEAR: + case VKVG_OPERATOR_CLEAR: CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_CLEAR); break; case VKVG_OPERATOR_DIFFERENCE: @@ -583,7 +583,6 @@ void _update_cur_pattern (VkvgContext ctx, VkvgPattern pat) { //flush ctx in two steps to add the src transitioning in the cmd buff if (ctx->cmdStarted){//transition of img without appropriate dependencies in subpass must be done outside renderpass. - //_flush_undrawn_vertices (ctx);//ensure all vertices are flushed _end_render_pass (ctx); _flush_vertices_caches (ctx); }else { diff --git a/src/vkvg_device_internal.c b/src/vkvg_device_internal.c index fb199c9..f99b6a1 100644 --- a/src/vkvg_device_internal.c +++ b/src/vkvg_device_internal.c @@ -347,11 +347,12 @@ void _setupPipelines(VkvgDevice dev) blendAttachmentState.alphaBlendOp = blendAttachmentState.colorBlendOp = VK_BLEND_OP_SUBTRACT; VK_CHECK_RESULT(vkCreateGraphicsPipelines(dev->vkDev, dev->pipelineCache, 1, &pipelineCreateInfo, NULL, &dev->pipe_SUB)); - //blendAttachmentState.blendEnable = VK_FALSE; - //rasterizationState.polygonMode = VK_POLYGON_MODE_POINT; //shaderStages[1].pName = "op_CLEAR"; - blendAttachmentState.srcAlphaBlendFactor = blendAttachmentState.dstAlphaBlendFactor = - blendAttachmentState.srcColorBlendFactor = blendAttachmentState.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO; + blendAttachmentState.colorBlendOp = blendAttachmentState.alphaBlendOp = VK_BLEND_OP_SUBTRACT; + blendAttachmentState.srcColorBlendFactor = VK_BLEND_FACTOR_ONE; + blendAttachmentState.dstColorBlendFactor = VK_BLEND_FACTOR_ONE; + blendAttachmentState.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE; + blendAttachmentState.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE; VK_CHECK_RESULT(vkCreateGraphicsPipelines(dev->vkDev, dev->pipelineCache, 1, &pipelineCreateInfo, NULL, &dev->pipe_CLEAR));