Factor out SPIR-V typecasting helper functions.
The test diffs look scary, but the only actual change is a minor
renumbering of IDs. The actual logic is the same.
Change-Id: I5ecc26c8581a4c01834932ff0291deba7d9e4618
Bug: skia:11171
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353622
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLSPIRVCodeGenerator.h b/src/sksl/SkSLSPIRVCodeGenerator.h
index e7cac71..e1d23bb 100644
--- a/src/sksl/SkSLSPIRVCodeGenerator.h
+++ b/src/sksl/SkSLSPIRVCodeGenerator.h
@@ -227,10 +227,19 @@
SpvId writeFloatConstructor(const Constructor& c, OutputStream& out);
+ SpvId castScalarToFloat(SpvId inputId, const Type& inputType, const Type& outputType,
+ OutputStream& out);
+
SpvId writeIntConstructor(const Constructor& c, OutputStream& out);
+ SpvId castScalarToSignedInt(SpvId inputId, const Type& inputType, const Type& outputType,
+ OutputStream& out);
+
SpvId writeUIntConstructor(const Constructor& c, OutputStream& out);
+ SpvId castScalarToUnsignedInt(SpvId inputId, const Type& inputType, const Type& outputType,
+ OutputStream& out);
+
/**
* Writes a matrix with the diagonal entries all equal to the provided expression, and all other
* entries equal to zero.