diff options
author | Christoph Bumiller <[email protected]> | 2012-01-20 13:29:42 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-01-20 19:24:31 +0100 |
commit | 0d27be3d7982d38d3c26e693be959a9e6b776e5f (patch) | |
tree | 830346916a58bbf7a9fedf951e91fc8da2b627be /src/gallium/drivers/nvc0/nvc0_program.c | |
parent | d540af554adfe302387014c0f46d6ac3aaa75121 (diff) |
nvc0: handle discontiguous outputs in stream_output_info
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_program.c')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_program.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c index 60abc224398..44c7a65e3c9 100644 --- a/src/gallium/drivers/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nvc0/nvc0_program.c @@ -492,28 +492,31 @@ nvc0_program_create_tfb_state(const struct nv50_ir_prog_info *info, const struct pipe_stream_output_info *pso) { struct nvc0_transform_feedback_state *tfb; - int n = 0; - int i, c, b; + unsigned b, i, c; - tfb = MALLOC(sizeof(*tfb) + pso->num_outputs * 4 * sizeof(uint8_t)); + tfb = MALLOC_STRUCT(nvc0_transform_feedback_state); if (!tfb) return NULL; - for (b = 0; b < 4; ++b) { + tfb->stride[b] = pso->stride[b] * 4; tfb->varying_count[b] = 0; + } + memset(tfb->varying_index, 0xff, sizeof(tfb->varying_index)); /* = skip */ - for (i = 0; i < pso->num_outputs; ++i) { - unsigned startc = pso->output[i].start_component; - if (pso->output[i].output_buffer != b) - continue; - for (c = 0; c < pso->output[i].num_components; ++c) { - tfb->varying_count[b]++; - tfb->varying_index[n++] = - info->out[pso->output[i].register_index].slot[startc + c]; - } - } - tfb->stride[b] = pso->stride[b] * 4; + for (i = 0; i < pso->num_outputs; ++i) { + unsigned s = pso->output[i].start_component; + unsigned p = pso->output[i].dst_offset; + b = pso->output[i].output_buffer; + + for (c = 0; c < pso->output[i].num_components; ++c) + tfb->varying_index[b][p++] = + info->out[pso->output[i].register_index].slot[s + c]; + + tfb->varying_count[b] = MAX2(tfb->varying_count[b], p); } + for (b = 0; b < 4; ++b) // zero unused indices (looks nicer) + for (c = tfb->varying_count[b]; c & 3; ++c) + tfb->varying_index[b][c] = 0; return tfb; } |