SPIRV-Cross/reference/shaders-msl/comp/mat3-row-maj-read-write-const.comp
Hans-Kristian Arntzen 31be74a853 Add relax_nan_checks options.
Makes codegen from typical D3D emulation SPIR-V more readable.
Also makes cross compilation with NotEqual more sensible.
It's very rare to actually need the strict NaN-checks in practice.

Also, glslang now emits UnordNotEqual by default it seems, so give up
trying to assume OrdNotEqual. Harmonize for UnordNotEqual as the sane
default.
2022-03-03 14:50:56 +01:00

23 lines
554 B
Plaintext

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct model_t
{
float3x3 mtx_rm;
};
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
kernel void main0(device model_t& model [[buffer(0)]])
{
float3x3 mtx_cm = transpose(model.mtx_rm);
float3x3 mtx1 = mtx_cm * float3x3(float3(4.0, -3.0, 1.0), float3(-7.0, 7.0, -7.0), float3(-5.0, 6.0, -8.0));
if (mtx1[0].x != 0.0)
{
model.mtx_rm = transpose(float3x3(float3(-5.0, -3.0, -5.0), float3(-2.0, 2.0, -5.0), float3(6.0, 3.0, -8.0)));
}
}