Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hollings <bill.hollings@brenwill.com>2021-09-04 01:20:49 +0300
committerBill Hollings <bill.hollings@brenwill.com>2021-09-04 01:20:49 +0300
commit5fb1ca4f0d04f2b169086e1a48a465bc2dc29169 (patch)
treea66f386b115f2bbaa27ae0e1d0c162d7248a339c /spirv_msl.cpp
parent51d8e7be9443aebb773192812ef7e4d67a7adce1 (diff)
Add support for additional ops in OpSpecConstantOp.
MSL: Support op OpQuantizeToF16 in OpSpecConstantOp. All: Support op OpSRem in OpSpecConstantOp.
Diffstat (limited to 'spirv_msl.cpp')
-rw-r--r--spirv_msl.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/spirv_msl.cpp b/spirv_msl.cpp
index 56794c32..d20f1643 100644
--- a/spirv_msl.cpp
+++ b/spirv_msl.cpp
@@ -13327,6 +13327,38 @@ string CompilerMSL::type_to_array_glsl(const SPIRType &type)
}
}
+string CompilerMSL::constant_op_expression(const SPIRConstantOp &cop)
+{
+ auto &type = get<SPIRType>(cop.basetype);
+ string op;
+
+ switch (cop.opcode)
+ {
+ case OpQuantizeToF16:
+ switch (type.vecsize)
+ {
+ case 1:
+ op = "float(half(";
+ break;
+ case 2:
+ op = "float2(half2(";
+ break;
+ case 3:
+ op = "float3(half3(";
+ break;
+ case 4:
+ op = "float4(half4(";
+ break;
+ default:
+ SPIRV_CROSS_THROW("Illegal argument to OpSpecConstantOp QuantizeToF16.");
+ }
+ return join(op, to_expression(cop.arguments[0]), "))");
+
+ default:
+ return CompilerGLSL::constant_op_expression(cop);
+ }
+}
+
bool CompilerMSL::variable_decl_is_remapped_storage(const SPIRVariable &variable, spv::StorageClass storage) const
{
if (variable.storage == storage)