Open js6i opened 3 months ago
Having each descriptor set carry its own encoder sounds like a lot. Perhaps we could have the descriptor set defer to the layout's encoder, unless the variable descriptor count is less than the descriptor count of the variable-length binding.
I think we could do that. Are they expensive though? I would have thought it's fine to create them on demand, for single use.
However, we are going to move away from argument encoders very soon. So, I don't think we should bother making things that complex unless we actually determine it is causing a problem.
It's causing a validation error. That said, there's also another one, when the shader has the maximum size array declared, but the buffer that gets bound is smaller. Let's hold off merging for now, I'll see what can be done about the other one.
I updated the PR with commits that fix the validation errors. However now, in a number of tests, I'm getting GPU crashes instead - which seem to be triggered by having flexible arrays in the shaders. Marking as WIP..
When allocating descriptors from the pool, we should only request as much as needed for the variable number of descriptors, if applicable.
It looks slightly dicey to use the fixed size argument encoder when encoding variable sized bindings. Since here we're creating the encoder to calculate the size, maybe we could use it for encoding too..