summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_state_derived.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-04-11 08:28:39 +0200
committerMarek Olšák <maraeo@gmail.com>2010-04-11 10:15:50 +0200
commit146879284c6b844f35afe3a3ef3330726afbe8ac (patch)
tree92c54f39089b1dcc54d7b5916778c07e60c08472 /src/gallium/drivers/r300/r300_state_derived.c
parent08afcaa56e187cdd137a5c6581c265c1a0fc8d18 (diff)
r300g: revisit some assertions and fix potential failures
* 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.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_derived.c')
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 9496815383..10e854dac9 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -83,8 +83,10 @@ static void r300_draw_emit_all_attribs(struct r300_context* r300)
/* 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]);
@@ -93,13 +95,11 @@ static void r300_draw_emit_all_attribs(struct r300_context* r300)
}
/* 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. */
@@ -344,7 +344,7 @@ static void r300_update_rs_block(struct r300_context* r300,
/* 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);