[Mesa-dev] gallium scaled types
jfonseca at vmware.com
Tue Sep 13 12:39:17 PDT 2011
----- Original Message -----
> Am 13.09.2011 20:45, schrieb Jose Fonseca:
> > ----- Original Message -----
> >> José, Roland,
> >> there is a problem with the proposed approach of having the
> >> convert_to_float flag. That flag might not be supported for
> >> certain integer formats. We would need to update some more places,
> >> e.g. is_format_supported:
> >> boolean (*is_format_supported)( struct pipe_screen *, enum
> >> pipe_format format, enum pipe_texture_target target, unsigned
> >> sample_count, unsigned bindings, boolean can_be_converted_to_float
> >> );
> >> See the last parameter. Ugly, isn't it? There is no other way
> >> around it.
> > AFAIK, is_format_supported() was never used for vertex formats,
> > just
> > textures. And given that textures can only be sampled without
> > implicit conversion (i.e., the "pure" vs scaled integers doesn't
> > apply), I see no need to add can_be_converted_to_float to
> > is_format_supported().
> > I think what we need a is_vertex_format_supported(), or something
> > like that.
> No, is_format_supported() definitely is used for vertex buffers and
> like (target PIPE_BUFFER, bindings PIPE_BIND_VERTEX_BUFFER etc.).
> Given that you want to be able to rebind resources to different
> attachment points (e.g. render target and vertex buffer) I think it
> really needs to be unified.
I'm not sure how this currently works. Unlike texture buffer, a vertex buffer doesn't have a single or even constant format -- a vertex buffer can have an arbitrary number of vertex attribute formats, and they can vary along the buffer's life time. I guess I'll need to read the code.
Well, if it's better to continue to use is_format_supported, then indeed needs to get that flag in an additional parameter. If the number parameters is getting large we can either group them in a structure, or create dedicated helper functions for the most common cases, e.g.:
- one util_is_vertex_format_supported() inline helper for vertex formats that doesn't take sample_count & target args
- one util_is_texture_format_supported() for textures formats, that doesn't take the can_be_converted_to_float arg.
More information about the mesa-dev