[Mesa-dev] Question about implementing viewport transfer and const load in nir

Qiang Yu yuq825 at gmail.com
Wed Aug 30 07:18:20 UTC 2017

> In my case, VC4 has lots of custom state-dependent uniforms, and uniform
> upload is where we spend most of our CPU time (basically each draw call
> needs to re-upload the uniform stream, and the stream has to be in the
> order they will be used by instructions, rather than where they appear
> in NIR).
> So, I've just got an array of {type of uniform, some sort of index}
> tuples attached to the compiled shader to represent the stream.  Each
> can reference "offset in gallium const buffer" or "a load_const value"
> or "my special viewport x scale" or whatever, and I walk it at draw time
> to write out my stream.
So in VC4:
1. st call set_constant_buffer
2. VC4 prepare draw stream and const buffer modify info
3. when draw, VC4 use the modify info to upload data to constant
buffer set by set_constant_buffer

How do you ensure:
1. st will call set_constant_buffer because some shader has no uniform
2. the constant buffer has enough space, because you don't tell st to
allocate more space for driver spec uniform, right?


More information about the mesa-dev mailing list