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.
*/
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 );
&machine.Outputs[1].xyzw[0].f[0],
sizeof( quad->outputs.color ) );
+#if 0
if( softpipe->need_z ) {
/* XXX temporary */
memcpy(
&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 ) {
GLuint mapped_index;\r
GLuint i;\r
\r
+ assert(processor == TGSI_PROCESSOR_FRAGMENT\r
+ || processor == TGSI_PROCESSOR_VERTEX);\r
+\r
switch( file ) {\r
case TGSI_FILE_INPUT:\r
/*\r
/*\r
* Copy fragment z if the shader does not write it.\r
*/\r
+#if 0\r
if( !(program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) ) {\r
fullinst = tgsi_default_full_instruction();\r
\r
maxTokens - ti );\r
preamble_size++;\r
}\r
+#endif\r
\r
for( i = 0; i < program->Base.NumInstructions; i++ ) {\r
if( compile_instruction(\r