summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-23 13:24:06 -0600
committerBrian <[email protected]>2007-08-23 13:24:06 -0600
commitef7c25090074cb02f18acc905bca5f25a56bd021 (patch)
treef209f095f3a9038c058e9c956fdbf81316ae81e4 /src/mesa
parentc990d0fd57a05301429b3af75b7fed0337621941 (diff)
For the time being, interpolate Z in shade_quad() rather in the shader.
This was causing trouble for the i915 driver.
Diffstat (limited to 'src/mesa')
-rwxr-xr-xsrc/mesa/pipe/softpipe/sp_quad_fs.c43
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c5
2 files changed, 48 insertions, 0 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index ceba94aa94d..8a419c9ac78 100755
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -55,6 +55,34 @@ quad_shade_stage(struct quad_stage *qs)
return (struct quad_shade_stage *) qs;
}
+
+
+
+/**
+ * Compute quad's attribute values by linear interpolation.
+ *
+ * Push into the fp:
+ *
+ * INPUT[attr] = MAD COEF_A0[attr], COEF_DADX[attr], INPUT_WPOS.xxxx
+ * INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy
+ */
+static INLINE void
+linterp_z(const struct tgsi_interp_coef *coef,
+ struct tgsi_exec_vector *pos)
+{
+ uint ch = 2;
+ uint j;
+ for (j = 0; j < QUAD_SIZE; j++) {
+ const float x = pos->xyzw[0].f[j];
+ const float y = pos->xyzw[1].f[j];
+ pos->xyzw[ch].f[j] = (coef->a0[ch] +
+ coef->dadx[ch] * x +
+ coef->dady[ch] * y);
+ }
+}
+
+
+
/* This should be done by the fragment shader execution unit (code
* generated from the decl instructions). Do it here for now.
*/
@@ -101,6 +129,9 @@ shade_quad(
machine.Inputs[0].xyzw[1].f[2] = fy + 1.0f;
machine.Inputs[0].xyzw[1].f[3] = fy + 1.0f;
+ /* interp Z */
+ linterp_z(&quad->coef[0], &machine.Inputs[0]);
+
/* run shader */
tgsi_exec_machine_run( &machine );
@@ -110,6 +141,7 @@ shade_quad(
&machine.Outputs[1].xyzw[0].f[0],
sizeof( quad->outputs.color ) );
+#if 0
if( softpipe->need_z ) {
/* XXX temporary */
memcpy(
@@ -117,6 +149,17 @@ shade_quad(
&machine.Outputs[0].xyzw[2],
sizeof( quad->outputs.depth ) );
}
+#else
+ {
+ uint i;
+ for (i = 0; i < 4; i++) {
+ quad->outputs.depth[i] = machine.Inputs[0].xyzw[2].f[i];
+#if 0
+ printf("output z %f\n", quad->outputs.depth[i]);
+#endif
+ }
+ }
+#endif
/* shader may cull fragments */
if( quad->mask ) {
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
index 1de80eb734d..eeaed844d5e 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
@@ -52,6 +52,9 @@ map_register_file_index(
GLuint mapped_index;
GLuint i;
+ assert(processor == TGSI_PROCESSOR_FRAGMENT
+ || processor == TGSI_PROCESSOR_VERTEX);
+
switch( file ) {
case TGSI_FILE_INPUT:
/*
@@ -616,6 +619,7 @@ tgsi_mesa_compile_fp_program(
/*
* Copy fragment z if the shader does not write it.
*/
+#if 0
if( !(program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) ) {
fullinst = tgsi_default_full_instruction();
@@ -639,6 +643,7 @@ tgsi_mesa_compile_fp_program(
maxTokens - ti );
preamble_size++;
}
+#endif
for( i = 0; i < program->Base.NumInstructions; i++ ) {
if( compile_instruction(