Robert Bragg <[email protected]> wrote: > One concern I have a.t.m is that we probably don't track custom > uniforms in a useful way a.t.m and likely you will end up with the > same program associated with all of your windows and when you change > the uniform for each window you'll in fact just end up changing the > uniform on the same program and then when you draw all windows will > end up with the same stacking-z. I wonder if we need to move the > ownership of uniforms from CoglProgram into CoglMaterial.
Moving the uniforms seems like a good idea anyway, but in this case wouldn't it make more sense to use a custom vertex attribute for the window's depth? Otherwise we would end up breaking the batch for each window which seems a shame. I wonder if we could add the concept of a 'default custom vertex attribute value' to the pipeline? So this would be a default value that would get used for a vertex attribute if no vertex array is enabled for that attribute. That would correspond to the current design for the pipeline color. Eg, if you set a color on a pipeline that will currently only affect the vertex color if no attribute array is enabled. Then when we render through the journal we could recognise when journal entries differ only by the default attribute values and instead put the values in the vertex array to batch them together. Depending on how mutter is currently implemented, it's almost possible to do this already with the existing CoglVertexAttribute API. In theory you can create a custom attribute in GLSL and then use its name when you call cogl_vertex_attribute_new to set it. However there's some missing logic in Cogl to tie the name to the right attribute number. We currently just say the first custom attribute name gets tied to attribute number 0, the second to 1 and so on. This is particularly broken because in GL attribute number 0 is always tied to the builtin gl_Position attribute so the first attribute will always be wrong. So in the short term, we could fix custom attributes with the vertex attribute API and gnome-shell might be able to use that. In the medium term we could add default attribute values to CoglPipeline and then gnome-shell could use that instead of having to manually batch the windows together. And in the long term we would add good render-list support and the depth testing optimisations would happen automatically. Regards, - Neil _______________________________________________ clutter-app-devel-list mailing list [email protected] http://lists.clutter-project.org/listinfo/clutter-app-devel-list
