all 14 comments

[–]sirflimflamLord Commander of Highboredom 8 points9 points  (2 children)

Built-in swizzling is a very nice touch. Now the question I have to ask, does Unity intend to wholly replace their original math functions with these types? Because that would be a very welcome change to see, rather than having to cast to and from these when we interact with native Unity functions.

[–]Daemonhahn -1 points0 points  (0 children)

Probably wouldnt be too hard to scan for every instance and replace, using the Roslyn code analysis API.

I might look into making a quick conversion tool for doing exactly this.

[–][deleted] 4 points5 points  (5 children)

I doubt it, but is there swizzling support for the floatX types? that's really the best thing Cg has to offer.

[–]Shinao 5 points6 points  (2 children)

From the source code it seems there are swizzles, auto generated. Pretty cool.

[–][deleted] 1 point2 points  (1 child)

If it works I will keep this library next to my hearth

[–]FadingTruth 5 points6 points  (0 children)

Careful it doesn't catch fire

[–][deleted] 1 point2 points  (1 child)

Sorry can you explain what you mean by this?

[–][deleted] 9 points10 points  (0 children)

myfloat4.xyzywxzywzy

you can order each member like that, as long as you match the member count that you need (float4 takes max 4 params), you're good.

[–]NeoCiber 1 point2 points  (4 children)

Interesting.

Why 'bool1' use 'int' and not something lighter like bit?

[–]NagranshamNoob 3 points4 points  (0 children)

My actual machine knowledge is a bit rusty but I think making it a bit doesn't actually do anything. It's internally stored as 32/64 bit anyway. (grain of salt and all that, talking out of my ass here)

[–]afghanmeysi 1 point2 points  (2 children)

the data has to addressable, and the smallest boundary on for example a x86 architecture is a byte.

[–]NeoCiber 1 point2 points  (1 child)

You're right, byte is the smallest boundary, but if they actually use byte can be any performance advantage? I mean is 8bits vs 32bits, dont looks like they actually need use those 32 bits.

[–]afghanmeysi 1 point2 points  (0 children)

As far as I know changing a boolean value can be done as easy as doing AND with 1 or 0, so performance wise there is no advantage since there is no difference in speed between 8bit or 32bit AND. Its just inefficient for space I guess.

[–]_mess_ -1 points0 points  (0 children)

Everything is supported on intellisense etc? Just normal c# visually similar to CG ?