[Mesa-dev] [PATCH] draw: move type construction out of loop

Roland Scheidegger sroland at vmware.com
Fri Nov 1 21:05:24 PDT 2013


Am 02.11.2013 00:09, schrieb Brian Paul:
> We can create clip_ptr_type once instead of n times inside the loop.
> ---
>  src/gallium/auxiliary/draw/draw_llvm.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
> index 03668d9..fe49b86 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -1036,6 +1036,9 @@ store_clip(struct gallivm_state *gallivm,
>     LLVMValueRef io_ptrs[LP_MAX_VECTOR_WIDTH / 32];
>     LLVMValueRef inds[LP_MAX_VECTOR_WIDTH / 32];
>     LLVMValueRef clip_ptrs[LP_MAX_VECTOR_WIDTH / 32];
> +   LLVMTypeRef clip_ptr_type =
> +      LLVMPointerType(LLVMVectorType(LLVMFloatTypeInContext(gallivm->context),
> +                                     4), 0);
>     int i, j;
>  
>     indices[0] =
> @@ -1070,7 +1073,6 @@ store_clip(struct gallivm_state *gallivm,
>     }
>  
>     for (j = 0; j < vs_type.length; j++) {
> -      LLVMTypeRef  clip_ptr_type = LLVMPointerType(LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4), 0);
>        LLVMValueRef clip_ptr;
>  
>        clip_ptr = LLVMBuildGEP(builder, clip_ptrs[j], indices, 2, "clipo");
> 

Reviewed-by: Roland Scheidegger <sroland at vmware.com>


More information about the mesa-dev mailing list