Clone of mesa.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

nv04_context.h 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #ifndef __NV04_CONTEXT_H__
  2. #define __NV04_CONTEXT_H__
  3. #include "pipe/p_context.h"
  4. #include "pipe/p_defines.h"
  5. #include "pipe/p_state.h"
  6. #include "pipe/p_compiler.h"
  7. #include "util/u_memory.h"
  8. #include "util/u_math.h"
  9. #include "draw/draw_vertex.h"
  10. #include "nouveau/nouveau_winsys.h"
  11. #include "nouveau/nouveau_gldefs.h"
  12. #define NOUVEAU_PUSH_CONTEXT(ctx) \
  13. struct nv04_screen *ctx = nv04->screen
  14. #include "nouveau/nouveau_push.h"
  15. #include "nv04_state.h"
  16. #define NOUVEAU_ERR(fmt, args...) \
  17. fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
  18. #define NOUVEAU_MSG(fmt, args...) \
  19. fprintf(stderr, "nouveau: "fmt, ##args);
  20. #include "nv04_screen.h"
  21. #define NV04_NEW_VERTPROG (1 << 1)
  22. #define NV04_NEW_FRAGPROG (1 << 2)
  23. #define NV04_NEW_BLEND (1 << 3)
  24. #define NV04_NEW_RAST (1 << 4)
  25. #define NV04_NEW_CONTROL (1 << 5)
  26. #define NV04_NEW_VIEWPORT (1 << 6)
  27. #define NV04_NEW_SAMPLER (1 << 7)
  28. #define NV04_NEW_FRAMEBUFFER (1 << 8)
  29. #define NV04_NEW_VTXARRAYS (1 << 9)
  30. struct nv04_context {
  31. struct pipe_context pipe;
  32. struct nouveau_winsys *nvws;
  33. struct nv04_screen *screen;
  34. unsigned pctx_id;
  35. struct draw_context *draw;
  36. int chipset;
  37. struct nouveau_notifier *sync;
  38. uint32_t dirty;
  39. struct nv04_blend_state *blend;
  40. struct nv04_sampler_state *sampler[PIPE_MAX_SAMPLERS];
  41. struct nv04_fragtex_state fragtex;
  42. struct nv04_rasterizer_state *rast;
  43. struct nv04_depth_stencil_alpha_state *dsa;
  44. struct nv04_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
  45. unsigned dirty_samplers;
  46. unsigned fp_samplers;
  47. unsigned vp_samplers;
  48. uint32_t rt_enable;
  49. struct pipe_framebuffer_state *framebuffer;
  50. struct pipe_surface *rt;
  51. struct pipe_surface *zeta;
  52. struct {
  53. struct pipe_buffer *buffer;
  54. uint32_t format;
  55. } tex[16];
  56. unsigned vb_enable;
  57. struct {
  58. struct pipe_buffer *buffer;
  59. unsigned delta;
  60. } vb[16];
  61. float *constbuf[PIPE_SHADER_TYPES][32][4];
  62. unsigned constbuf_nr[PIPE_SHADER_TYPES];
  63. struct vertex_info vertex_info;
  64. struct {
  65. struct nouveau_resource *exec_heap;
  66. struct nouveau_resource *data_heap;
  67. struct nv04_vertex_program *active;
  68. struct nv04_vertex_program *current;
  69. struct pipe_buffer *constant_buf;
  70. } vertprog;
  71. struct {
  72. struct nv04_fragment_program *active;
  73. struct nv04_fragment_program *current;
  74. struct pipe_buffer *constant_buf;
  75. } fragprog;
  76. struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
  77. struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
  78. struct pipe_viewport_state viewport;
  79. };
  80. static INLINE struct nv04_context *
  81. nv04_context(struct pipe_context *pipe)
  82. {
  83. return (struct nv04_context *)pipe;
  84. }
  85. extern void nv04_init_state_functions(struct nv04_context *nv04);
  86. extern void nv04_init_surface_functions(struct nv04_context *nv04);
  87. extern void nv04_screen_init_miptree_functions(struct pipe_screen *screen);
  88. /* nv04_clear.c */
  89. extern void nv04_clear(struct pipe_context *pipe, struct pipe_surface *ps,
  90. unsigned clearValue);
  91. /* nv04_draw.c */
  92. extern struct draw_stage *nv04_draw_render_stage(struct nv04_context *nv04);
  93. /* nv04_fragprog.c */
  94. extern void nv04_fragprog_bind(struct nv04_context *,
  95. struct nv04_fragment_program *);
  96. extern void nv04_fragprog_destroy(struct nv04_context *,
  97. struct nv04_fragment_program *);
  98. /* nv04_fragtex.c */
  99. extern void nv04_fragtex_bind(struct nv04_context *);
  100. /* nv04_prim_vbuf.c */
  101. struct draw_stage *nv04_draw_vbuf_stage( struct nv04_context *nv04 );
  102. /* nv04_state.c and friends */
  103. extern void nv04_emit_hw_state(struct nv04_context *nv04);
  104. extern void nv04_state_tex_update(struct nv04_context *nv04);
  105. /* nv04_vbo.c */
  106. extern boolean nv04_draw_arrays(struct pipe_context *, unsigned mode,
  107. unsigned start, unsigned count);
  108. extern boolean nv04_draw_elements( struct pipe_context *pipe,
  109. struct pipe_buffer *indexBuffer,
  110. unsigned indexSize,
  111. unsigned prim, unsigned start, unsigned count);
  112. #endif