[Mesa-dev] [PATCH] r600g: tgsi to llvm emits stream output intrinsics.
Aaron Watry
awatry at gmail.com
Fri Dec 14 06:09:42 PST 2012
> diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
> index 8f1ed26..14c0205 100644
> --- a/src/gallium/drivers/r600/r600_llvm.c
> +++ b/src/gallium/drivers/r600/r600_llvm.c
> @@ -229,11 +229,32 @@ static void llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
> {
> struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
> struct lp_build_context * base = &bld_base->base;
> + struct pipe_stream_output_info * so = ctx->stream_outputs;
> unsigned i;
>
> unsigned color_count = 0;
> boolean has_color = false;
>
> + if (ctx->type == TGSI_PROCESSOR_VERTEX && so->num_outputs) {
> + printf("I have %d so\n", so->num_outputs);
Did you mean to leave that printf there?
> + for (i = 0; i < so->num_outputs; i++) {
> + unsigned register_index = so->output[i].register_index;
> + unsigned start_component = so->output[i].start_component;
> + unsigned num_component = so->output[i].num_components;
> + unsigned dst_offset = so->output[i].dst_offset;
> + unsigned chan;
> + for (chan = start_component; chan < start_component + num_component; chan++) {
> + LLVMValueRef args[3];
> + args[0] = LLVMBuildLoad(base->gallivm->builder,
> + ctx->soa.outputs[register_index][chan], "");
> + args[1] = lp_build_const_int32(base->gallivm, 4 * (dst_offset - start_component) + chan);
> + args[2] = lp_build_const_int32(base->gallivm, so->output[i].output_buffer);
> + lp_build_intrinsic(base->gallivm->builder, "llvm.R600.store.stream.output",
> + LLVMVoidTypeInContext(base->gallivm->context), args, 3);
> + }
> + }
> + }
> +
> /* Add the necessary export instructions */
> for (i = 0; i < ctx->output_reg_count; i++) {
> unsigned chan;
More information about the mesa-dev
mailing list