Compare commits

...

4 commits

Author SHA1 Message Date
Isaac Marovitz
cf49b058f4
Fix spec constants
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-03-28 00:35:56 -04:00
Isaac Marovitz
5d3ed8016c
Fix matrix multiplication ordering
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-03-27 18:43:28 -04:00
Isaac Marovitz
c11a6f28b5
Make spec constants optional
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-03-27 18:43:21 -04:00
Isaac Marovitz
8752326f1c
Fix incorrect “FLT_MIN”
Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-03-27 18:43:12 -04:00
2 changed files with 7 additions and 7 deletions

View file

@ -13,7 +13,6 @@
#if defined(__air__) || !defined(__cplusplus) || defined(__INTELLISENSE__)
#ifndef __air__
#define FLT_MIN asfloat(0xff7fffff)
#define FLT_MAX asfloat(0x7f7fffff)
#endif
@ -42,11 +41,12 @@ struct PushConstants
using namespace metal;
constant uint G_SPEC_CONSTANT [[function_constant(0)]];
constant uint G_SPEC_CONSTANTS [[function_constant(0)]];
constant uint G_SPEC_CONSTANTS_VAL = is_function_constant_defined(G_SPEC_CONSTANTS) ? G_SPEC_CONSTANTS : 0;
uint g_SpecConstants()
{
return G_SPEC_CONSTANT;
return G_SPEC_CONSTANTS_VAL;
}
struct PushConstants
@ -173,7 +173,7 @@ float rcp(T a)
template<typename T>
float4x4 mul(T a, T b)
{
return a * b;
return b * a;
}
#endif

View file

@ -1085,19 +1085,19 @@ void ShaderRecompiler::recompile(const AluInstruction& instr)
case AluScalarOpcode::Logc:
case AluScalarOpcode::Log:
print("clamp(log2({}), FLT_MIN, FLT_MAX)", op(SCALAR_0).expression);
print("clamp(log2({}), -FLT_MAX, FLT_MAX)", op(SCALAR_0).expression);
break;
case AluScalarOpcode::Rcpc:
case AluScalarOpcode::Rcpf:
case AluScalarOpcode::Rcp:
print("clamp(rcp({}), FLT_MIN, FLT_MAX)", op(SCALAR_0).expression);
print("clamp(rcp({}), -FLT_MAX, FLT_MAX)", op(SCALAR_0).expression);
break;
case AluScalarOpcode::Rsqc:
case AluScalarOpcode::Rsqf:
case AluScalarOpcode::Rsq:
print("clamp(rsqrt({}), FLT_MIN, FLT_MAX)", op(SCALAR_0).expression);
print("clamp(rsqrt({}), -FLT_MAX, FLT_MAX)", op(SCALAR_0).expression);
break;
case AluScalarOpcode::Subs: