diff options
author | Eric Anholt <[email protected]> | 2011-11-08 18:50:09 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-11-11 08:27:59 -0800 |
commit | 1c65abb211e6a3df8c46180ae3242486ee97dc8d (patch) | |
tree | 89e4d0955f49f0cd841c9d0f7efd933f6d7fdd4a /src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | |
parent | 9472f6677672ac89d6addba025b33287670da9e9 (diff) |
i965: Add support for gl_VertexID and gl_InstanceID.
The compiler setup for these VF-uploaded attributes looks a little
cheesy with mixing system values and real VBO-sourced attributes. It
would be nice if we could just compute the ATTR[] map to GRF index up
front and use it at visit time instead of using ir->location in the
ATTR file. However, we don't know the reg_offset at
visit(ir_variable *) time, so we can't do the mapping that early.
Fixes piglit vertexid test.
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 5b80f559015..853c3eeca13 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -880,6 +880,27 @@ vec4_visitor::visit(ir_variable *ir) } break; + case ir_var_system_value: + /* VertexID is stored by the VF as the last vertex element, but + * we don't represent it with a flag in inputs_read, so we call + * it VERT_ATTRIB_MAX, which setup_attributes() picks up on. + */ + reg = new(mem_ctx) dst_reg(ATTR, VERT_ATTRIB_MAX); + prog_data->uses_vertexid = true; + + switch (ir->location) { + case SYSTEM_VALUE_VERTEX_ID: + reg->writemask = WRITEMASK_X; + break; + case SYSTEM_VALUE_INSTANCE_ID: + reg->writemask = WRITEMASK_Y; + break; + default: + assert(!"not reached"); + break; + } + break; + default: assert(!"not reached"); } |