splitshockvirus,
@splitshockvirus@mstdn.starnix.network avatar

Hey man whatever this is that you're doing can you do that some other time.

crunklord420,
@crunklord420@clubcyberia.co avatar

@splitshockvirus new csgo skins just dropped, need to compile shaders for hours.

gentoobro,
@gentoobro@gleasonator.com avatar

@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.

crunklord420,
@crunklord420@clubcyberia.co avatar

@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.

gentoobro,
@gentoobro@gleasonator.com avatar

@crunklord420 @splitshockvirus Things that complicated are seldom truly optimized.

It's insane to have special shaders for each skin. There aren't that many ways you can make light reflect, even with oil-slick effects and such.

icedquinn,
@icedquinn@blob.cat avatar

@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

gentoobro,
@gentoobro@gleasonator.com avatar

@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,
@icedquinn@blob.cat avatar

@gentoobro @crunklord420 @splitshockvirus each shader change is a draw call, though, which is a scarce resource on PC.

gentoobro,
@gentoobro@gleasonator.com avatar

@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.

icedquinn,
@icedquinn@blob.cat avatar

@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.

a1ba,
@a1ba@suya.place avatar

@icedquinn @crunklord420 @gentoobro @splitshockvirus isn't ubershader is just a single shader file compiled into multiple smaller ones by switching the macros (as GLSL allows C preprocessor)

gentoobro,
@gentoobro@gleasonator.com avatar

@a1ba @icedquinn @crunklord420 @splitshockvirus Also, annoyingly, some GLSL compilers don't support line continuations, which makes using non-trivial macros difficult.

icedquinn,
@icedquinn@blob.cat avatar

@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,
@gentoobro@gleasonator.com avatar

@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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • Hentai
  • doujinshi
  • announcements
  • general
  • All magazines