[Mesa-dev] [PATCH 2/3] draw/llvm: fix storing of clipvertex and positions into pre_clip_pos

Brian Paul brianp at vmware.com
Mon Mar 5 14:53:45 PST 2012


On 03/03/2012 10:55 AM, Dave Airlie wrote:
> From: Dave Airlie<airlied at redhat.com>
>
> This fixes the rest of the piglit clipvertex tests.
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
> ---
>   src/gallium/auxiliary/draw/draw_llvm.c |   16 +++++++++-------
>   1 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
> index fd10bf2..5e7fd18 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -899,7 +899,7 @@ static void
>   store_clip(struct gallivm_state *gallivm,
>              LLVMValueRef io_ptr,
>              LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
> -           boolean pre_clip_pos)
> +           boolean pre_clip_pos, int idx)

A comment indicating what idx is would be good.

Otherwise, Reviewed-by: Brian Paul <brianp at vmware.com>


>   {
>      LLVMBuilderRef builder = gallivm->builder;
>      LLVMValueRef out[4];
> @@ -918,10 +918,10 @@ store_clip(struct gallivm_state *gallivm,
>      indices[0] =
>      indices[1] = lp_build_const_int32(gallivm, 0);
>
> -   out[0] = LLVMBuildLoad(builder, outputs[0][0], ""); /*x0 x1 x2 x3*/
> -   out[1] = LLVMBuildLoad(builder, outputs[0][1], ""); /*y0 y1 y2 y3*/
> -   out[2] = LLVMBuildLoad(builder, outputs[0][2], ""); /*z0 z1 z2 z3*/
> -   out[3] = LLVMBuildLoad(builder, outputs[0][3], ""); /*w0 w1 w2 w3*/
> +   out[0] = LLVMBuildLoad(builder, outputs[idx][0], ""); /*x0 x1 x2 x3*/
> +   out[1] = LLVMBuildLoad(builder, outputs[idx][1], ""); /*y0 y1 y2 y3*/
> +   out[2] = LLVMBuildLoad(builder, outputs[idx][2], ""); /*z0 z1 z2 z3*/
> +   out[3] = LLVMBuildLoad(builder, outputs[idx][3], ""); /*w0 w1 w2 w3*/
>
>      io0_ptr = LLVMBuildGEP(builder, io_ptr,&ind0, 1, "");
>      io1_ptr = LLVMBuildGEP(builder, io_ptr,&ind1, 1, "");
> @@ -1246,6 +1246,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
>                                      variant->key.clip_z  ||
>                                      variant->key.clip_user;
>      LLVMValueRef variant_func;
> +   const unsigned pos = draw_current_shader_position_output(llvm->draw);
> +   const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
>
>      arg_types[0] = get_context_ptr_type(llvm);       /* context */
>      arg_types[1] = get_vertex_header_ptr_type(llvm); /* vertex_header */
> @@ -1399,8 +1401,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
>                     variant->key.clamp_vertex_color);
>
>         /* store original positions in clip before further manipulation */
> -      store_clip(gallivm, io, outputs, 0);
> -      store_clip(gallivm, io, outputs, 1);
> +      store_clip(gallivm, io, outputs, 0, cv);
> +      store_clip(gallivm, io, outputs, 1, pos);
>
>         /* do cliptest */
>         if (enable_cliptest) {



More information about the mesa-dev mailing list