ComputeSharp
ComputeSharp copied to clipboard
Support for GLSL-style operators
Adding support for GLSL-style operators such as *
operator between matrices like float2x2
and vectors like float2
(which would work like that: float2x2 * float2 = new float2(float2x2.M11 * float2.X + float2x2.M12 * float2.Y, float2x2.M21 * float2.X + float2x2.M22 * float2.Y);
) would make it easier to port GLSL shaders to ComputeSharp (HLSL)
Yeah, I had similar issues with Line 46 here https://www.shadertoy.com/view/7lc3R4 with *=
as well:
vec2 tuv;
...
tuv *= Rot(radians((degree-.5)*720.+180.));
and changed it in ComputeSharp to:
float2 tuv;
...
tuv.XY = Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians((degree - 0.5f) * 720.0f + 180.0f)));
So it'd be nice to at least have it be able to do instead:
tuv.XY *= Rotate(Hlsl.Radians((degree - 0.5f) * 720.0f + 180.0f));
Yeah I second this, would be nice to have it. Hlsl.Mul()
can be used in place of *
, but it's more natural to use *
, especially when porting over shader code.
I suspect porting GLSL shaders to CS.D2D1 shaders for use in PDN v5 effects will be a thing once these things all go live. Having these operators will really simplify that.
Alright, @rickbrew convinced me, here's a sneak-peek 😄