Go to the source code of this file.
Functions | |
static void | failover_destroy (struct pipe_context *pipe) |
static boolean | failover_draw_elements (struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned prim, unsigned start, unsigned count) |
static boolean | failover_draw_arrays (struct pipe_context *pipe, unsigned prim, unsigned start, unsigned count) |
struct pipe_context * | failover_create (struct pipe_context *hw, struct pipe_context *sw) |
struct pipe_context* failover_create | ( | struct pipe_context * | hw, | |
struct pipe_context * | sw | |||
) | [read] |
Definition at line 110 of file fo_context.c.
References pipe_context::begin_query, CALLOC_STRUCT, pipe_context::clear, pipe_context::destroy, failover_context::dirty, pipe_context::draw_arrays, pipe_context::draw_elements, pipe_context::end_query, failover_destroy(), failover_draw_arrays(), failover_draw_elements(), failover_init_state_functions(), pipe_context::flush, failover_context::hw, failover_context::pipe, pipe_context::screen, pipe_context::surface_copy, pipe_context::surface_fill, failover_context::sw, and pipe_context::winsys.
00112 { 00113 struct failover_context *failover = CALLOC_STRUCT(failover_context); 00114 if (failover == NULL) 00115 return NULL; 00116 00117 failover->hw = hw; 00118 failover->sw = sw; 00119 failover->pipe.winsys = hw->winsys; 00120 failover->pipe.screen = hw->screen; 00121 failover->pipe.destroy = failover_destroy; 00122 #if 0 00123 failover->pipe.is_format_supported = hw->is_format_supported; 00124 failover->pipe.get_name = hw->get_name; 00125 failover->pipe.get_vendor = hw->get_vendor; 00126 failover->pipe.get_param = hw->get_param; 00127 failover->pipe.get_paramf = hw->get_paramf; 00128 #endif 00129 00130 failover->pipe.draw_arrays = failover_draw_arrays; 00131 failover->pipe.draw_elements = failover_draw_elements; 00132 failover->pipe.clear = hw->clear; 00133 00134 /* No software occlusion fallback (or other optional functionality) 00135 * at this point - if the hardware doesn't support it, don't 00136 * advertise it to the application. 00137 */ 00138 failover->pipe.begin_query = hw->begin_query; 00139 failover->pipe.end_query = hw->end_query; 00140 00141 failover_init_state_functions( failover ); 00142 00143 failover->pipe.surface_copy = hw->surface_copy; 00144 failover->pipe.surface_fill = hw->surface_fill; 00145 00146 #if 0 00147 failover->pipe.texture_create = hw->texture_create; 00148 failover->pipe.texture_release = hw->texture_release; 00149 failover->pipe.get_tex_surface = hw->get_tex_surface; 00150 failover->pipe.texture_update = hw->texture_update; 00151 #endif 00152 00153 failover->pipe.flush = hw->flush; 00154 00155 failover->dirty = 0; 00156 00157 return &failover->pipe; 00158 }
static void failover_destroy | ( | struct pipe_context * | pipe | ) | [static] |
Definition at line 39 of file fo_context.c.
References failover_context().
00040 { 00041 struct failover_context *failover = failover_context( pipe ); 00042 00043 free( failover ); 00044 }
static boolean failover_draw_arrays | ( | struct pipe_context * | pipe, | |
unsigned | prim, | |||
unsigned | start, | |||
unsigned | count | |||
) | [static] |
Definition at line 102 of file fo_context.c.
References failover_draw_elements().
00104 { 00105 return failover_draw_elements(pipe, NULL, 0, prim, start, count); 00106 }
static boolean failover_draw_elements | ( | struct pipe_context * | pipe, | |
struct pipe_buffer * | indexBuffer, | |||
unsigned | indexSize, | |||
unsigned | prim, | |||
unsigned | start, | |||
unsigned | count | |||
) | [static] |
Definition at line 48 of file fo_context.c.
References failover_context::dirty, pipe_context::draw_elements, failover_context(), failover_state_emit(), pipe_context::flush, FO_HW, FO_SW, failover_context::hw, failover_context::mode, failover_context::sw, and TRUE.
00052 { 00053 struct failover_context *failover = failover_context( pipe ); 00054 00055 /* If there has been any statechange since last time, try hardware 00056 * rendering again: 00057 */ 00058 if (failover->dirty) { 00059 failover->mode = FO_HW; 00060 } 00061 00062 /* Try hardware: 00063 */ 00064 if (failover->mode == FO_HW) { 00065 if (!failover->hw->draw_elements( failover->hw, 00066 indexBuffer, 00067 indexSize, 00068 prim, 00069 start, 00070 count )) { 00071 00072 failover->hw->flush( failover->hw, ~0, NULL ); 00073 failover->mode = FO_SW; 00074 } 00075 } 00076 00077 /* Possibly try software: 00078 */ 00079 if (failover->mode == FO_SW) { 00080 00081 if (failover->dirty) 00082 failover_state_emit( failover ); 00083 00084 failover->sw->draw_elements( failover->sw, 00085 indexBuffer, 00086 indexSize, 00087 prim, 00088 start, 00089 count ); 00090 00091 /* Be ready to switch back to hardware rendering without an 00092 * intervening flush. Unlikely to be much performance impact to 00093 * this: 00094 */ 00095 failover->sw->flush( failover->sw, ~0, NULL ); 00096 } 00097 00098 return TRUE; 00099 }