aardvark-platform/aardvark.rendering

Shader caches do not work as intended with IFrameBufferSignature

luithefirst opened this issue · 2 comments

The OpenGL shader caches in Program.fs (https://github.com/aardvark-platform/aardvark.rendering/blob/master/src/Aardvark.Rendering.GL/Resources/Program.fs#L430)
either use (string * IFrameBufferSignature) or (Effect * IFrameBufferSignature). A FrameBufferSignature is created per RenderControl and if not cached in the application it might also be created redundantly in RenderToTexture use cases.
It looks like the shader caches should be dependent on the structure of the AttachmentSignatures rather than the actual FramebufferSignature.

We could consider using a custom EqualityComparer. There also is an almost complete IsAssignableFrom.

There are also other methods like IRuntime.AssembleModule with a dependency on IFrameBufferSignature, so we have the same behavior there.

We are actually missing a cache in CreateFrameBufferSignature, but they can be deleted as in Vulkan they seem to actually have some resources. -> The shader cache should even work if a signature is re-created.

We might also think about adding something like a FrameBufferOutputDeclaration or FrameBufferAttachmentSignature (nicer version CreateFrameBufferSignature argument? Wouldn't this make the IsAssignableFrom question easier?

Should be fixed by 50dfe09