Am 13.09.2011 21:39, schrieb Jose Fonseca: > > > ----- 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 the like (target PIPE_BUFFER, bindings PIPE_BIND_VERTEX_BUFFER >> etc.). > > Ah, OK. > >> 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. I'm not sure it really works correctly for now. I don't think any driver even allows PIPE_BUFFER used for PIPE_BIND_SAMPLER_VIEW for instance so it's more theoretical anyway. But I think it should work because PIPE_BUFFER is literally just a 1 dimensional array of elements, at least if attached as a sampler view or render target. Not sure though all the interfaces are really right for it to work, but if not we need to fix them at some point.
Roland > > 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. > > Jose _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev