From 43d225f2f32cafe73d82c4ff459b4ca0d95d79cb Mon Sep 17 00:00:00 2001 From: Timothy Liang Date: Thu, 19 Jul 2018 15:27:13 -0400 Subject: added byte type support to SkSLC MSL generator Also cleaned up converting half to float Bug: skia: Change-Id: I4fbb01b887b40f9e6b8cf5cdd7e03e056b29db07 Reviewed-on: https://skia-review.googlesource.com/142582 Reviewed-by: Ethan Nicholas Commit-Queue: Timothy Liang --- src/sksl/SkSLMetalCodeGenerator.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/sksl/SkSLMetalCodeGenerator.cpp b/src/sksl/SkSLMetalCodeGenerator.cpp index 5a7ccb7c7f..e760f567e6 100644 --- a/src/sksl/SkSLMetalCodeGenerator.cpp +++ b/src/sksl/SkSLMetalCodeGenerator.cpp @@ -88,17 +88,23 @@ void MetalCodeGenerator::writeType(const Type& type) { this->writeType(type.componentType()); this->write(to_string(type.columns())); break; + case Type::kMatrix_Kind: + this->writeType(type.componentType()); + this->write(to_string(type.columns())); + this->write("x"); + this->write(to_string(type.rows())); + break; case Type::kSampler_Kind: - this->write("texture2d "); //FIXME - support other texture types; + this->write("texture2d "); // FIXME - support other texture types; break; default: - // FIXME - converted all half types to floats for MVK integration - if ((type.kind() == Type::kVector_Kind || type.kind() == Type::kMatrix_Kind) && - type.componentType() == *fContext.fHalf_Type) { - this->writeType(fContext.fFloat_Type->toCompound(fContext, type.columns(), - type.rows())); - } else if (type == *fContext.fHalf_Type) { - this->writeType(*fContext.fFloat_Type); + if (type == *fContext.fHalf_Type) { + // FIXME - Currently only supporting floats in MSL to avoid type coercion issues. + this->write(fContext.fFloat_Type->name()); + } else if (type == *fContext.fByte_Type) { + this->write("char"); + } else if (type == *fContext.fUByte_Type) { + this->write("uchar"); } else { this->write(type.name()); } -- cgit v1.2.3