aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/vk/GrVkCopyManager.cpp7
-rw-r--r--src/gpu/vk/GrVkPipeline.cpp6
2 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp
index 6f5acb46c4..d0edb2365d 100644
--- a/src/gpu/vk/GrVkCopyManager.cpp
+++ b/src/gpu/vk/GrVkCopyManager.cpp
@@ -144,6 +144,13 @@ bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu,
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
+ // None of our copy methods can handle a swizzle. TODO: Make copySurfaceAsDraw handle the
+ // swizzle.
+ if (gpu->caps()->shaderCaps()->configOutputSwizzle(src->config()) !=
+ gpu->caps()->shaderCaps()->configOutputSwizzle(dst->config())) {
+ return false;
+ }
+
if (!gpu->vkCaps().supportsCopiesAsDraws()) {
return false;
}
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 809333f7ef..47acb94266 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -526,7 +526,11 @@ static void set_dynamic_blend_constant_state(GrVkGpu* gpu,
GrBlendCoeff dstCoeff = blendInfo.fDstBlend;
float floatColors[4];
if (blend_coeff_refs_constant(srcCoeff) || blend_coeff_refs_constant(dstCoeff)) {
- GrColorToRGBAFloat(blendInfo.fBlendConstant, floatColors);
+ // Swizzle the blend to match what the shader will output.
+ const GrSwizzle& swizzle = gpu->caps()->shaderCaps()->configOutputSwizzle(
+ pipeline.getRenderTarget()->config());
+ GrColor blendConst = swizzle.applyTo(blendInfo.fBlendConstant);
+ GrColorToRGBAFloat(blendConst, floatColors);
} else {
memset(floatColors, 0, 4 * sizeof(float));
}