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.

fo_context.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. /* Authors: Keith Whitwell <keith@tungstengraphics.com>
  28. */
  29. #ifndef FO_CONTEXT_H
  30. #define FO_CONTEXT_H
  31. #include "pipe/p_state.h"
  32. #include "pipe/p_context.h"
  33. #define FO_NEW_VIEWPORT 0x1
  34. #define FO_NEW_RASTERIZER 0x2
  35. #define FO_NEW_FRAGMENT_SHADER 0x4
  36. #define FO_NEW_BLEND 0x8
  37. #define FO_NEW_CLIP 0x10
  38. #define FO_NEW_SCISSOR 0x20
  39. #define FO_NEW_STIPPLE 0x40
  40. #define FO_NEW_FRAMEBUFFER 0x80
  41. #define FO_NEW_ALPHA_TEST 0x100
  42. #define FO_NEW_DEPTH_STENCIL 0x200
  43. #define FO_NEW_SAMPLER 0x400
  44. #define FO_NEW_TEXTURE 0x800
  45. #define FO_NEW_VERTEX 0x2000
  46. #define FO_NEW_VERTEX_SHADER 0x4000
  47. #define FO_NEW_BLEND_COLOR 0x8000
  48. #define FO_NEW_CLEAR_COLOR 0x10000
  49. #define FO_NEW_VERTEX_BUFFER 0x20000
  50. #define FO_NEW_VERTEX_ELEMENT 0x40000
  51. #define FO_HW 0
  52. #define FO_SW 1
  53. struct fo_state {
  54. void *sw_state;
  55. void *hw_state;
  56. };
  57. struct failover_context {
  58. struct pipe_context pipe; /**< base class */
  59. /* The most recent drawing state as set by the driver:
  60. */
  61. const struct fo_state *blend;
  62. const struct fo_state *sampler[PIPE_MAX_SAMPLERS];
  63. const struct fo_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
  64. const struct fo_state *depth_stencil;
  65. const struct fo_state *rasterizer;
  66. const struct fo_state *fragment_shader;
  67. const struct fo_state *vertex_shader;
  68. struct pipe_blend_color blend_color;
  69. struct pipe_clip_state clip;
  70. struct pipe_framebuffer_state framebuffer;
  71. struct pipe_poly_stipple poly_stipple;
  72. struct pipe_scissor_state scissor;
  73. struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
  74. struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
  75. struct pipe_viewport_state viewport;
  76. struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
  77. struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
  78. uint num_vertex_buffers;
  79. uint num_vertex_elements;
  80. void *sw_sampler_state[PIPE_MAX_SAMPLERS];
  81. void *hw_sampler_state[PIPE_MAX_SAMPLERS];
  82. void *sw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS];
  83. void *hw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS];
  84. unsigned dirty;
  85. unsigned num_samplers;
  86. unsigned num_vertex_samplers;
  87. unsigned num_textures;
  88. unsigned num_vertex_textures;
  89. unsigned mode;
  90. struct pipe_context *hw;
  91. struct pipe_context *sw;
  92. };
  93. void failover_init_state_functions( struct failover_context *failover );
  94. void failover_state_emit( struct failover_context *failover );
  95. static INLINE struct failover_context *
  96. failover_context( struct pipe_context *pipe )
  97. {
  98. return (struct failover_context *)pipe;
  99. }
  100. /* Internal functions
  101. */
  102. void
  103. failover_set_constant_buffer(struct pipe_context *pipe,
  104. uint shader, uint index,
  105. struct pipe_buffer *buf);
  106. #endif /* FO_CONTEXT_H */