aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-05-11 09:20:59 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-11 13:43:12 +0000
commit6c9f1013772436b61d092b312dad5fecc144c09f (patch)
treed36f4fc87591e4b9c43ec75eb34e8347fb5801f4 /src
parent87f807136c216f5db12568afc2e5c8e893b99ef1 (diff)
Add some swizzle checks to vulkan backend
Bug: skia: Change-Id: I9f5a5c1fda9cf26fc6479e1cd6d0e981e6991c8e Reviewed-on: https://skia-review.googlesource.com/16426 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src')
-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));
}