diff options
author | Timothy Liang <timliang@google.com> | 2018-07-19 15:27:13 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-20 19:23:46 +0000 |
commit | 43d225f2f32cafe73d82c4ff459b4ca0d95d79cb (patch) | |
tree | 1632c2919e64d5ea929edec2cca76ed8e595651a /src/sksl | |
parent | 1c1391c2f6991d3250f7c45a360fa13bf60e07d7 (diff) |
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 <ethannicholas@google.com>
Commit-Queue: Timothy Liang <timliang@google.com>
Diffstat (limited to 'src/sksl')
-rw-r--r-- | src/sksl/SkSLMetalCodeGenerator.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
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<float> "); //FIXME - support other texture types; + this->write("texture2d<float> "); // 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()); } |