[gtk+/wip/matthiasc/text-node] more work-in-progress



commit a87b120a2d2cc0dd01ae432f737bb5032446d493
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 9 22:31:02 2017 -0400

    more work-in-progress
    
    Use the proper blend factors for masks. Still doesn't work.

 gsk/gskrendernodeimpl.c        |    3 ++-
 gsk/gskvulkanmaskpipeline.c    |    3 ++-
 gsk/gskvulkanpipeline.c        |   21 +++++++++++++++++----
 gsk/gskvulkanpipelineprivate.h |    6 ++++++
 4 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 6174b2a..c1b09c8 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -3891,7 +3891,8 @@ render_text (cairo_t          *cr,
 
 /*
  * Next steps:
- * - figure out A8 textures and masking
+ * - make the mask shader work
+ * - figure out A8 textures
  * - make the shader use per-glyph rects from a larger texture
  * - switch to using a font atlas insead of per-call cached surfaces
  */
diff --git a/gsk/gskvulkanmaskpipeline.c b/gsk/gskvulkanmaskpipeline.c
index 8272aa5..32e194f 100644
--- a/gsk/gskvulkanmaskpipeline.c
+++ b/gsk/gskvulkanmaskpipeline.c
@@ -87,7 +87,8 @@ gsk_vulkan_mask_pipeline_new (GskVulkanPipelineLayout *layout,
                                const char              *shader_name,
                                VkRenderPass             render_pass)
 {
-  return gsk_vulkan_pipeline_new (GSK_TYPE_VULKAN_MASK_PIPELINE, layout, shader_name, render_pass);
+  return gsk_vulkan_pipeline_new_full (GSK_TYPE_VULKAN_MASK_PIPELINE, layout, shader_name, render_pass,
+                                       VK_BLEND_FACTOR_SRC_ALPHA, VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA);
 }
 
 gsize
diff --git a/gsk/gskvulkanpipeline.c b/gsk/gskvulkanpipeline.c
index 7fff1d2..71ea27e 100644
--- a/gsk/gskvulkanpipeline.c
+++ b/gsk/gskvulkanpipeline.c
@@ -68,6 +68,19 @@ gsk_vulkan_pipeline_new (GType                    pipeline_type,
                          const char              *shader_name,
                          VkRenderPass             render_pass)
 {
+  return gsk_vulkan_pipeline_new_full (pipeline_type, layout, shader_name, render_pass,
+                                       VK_BLEND_FACTOR_ONE,
+                                       VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA);
+}
+
+GskVulkanPipeline *
+gsk_vulkan_pipeline_new_full (GType                    pipeline_type,
+                              GskVulkanPipelineLayout *layout,
+                              const char              *shader_name,
+                              VkRenderPass             render_pass,
+                              VkBlendFactor            srcBlendFactor,
+                              VkBlendFactor            dstBlendFactor)
+{
   GskVulkanPipelinePrivate *priv;
   GskVulkanPipeline *self;
   
@@ -134,11 +147,11 @@ gsk_vulkan_pipeline_new (GType                    pipeline_type,
                                                        {
                                                            .blendEnable = VK_TRUE,
                                                            .colorBlendOp = VK_BLEND_OP_ADD,
-                                                           .srcColorBlendFactor = VK_BLEND_FACTOR_ONE,
-                                                           .dstColorBlendFactor = 
VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
+                                                           .srcColorBlendFactor = srcBlendFactor,
+                                                           .dstColorBlendFactor = dstBlendFactor,
                                                            .alphaBlendOp = VK_BLEND_OP_ADD,
-                                                           .srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE,
-                                                           .dstAlphaBlendFactor = 
VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
+                                                           .srcAlphaBlendFactor = srcBlendFactor,
+                                                           .dstAlphaBlendFactor = dstBlendFactor,
                                                            .colorWriteMask = VK_COLOR_COMPONENT_A_BIT
                                                                            | VK_COLOR_COMPONENT_R_BIT
                                                                            | VK_COLOR_COMPONENT_G_BIT
diff --git a/gsk/gskvulkanpipelineprivate.h b/gsk/gskvulkanpipelineprivate.h
index 91ffee8..504306a 100644
--- a/gsk/gskvulkanpipelineprivate.h
+++ b/gsk/gskvulkanpipelineprivate.h
@@ -48,6 +48,12 @@ GskVulkanPipeline *     gsk_vulkan_pipeline_new                         (GType
                                                                          GskVulkanPipelineLayout        
*layout,
                                                                          const char                     
*shader_name,
                                                                          VkRenderPass                    
render_pass);
+GskVulkanPipeline *     gsk_vulkan_pipeline_new_full                    (GType                           
pipeline_type,
+                                                                         GskVulkanPipelineLayout        
*layout,
+                                                                         const char                     
*shader_name,
+                                                                         VkRenderPass                    
render_pass,
+                                                                         VkBlendFactor                   
srcBlendFactor,
+                                                                         VkBlendFactor                   
dstBlendFactor);
 
 VkPipeline              gsk_vulkan_pipeline_get_pipeline                (GskVulkanPipeline              
*self);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]