The Cross-Platform Rendering Conundrum: Why SDL's GPU API Takes This Shader Approach
Game developers face the challenge of efficient cross-platform rendering. Different platforms (Windows, macOS, Linux, consoles) utilize diverse graphics APIs (Vulkan, Metal, Direct3D), with shader handling being particularly complex. The author, a co-maintainer of the FNA project (a modern XNA framework port), created Refresh, a cross-platform graphics abstraction library, and proposed an SDL GPU API solution supporting various shader formats like SPIR-V, HLSL, DXBC, and MSL. This multi-format approach stems from the lack of a standardized shader ISA due to differing GPU architectures and vendor interests. Treating shaders as content, not code, allows flexibility in compilation workflows. The approach handles existing shaders (like XNA's FX bytecode) while avoiding the immense effort of creating a custom shader language, prioritizing practical cross-platform rendering.
Read more