* Turn some assertions to error messages.
* At most 16 vertex elements can be set, others are ignored.
* Rasterize at most 8 vertex-shader generic outputs, others are ignored.
This includes fog and WPOS.
* Unknown shader semantic names are ignored.
r300->dirty_state &= ~R300_NEW_VERTEX_SHADER_CONSTANTS;
}
- /* XXX
- assert(r300->dirty_state == 0);
- */
-
/* Emit the VBO for SWTCL. */
if (!r300screen->caps.has_tcl) {
r300_emit_vertex_buffer(r300);
break;
default:
- assert(0);
+ fprintf(stderr, "r300: FP: Unknown input semantic: %i\n",
+ info->input_semantic_name[i]);
}
}
}
CS_LOCALS(r300);
if (alt_num_verts) {
- assert(count < (1 << 24));
+ if (count >= (1 << 24)) {
+ fprintf(stderr, "r300: Got a huge number of vertices: %i, "
+ "refusing to render.\n", count);
+ return;
+ }
BEGIN_CS(9);
OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
} else {
#endif
CS_LOCALS(r300);
- assert(count < (1 << 24));
+ if (count >= (1 << 24)) {
+ fprintf(stderr, "r300: Got a huge number of vertices: %i, "
+ "refusing to render.\n", count);
+ return;
+ }
maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index);
if (buffers[i].buffer) {
if (buffers[i].stride % 4 != 0) {
// XXX Shouldn't we align the buffer?
- fprintf(stderr, "r300_set_vertex_buffers: "
+ fprintf(stderr, "r300: set_vertex_buffers: "
"Unaligned buffer stride %i isn't supported.\n",
buffers[i].stride);
- assert(0);
abort();
}
}
enum pipe_format format;
unsigned i;
- assert(velems->count <= 16);
+ if (velems->count > 16) {
+ fprintf(stderr, "r300: More than 16 vertex elements are not supported,"
+ " requested %i, using 16.\n", velems->count);
+ velems->count = 16;
+ }
/* Vertex shaders have no semantics on their inputs,
* so PSC should just route stuff based on the vertex elements,
/* XXX Back-face colors. */
/* Texture coordinates. */
+ /* Only 8 generic vertex attributes can be used. If there are more,
+ * they won't be rasterized. */
gen_count = 0;
- for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
+ for (i = 0; i < ATTR_GENERIC_COUNT && gen_count < 8; i++) {
if (vs_outputs->generic[i] != ATTR_UNUSED) {
r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE,
vs_outputs->generic[i]);
}
/* Fog coordinates. */
- if (vs_outputs->fog != ATTR_UNUSED) {
+ if (gen_count < 8 && vs_outputs->fog != ATTR_UNUSED) {
r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE,
vs_outputs->fog);
gen_count++;
}
-
- assert(gen_count <= 8);
}
/* Update the PSC tables for SW TCL, using Draw. */
/* Rasterize WPOS. */
/* If the FS doesn't need it, it's not written by the VS. */
- if (fs_inputs->wpos != ATTR_UNUSED) {
+ if (vs_outputs->wpos != ATTR_UNUSED && fs_inputs->wpos != ATTR_UNUSED) {
rX00_rs_tex(&rs, tex_count, tex_count, FALSE);
rX00_rs_tex_write(&rs, tex_count, fp_offset);
case TGSI_SEMANTIC_EDGEFLAG:
assert(index == 0);
- fprintf(stderr, "r300 VP: cannot handle edgeflag output\n");
- assert(0);
+ fprintf(stderr, "r300 VP: cannot handle edgeflag output.\n");
break;
+
default:
- assert(0);
+ fprintf(stderr, "r300 VP: unknown vertex output semantic: %i.\n",
+ info->output_semantic_name[i]);
}
}
/* Texture coordinates. */
gen_count = 0;
- for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
+ for (i = 0; i < ATTR_GENERIC_COUNT && gen_count < 8; i++) {
if (vs_outputs->generic[i] != ATTR_UNUSED) {
vap_out->vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << gen_count);
vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * gen_count));
- assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
}
/* Fog coordinates. */
- if (vs_outputs->fog != ATTR_UNUSED) {
+ if (gen_count < 8 && vs_outputs->fog != ATTR_UNUSED) {
vap_out->vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << gen_count);
vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * gen_count));
- assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
- assert(gen_count <= 8);
-
/* WPOS. */
- vs->wpos_tex_output = gen_count;
-
- assert(tabi < 16);
- stream_loc[tabi++] = 6 + gen_count;
+ if (gen_count < 8) {
+ vs->wpos_tex_output = gen_count;
+ stream_loc[tabi++] = 6 + gen_count;
+ } else {
+ vs_outputs->wpos = ATTR_UNUSED;
+ }
for (; tabi < 16;) {
stream_loc[tabi++] = -1;
compiler.SetHwInputOutput = &set_vertex_inputs_outputs;
/* Insert the WPOS output. */
- rc_copy_output(&compiler.Base, 0, vs->outputs.wpos);
+ if (vs->outputs.wpos != ATTR_UNUSED) {
+ rc_copy_output(&compiler.Base, 0, vs->outputs.wpos);
+ }
/* Invoke the compiler */
r3xx_compile_vertex_program(&compiler);
int tex_output = vs->wpos_tex_output;
uint32_t tex_fmt = R300_INPUT_CNTL_TC0 << tex_output;
+ if (vs->outputs.wpos == ATTR_UNUSED) {
+ return FALSE;
+ }
+
if (r300->fs->inputs.wpos != ATTR_UNUSED) {
/* Enable WPOS in VAP. */
if (!(vap_out->vap_vsm_vtx_assm & tex_fmt)) {
vap_out->vap_vsm_vtx_assm |= tex_fmt;
vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * tex_output));
-
- assert(tex_output < 8);
return TRUE;
}
} else {