[Mesa-dev] [PATCH 00/36] i965: Keep track of vertex attribute layout explicitly

Paul Berry stereotype441 at gmail.com
Fri Sep 2 09:06:39 PDT 2011

This patch series modifies the i965 driver code that relates to
the layout of vertex attributes in the VUE (vertex URB entry).
Previously the layout of vertex attributes was implicit in a
large number of different source files, and was not always
consistent (for instance, some code forgot to account for the
fact that gl_PointSize is stored in the VUE header rather than as
a separate interpolated attribute, resulting in subtle bugs for
shaders that set gl_PointSize).  There were also a number of
fragile assumptions about the relationship between VUE layout,
the structure of the gl_vert_result enum, and the structure of
the gl_frag_attrib enum.

With this patch series, the layout of vertex attributes in the
VUE is computed explicitly by the function brw_compute_vue_map()
and stored in the struct brw_vue_map.  This data structure
records the relationship between elements of the gl_vert_result
enum and vec4-sized "slots" in the VUE.  For VUE slots that don't
strictly correspond to a gl_vert_result, we use a new enum,

Since we are currently in a transition period between the old and
new vertex shader back-ends, I went ahead and applied my changes
to both, but I took the most care on the new vertex shader
back-end, so you'll see more fine-grained patches there than on
the old vertex shader back-end.

In addition to fixing a number of subtle bugs and (hopefully)
making the code more transparent, this patch series paves the way
for implementing gl_ClipDistance, which requires adding new
elements to the gl_vert_result enum, and would otherwise have
broken many of the driver's implicit assumptions about VUE

I've tested this patch series against both the old and new VS backends
on Sandy Bridge, and got no Piglit regressions.  I also tested the old
VS backend on Iron Lake and got no Piglit regressions.  I am still in
the process of testing it with the the new VS backend on Iron Lake.

[PATCH 01/36] Refactor code that converts between gl_vert_result and gl_frag_attrib.
[PATCH 02/36] i965: Write code to compute a VUE map.
[PATCH 03/36] i965: Add functions to compute offsets within the VUE map.
[PATCH 04/36] i965: old VS: Use brw_vue_map instead of implicit assumptions about VUE structure.
[PATCH 05/36] i965: old VS: use the VUE map to compute the URB entry size.
[PATCH 06/36] i965: new VS: Use output_reg[] to find NDC and HPOS registers.
[PATCH 07/36] i965: new VS: move NDC computation (GEN4-5) to a separate function.
[PATCH 08/36] i965: new VS: Move PSIZ/flags computation to a separate function.
[PATCH 09/36] i965: new VS: move clip distance computation (GEN5+) to a separate function.
[PATCH 10/36] i965: new VS: use the VUE map to write out vertex attributes.
[PATCH 11/36] i965: new VS: Clarify comments about max_usable_mrf and add an assertion.
[PATCH 12/36] i965: new VS: Compute urb entry size based on the VUE map.
[PATCH 13/36] i965: SF: Move the computation of urb_entry_read_offset.
[PATCH 14/36] i965: SF: Modify calculate_point_sprite_mask to use the VUE map.
[PATCH 15/36] i965: SF: change get_vert_attr to use the VUE map, and rename it.
[PATCH 16/36] i965: SF: Change the flags that refer to "attr" to be based on gl_vert_result.
[PATCH 17/36] i965: SF: Change calculate_masks to use the VUE map.
[PATCH 18/36] i965: SF: Remove attr_to_idx and idx_to_attr.
[PATCH 19/36] i965: SF: Stop using nr_setup_attrs in compute_masks.
[PATCH 20/36] i965: SF: Remove unnecessary variables.
[PATCH 21/36] i965: SF: New implementation of get_attr_override using the VUE map.
[PATCH 22/36] i965: SF: Move outputs_written to a local variable for clarity.
[PATCH 23/36] i965: SF: Change gen{6,7}_sf_state.c to compute URB read length based on VUE map.
[PATCH 24/36] i965: clip: Add VUE map computation to clip stage for Gen4-5.
[PATCH 25/36] i965: clip: rename header_position_offset to the more correct ndc_offset.
[PATCH 26/36] i965: clip: Move hpos_offest and ndc_offset into local functions.
[PATCH 27/36] i965: clip: Modify brw_clip_tri_alloc_regs() to use the VUE map.
[PATCH 28/36] i965: clip: Move header_regs into brw_clip_compile.
[PATCH 29/36] i965: clip: Modify brw_clip_interp_vertex() to use the VUE map.
[PATCH 30/36] i965: clip: Rework brw_clip_interp_vertex() to use the VUE map.
[PATCH 31/36] i965: clip: Add a function to determine whether a vert_result is in use.
[PATCH 32/36] i965: clip: Convert computations to ..._to_offset() for clarity.
[PATCH 33/36] i965: clip: Change computation of nr_regs to use VUE map.
[PATCH 34/36] i965: clip: Remove assumption about VUE header from brw_clip_interp_vertex()
[PATCH 35/36] i965: clip: Remove no-longer-needed variables.
[PATCH 36/36] i965: GS: Use the VUE map to compute URB size.

More information about the mesa-dev mailing list