uint16_t type, swizzle;
enum pipe_format format;
unsigned i;
+ int identity[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+ int* stream_tab;
+
+ /* If TCL is bypassed, map vertex streams to equivalent VS output
+ * locations. */
+ if (r300->rs_state->enable_vte) {
+ stream_tab = identity;
+ } else {
+ stream_tab = r300->vs->stream_loc_notcl;
+ }
/* Vertex shaders have no semantics on their inputs,
* so PSC should just route stuff based on the vertex elements,
format = r300->vertex_element[i].src_format;
type = r300_translate_vertex_data_type(format) |
- (i << R300_DST_VEC_LOC_SHIFT);
+ (stream_tab[i] << R300_DST_VEC_LOC_SHIFT);
swizzle = r300_translate_vertex_data_swizzle(format);
- if (i % 2) {
+ if (i & 1) {
vformat->vap_prog_stream_cntl[i >> 1] |= type << 16;
vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
} else {
}
}
-
assert(i <= 15);
/* Set the last vector in the PSC. */
uint16_t type, swizzle;
enum pipe_format format;
unsigned i, attrib_count;
- int* vs_output_tab = r300->vs->output_stream_loc_swtcl;
+ int* vs_output_tab = r300->vs->stream_loc_notcl;
/* For each Draw attribute, route it to the fragment shader according
* to the vs_output_tab. */
assert(gen_count <= 8);
}
-/* Set VS output stream locations for SWTCL. */
-static void r300_stream_locations_swtcl(
+/* Sets up stream mapping to equivalent VS outputs if TCL is bypassed
+ * or isn't present. */
+static void r300_stream_locations_notcl(
struct r300_shader_semantics* vs_outputs,
- int* output_stream_loc)
+ int* stream_loc)
{
int i, tabi = 0, gen_count;
- /* XXX Check whether the numbers (0, 1, 2+i, etc.) are correct.
- * These should go to VAP_PROG_STREAM_CNTL/DST_VEC_LOC. */
-
/* Position. */
- output_stream_loc[tabi++] = 0;
+ stream_loc[tabi++] = 0;
/* Point size. */
if (vs_outputs->psize != ATTR_UNUSED) {
- output_stream_loc[tabi++] = 1;
+ stream_loc[tabi++] = 1;
}
/* Colors. */
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
if (vs_outputs->color[i] != ATTR_UNUSED) {
- output_stream_loc[tabi++] = 2 + i;
+ stream_loc[tabi++] = 2 + i;
}
}
/* Back-face colors. */
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
if (vs_outputs->bcolor[i] != ATTR_UNUSED) {
- output_stream_loc[tabi++] = 4 + i;
+ stream_loc[tabi++] = 4 + i;
}
}
for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
if (vs_outputs->bcolor[i] != ATTR_UNUSED) {
assert(tabi < 16);
- output_stream_loc[tabi++] = 6 + gen_count;
+ stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
}
/* Fog coordinates. */
if (vs_outputs->fog != ATTR_UNUSED) {
assert(tabi < 16);
- output_stream_loc[tabi++] = 6 + gen_count;
+ stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
assert(gen_count <= 8);
for (; tabi < 16;) {
- output_stream_loc[tabi++] = -1;
+ stream_loc[tabi++] = -1;
}
}
/* Initialize. */
r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
r300_shader_vap_output_fmt(&vs->outputs, vs->hwfmt);
-
- if (!r300_screen(r300->context.screen)->caps->has_tcl) {
- r300_stream_locations_swtcl(&vs->outputs, vs->output_stream_loc_swtcl);
- }
+ r300_stream_locations_notcl(&vs->outputs, vs->stream_loc_notcl);
/* Setup the compiler */
rc_init(&compiler.Base);
/* Invoke the compiler */
r3xx_compile_vertex_program(&compiler);
if (compiler.Base.Error) {
- /* XXX Fail gracefully */
+ /* XXX We should fallback using Draw. */
fprintf(stderr, "r300 VP: Compiler error\n");
abort();
}