@warrenm Hey! - mind a quick q ? I am encoding depth 16 images (half float) as 2 8 bit unsigned chars (high/low for encoding), & want use in a metal shader. Is this doable? Can I make a half float from 2 8 bit values?
Sorry if obvious / dumb but hey thats where Im @ :D
If you have the depth image data in that format, you can copy it to a texture of r16Float format and sample it in a shader by binding it as a texture2d<half, access::sample>. Feel free to DM for further detail, or if I'm misunderstanding.
-
-
My depth texture is encoded as two channels of a BGRA unorm HEVC stream - I take the half float high and low bits to 8 bit r & g channels. Was curious how to re mix the two 8 but values in a shader post sample of the texture.
-
Maybe something like this? ushort d = (depthSample.r << 8) | depthSample.g; half depth = *reinterpret_cast<thread half *>(&d);
-
Oh interesting. Had no idea you could reinterpret cast in a shader. Shit. Ha. Thanks!
-
MSL is C++™

-
I suppose I thought it was a subset like CILK > GLSL but fool me once :P
-
It’s a “static” subset of C++14 (no RTTI, dynamic_cast, virtual, etc.), but it’s got a surprising amount of the rest (no lambdas, though
).
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.