Clone of mesa.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

p_context.h 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /**************************************************************************
  2. *
  3. * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial portions
  16. * of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  21. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
  22. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. **************************************************************************/
  27. #ifndef PIPE_CONTEXT_H
  28. #define PIPE_CONTEXT_H
  29. #include "p_state.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. struct pipe_screen;
  34. struct pipe_fence_handle;
  35. struct pipe_state_cache;
  36. struct pipe_query;
  37. struct pipe_winsys;
  38. /**
  39. * Gallium rendering context. Basically:
  40. * - state setting functions
  41. * - VBO drawing functions
  42. * - surface functions
  43. */
  44. struct pipe_context {
  45. struct pipe_winsys *winsys;
  46. struct pipe_screen *screen;
  47. void *priv; /**< context private data (for DRI for example) */
  48. void *draw; /**< private, for draw module (temporary?) */
  49. void (*destroy)( struct pipe_context * );
  50. /* Possible interface for setting edgeflags. These aren't really
  51. * vertex elements, so don't fit there.
  52. */
  53. void (*set_edgeflags)( struct pipe_context *,
  54. const unsigned *bitfield );
  55. /**
  56. * VBO drawing (return false on fallbacks (temporary??))
  57. */
  58. /*@{*/
  59. boolean (*draw_arrays)( struct pipe_context *pipe,
  60. unsigned mode, unsigned start, unsigned count);
  61. boolean (*draw_elements)( struct pipe_context *pipe,
  62. struct pipe_buffer *indexBuffer,
  63. unsigned indexSize,
  64. unsigned mode, unsigned start, unsigned count);
  65. /* XXX: this is (probably) a temporary entrypoint, as the range
  66. * information should be available from the vertex_buffer state.
  67. * Using this to quickly evaluate a specialized path in the draw
  68. * module.
  69. */
  70. boolean (*draw_range_elements)( struct pipe_context *pipe,
  71. struct pipe_buffer *indexBuffer,
  72. unsigned indexSize,
  73. unsigned minIndex,
  74. unsigned maxIndex,
  75. unsigned mode,
  76. unsigned start,
  77. unsigned count);
  78. /*@}*/
  79. /**
  80. * Query objects
  81. */
  82. /*@{*/
  83. struct pipe_query *(*create_query)( struct pipe_context *pipe,
  84. unsigned query_type );
  85. void (*destroy_query)(struct pipe_context *pipe,
  86. struct pipe_query *q);
  87. void (*begin_query)(struct pipe_context *pipe, struct pipe_query *q);
  88. void (*end_query)(struct pipe_context *pipe, struct pipe_query *q);
  89. boolean (*get_query_result)(struct pipe_context *pipe,
  90. struct pipe_query *q,
  91. boolean wait,
  92. uint64_t *result);
  93. /*@}*/
  94. /**
  95. * State functions (create/bind/destroy state objects)
  96. */
  97. /*@{*/
  98. void * (*create_blend_state)(struct pipe_context *,
  99. const struct pipe_blend_state *);
  100. void (*bind_blend_state)(struct pipe_context *, void *);
  101. void (*delete_blend_state)(struct pipe_context *, void *);
  102. void * (*create_sampler_state)(struct pipe_context *,
  103. const struct pipe_sampler_state *);
  104. void (*bind_sampler_states)(struct pipe_context *, unsigned num, void **);
  105. void (*delete_sampler_state)(struct pipe_context *, void *);
  106. void * (*create_rasterizer_state)(struct pipe_context *,
  107. const struct pipe_rasterizer_state *);
  108. void (*bind_rasterizer_state)(struct pipe_context *, void *);
  109. void (*delete_rasterizer_state)(struct pipe_context *, void *);
  110. void * (*create_depth_stencil_alpha_state)(struct pipe_context *,
  111. const struct pipe_depth_stencil_alpha_state *);
  112. void (*bind_depth_stencil_alpha_state)(struct pipe_context *, void *);
  113. void (*delete_depth_stencil_alpha_state)(struct pipe_context *, void *);
  114. void * (*create_fs_state)(struct pipe_context *,
  115. const struct pipe_shader_state *);
  116. void (*bind_fs_state)(struct pipe_context *, void *);
  117. void (*delete_fs_state)(struct pipe_context *, void *);
  118. void * (*create_vs_state)(struct pipe_context *,
  119. const struct pipe_shader_state *);
  120. void (*bind_vs_state)(struct pipe_context *, void *);
  121. void (*delete_vs_state)(struct pipe_context *, void *);
  122. /*@}*/
  123. /**
  124. * Parameter-like state (or properties)
  125. */
  126. /*@{*/
  127. void (*set_blend_color)( struct pipe_context *,
  128. const struct pipe_blend_color * );
  129. void (*set_clip_state)( struct pipe_context *,
  130. const struct pipe_clip_state * );
  131. void (*set_constant_buffer)( struct pipe_context *,
  132. uint shader, uint index,
  133. const struct pipe_constant_buffer *buf );
  134. void (*set_framebuffer_state)( struct pipe_context *,
  135. const struct pipe_framebuffer_state * );
  136. void (*set_polygon_stipple)( struct pipe_context *,
  137. const struct pipe_poly_stipple * );
  138. void (*set_scissor_state)( struct pipe_context *,
  139. const struct pipe_scissor_state * );
  140. void (*set_viewport_state)( struct pipe_context *,
  141. const struct pipe_viewport_state * );
  142. void (*set_sampler_textures)( struct pipe_context *,
  143. unsigned num_textures,
  144. struct pipe_texture ** );
  145. void (*set_vertex_buffers)( struct pipe_context *,
  146. unsigned num_buffers,
  147. const struct pipe_vertex_buffer * );
  148. void (*set_vertex_elements)( struct pipe_context *,
  149. unsigned num_elements,
  150. const struct pipe_vertex_element * );
  151. /*@}*/
  152. /**
  153. * Surface functions
  154. */
  155. /*@{*/
  156. void (*surface_copy)(struct pipe_context *pipe,
  157. struct pipe_surface *dest,
  158. unsigned destx, unsigned desty,
  159. struct pipe_surface *src, /* don't make this const -
  160. need to map/unmap */
  161. unsigned srcx, unsigned srcy,
  162. unsigned width, unsigned height);
  163. void (*surface_fill)(struct pipe_context *pipe,
  164. struct pipe_surface *dst,
  165. unsigned dstx, unsigned dsty,
  166. unsigned width, unsigned height,
  167. unsigned value);
  168. void (*clear)(struct pipe_context *pipe,
  169. struct pipe_surface *ps,
  170. unsigned clearValue);
  171. /*@}*/
  172. /** Flush rendering (flags = bitmask of PIPE_FLUSH_x tokens) */
  173. void (*flush)( struct pipe_context *pipe,
  174. unsigned flags,
  175. struct pipe_fence_handle **fence );
  176. };
  177. #ifdef __cplusplus
  178. }
  179. #endif
  180. #endif /* PIPE_CONTEXT_H */