Clément Foucault @fclem13:59
ok is your issue with a scene with lots of shaders or with a special shader in particular?
-
or even with any shader?
-
3di @3di14:01
mines with a group node that gets fully re-compiled every time I plug something into one of it’s external sockets. Aiming to try and find a way to associate the already compiled glsl with the node, and then if the node remains unchanged, use the existing glsl instead of recompiling. The question is, is the recompilation indicated by the blue progress bar referring to blender’s task of converting the shader graph to glsl, or does it refer to to opengl’s progress of converting that glsl to machine code.
Clément Foucault @fclem14:04
Blue bar is just shader_compiled/shader_in_queue
-
so nothing about OpenGL status
-
also we already detect if a shader does not change. But we cannot optimize the “only recompile the bits that changed” because it’s bytecode that we don’t even have and could be vastly different for each GPU/vendors.
-
what we can improve tho, is that we could decouple shading from the material evaluation. but this means defered shading and is a big paradigm change frow what we have now.
-
3di @3di14:07
OK, so the bit were waiting for is shader to glsl and not glsl to machine code.
Clément Foucault @fclem14:08
NodeTree > glsl is done async and does not freeze. The GLSL > bytecode is freezing because drivers hangs.
3di @3di14:10
it’s not hanging, its the blue progress bar slowly climbing, so presumably it hasn’t even begun the glsl to bytecode at this point?
Clément Foucault @fclem14:11
the blue bar is just an indication of how many shaders are still not recompiled.
3di @3di14:11
I only have one material
Clément Foucault @fclem14:11
blue bar shows both
3di @3di14:11
Or when you say shader, do you mean each node/group inside that material?
Clément Foucault @fclem14:11
if blue bar is not doing 0 > 100% instantly you don’t have only 1 material
3di @3di14:12
I’ll make a video
3di @3di14:30
dropbox.com/s/tux9bnenn9kgzcn/2021-04-19 14-24-26.mp4?dl=0
Clément Foucault @fclem14:36
Looks like it is our nodetree folding system that is taking too long here
3di @3di14:36
my aim was to see if it would be possible to hash the individual nodes/groups, and when the glsl is created for that node, the hash would be used as a key for a dictionary of each nodes glsl, and then when recompiling the shader graph to glsl in future, if the hash was the same, it would use the stored glsl to build the full material, before presenting it to opengl for the conversion to bytecode.
Clément Foucault @fclem14:37
Not sure if it is glsl here that is taking the time. Do you compile blender yourself?
3di @3di14:37
yeah
-
i’ve done a basic patch that was approved before.
-
so i’m not completely unfamiliar with the code.
-
but i’m not great
-
I’m not sure why enabling alpha blend would double the compile time either.
-
Clément Foucault @fclem14:40
maybe in this case it needs multiple shaders for one material.
3di @3di14:42
ok, i’ll do that.
-
thanks.
-
Clément Foucault @fclem14:42
3di my gut feeling is that it will be inside ntreeGPUMaterialNodes
-
But basically, we flatten the whole tree so if you have nested groups it can increase time quite a bit.
-
But one thing I don’t understand is why we allocate all nodes separately… this is a mystery to me. Might be a low hanging fruit to pick.
-
3di @3di14:44
Brilliant, thanks. I’ll take a look later this week, it’s been pretty quiet due to covid, and i’ve just had my first client work through for a few weeks, so best crack on with that.
- 1