Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nvfx_fragtex.c 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "nvfx_context.h"
  2. static boolean
  3. nvfx_fragtex_validate(struct nvfx_context *nvfx)
  4. {
  5. struct nvfx_fragment_program *fp = nvfx->fragprog;
  6. struct nvfx_state *state = &nvfx->state;
  7. struct nouveau_stateobj *so;
  8. unsigned samplers, unit;
  9. samplers = state->fp_samplers & ~fp->samplers;
  10. while (samplers) {
  11. unit = ffs(samplers) - 1;
  12. samplers &= ~(1 << unit);
  13. so = so_new(1, 1, 0);
  14. so_method(so, nvfx->screen->eng3d, NV34TCL_TX_ENABLE(unit), 1);
  15. so_data (so, 0);
  16. so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
  17. so_ref(NULL, &so);
  18. state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
  19. }
  20. samplers = nvfx->dirty_samplers & fp->samplers;
  21. while (samplers) {
  22. unit = ffs(samplers) - 1;
  23. samplers &= ~(1 << unit);
  24. if(!nvfx->is_nv4x)
  25. so = nv30_fragtex_build(nvfx, unit);
  26. else
  27. so = nv40_fragtex_build(nvfx, unit);
  28. so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
  29. so_ref(NULL, &so);
  30. state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
  31. }
  32. nvfx->state.fp_samplers = fp->samplers;
  33. return FALSE;
  34. }
  35. struct nvfx_state_entry nvfx_state_fragtex = {
  36. .validate = nvfx_fragtex_validate,
  37. .dirty = {
  38. .pipe = NVFX_NEW_SAMPLER | NVFX_NEW_FRAGPROG,
  39. .hw = 0
  40. }
  41. };