diff options
Diffstat (limited to 'src/gpu/vk')
-rw-r--r-- | src/gpu/vk/GrVkPipeline.cpp | 4 | ||||
-rw-r--r-- | src/gpu/vk/GrVkPipelineStateBuilder.cpp | 24 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp index 60e7f43259..6cdfc4eff9 100644 --- a/src/gpu/vk/GrVkPipeline.cpp +++ b/src/gpu/vk/GrVkPipeline.cpp @@ -436,7 +436,9 @@ static void setup_raster_state(const GrPipeline& pipeline, rasterInfo->polygonMode = caps->wireframeMode() ? VK_POLYGON_MODE_LINE : VK_POLYGON_MODE_FILL; rasterInfo->cullMode = VK_CULL_MODE_NONE; - rasterInfo->frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; + // A triangle is front-facing if it winds clockwise in device space. + rasterInfo->frontFace = (kTopLeft_GrSurfaceOrigin == pipeline.proxy()->origin()) + ? VK_FRONT_FACE_CLOCKWISE : VK_FRONT_FACE_COUNTER_CLOCKWISE; rasterInfo->depthBiasEnable = VK_FALSE; rasterInfo->depthBiasConstantFactor = 0.0f; rasterInfo->depthBiasClamp = 0.0f; 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); |