[Mesa-dev] i965 uniform upload question

Rogovin, Kevin kevin.rogovin at intel.com
Mon Nov 18 11:02:52 PST 2013

Hello all,

 Yet another questions related to i965. I was taking a gander through the code base hunting down where and how uniforms are uploaded to the GPU; what I do see is that pointers are set directly to the a backing store that holds the uniform values:

 brw_vec4_prog_data::param array of pointers point to gl_uniform_storage::storage
 brw_wm_prog_data::param array of pointers point to gl_uniform_storage::storage.

to where they point is modified by _mesa_uniform() and _mesa_uniform_matrix(). I also see that pull_param field seems to be the same-ish as param, for example vec4_visitor::move_uniform_access_to_pull_constants() essentially copies from param to pull_param.

and now the questions:
  1) what is meant by push and pull constants?
  2) why are there both param and pull_param? Is it essentially param is for Gen4 and 5 to o uniform stuff and pull_param for Gen6 or higher? Is it so that pull_param values are sent to the GPU through a buffer object surface?
  3) for Gen6 and 7, are the uniform values first dumped into brw_state_state::const_bo which is then viewed as a surface? Is there any means to only "upload" those uniforms that have changed?
  4) going further, is there a good reason why the uniforms of the default uniform block not just mapped to a UBO anyways? it seems like this would cut down on code quasi-duplication. Further along, is there a Mesa interface to setup call backs so that when uniform gets modified,? Such a  value change callback could be adding an entry in a list of a buffer object update (with the buffer object also mirrored as plain user space data). With that list one could issue a smaller set of buffer object updates and that buffer object holds the values for the default uniform block. Just an idea..

another question on the subject of uniforms is the driver_storage interface thing in Mesa.. it appears that i965 does not use it, is that correct? What does that interface provide that the direct interface of poking into the array does not? I do not see anywhere (yet) in the other drivers that reference it either? does anything use it? Or do I have it utterly wrong?


More information about the mesa-dev mailing list