- clipper->num_color_attribs = 0;
- for (i = 0; i < vs->info.num_outputs; i++) {
- if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
- vs->info.output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
- clipper->color_attribs[clipper->num_color_attribs++] = i;
- }
+ /* Then resolve the interpolation mode for every output attribute.
+ *
+ * Given how the rest of the code, the most efficient way is to
+ * have a vector of flat-mode attributes, and a mask for
+ * noperspective attributes.
+ */
+
+ clipper->num_flat_attribs = 0;
+ memset(clipper->noperspective_attribs, 0, sizeof(clipper->noperspective_attribs));
+ for (i = 0; i < vs->info.num_outputs; i++) {
+ /* Find the interpolation mode for a specific attribute
+ */
+ int interp;
+
+ /* If it's gl_{Front,Back}{,Secondary}Color, pick up the mode
+ * from the array we've filled before. */
+ if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_COLOR ||
+ vs->info.output_semantic_name[i] == TGSI_SEMANTIC_BCOLOR) {
+ interp = indexed_interp[vs->info.output_semantic_index[i]];
+ } else {
+ /* Otherwise, search in the FS inputs, with a decent default
+ * if we don't find it.
+ */
+ uint j;
+ interp = TGSI_INTERPOLATE_PERSPECTIVE;
+ if (fs) {
+ for (j = 0; j < fs->info.num_inputs; j++) {
+ if (vs->info.output_semantic_name[i] == fs->info.input_semantic_name[j] &&
+ vs->info.output_semantic_index[i] == fs->info.input_semantic_index[j]) {
+ interp = fs->info.input_interpolate[j];
+ break;
+ }
+ }
+ }