@gentoobro@crunklord420@splitshockvirus usually the point of an ubershader is it does all of your shit so you aren't having to change shader programs during the render
@crunklord420@splitshockvirus What the fuck is in their shaders that takes so long? Mine compile in a couple seconds. Must be some sort of bloated middleware.
@gentoobro@splitshockvirus I don't know 100% but I assume it has to do with giant ubershaders full of compile-time ifdefs. Every new skin requires X number of minor variation shader recompiles. Every minor change requires you recompile every variation. It's just an ugly interdependence mess for the sake of run-time optimization.
@icedquinn@crunklord420@splitshockvirus Yeah. I have one for GUI rendering. Whether you swap shader programs or not during rendering is not the point. (In CS they could swap shaders for the guns without much problem. There aren't many guns on screen at any given point in time.) The insane part is that they have special shader code for each skin, or even many skins.
@icedquinn@crunklord420@splitshockvirus Draw calls are different. You need to have a shader bound already to issue a draw call. Shader changes go into the graphics queue, yes, but they aren't that scarce, and can be even cheaper if you do it carefully. Swapping the executable code is rather fast; reconfiguring the layout of the cache (uniforms) is the expensive part. In Vulkan you can carefully manage these costs independently. In OpenGL you can do some voodoo and the driver will probably hopefully maybe get it right. (Dunno about DirectX. Fuck Microshaft.)
A modern game might have a dozen shader changes each frame just due to the render pipeline alone. The main thing is to not just change shaders willy-nilly between each model or primitive.
On a side note, draw calls themselves aren't that expensive per-se. There can be some CPU overhead, but the main thing to remember is that the GPU is extremely pipelined and you want to let it crunch on as much data at one time as you can. You also don't want to cross the driver barrier too much with OpenGL, but that's a different story.
@gentoobro@crunklord420@splitshockvirus a lot of modern games are also designed for a console first, where gpu interactions are cheap. this is partly why all of the ports run like shit, even the good ones, because the platforms they design for have cheaper state management.
@gentoobro@crunklord420@splitshockvirus i would like to learn vulkan :ablobcatohlookaround: i was stuck on old GL for a very long time, esp. to be compatible with very old potato.
now the discount 200$ mini pcs run vulkan, so its time to move on.
@icedquinn@crunklord420@splitshockvirus Consoles also usually have extremely fast main memory and hard guarantees about core scheduling. It's my understanding that most cross-platform games use some sort of rendering abstraction where they create a command list in their own format then translate it into whatever API is being used underneath. That sort of thing is extremely difficult to optimize for.
As for my game, users will have the option of Vulkan or Vulkan. 😆
@gentoobro@crunklord420@splitshockvirus@a1ba sort of glad that GLSL type stuff is dead. SPIR docs might be excessively long but ime its often better to let the client send bytecode.
@gentoobro@crunklord420@splitshockvirus@a1ba we didn't have the option of sending bytecode in the past* and you handed GLSL to the graphics driver at runtime. Pray the driver feels like giving you useful error messages. :neocat_googly_shocked:
* there were some extensions but who the fuck used those
@icedquinn@crunklord420@splitshockvirus@a1ba You still write GLSL. It's a more strict version, but basically the same. You run it through a compiler (glslang) at build time. Maybe one day I'll put my tooling up on notabug. SPIR-V is for shipping, kind of like x86 machine code is for shipping.