Don't change the front face direction in Vulkan
This fixed a similar regression in GL, so it will probably fix the Vk one as well. Bug: skia: Change-Id: I37a65cb2d1d2ba5e43015c7a6133a7aa9a4f8512 Reviewed-on: https://skia-review.googlesource.com/144832 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
120517154c
commit
b91c46616a
@ -436,9 +436,7 @@ 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;
|
||||
// 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->frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
rasterInfo->depthBiasEnable = VK_FALSE;
|
||||
rasterInfo->depthBiasConstantFactor = 0.0f;
|
||||
rasterInfo->depthBiasClamp = 0.0f;
|
||||
|
@ -204,23 +204,19 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
uint32_t get_pipeline_info_key(const GrPipeline& pipeline) {
|
||||
uint32_t get_blend_info_key(const GrPipeline& pipeline) {
|
||||
GrXferProcessor::BlendInfo blendInfo;
|
||||
pipeline.getXferProcessor().getBlendInfo(&blendInfo);
|
||||
|
||||
static const uint32_t kBlendWriteShift = 1;
|
||||
static const uint32_t kBlendCoeffShift = 5;
|
||||
GR_STATIC_ASSERT(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
|
||||
GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
|
||||
|
||||
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);
|
||||
uint32_t key = blendInfo.fWriteColor;
|
||||
key |= (blendInfo.fSrcBlend << kBlendWriteShift);
|
||||
key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
|
||||
key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
|
||||
|
||||
return key;
|
||||
}
|
||||
@ -242,7 +238,7 @@ bool GrVkPipelineStateBuilder::Desc::Build(Desc* desc,
|
||||
|
||||
stencil.genKey(&b);
|
||||
|
||||
b.add32(get_pipeline_info_key(pipeline));
|
||||
b.add32(get_blend_info_key(pipeline));
|
||||
|
||||
b.add32((uint32_t)primitiveType);
|
||||
|
||||
|
@ -1765,6 +1765,15 @@ SpvId SPIRVCodeGenerator::writeVariableReference(const VariableReference& ref, O
|
||||
this->writeWord(oneId, out);
|
||||
return flipped;
|
||||
}
|
||||
if (ref.fVariable.fModifiers.fLayout.fBuiltin == SK_CLOCKWISE_BUILTIN &&
|
||||
!fProgram.fSettings.fFlipY) {
|
||||
// FrontFacing in Vulkan is defined in terms of a top-down render target. In skia, we use
|
||||
// the default convention of "counter-clockwise face is front".
|
||||
SpvId inverse = this->nextId();
|
||||
this->writeInstruction(SpvOpLogicalNot, this->getType(*fContext.fBool_Type), inverse,
|
||||
result, out);
|
||||
return inverse;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user