diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-03-18 14:18:55 +0100 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2010-03-18 15:02:36 +0100 |
commit | c944fb5ffe7cf16154d6395001f43a6c965cab1f (patch) | |
tree | a0533cefa8ebf06d2ecdc528ad930dd89ab7a8fb /src/mesa/drivers/dri/nouveau/nv10_state_tex.c | |
parent | 1a812ab57a71d16e45ca44de7ae0570d2bd46674 (diff) | |
download | external_mesa3d-c944fb5ffe7cf16154d6395001f43a6c965cab1f.zip external_mesa3d-c944fb5ffe7cf16154d6395001f43a6c965cab1f.tar.gz external_mesa3d-c944fb5ffe7cf16154d6395001f43a6c965cab1f.tar.bz2 |
dri/nouveau: Implement texcoord generation.
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nv10_state_tex.c')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv10_state_tex.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c index 9214872..35f41d7 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c @@ -32,11 +32,44 @@ #include "nouveau_util.h" #include "nv10_driver.h" +#define TX_GEN_MODE(i, j) (NV10TCL_TX_GEN_MODE_S(i) + 4 * (j)) +#define TX_GEN_COEFF(i, j) (NV10TCL_TX_GEN_COEFF_S_A(i) + 16 * (j)) #define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i)) void nv10_emit_tex_gen(GLcontext *ctx, int emit) { + const int i = emit - NOUVEAU_STATE_TEX_GEN0; + struct nouveau_context *nctx = to_nouveau_context(ctx); + struct nouveau_channel *chan = context_chan(ctx); + struct nouveau_grobj *celsius = context_eng3d(ctx); + struct gl_texture_unit *unit = &ctx->Texture.Unit[i]; + int j; + + for (j = 0; j < 4; j++) { + if (nctx->fallback == HWTNL && (unit->TexGenEnabled & 1 << j)) { + struct gl_texgen *coord = get_texgen_coord(unit, j); + float *k = get_texgen_coeff(coord); + + if (k) { + BEGIN_RING(chan, celsius, + TX_GEN_COEFF(i, j), 4); + OUT_RINGf(chan, k[0]); + OUT_RINGf(chan, k[1]); + OUT_RINGf(chan, k[2]); + OUT_RINGf(chan, k[3]); + } + + BEGIN_RING(chan, celsius, TX_GEN_MODE(i, j), 1); + OUT_RING(chan, nvgl_texgen_mode(coord->Mode)); + + } else { + BEGIN_RING(chan, celsius, TX_GEN_MODE(i, j), 1); + OUT_RING(chan, 0); + } + } + + context_dirty_i(ctx, TEX_MAT, i); } void |