external/skia/UnpackedTarball_skia.mk |    1 
 external/skia/tdf148624.patch.1       |   60 ++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

New commits:
commit 5704c346eac79f211f0487e369c0020c0595e1d8
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Fri Jun 17 10:38:03 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Jun 19 22:03:00 2022 +0200

    upstream Skia fix for Vulkan crash on texture binding (tdf#148624)
    
    Change-Id: Ic16a516bfde04aba0336baca58f605d6cf9fd413
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136035
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/external/skia/UnpackedTarball_skia.mk 
b/external/skia/UnpackedTarball_skia.mk
index c6e27ecf4183..edd4ad78146f 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -37,6 +37,7 @@ skia_patches := \
     disable-freetype-colrv1.1 \
     windows-libraries-system32.patch.1 \
     fix-graphite-ifdef.patch.1 \
+    tdf148624.patch.1 \
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))
 
diff --git a/external/skia/tdf148624.patch.1 b/external/skia/tdf148624.patch.1
new file mode 100644
index 000000000000..570a03c6aa48
--- /dev/null
+++ b/external/skia/tdf148624.patch.1
@@ -0,0 +1,60 @@
+commit b2cecde549c76cbd1c8b7d0cee2c6799936c1e7a
+Author: Greg Daniel <egdan...@google.com>
+Date:   Thu Jun 16 11:29:08 2022 -0400
+
+    Fix not using texture barrier on StrokeTessOp.
+    
+    Previously we were overwriting the renderpassXferBarriers flag on
+    ProgramInfo to set it to kNone. This flag is meant to say whether or not
+    the entire render pass uses barriers or not. This is needed in Vulkan
+    because all pipelines in a render pass that has an input attachment
+    must bind the input attachment regardless if it is used or not. So the
+    pipeline must be created with a layout for an input attachment
+    descriptor set.
+    
+    This change just removes to performance optimization to only use the
+    barrier on the stencil and not fill draw. This use case shouldn't
+    come up too often and also shouldn't be a big perf hit regardless.
+    The way GrAppliedClip is created/used it is hard for us to create
+    multiple different Pipeline objects: one for stencil and one for the
+    fill.
+    
+    Bug: skia:13402
+    Change-Id: I15ce74b4d41b90d3dd4169a1f4fb77ed87c8b26d
+    Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549898
+    Reviewed-by: Michael Ludwig <michaellud...@google.com>
+    Commit-Queue: Greg Daniel <egdan...@google.com>
+
+diff --git a/src/gpu/ops/StrokeTessellateOp.cpp 
b/src/gpu/ops/StrokeTessellateOp.cpp
+index e9f1c77136..5564d99185 100644
+--- a/src/gpu/ops/StrokeTessellateOp.cpp
++++ b/src/gpu/ops/StrokeTessellateOp.cpp
+@@ -210,7 +210,12 @@ void 
StrokeTessellateOp::prePrepareTessellator(GrTessellationShader::ProgramArgs
+         fStencilProgram = GrTessellationShader::MakeProgram(args, 
fTessellator->shader(), pipeline,
+                                                             &kMarkStencil);
+         fillStencil = &kTestAndResetStencil;
+-        args.fXferBarrierFlags = GrXferBarrierFlags::kNone;
++        // TODO: Currently if we have a texture barrier for a dst read it 
will get put in before
++        // both the stencil draw and the fill draw. In reality we only really 
need the barrier
++        // once to guard the reads of the color buffer in the fill from the 
previous writes. Maybe
++        // we can investigate how to remove one of these barriers but it is 
probably not something
++        // that is required a lot and thus the extra barrier shouldn't be too 
much of a perf hit to
++        // general Skia use.
+     }
+ 
+     fFillProgram = GrTessellationShader::MakeProgram(args, 
fTessellator->shader(), pipeline,
+diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp 
b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+index 51c8a47f4c..90476250b2 100644
+--- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp
++++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+@@ -280,6 +280,10 @@ GrVkPipelineState* 
GrVkPipelineStateBuilder::finalize(const GrProgramDesc& desc,
+         }
+     }
+ 
++    // The vulkan spec says that if a subpass has an input attachment, then 
the input attachment
++    // descriptor set must be bound to all pipelines in that subpass. This 
includes pipelines that
++    // don't actually use the input attachment. Thus we look at the 
renderPassBarriers and not just
++    // the DstProxyView barrier flags to determine if we use the input 
attachment.
+     bool usesInput = SkToBool(fProgramInfo.renderPassBarriers() & 
GrXferBarrierFlags::kTexture);
+     uint32_t layoutCount =
+         usesInput ? GrVkUniformHandler::kDescSetCount : 
(GrVkUniformHandler::kDescSetCount - 1);

Reply via email to