aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkPipelineStateBuilder.cpp
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-07-27 12:38:35 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-27 19:04:46 +0000
commit49d14e98fe43fdff818e7571c1a61cd5045fedc0 (patch)
tree18d48cd1922c646b6dafa851fbe214c8904aef87 /src/gpu/vk/GrVkPipelineStateBuilder.cpp
parentf4f6bbfadac327619a3832acad9c8afe06629b55 (diff)
sksl: Add a "sk_Clockwise" built-in
This allows us to identify clockwise-winding triangles, in terms of Skia device space, in all backends and with all render target origins. Bug: skia: Change-Id: I220e1c459e0129d1cc4dee6458ef94277fbedd21 Reviewed-on: https://skia-review.googlesource.com/142662 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/vk/GrVkPipelineStateBuilder.cpp')
-rw-r--r--src/gpu/vk/GrVkPipelineStateBuilder.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
index 91685c6016..bcccbc0c17 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
@@ -204,19 +204,23 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s
//////////////////////////////////////////////////////////////////////////////
-uint32_t get_blend_info_key(const GrPipeline& pipeline) {
- GrXferProcessor::BlendInfo blendInfo;
- pipeline.getXferProcessor().getBlendInfo(&blendInfo);
-
- static const uint32_t kBlendWriteShift = 1;
+uint32_t get_pipeline_info_key(const GrPipeline& pipeline) {
static const uint32_t kBlendCoeffShift = 5;
GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
- uint32_t key = blendInfo.fWriteColor;
- key |= (blendInfo.fSrcBlend << kBlendWriteShift);
- key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
- key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
+ GrXferProcessor::BlendInfo blendInfo;
+ pipeline.getXferProcessor().getBlendInfo(&blendInfo);
+
+ GrSurfaceOrigin origin = pipeline.proxy()->origin();
+ SkASSERT(0 == origin || 1 == origin);
+
+ uint32_t key;
+ key = blendInfo.fEquation;
+ key = blendInfo.fDstBlend | (key << kBlendCoeffShift);
+ key = blendInfo.fSrcBlend | (key << kBlendCoeffShift);
+ key = (int)blendInfo.fWriteColor | (key << 1);
+ key = origin | (key << 1);
return key;
}
@@ -238,7 +242,7 @@ bool GrVkPipelineStateBuilder::Desc::Build(Desc* desc,
stencil.genKey(&b);
- b.add32(get_blend_info_key(pipeline));
+ b.add32(get_pipeline_info_key(pipeline));
b.add32((uint32_t)primitiveType);