]> O.S.I.I.S - jp/vkvg.git/commitdiff
implement clear operator with substract blending
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 14 Jul 2021 20:06:37 +0000 (22:06 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 14 Jul 2021 20:06:37 +0000 (22:06 +0200)
src/vkvg_context_internal.c
src/vkvg_device_internal.c

index f06245f2f9fee15fcdcd5d782d34faa48d7edd84..48daab063b15a921fccde7a82d1de57f5f883285 100644 (file)
@@ -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 {
index fb199c9649a0ab24e5ef1024f7689aaea743360a..f99b6a1706b02fd7070c529f94c6cc41a886f13a 100644 (file)
@@ -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));