From: José Fonseca Date: Fri, 14 Aug 2009 09:56:40 +0000 (+0100) Subject: llvmpipe: Pass the interpolation factors as scalars. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b6f43b445b43188b10cb57e4cff0190ae2cee789;p=mesa.git llvmpipe: Pass the interpolation factors as scalars. --- diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index 1f489a359b1..60b9819fffe 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -1372,16 +1372,22 @@ emit_declaration( case TGSI_INTERPOLATE_LINEAR: { LLVMValueRef dadx_ptr = LLVMBuildGEP(builder, bld->dadx_ptr, &index, 1, ""); LLVMValueRef dady_ptr = LLVMBuildGEP(builder, bld->dady_ptr, &index, 1, ""); + dadx = LLVMBuildLoad(builder, dadx_ptr, ""); + dady = LLVMBuildLoad(builder, dady_ptr, ""); + dadx = lp_build_broadcast_scalar(&bld->base, dadx); + dady = lp_build_broadcast_scalar(&bld->base, dady); util_snprintf(name, sizeof name, "dadx_%u.%c", attrib, "xyzw"[chan]); - dadx = LLVMBuildLoad(builder, dadx_ptr, name); + LLVMSetValueName(dadx, name); util_snprintf(name, sizeof name, "dady_%u.%c", attrib, "xyzw"[chan]); - dady = LLVMBuildLoad(builder, dady_ptr, name); + LLVMSetValueName(dady, name); } case TGSI_INTERPOLATE_CONSTANT: { LLVMValueRef a0_ptr = LLVMBuildGEP(builder, bld->a0_ptr, &index, 1, ""); + a0 = LLVMBuildLoad(builder, a0_ptr, ""); + a0 = lp_build_broadcast_scalar(&bld->base, a0); util_snprintf(name, sizeof name, "a0_%u.%c", attrib, "xyzw"[chan]); - a0 = LLVMBuildLoad(builder, a0_ptr, name); + LLVMSetValueName(a0, name); break; } diff --git a/src/gallium/drivers/llvmpipe/lp_quad_fs.c b/src/gallium/drivers/llvmpipe/lp_quad_fs.c index d4f9fb2a06c..dfc7eeaa7e6 100644 --- a/src/gallium/drivers/llvmpipe/lp_quad_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_quad_fs.c @@ -54,9 +54,9 @@ struct quad_shade_stage struct quad_stage stage; /**< base class */ union tgsi_exec_channel ALIGN16_ATTRIB pos[NUM_CHANNELS]; - union tgsi_exec_channel ALIGN16_ATTRIB a0[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS]; - union tgsi_exec_channel ALIGN16_ATTRIB dadx[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS]; - union tgsi_exec_channel ALIGN16_ATTRIB dady[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS]; + float ALIGN16_ATTRIB a0[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS]; + float ALIGN16_ATTRIB dadx[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS]; + float ALIGN16_ATTRIB dady[PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS]; struct tgsi_exec_vector ALIGN16_ATTRIB outputs[PIPE_MAX_ATTRIBS]; }; @@ -111,11 +111,9 @@ setup_coef_vector(struct quad_shade_stage *qss, for (attrib = 0; attrib < num_inputs; ++attrib) { for (chan = 0; chan < NUM_CHANNELS; ++chan) { - for( i = 0; i < QUAD_SIZE; ++i ) { - qss->a0[attrib][chan].f[i] = coef[attrib].a0[chan]; - qss->dadx[attrib][chan].f[i] = coef[attrib].dadx[chan]; - qss->dady[attrib][chan].f[i] = coef[attrib].dady[chan]; - } + qss->a0[attrib][chan] = coef[attrib].a0[chan]; + qss->dadx[attrib][chan] = coef[attrib].dadx[chan]; + qss->dady[attrib][chan] = coef[attrib].dady[chan]; } } } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index e6efa426fe0..c148a9f8e7a 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -77,9 +77,9 @@ shader_generate(struct llvmpipe_screen *screen, vec_type = lp_build_vec_type(type); arg_types[0] = LLVMPointerType(vec_type, 0); /* pos */ - arg_types[1] = LLVMPointerType(vec_type, 0); /* a0 */ - arg_types[2] = LLVMPointerType(vec_type, 0); /* dadx */ - arg_types[3] = LLVMPointerType(vec_type, 0); /* dady */ + arg_types[1] = LLVMPointerType(elem_type, 0); /* a0 */ + arg_types[2] = LLVMPointerType(elem_type, 0); /* dadx */ + arg_types[3] = LLVMPointerType(elem_type, 0); /* dady */ arg_types[4] = LLVMPointerType(elem_type, 0); /* consts */ arg_types[5] = LLVMPointerType(vec_type, 0); /* outputs */ arg_types[6] = LLVMPointerType(LLVMInt8Type(), 0); /* samplers */