On Tue, Dec 14, 2010 at 6:59 PM, Neil Roberts <[email protected]> wrote:
> 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.
Yeah, definitely; a vertex attribute instead of repeatedly changing a
uniform sounds much saner.

> 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.

Right we've also chatted about exposing that "default" value for some
of the other builtins besides the color. It's consistent with how GL
exposes its builtin attributes in that you can set a constant to
fallback to when an array isn't in use. I think it's also consistent
with how glVertexAttrib relates to glVertexAttribPointer.

The idea of generalizing the way we handle default attribute values
inside the journal sounds neat.

>
> 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.
One thing to keep in mind here is that the CoglVertexAttribute API is
currently marked as "Unstable" and you have to define
COGL_ENABLE_EXPERIMENTAL_API to use it, so at this point gnome-shell
shouldn't depend on it in any releases. That said the reason it's
marked as experimental is because we want feedback for it so even
though it shouldn't be depended on in releases yet experimentation
will help us test the new API.

> 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.

sounds good.

regards,
- Robert
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to