static void populate_key( struct brw_context *brw,
struct brw_gs_prog_key *key )
{
+ static const unsigned swizzle_for_offset[4] = {
+ BRW_SWIZZLE4(0, 1, 2, 3),
+ BRW_SWIZZLE4(1, 2, 3, 3),
+ BRW_SWIZZLE4(2, 3, 3, 3),
+ BRW_SWIZZLE4(3, 3, 3, 3)
+ };
+
struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
for (i = 0; i < key->num_transform_feedback_bindings; ++i) {
key->transform_feedback_bindings[i] =
linked_xfb_info->Outputs[i].OutputRegister;
+ key->transform_feedback_swizzles[i] =
+ swizzle_for_offset[linked_xfb_info->Outputs[i].ComponentOffset];
}
}
/* On Gen6, GS is also used for rasterizer discard. */
* entry.
*/
unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
+
+ /**
+ * Map from the index of a transform feedback binding table entry to the
+ * swizzles that should be used when streaming out data through that
+ * binding table entry.
+ */
+ unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
};
struct brw_gs_compile {
vertex_slot.subnr = (slot % 2) * 16;
/* gl_PointSize is stored in VERT_RESULT_PSIZ.w. */
vertex_slot.dw1.bits.swizzle = vert_result == VERT_RESULT_PSIZ
- ? BRW_SWIZZLE_WWWW : BRW_SWIZZLE_NOOP;
+ ? BRW_SWIZZLE_WWWW : key->transform_feedback_swizzles[binding];
brw_set_access_mode(p, BRW_ALIGN_16);
brw_MOV(p, stride(c->reg.header, 4, 4, 1),
retype(vertex_slot, BRW_REGISTER_TYPE_UD));
if (vert_result == VERT_RESULT_PSIZ) {
assert(linked_xfb_info->Outputs[i].NumComponents == 1);
component_mask <<= 3;
+ } else {
+ component_mask <<= linked_xfb_info->Outputs[i].ComponentOffset;
}
buffer_mask |= 1 << buffer;