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.

nv40_state_viewport.c 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #include "nv40_context.h"
  2. static boolean
  3. nv40_state_viewport_validate(struct nv40_context *nv40)
  4. {
  5. struct pipe_viewport_state *vpt = &nv40->viewport;
  6. struct nouveau_stateobj *so;
  7. unsigned bypass;
  8. if (nv40->render_mode == HW && !nv40->rasterizer->pipe.bypass_clipping)
  9. bypass = 0;
  10. else
  11. bypass = 1;
  12. if (nv40->state.hw[NV40_STATE_VIEWPORT] &&
  13. (bypass || !(nv40->dirty & NV40_NEW_VIEWPORT)) &&
  14. nv40->state.viewport_bypass == bypass)
  15. return FALSE;
  16. nv40->state.viewport_bypass = bypass;
  17. so = so_new(11, 0);
  18. if (!bypass) {
  19. so_method(so, nv40->screen->curie,
  20. NV40TCL_VIEWPORT_TRANSLATE_X, 8);
  21. so_data (so, fui(vpt->translate[0]));
  22. so_data (so, fui(vpt->translate[1]));
  23. so_data (so, fui(vpt->translate[2]));
  24. so_data (so, fui(vpt->translate[3]));
  25. so_data (so, fui(vpt->scale[0]));
  26. so_data (so, fui(vpt->scale[1]));
  27. so_data (so, fui(vpt->scale[2]));
  28. so_data (so, fui(vpt->scale[3]));
  29. so_method(so, nv40->screen->curie, 0x1d78, 1);
  30. so_data (so, 1);
  31. } else {
  32. so_method(so, nv40->screen->curie,
  33. NV40TCL_VIEWPORT_TRANSLATE_X, 8);
  34. so_data (so, fui(0.0));
  35. so_data (so, fui(0.0));
  36. so_data (so, fui(0.0));
  37. so_data (so, fui(0.0));
  38. so_data (so, fui(1.0));
  39. so_data (so, fui(1.0));
  40. so_data (so, fui(1.0));
  41. so_data (so, fui(0.0));
  42. /* Not entirely certain what this is yet. The DDX uses this
  43. * value also as it fixes rendering when you pass
  44. * pre-transformed vertices to the GPU. My best gusss is that
  45. * this bypasses some culling/clipping stage. Might be worth
  46. * noting that points/lines are uneffected by whatever this
  47. * value fixes, only filled polygons are effected.
  48. */
  49. so_method(so, nv40->screen->curie, 0x1d78, 1);
  50. so_data (so, 0x110);
  51. }
  52. so_ref(so, &nv40->state.hw[NV40_STATE_VIEWPORT]);
  53. so_ref(NULL, &so);
  54. return TRUE;
  55. }
  56. struct nv40_state_entry nv40_state_viewport = {
  57. .validate = nv40_state_viewport_validate,
  58. .dirty = {
  59. .pipe = NV40_NEW_VIEWPORT | NV40_NEW_RAST,
  60. .hw = NV40_STATE_VIEWPORT
  61. }
  62. };