4 ms·
? There's no C++ in Metal, it's Objective-C. You can build C or C++ bindings for Metal if you want ( as has been done by https://github.com/recp/cmt https://git
by Jasper_ 8y ago
? There's no C++ in Metal, it's Objective-C. You can build C or C++ bindings for Metal if you want ( as has been done by https://github.com/recp/cmt https://github.com/recp/cmt ), the binding language is not really a concern.
- jcelerier 8y ago> There's no C++ in Metal, it's Objective-C. ... did you use Metal ? Metal shaders are written in ≈C++14. Says so right here in the first example: https://developer.apple.com/documentation/metal/hello_triangle https://developer.apple.com/documentation/metal/hello_triang...
- Jasper_ 8y agoOh, sure, the shader language. That part doesn't really matter to me, it all gets compiled to some GPU-specific machine code in the end. Write it in GLSL, HLSL, SPIR-V, C++, who cares really. And shader cross-compilers are already incredibly common in the industry (most write in HLSL, then translate with HLSLParser, or glsl-optimizer, or spirv-cross, etc.). When I talk about "good APIs", I'm mostly talking about the driver and CPU side of things, since that's the common bottleneck we're looking to replace with an OpenGL replacement. GPU compiler is already pretty highly optimized.
- pjmlp 8y agoWhich proves you never wrote a single line of Metal. Metal Shaders are written in C++14 with a couple of language extensions.
- atq2119 8y agoShaders are not the API. If there's truly a need for it, people could come up with a more C++-style frontend for generating SPIRV for Vulkan.
- pjmlp 8y agoShaders are part of the API, they define what the GPU is supposed to do with a bunch of points and textures. History proves that alternatives to official APIs always follow the CoffeeScript path, the only difference is how fast they eventually die after the initial hype.
- atq2119 8y agoConsidering that there are already multiple frontend languages for Vulkan shaders - both GLSL and HLSL are supported, and not via cross-compilation - you're quite likely to be proven wrong. (Let's not even go into the various experimental frontends that target SPIR-V directly. Those likely aren't going anywhere, like most experimental languages.) Here's the key difference: Vulkan doesn't specify a high-level shader language at all, even though Khronos obviously has a GLSL bias. It specifies SPIR-V, which means that WebAssembly is a better analogy in CPU space than JavaScript/CoffeeScript.
- pjmlp 8y agoHLSL support is a kind of Google driven effort without being part of official Vulkan specification, due to many devs stating them they wouldn't care about Vulkan without such support, given their amount of DirectX shaders. Google naturally has a vested interest in making Vulkan being adopted on Android, since it drives sales, as its proper support requires recent flaghship models. By not being part of Vulkan standard and certification tests, basically if a driver does not handle the SPIR-V as generated by HLSL compiler, good luck with the vendor's support channels.
- atq2119 8y agoIt's clear that vendors do have a serious interest in supporting SPIR-V as specified, not just SPIR-V as produced by glslang. I can assure you that I have reliable sources for that, though obviously it's up to you whether you want to believe a random internet person. Also, the Vulkan Conformance Test Suite is open source.[0] Contributions of better SPIR-V tests would certainly be accepted, so Google (or anybody else, really) has an easy path towards forcing better support in drivers if they care sufficiently. [0] https://github.com/KhronosGroup/VK-GL-CTS/ https://github.com/KhronosGroup/VK-GL-CTS/