cbaggers / cepl

Code Evaluate Play Loop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The way we define ssbos as structs makes indirect rendering hard

cbaggers opened this issue · comments

To use multi-map-g you need to pass a gpu-array of indirect-commands. However to populate them from a shader they need to be an ssbo and we require ssbos to be a struct.

So for example multi-map-g wants a #<GPU-ARRAY :element-type ELEMENTS-INDIRECT-COMMAND :dimensions (10) :backed-by :BUFFER> but making the ssbo means making the following struct

(defstruct-g (inst-counts2 :layout std-430)
  (arr (elements-indirect-command 10)))

This mismatch sucks. What can we do about it?

Could varjo allow ssbo arguments to be arrays of structs of the std-430 type?
eh it doesnt really fit :/

here is the current code for the struct

layout(std430) buffer _SSBO_INSTANCE_COUNTS
{
    ELEMENTS_INDIRECT_COMMAND[10] ARR;
} INSTANCE_COUNTS;

We could make command-array a cepl type and have accessor that expose ssbos and gpu-arrays that shadow each other.

It's a breaking change but could be a nice one. We could also the details of where it's array or element indirect draw which would mean we didnt have to pass in the stream... hmm it seems we still need the vao... well we could store the stream in there and pass it all together.