[Mesa-dev] Gallium: src_offset of pipe_vertex_element should be more restricted
Marek Olšák
maraeo at gmail.com
Fri Mar 30 10:30:27 PDT 2012
Hi everyone,
I noticed the src_offset of pipe_vertex_element has 32 bits, but no
hardware can do such a large value per vertex element and it leads to
awkward workarounds in hardware drivers. To my knowledge, nv50 can
only do 12 bits and r600 can only do 16 bits. There's no such
limitation on pipe_vertex_buffer::buffer_offset.
I am proposing to change src_offset to 12 bits. Then the
pipe_vertex_element struct can be packed like this:
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -476,20 +476,21 @@ struct pipe_stream_output_target
*/
struct pipe_vertex_element
{
- /** Offset of this attribute, in bytes, from the start of the vertex */
- unsigned src_offset;
+ /** Offset of this attribute, in bytes, from the start of the vertex.
+ * Limited to 12 bits due to lack of hardware support. */
+ unsigned src_offset:12;
+
+ /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does
+ * this attribute live in?
+ */
+ unsigned vertex_buffer_index:5;
+
+ enum pipe_format src_format:15;
/** Instance data rate divisor. 0 means this is per-vertex data,
* n means per-instance data used for n consecutive instances (n > 0).
*/
unsigned instance_divisor;
-
- /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does
- * this attribute live in?
- */
- unsigned vertex_buffer_index;
-
- enum pipe_format src_format;
};
The Mesa state tracker change should be trivial. Opinions?
Best regards,
Marek
More information about the mesa-dev
mailing list