32
32
#include "nouveau_util.h"
33
33
#include "nv10_driver.h"
35
#define TX_GEN_MODE(i, j) (NV10TCL_TX_GEN_MODE_S(i) + 4 * (j))
36
#define TX_GEN_COEFF(i, j) (NV10TCL_TX_GEN_COEFF_S_A(i) + 16 * (j))
37
#define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i))
36
40
nv10_emit_tex_gen(GLcontext *ctx, int emit)
42
const int i = emit - NOUVEAU_STATE_TEX_GEN0;
43
struct nouveau_context *nctx = to_nouveau_context(ctx);
44
struct nouveau_channel *chan = context_chan(ctx);
45
struct nouveau_grobj *celsius = context_eng3d(ctx);
46
struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
49
for (j = 0; j < 4; j++) {
50
if (nctx->fallback == HWTNL && (unit->TexGenEnabled & 1 << j)) {
51
struct gl_texgen *coord = get_texgen_coord(unit, j);
52
float *k = get_texgen_coeff(coord);
55
BEGIN_RING(chan, celsius,
56
TX_GEN_COEFF(i, j), 4);
57
OUT_RINGp(chan, k, 4);
60
BEGIN_RING(chan, celsius, TX_GEN_MODE(i, j), 1);
61
OUT_RING(chan, nvgl_texgen_mode(coord->Mode));
64
BEGIN_RING(chan, celsius, TX_GEN_MODE(i, j), 1);
69
context_dirty_i(ctx, TEX_MAT, i);
73
nv10_emit_tex_mat(GLcontext *ctx, int emit)
75
const int i = emit - NOUVEAU_STATE_TEX_MAT0;
76
struct nouveau_context *nctx = to_nouveau_context(ctx);
77
struct nouveau_channel *chan = context_chan(ctx);
78
struct nouveau_grobj *celsius = context_eng3d(ctx);
80
if (nctx->fallback == HWTNL &&
81
((ctx->Texture._TexMatEnabled & 1 << i) ||
82
ctx->Texture.Unit[i]._GenFlags)) {
83
BEGIN_RING(chan, celsius, NV10TCL_TX_MATRIX_ENABLE(i), 1);
86
BEGIN_RING(chan, celsius, TX_MATRIX(i), 16);
87
OUT_RINGm(chan, ctx->TextureMatrixStack[i].Top->m);
90
BEGIN_RING(chan, celsius, NV10TCL_TX_MATRIX_ENABLE(i), 1);