1 #include "nvfx_context.h"
4 nvfx_fragtex_validate(struct nvfx_context
*nvfx
)
6 struct nvfx_fragment_program
*fp
= nvfx
->fragprog
;
7 struct nvfx_state
*state
= &nvfx
->state
;
8 struct nouveau_stateobj
*so
;
9 unsigned samplers
, unit
;
11 samplers
= state
->fp_samplers
& ~fp
->samplers
;
13 unit
= ffs(samplers
) - 1;
14 samplers
&= ~(1 << unit
);
17 so_method(so
, nvfx
->screen
->eng3d
, NV34TCL_TX_ENABLE(unit
), 1);
19 so_ref(so
, &nvfx
->state
.hw
[NVFX_STATE_FRAGTEX0
+ unit
]);
21 state
->dirty
|= (1ULL << (NVFX_STATE_FRAGTEX0
+ unit
));
24 samplers
= nvfx
->dirty_samplers
& fp
->samplers
;
26 unit
= ffs(samplers
) - 1;
27 samplers
&= ~(1 << unit
);
30 so
= nv30_fragtex_build(nvfx
, unit
);
32 so
= nv40_fragtex_build(nvfx
, unit
);
34 so_ref(so
, &nvfx
->state
.hw
[NVFX_STATE_FRAGTEX0
+ unit
]);
36 state
->dirty
|= (1ULL << (NVFX_STATE_FRAGTEX0
+ unit
));
39 nvfx
->state
.fp_samplers
= fp
->samplers
;
43 struct nvfx_state_entry nvfx_state_fragtex
= {
44 .validate
= nvfx_fragtex_validate
,
46 .pipe
= NVFX_NEW_SAMPLER
| NVFX_NEW_FRAGPROG
,