diff options
-rw-r--r-- | src/gallium/state_trackers/nine/nine_ff.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index d2b30f83a8f..2e3470f92ef 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -1377,11 +1377,13 @@ nine_ff_get_vs(struct NineDevice9 *device) struct vs_build_ctx bld; struct nine_ff_vs_key key; unsigned s, i; + char input_texture_coord[8]; assert(sizeof(key) <= sizeof(key.value32)); memset(&key, 0, sizeof(key)); memset(&bld, 0, sizeof(bld)); + memset(&input_texture_coord, 0, sizeof(input_texture_coord)); bld.key = &key; @@ -1399,6 +1401,13 @@ nine_ff_get_vs(struct NineDevice9 *device) key.color1in_one = 0; else if (usage == NINE_DECLUSAGE_PSIZE) key.vertexpointsize = 1; + else if (usage % NINE_DECLUSAGE_COUNT == NINE_DECLUSAGE_TEXCOORD) { + s = usage / NINE_DECLUSAGE_COUNT; + if (s < 8) + input_texture_coord[s] = 1; + else + DBG("FF given texture coordinate >= 8. Ignoring\n"); + } } } if (!key.vertexpointsize) @@ -1436,18 +1445,18 @@ nine_ff_get_vs(struct NineDevice9 *device) } for (s = 0; s < 8; ++s) { - if (state->ff.tex_stage[s][D3DTSS_COLOROP] == D3DTOP_DISABLE && - state->ff.tex_stage[s][D3DTSS_ALPHAOP] == D3DTOP_DISABLE) - break; + unsigned gen = (state->ff.tex_stage[s][D3DTSS_TEXCOORDINDEX] >> 16) + 1; + unsigned dim = MIN2(state->ff.tex_stage[s][D3DTSS_TEXTURETRANSFORMFLAGS] & 0x7, 4); + + if (key.position_t && gen > NINED3DTSS_TCI_PASSTHRU) + gen = NINED3DTSS_TCI_PASSTHRU; + + if (!input_texture_coord[s] && gen == NINED3DTSS_TCI_PASSTHRU) + gen = NINED3DTSS_TCI_DISABLE; + + key.tc_gen |= gen << (s * 3); key.tc_idx |= (state->ff.tex_stage[s][D3DTSS_TEXCOORDINDEX] & 7) << (s * 3); - if (!key.position_t) { - unsigned gen = (state->ff.tex_stage[s][D3DTSS_TEXCOORDINDEX] >> 16) + 1; - unsigned dim = MIN2(state->ff.tex_stage[s][D3DTSS_TEXTURETRANSFORMFLAGS] & 0x7, 4); - key.tc_gen |= gen << (s * 3); - key.tc_dim |= dim << (s * 3); - } else { - key.tc_gen |= NINED3DTSS_TCI_PASSTHRU << (s * 3); - } + key.tc_dim |= dim << (s * 3); } vs = util_hash_table_get(device->ff.ht_vs, &key); |