Revert "Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots""""
Updated to use sentinel GL context even when GL backend is not built.
This reverts commit 1171d314efc7e131b039c94126d26575cfb9e70c.
Change-Id: Ia94bbe4865ddd4e898446c13886877c539f0eb0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index a8f44d8..f313940 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -92,6 +92,7 @@
SK_ABORT("Unexpected texture target");
}
}
+#endif
GrGLFormat GrBackendFormat::asGLFormat() const {
if (this->isValid() && GrBackendApi::kOpenGL == fBackend) {
@@ -99,7 +100,6 @@
}
return GrGLFormat::kUnknown;
}
-#endif
GrBackendFormat GrBackendFormat::MakeVk(const GrVkYcbcrConversionInfo& ycbcrInfo) {
SkASSERT(ycbcrInfo.isValid());
diff --git a/src/sksl/SkSLMetalCodeGenerator.cpp b/src/sksl/SkSLMetalCodeGenerator.cpp
index c42061f..b8a6d9c 100644
--- a/src/sksl/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/SkSLMetalCodeGenerator.cpp
@@ -15,10 +15,6 @@
#include "src/sksl/ir/SkSLNop.h"
#include "src/sksl/ir/SkSLVariableReference.h"
-#ifdef SK_MOLTENVK
- static const uint32_t MVKMagicNum = 0x19960412;
-#endif
-
namespace SkSL {
void MetalCodeGenerator::setupIntrinsics() {
@@ -537,7 +533,7 @@
break;
case SK_CLOCKWISE_BUILTIN:
// We'd set the front facing winding in the MTLRenderCommandEncoder to be counter
- // clockwise to match Skia convention. This is also the default in MoltenVK.
+ // clockwise to match Skia convention.
this->write(fProgram.fSettings.fFlipY ? "_frontFacing" : "(!_frontFacing)");
break;
default:
@@ -789,18 +785,10 @@
if ("main" == f.fDeclaration.fName) {
switch (fProgram.fKind) {
case Program::kFragment_Kind:
-#ifdef SK_MOLTENVK
- this->write("fragment Outputs main0");
-#else
this->write("fragment Outputs fragmentMain");
-#endif
break;
case Program::kVertex_Kind:
-#ifdef SK_MOLTENVK
- this->write("vertex Outputs main0");
-#else
this->write("vertex Outputs vertexMain");
-#endif
break;
default:
SkASSERT(false);
@@ -842,21 +830,13 @@
this->write("& " );
this->write(fInterfaceBlockNameMap[&intf]);
this->write(" [[buffer(");
-#ifdef SK_MOLTENVK
- this->write(to_string(intf.fVariable.fModifiers.fLayout.fSet));
-#else
this->write(to_string(intf.fVariable.fModifiers.fLayout.fBinding));
-#endif
this->write(")]]");
}
}
if (fProgram.fKind == Program::kFragment_Kind) {
if (fProgram.fInputs.fRTHeight && fInterfaceBlockNameMap.empty()) {
-#ifdef SK_MOLTENVK
- this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(0)]]");
-#else
this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(1)]]");
-#endif
fRTHeightName = "_anonInterface0.u_skRTHeight";
}
this->write(", bool _frontFacing [[front_facing]]");
@@ -1030,11 +1010,7 @@
void MetalCodeGenerator::writeFields(const std::vector<Type::Field>& fields, int parentOffset,
const InterfaceBlock* parentIntf) {
-#ifdef SK_MOLTENVK
- MemoryLayout memoryLayout(MemoryLayout::k140_Standard);
-#else
MemoryLayout memoryLayout(MemoryLayout::kMetal_Standard);
-#endif
int currentOffset = 0;
for (const auto& field: fields) {
int fieldOffset = field.fModifiers.fLayout.fOffset;
@@ -1059,21 +1035,6 @@
to_string((int) alignment));
}
}
-#ifdef SK_MOLTENVK
- if (fieldType->kind() == Type::kVector_Kind &&
- fieldType->columns() == 3) {
- SkASSERT(memoryLayout.size(*fieldType) == 3);
- // Pack all vec3 types so that their size in bytes will match what was expected in the
- // original SkSL code since MSL has vec3 sizes equal to 4 * component type, while SkSL
- // has vec3 equal to 3 * component type.
-
- // FIXME - Packed vectors can't be accessed by swizzles, but can be indexed into. A
- // combination of this being a problem which only occurs when using MoltenVK and the
- // fact that we haven't swizzled a vec3 yet means that this problem hasn't been
- // addressed.
- this->write(PACKED_PREFIX);
- }
-#endif
currentOffset += memoryLayout.size(*fieldType);
std::vector<int> sizes;
while (fieldType->kind() == Type::kArray_Kind) {
@@ -1681,9 +1642,6 @@
bool MetalCodeGenerator::generateCode() {
OutputStream* rawOut = fOut;
fOut = &fHeader;
-#ifdef SK_MOLTENVK
- fOut->write((const char*) &MVKMagicNum, sizeof(MVKMagicNum));
-#endif
fProgramKind = fProgram.fKind;
this->writeHeader();
this->writeUniformStruct();
@@ -1701,9 +1659,6 @@
write_stringstream(fHeader, *rawOut);
write_stringstream(fExtraFunctions, *rawOut);
write_stringstream(body, *rawOut);
-#ifdef SK_MOLTENVK
- this->write("\0");
-#endif
return true;
}