|
@@ -1234,8 +1234,7 @@ void CompilerHLSL::declare_undefined_values()
|
|
|
if (options.force_zero_initialized_variables && type_can_zero_initialize(type))
|
|
if (options.force_zero_initialized_variables && type_can_zero_initialize(type))
|
|
|
initializer = join(" = ", to_zero_initialized_expression(undef.basetype));
|
|
initializer = join(" = ", to_zero_initialized_expression(undef.basetype));
|
|
|
|
|
|
|
|
- statement("static ", variable_decl(type, to_name(undef.self), undef.self),
|
|
|
|
|
- initializer, ";");
|
|
|
|
|
|
|
+ statement("static ", variable_decl(type, to_name(undef.self), undef.self), initializer, ";");
|
|
|
emitted = true;
|
|
emitted = true;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -1529,14 +1528,14 @@ void CompilerHLSL::emit_resources()
|
|
|
if (requires_fp16_packing)
|
|
if (requires_fp16_packing)
|
|
|
{
|
|
{
|
|
|
// HLSL does not pack into a single word sadly :(
|
|
// HLSL does not pack into a single word sadly :(
|
|
|
- statement("uint SPIRV_Cross_packHalf2x16(float2 value)");
|
|
|
|
|
|
|
+ statement("uint spvPackHalf2x16(float2 value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint2 Packed = f32tof16(value);");
|
|
statement("uint2 Packed = f32tof16(value);");
|
|
|
statement("return Packed.x | (Packed.y << 16);");
|
|
statement("return Packed.x | (Packed.y << 16);");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement("");
|
|
statement("");
|
|
|
|
|
|
|
|
- statement("float2 SPIRV_Cross_unpackHalf2x16(uint value)");
|
|
|
|
|
|
|
+ statement("float2 spvUnpackHalf2x16(uint value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("return f16tof32(uint2(value & 0xffff, value >> 16));");
|
|
statement("return f16tof32(uint2(value & 0xffff, value >> 16));");
|
|
|
end_scope();
|
|
end_scope();
|
|
@@ -1545,13 +1544,13 @@ void CompilerHLSL::emit_resources()
|
|
|
|
|
|
|
|
if (requires_uint2_packing)
|
|
if (requires_uint2_packing)
|
|
|
{
|
|
{
|
|
|
- statement("uint64_t SPIRV_Cross_packUint2x32(uint2 value)");
|
|
|
|
|
|
|
+ statement("uint64_t spvPackUint2x32(uint2 value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("return (uint64_t(value.y) << 32) | uint64_t(value.x);");
|
|
statement("return (uint64_t(value.y) << 32) | uint64_t(value.x);");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement("");
|
|
statement("");
|
|
|
|
|
|
|
|
- statement("uint2 SPIRV_Cross_unpackUint2x32(uint64_t value)");
|
|
|
|
|
|
|
+ statement("uint2 spvUnpackUint2x32(uint64_t value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint2 Unpacked;");
|
|
statement("uint2 Unpacked;");
|
|
|
statement("Unpacked.x = uint(value & 0xffffffff);");
|
|
statement("Unpacked.x = uint(value & 0xffffffff);");
|
|
@@ -1564,14 +1563,14 @@ void CompilerHLSL::emit_resources()
|
|
|
if (requires_explicit_fp16_packing)
|
|
if (requires_explicit_fp16_packing)
|
|
|
{
|
|
{
|
|
|
// HLSL does not pack into a single word sadly :(
|
|
// HLSL does not pack into a single word sadly :(
|
|
|
- statement("uint SPIRV_Cross_packFloat2x16(min16float2 value)");
|
|
|
|
|
|
|
+ statement("uint spvPackFloat2x16(min16float2 value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint2 Packed = f32tof16(value);");
|
|
statement("uint2 Packed = f32tof16(value);");
|
|
|
statement("return Packed.x | (Packed.y << 16);");
|
|
statement("return Packed.x | (Packed.y << 16);");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement("");
|
|
statement("");
|
|
|
|
|
|
|
|
- statement("min16float2 SPIRV_Cross_unpackFloat2x16(uint value)");
|
|
|
|
|
|
|
+ statement("min16float2 spvUnpackFloat2x16(uint value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("return min16float2(f16tof32(uint2(value & 0xffff, value >> 16)));");
|
|
statement("return min16float2(f16tof32(uint2(value & 0xffff, value >> 16)));");
|
|
|
end_scope();
|
|
end_scope();
|
|
@@ -1581,14 +1580,14 @@ void CompilerHLSL::emit_resources()
|
|
|
// HLSL does not seem to have builtins for these operation, so roll them by hand ...
|
|
// HLSL does not seem to have builtins for these operation, so roll them by hand ...
|
|
|
if (requires_unorm8_packing)
|
|
if (requires_unorm8_packing)
|
|
|
{
|
|
{
|
|
|
- statement("uint SPIRV_Cross_packUnorm4x8(float4 value)");
|
|
|
|
|
|
|
+ statement("uint spvPackUnorm4x8(float4 value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint4 Packed = uint4(round(saturate(value) * 255.0));");
|
|
statement("uint4 Packed = uint4(round(saturate(value) * 255.0));");
|
|
|
statement("return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24);");
|
|
statement("return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24);");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement("");
|
|
statement("");
|
|
|
|
|
|
|
|
- statement("float4 SPIRV_Cross_unpackUnorm4x8(uint value)");
|
|
|
|
|
|
|
+ statement("float4 spvUnpackUnorm4x8(uint value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24);");
|
|
statement("uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24);");
|
|
|
statement("return float4(Packed) / 255.0;");
|
|
statement("return float4(Packed) / 255.0;");
|
|
@@ -1598,14 +1597,14 @@ void CompilerHLSL::emit_resources()
|
|
|
|
|
|
|
|
if (requires_snorm8_packing)
|
|
if (requires_snorm8_packing)
|
|
|
{
|
|
{
|
|
|
- statement("uint SPIRV_Cross_packSnorm4x8(float4 value)");
|
|
|
|
|
|
|
+ statement("uint spvPackSnorm4x8(float4 value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff;");
|
|
statement("int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff;");
|
|
|
statement("return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24));");
|
|
statement("return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24));");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement("");
|
|
statement("");
|
|
|
|
|
|
|
|
- statement("float4 SPIRV_Cross_unpackSnorm4x8(uint value)");
|
|
|
|
|
|
|
+ statement("float4 spvUnpackSnorm4x8(uint value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("int SignedValue = int(value);");
|
|
statement("int SignedValue = int(value);");
|
|
|
statement("int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24;");
|
|
statement("int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24;");
|
|
@@ -1616,14 +1615,14 @@ void CompilerHLSL::emit_resources()
|
|
|
|
|
|
|
|
if (requires_unorm16_packing)
|
|
if (requires_unorm16_packing)
|
|
|
{
|
|
{
|
|
|
- statement("uint SPIRV_Cross_packUnorm2x16(float2 value)");
|
|
|
|
|
|
|
+ statement("uint spvPackUnorm2x16(float2 value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint2 Packed = uint2(round(saturate(value) * 65535.0));");
|
|
statement("uint2 Packed = uint2(round(saturate(value) * 65535.0));");
|
|
|
statement("return Packed.x | (Packed.y << 16);");
|
|
statement("return Packed.x | (Packed.y << 16);");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement("");
|
|
statement("");
|
|
|
|
|
|
|
|
- statement("float2 SPIRV_Cross_unpackUnorm2x16(uint value)");
|
|
|
|
|
|
|
+ statement("float2 spvUnpackUnorm2x16(uint value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint2 Packed = uint2(value & 0xffff, value >> 16);");
|
|
statement("uint2 Packed = uint2(value & 0xffff, value >> 16);");
|
|
|
statement("return float2(Packed) / 65535.0;");
|
|
statement("return float2(Packed) / 65535.0;");
|
|
@@ -1633,14 +1632,14 @@ void CompilerHLSL::emit_resources()
|
|
|
|
|
|
|
|
if (requires_snorm16_packing)
|
|
if (requires_snorm16_packing)
|
|
|
{
|
|
{
|
|
|
- statement("uint SPIRV_Cross_packSnorm2x16(float2 value)");
|
|
|
|
|
|
|
+ statement("uint spvPackSnorm2x16(float2 value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff;");
|
|
statement("int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff;");
|
|
|
statement("return uint(Packed.x | (Packed.y << 16));");
|
|
statement("return uint(Packed.x | (Packed.y << 16));");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement("");
|
|
statement("");
|
|
|
|
|
|
|
|
- statement("float2 SPIRV_Cross_unpackSnorm2x16(uint value)");
|
|
|
|
|
|
|
+ statement("float2 spvUnpackSnorm2x16(uint value)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("int SignedValue = int(value);");
|
|
statement("int SignedValue = int(value);");
|
|
|
statement("int2 Packed = int2(SignedValue << 16, SignedValue) >> 16;");
|
|
statement("int2 Packed = int2(SignedValue << 16, SignedValue) >> 16;");
|
|
@@ -1654,7 +1653,7 @@ void CompilerHLSL::emit_resources()
|
|
|
static const char *types[] = { "uint", "uint2", "uint3", "uint4" };
|
|
static const char *types[] = { "uint", "uint2", "uint3", "uint4" };
|
|
|
for (auto &type : types)
|
|
for (auto &type : types)
|
|
|
{
|
|
{
|
|
|
- statement(type, " SPIRV_Cross_bitfieldInsert(", type, " Base, ", type, " Insert, uint Offset, uint Count)");
|
|
|
|
|
|
|
+ statement(type, " spvBitfieldInsert(", type, " Base, ", type, " Insert, uint Offset, uint Count)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));");
|
|
statement("uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));");
|
|
|
statement("return (Base & ~Mask) | ((Insert << Offset) & Mask);");
|
|
statement("return (Base & ~Mask) | ((Insert << Offset) & Mask);");
|
|
@@ -1668,7 +1667,7 @@ void CompilerHLSL::emit_resources()
|
|
|
static const char *unsigned_types[] = { "uint", "uint2", "uint3", "uint4" };
|
|
static const char *unsigned_types[] = { "uint", "uint2", "uint3", "uint4" };
|
|
|
for (auto &type : unsigned_types)
|
|
for (auto &type : unsigned_types)
|
|
|
{
|
|
{
|
|
|
- statement(type, " SPIRV_Cross_bitfieldUExtract(", type, " Base, uint Offset, uint Count)");
|
|
|
|
|
|
|
+ statement(type, " spvBitfieldUExtract(", type, " Base, uint Offset, uint Count)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);");
|
|
statement("uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);");
|
|
|
statement("return (Base >> Offset) & Mask;");
|
|
statement("return (Base >> Offset) & Mask;");
|
|
@@ -1680,7 +1679,7 @@ void CompilerHLSL::emit_resources()
|
|
|
static const char *signed_types[] = { "int", "int2", "int3", "int4" };
|
|
static const char *signed_types[] = { "int", "int2", "int3", "int4" };
|
|
|
for (auto &type : signed_types)
|
|
for (auto &type : signed_types)
|
|
|
{
|
|
{
|
|
|
- statement(type, " SPIRV_Cross_bitfieldSExtract(", type, " Base, int Offset, int Count)");
|
|
|
|
|
|
|
+ statement(type, " spvBitfieldSExtract(", type, " Base, int Offset, int Count)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("int Mask = Count == 32 ? -1 : ((1 << Count) - 1);");
|
|
statement("int Mask = Count == 32 ? -1 : ((1 << Count) - 1);");
|
|
|
statement(type, " Masked = (Base >> Offset) & Mask;");
|
|
statement(type, " Masked = (Base >> Offset) & Mask;");
|
|
@@ -1695,7 +1694,7 @@ void CompilerHLSL::emit_resources()
|
|
|
{
|
|
{
|
|
|
statement("// Returns the inverse of a matrix, by using the algorithm of calculating the classical");
|
|
statement("// Returns the inverse of a matrix, by using the algorithm of calculating the classical");
|
|
|
statement("// adjoint and dividing by the determinant. The contents of the matrix are changed.");
|
|
statement("// adjoint and dividing by the determinant. The contents of the matrix are changed.");
|
|
|
- statement("float2x2 SPIRV_Cross_Inverse(float2x2 m)");
|
|
|
|
|
|
|
+ statement("float2x2 spvInverse(float2x2 m)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("float2x2 adj; // The adjoint matrix (inverse after dividing by determinant)");
|
|
statement("float2x2 adj; // The adjoint matrix (inverse after dividing by determinant)");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
@@ -1719,29 +1718,29 @@ void CompilerHLSL::emit_resources()
|
|
|
if (requires_inverse_3x3)
|
|
if (requires_inverse_3x3)
|
|
|
{
|
|
{
|
|
|
statement("// Returns the determinant of a 2x2 matrix.");
|
|
statement("// Returns the determinant of a 2x2 matrix.");
|
|
|
- statement("float SPIRV_Cross_Det2x2(float a1, float a2, float b1, float b2)");
|
|
|
|
|
|
|
+ statement("float spvDet2x2(float a1, float a2, float b1, float b2)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("return a1 * b2 - b1 * a2;");
|
|
statement("return a1 * b2 - b1 * a2;");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement("// Returns the inverse of a matrix, by using the algorithm of calculating the classical");
|
|
statement("// Returns the inverse of a matrix, by using the algorithm of calculating the classical");
|
|
|
statement("// adjoint and dividing by the determinant. The contents of the matrix are changed.");
|
|
statement("// adjoint and dividing by the determinant. The contents of the matrix are changed.");
|
|
|
- statement("float3x3 SPIRV_Cross_Inverse(float3x3 m)");
|
|
|
|
|
|
|
+ statement("float3x3 spvInverse(float3x3 m)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)");
|
|
statement("float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement("// Create the transpose of the cofactors, as the classical adjoint of the matrix.");
|
|
statement("// Create the transpose of the cofactors, as the classical adjoint of the matrix.");
|
|
|
- statement("adj[0][0] = SPIRV_Cross_Det2x2(m[1][1], m[1][2], m[2][1], m[2][2]);");
|
|
|
|
|
- statement("adj[0][1] = -SPIRV_Cross_Det2x2(m[0][1], m[0][2], m[2][1], m[2][2]);");
|
|
|
|
|
- statement("adj[0][2] = SPIRV_Cross_Det2x2(m[0][1], m[0][2], m[1][1], m[1][2]);");
|
|
|
|
|
|
|
+ statement("adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]);");
|
|
|
|
|
+ statement("adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]);");
|
|
|
|
|
+ statement("adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]);");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
- statement("adj[1][0] = -SPIRV_Cross_Det2x2(m[1][0], m[1][2], m[2][0], m[2][2]);");
|
|
|
|
|
- statement("adj[1][1] = SPIRV_Cross_Det2x2(m[0][0], m[0][2], m[2][0], m[2][2]);");
|
|
|
|
|
- statement("adj[1][2] = -SPIRV_Cross_Det2x2(m[0][0], m[0][2], m[1][0], m[1][2]);");
|
|
|
|
|
|
|
+ statement("adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]);");
|
|
|
|
|
+ statement("adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]);");
|
|
|
|
|
+ statement("adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]);");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
- statement("adj[2][0] = SPIRV_Cross_Det2x2(m[1][0], m[1][1], m[2][0], m[2][1]);");
|
|
|
|
|
- statement("adj[2][1] = -SPIRV_Cross_Det2x2(m[0][0], m[0][1], m[2][0], m[2][1]);");
|
|
|
|
|
- statement("adj[2][2] = SPIRV_Cross_Det2x2(m[0][0], m[0][1], m[1][0], m[1][1]);");
|
|
|
|
|
|
|
+ statement("adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]);");
|
|
|
|
|
+ statement("adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]);");
|
|
|
|
|
+ statement("adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]);");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement("// Calculate the determinant as a combination of the cofactors of the first row.");
|
|
statement("// Calculate the determinant as a combination of the cofactors of the first row.");
|
|
|
statement("float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]);");
|
|
statement("float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]);");
|
|
@@ -1758,7 +1757,7 @@ void CompilerHLSL::emit_resources()
|
|
|
if (!requires_inverse_3x3)
|
|
if (!requires_inverse_3x3)
|
|
|
{
|
|
{
|
|
|
statement("// Returns the determinant of a 2x2 matrix.");
|
|
statement("// Returns the determinant of a 2x2 matrix.");
|
|
|
- statement("float SPIRV_Cross_Det2x2(float a1, float a2, float b1, float b2)");
|
|
|
|
|
|
|
+ statement("float spvDet2x2(float a1, float a2, float b1, float b2)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("return a1 * b2 - b1 * a2;");
|
|
statement("return a1 * b2 - b1 * a2;");
|
|
|
end_scope();
|
|
end_scope();
|
|
@@ -1766,71 +1765,71 @@ void CompilerHLSL::emit_resources()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
statement("// Returns the determinant of a 3x3 matrix.");
|
|
statement("// Returns the determinant of a 3x3 matrix.");
|
|
|
- statement("float SPIRV_Cross_Det3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, "
|
|
|
|
|
|
|
+ statement("float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, "
|
|
|
"float c2, float c3)");
|
|
"float c2, float c3)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
- statement("return a1 * SPIRV_Cross_Det2x2(b2, b3, c2, c3) - b1 * SPIRV_Cross_Det2x2(a2, a3, c2, c3) + c1 * "
|
|
|
|
|
- "SPIRV_Cross_Det2x2(a2, a3, "
|
|
|
|
|
|
|
+ statement("return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * "
|
|
|
|
|
+ "spvDet2x2(a2, a3, "
|
|
|
"b2, b3);");
|
|
"b2, b3);");
|
|
|
end_scope();
|
|
end_scope();
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement("// Returns the inverse of a matrix, by using the algorithm of calculating the classical");
|
|
statement("// Returns the inverse of a matrix, by using the algorithm of calculating the classical");
|
|
|
statement("// adjoint and dividing by the determinant. The contents of the matrix are changed.");
|
|
statement("// adjoint and dividing by the determinant. The contents of the matrix are changed.");
|
|
|
- statement("float4x4 SPIRV_Cross_Inverse(float4x4 m)");
|
|
|
|
|
|
|
+ statement("float4x4 spvInverse(float4x4 m)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)");
|
|
statement("float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement("// Create the transpose of the cofactors, as the classical adjoint of the matrix.");
|
|
statement("// Create the transpose of the cofactors, as the classical adjoint of the matrix.");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[0][0] = SPIRV_Cross_Det3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], "
|
|
|
|
|
|
|
+ "adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[0][1] = -SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], "
|
|
|
|
|
|
|
+ "adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[0][2] = SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], "
|
|
|
|
|
|
|
+ "adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[0][3] = -SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], "
|
|
|
|
|
|
|
+ "adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], "
|
|
|
"m[2][3]);");
|
|
"m[2][3]);");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[1][0] = -SPIRV_Cross_Det3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], "
|
|
|
|
|
|
|
+ "adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[1][1] = SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], "
|
|
|
|
|
|
|
+ "adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[1][2] = -SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], "
|
|
|
|
|
|
|
+ "adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[1][3] = SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], "
|
|
|
|
|
|
|
+ "adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], "
|
|
|
"m[2][3]);");
|
|
"m[2][3]);");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[2][0] = SPIRV_Cross_Det3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], "
|
|
|
|
|
|
|
+ "adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[2][1] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], "
|
|
|
|
|
|
|
+ "adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[2][2] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], "
|
|
|
|
|
|
|
+ "adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], "
|
|
|
"m[3][3]);");
|
|
"m[3][3]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[2][3] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], "
|
|
|
|
|
|
|
+ "adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], "
|
|
|
"m[2][3]);");
|
|
"m[2][3]);");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[3][0] = -SPIRV_Cross_Det3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], "
|
|
|
|
|
|
|
+ "adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], "
|
|
|
"m[3][2]);");
|
|
"m[3][2]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[3][1] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], "
|
|
|
|
|
|
|
+ "adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], "
|
|
|
"m[3][2]);");
|
|
"m[3][2]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[3][2] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], "
|
|
|
|
|
|
|
+ "adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], "
|
|
|
"m[3][2]);");
|
|
"m[3][2]);");
|
|
|
statement(
|
|
statement(
|
|
|
- "adj[3][3] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], "
|
|
|
|
|
|
|
+ "adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], "
|
|
|
"m[2][2]);");
|
|
"m[2][2]);");
|
|
|
statement_no_indent("");
|
|
statement_no_indent("");
|
|
|
statement("// Calculate the determinant as a combination of the cofactors of the first row.");
|
|
statement("// Calculate the determinant as a combination of the cofactors of the first row.");
|
|
@@ -1847,7 +1846,7 @@ void CompilerHLSL::emit_resources()
|
|
|
if (requires_scalar_reflect)
|
|
if (requires_scalar_reflect)
|
|
|
{
|
|
{
|
|
|
// FP16/FP64? No templates in HLSL.
|
|
// FP16/FP64? No templates in HLSL.
|
|
|
- statement("float SPIRV_Cross_Reflect(float i, float n)");
|
|
|
|
|
|
|
+ statement("float spvReflect(float i, float n)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("return i - 2.0 * dot(n, i) * n;");
|
|
statement("return i - 2.0 * dot(n, i) * n;");
|
|
|
end_scope();
|
|
end_scope();
|
|
@@ -1857,7 +1856,7 @@ void CompilerHLSL::emit_resources()
|
|
|
if (requires_scalar_refract)
|
|
if (requires_scalar_refract)
|
|
|
{
|
|
{
|
|
|
// FP16/FP64? No templates in HLSL.
|
|
// FP16/FP64? No templates in HLSL.
|
|
|
- statement("float SPIRV_Cross_Refract(float i, float n, float eta)");
|
|
|
|
|
|
|
+ statement("float spvRefract(float i, float n, float eta)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("float NoI = n * i;");
|
|
statement("float NoI = n * i;");
|
|
|
statement("float NoI2 = NoI * NoI;");
|
|
statement("float NoI2 = NoI * NoI;");
|
|
@@ -1877,7 +1876,7 @@ void CompilerHLSL::emit_resources()
|
|
|
if (requires_scalar_faceforward)
|
|
if (requires_scalar_faceforward)
|
|
|
{
|
|
{
|
|
|
// FP16/FP64? No templates in HLSL.
|
|
// FP16/FP64? No templates in HLSL.
|
|
|
- statement("float SPIRV_Cross_FaceForward(float n, float i, float nref)");
|
|
|
|
|
|
|
+ statement("float spvFaceForward(float n, float i, float nref)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
|
statement("return i * nref < 0.0 ? n : -n;");
|
|
statement("return i * nref < 0.0 ? n : -n;");
|
|
|
end_scope();
|
|
end_scope();
|
|
@@ -1916,7 +1915,7 @@ void CompilerHLSL::emit_texture_size_variants(uint64_t variant_mask, const char
|
|
|
if ((variant_mask & mask) == 0)
|
|
if ((variant_mask & mask) == 0)
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
- statement(ret_types[index], " SPIRV_Cross_", (uav ? "image" : "texture"), "Size(", (uav ? "RW" : ""),
|
|
|
|
|
|
|
+ statement(ret_types[index], " spv", (uav ? "Image" : "Texture"), "Size(", (uav ? "RW" : ""),
|
|
|
dims[index], "<", type_qualifier, types[type_index], vecsize_qualifier, "> Tex, ",
|
|
dims[index], "<", type_qualifier, types[type_index], vecsize_qualifier, "> Tex, ",
|
|
|
(uav ? "" : "uint Level, "), "out uint Param)");
|
|
(uav ? "" : "uint Level, "), "out uint Param)");
|
|
|
begin_scope();
|
|
begin_scope();
|
|
@@ -2282,7 +2281,7 @@ void CompilerHLSL::emit_function_prototype(SPIRFunction &func, const Bitset &ret
|
|
|
out_argument += "out ";
|
|
out_argument += "out ";
|
|
|
out_argument += type_to_glsl(type);
|
|
out_argument += type_to_glsl(type);
|
|
|
out_argument += " ";
|
|
out_argument += " ";
|
|
|
- out_argument += "SPIRV_Cross_return_value";
|
|
|
|
|
|
|
+ out_argument += "spvReturnValue";
|
|
|
out_argument += type_to_array_glsl(type);
|
|
out_argument += type_to_array_glsl(type);
|
|
|
arglist.push_back(move(out_argument));
|
|
arglist.push_back(move(out_argument));
|
|
|
}
|
|
}
|
|
@@ -2996,7 +2995,10 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse)
|
|
|
if (dref)
|
|
if (dref)
|
|
|
{
|
|
{
|
|
|
if (imgtype.image.dim != spv::Dim1D && imgtype.image.dim != spv::Dim2D)
|
|
if (imgtype.image.dim != spv::Dim1D && imgtype.image.dim != spv::Dim2D)
|
|
|
- SPIRV_CROSS_THROW("Depth comparison is only supported for 1D and 2D textures in HLSL shader model 2/3.");
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ SPIRV_CROSS_THROW(
|
|
|
|
|
+ "Depth comparison is only supported for 1D and 2D textures in HLSL shader model 2/3.");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (grad_x || grad_y)
|
|
if (grad_x || grad_y)
|
|
|
SPIRV_CROSS_THROW("Depth comparison is not supported for grad sampling in HLSL shader model 2/3.");
|
|
SPIRV_CROSS_THROW("Depth comparison is not supported for grad sampling in HLSL shader model 2/3.");
|
|
@@ -3023,8 +3025,7 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse)
|
|
|
}
|
|
}
|
|
|
else if (proj)
|
|
else if (proj)
|
|
|
{
|
|
{
|
|
|
- coord_expr = "float4(" + coord_expr + ", " +
|
|
|
|
|
- to_extract_component_expression(coord, coord_components) + ")";
|
|
|
|
|
|
|
+ coord_expr = "float4(" + coord_expr + ", " + to_extract_component_expression(coord, coord_components) + ")";
|
|
|
}
|
|
}
|
|
|
else if (dref)
|
|
else if (dref)
|
|
|
{
|
|
{
|
|
@@ -3409,7 +3410,7 @@ string CompilerHLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &i
|
|
|
requires_explicit_fp16_packing = true;
|
|
requires_explicit_fp16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- return "SPIRV_Cross_unpackFloat2x16";
|
|
|
|
|
|
|
+ return "spvUnpackFloat2x16";
|
|
|
}
|
|
}
|
|
|
else if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::Half && in_type.vecsize == 2)
|
|
else if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::Half && in_type.vecsize == 2)
|
|
|
{
|
|
{
|
|
@@ -3418,7 +3419,7 @@ string CompilerHLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &i
|
|
|
requires_explicit_fp16_packing = true;
|
|
requires_explicit_fp16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- return "SPIRV_Cross_packFloat2x16";
|
|
|
|
|
|
|
+ return "spvPackFloat2x16";
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
return "";
|
|
return "";
|
|
@@ -3483,7 +3484,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_fp16_packing = true;
|
|
requires_fp16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packHalf2x16");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvPackHalf2x16");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450UnpackHalf2x16:
|
|
case GLSLstd450UnpackHalf2x16:
|
|
@@ -3492,7 +3493,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_fp16_packing = true;
|
|
requires_fp16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackHalf2x16");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvUnpackHalf2x16");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450PackSnorm4x8:
|
|
case GLSLstd450PackSnorm4x8:
|
|
@@ -3501,7 +3502,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_snorm8_packing = true;
|
|
requires_snorm8_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packSnorm4x8");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvPackSnorm4x8");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450UnpackSnorm4x8:
|
|
case GLSLstd450UnpackSnorm4x8:
|
|
@@ -3510,7 +3511,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_snorm8_packing = true;
|
|
requires_snorm8_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackSnorm4x8");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvUnpackSnorm4x8");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450PackUnorm4x8:
|
|
case GLSLstd450PackUnorm4x8:
|
|
@@ -3519,7 +3520,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_unorm8_packing = true;
|
|
requires_unorm8_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packUnorm4x8");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvPackUnorm4x8");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450UnpackUnorm4x8:
|
|
case GLSLstd450UnpackUnorm4x8:
|
|
@@ -3528,7 +3529,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_unorm8_packing = true;
|
|
requires_unorm8_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackUnorm4x8");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvUnpackUnorm4x8");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450PackSnorm2x16:
|
|
case GLSLstd450PackSnorm2x16:
|
|
@@ -3537,7 +3538,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_snorm16_packing = true;
|
|
requires_snorm16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packSnorm2x16");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvPackSnorm2x16");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450UnpackSnorm2x16:
|
|
case GLSLstd450UnpackSnorm2x16:
|
|
@@ -3546,7 +3547,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_snorm16_packing = true;
|
|
requires_snorm16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackSnorm2x16");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvUnpackSnorm2x16");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450PackUnorm2x16:
|
|
case GLSLstd450PackUnorm2x16:
|
|
@@ -3555,7 +3556,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_unorm16_packing = true;
|
|
requires_unorm16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packUnorm2x16");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvPackUnorm2x16");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450UnpackUnorm2x16:
|
|
case GLSLstd450UnpackUnorm2x16:
|
|
@@ -3564,7 +3565,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_unorm16_packing = true;
|
|
requires_unorm16_packing = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackUnorm2x16");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvUnpackUnorm2x16");
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case GLSLstd450PackDouble2x32:
|
|
case GLSLstd450PackDouble2x32:
|
|
@@ -3613,7 +3614,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_Inverse");
|
|
|
|
|
|
|
+ emit_unary_func_op(result_type, id, args[0], "spvInverse");
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3636,7 +3637,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_scalar_reflect = true;
|
|
requires_scalar_reflect = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_binary_func_op(result_type, id, args[0], args[1], "SPIRV_Cross_Reflect");
|
|
|
|
|
|
|
+ emit_binary_func_op(result_type, id, args[0], args[1], "spvReflect");
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count);
|
|
CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count);
|
|
@@ -3650,7 +3651,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_scalar_refract = true;
|
|
requires_scalar_refract = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "SPIRV_Cross_Refract");
|
|
|
|
|
|
|
+ emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "spvRefract");
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count);
|
|
CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count);
|
|
@@ -3664,7 +3665,7 @@ void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop,
|
|
|
requires_scalar_faceforward = true;
|
|
requires_scalar_faceforward = true;
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
- emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "SPIRV_Cross_FaceForward");
|
|
|
|
|
|
|
+ emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "spvFaceForward");
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count);
|
|
CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count);
|
|
@@ -4701,9 +4702,9 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (bitcast_type == CompilerHLSL::TypePackUint2x32)
|
|
if (bitcast_type == CompilerHLSL::TypePackUint2x32)
|
|
|
- emit_unary_func_op(ops[0], ops[1], ops[2], "SPIRV_Cross_packUint2x32");
|
|
|
|
|
|
|
+ emit_unary_func_op(ops[0], ops[1], ops[2], "spvPackUint2x32");
|
|
|
else
|
|
else
|
|
|
- emit_unary_func_op(ops[0], ops[1], ops[2], "SPIRV_Cross_unpackUint2x32");
|
|
|
|
|
|
|
+ emit_unary_func_op(ops[0], ops[1], ops[2], "spvUnpackUint2x32");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
break;
|
|
@@ -5088,7 +5089,7 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|
|
auto dummy_samples_levels = join(get_fallback_name(id), "_dummy_parameter");
|
|
auto dummy_samples_levels = join(get_fallback_name(id), "_dummy_parameter");
|
|
|
statement("uint ", dummy_samples_levels, ";");
|
|
statement("uint ", dummy_samples_levels, ";");
|
|
|
|
|
|
|
|
- auto expr = join("SPIRV_Cross_textureSize(", to_expression(ops[2]), ", ",
|
|
|
|
|
|
|
+ auto expr = join("spvTextureSize(", to_expression(ops[2]), ", ",
|
|
|
bitcast_expression(SPIRType::UInt, ops[3]), ", ", dummy_samples_levels, ")");
|
|
bitcast_expression(SPIRType::UInt, ops[3]), ", ", dummy_samples_levels, ")");
|
|
|
|
|
|
|
|
auto &restype = get<SPIRType>(ops[0]);
|
|
auto &restype = get<SPIRType>(ops[0]);
|
|
@@ -5114,9 +5115,9 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|
|
|
|
|
|
|
string expr;
|
|
string expr;
|
|
|
if (uav)
|
|
if (uav)
|
|
|
- expr = join("SPIRV_Cross_imageSize(", to_expression(ops[2]), ", ", dummy_samples_levels, ")");
|
|
|
|
|
|
|
+ expr = join("spvImageSize(", to_expression(ops[2]), ", ", dummy_samples_levels, ")");
|
|
|
else
|
|
else
|
|
|
- expr = join("SPIRV_Cross_textureSize(", to_expression(ops[2]), ", 0u, ", dummy_samples_levels, ")");
|
|
|
|
|
|
|
+ expr = join("spvTextureSize(", to_expression(ops[2]), ", 0u, ", dummy_samples_levels, ")");
|
|
|
|
|
|
|
|
auto &restype = get<SPIRType>(ops[0]);
|
|
auto &restype = get<SPIRType>(ops[0]);
|
|
|
expr = bitcast_expression(restype, SPIRType::UInt, expr);
|
|
expr = bitcast_expression(restype, SPIRType::UInt, expr);
|
|
@@ -5146,9 +5147,9 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|
|
statement(variable_decl(type, to_name(id)), ";");
|
|
statement(variable_decl(type, to_name(id)), ";");
|
|
|
|
|
|
|
|
if (uav)
|
|
if (uav)
|
|
|
- statement("SPIRV_Cross_imageSize(", to_expression(ops[2]), ", ", to_name(id), ");");
|
|
|
|
|
|
|
+ statement("spvImageSize(", to_expression(ops[2]), ", ", to_name(id), ");");
|
|
|
else
|
|
else
|
|
|
- statement("SPIRV_Cross_textureSize(", to_expression(ops[2]), ", 0u, ", to_name(id), ");");
|
|
|
|
|
|
|
+ statement("spvTextureSize(", to_expression(ops[2]), ", 0u, ", to_name(id), ");");
|
|
|
|
|
|
|
|
auto &restype = get<SPIRType>(ops[0]);
|
|
auto &restype = get<SPIRType>(ops[0]);
|
|
|
auto expr = bitcast_expression(restype, SPIRType::UInt, to_name(id));
|
|
auto expr = bitcast_expression(restype, SPIRType::UInt, to_name(id));
|
|
@@ -5389,7 +5390,7 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|
|
force_recompile();
|
|
force_recompile();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- auto expr = join("SPIRV_Cross_bitfieldInsert(", to_expression(ops[2]), ", ", to_expression(ops[3]), ", ",
|
|
|
|
|
|
|
+ auto expr = join("spvBitfieldInsert(", to_expression(ops[2]), ", ", to_expression(ops[3]), ", ",
|
|
|
to_expression(ops[4]), ", ", to_expression(ops[5]), ")");
|
|
to_expression(ops[4]), ", ", to_expression(ops[5]), ")");
|
|
|
|
|
|
|
|
bool forward =
|
|
bool forward =
|
|
@@ -5411,9 +5412,9 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (opcode == OpBitFieldSExtract)
|
|
if (opcode == OpBitFieldSExtract)
|
|
|
- HLSL_TFOP(SPIRV_Cross_bitfieldSExtract);
|
|
|
|
|
|
|
+ HLSL_TFOP(spvBitfieldSExtract);
|
|
|
else
|
|
else
|
|
|
- HLSL_TFOP(SPIRV_Cross_bitfieldUExtract);
|
|
|
|
|
|
|
+ HLSL_TFOP(spvBitfieldUExtract);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|