llvmpipe: Pass the interpolation factors as scalars.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 14 Aug 2009 09:56:40 +0000 (10:56 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 29 Aug 2009 08:21:32 +0000 (09:21 +0100)
src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
src/gallium/drivers/llvmpipe/lp_quad_fs.c
src/gallium/drivers/llvmpipe/lp_state_fs.c

index 1f489a359b12ef03351e49c12e648eda47db7bbc..60b9819fffeaf3a13d3c2f733b1b8001b0d57b2c 100644 (file)
@@ -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;
                }
 
index d4f9fb2a06ca1ba97ef40de380d6c4ff80b0204f..dfc7eeaa7e661021bf04cfa378e0a7408a535e5c 100644 (file)
@@ -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];
       }
    }
 }
index e6efa426fe00fee5b138f64f11abce0bfdfe281f..c148a9f8e7a936055645c8e0c0c18d947c86fd40 100644 (file)
@@ -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 */