Remove SkSL InverseW setting
This was added to workaround a bug in D3D (w/SPIRV-cross). It's now
handled correctly in SPIRV-cross itself, so this is unused.
Change-Id: Ic411ee2219cf370bcebff18ae18689d16da90866
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344966
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp
index e2805a3..2d57341 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.cpp
+++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp
@@ -1869,7 +1869,7 @@
this->writeInstruction(SpvOpLoad, this->getType(ref.variable()->type()), result, var, out);
this->writePrecisionModifier(ref.variable()->type(), result);
if (ref.variable()->modifiers().fLayout.fBuiltin == SK_FRAGCOORD_BUILTIN &&
- (fProgram.fSettings.fFlipY || fProgram.fSettings.fInverseW)) {
+ fProgram.fSettings.fFlipY) {
// The x component never changes, so just grab it
SpvId xId = this->nextId();
this->writeInstruction(SpvOpCompositeExtract, this->getType(*fContext.fFloat_Type), xId,
@@ -1950,19 +1950,10 @@
FloatLiteral zero(fContext, -1, 0.0);
SpvId zeroId = writeFloatLiteral(zero);
- // Calculate the w component which may need to be inverted
+ // Calculate the w component
SpvId rawWId = this->nextId();
this->writeInstruction(SpvOpCompositeExtract, this->getType(*fContext.fFloat_Type), rawWId,
result, 3, out);
- SpvId invWId = 0;
- if (fProgram.fSettings.fInverseW) {
- // We need to invert w
- FloatLiteral one(fContext, -1, 1.0);
- SpvId oneId = writeFloatLiteral(one);
- invWId = this->nextId();
- this->writeInstruction(SpvOpFDiv, this->getType(*fContext.fFloat_Type), invWId, oneId,
- rawWId, out);
- }
// Fill in the new fragcoord with the components from above
SpvId adjusted = this->nextId();
@@ -1976,11 +1967,7 @@
this->writeWord(rawYId, out);
}
this->writeWord(zeroId, out);
- if (fProgram.fSettings.fInverseW) {
- this->writeWord(invWId, out);
- } else {
- this->writeWord(rawWId, out);
- }
+ this->writeWord(rawWId, out);
return adjusted;
}