Go to the source code of this file.
Functions | |
void | cell_clear_surface (struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue) |
Called via pipe->clear(). |
void cell_clear_surface | ( | struct pipe_context * | pipe, | |
struct pipe_surface * | ps, | |||
unsigned | clearValue | |||
) |
Called via pipe->clear().
Definition at line 70 of file cell_clear.c.
References cell_context::cbuf_map, cell_batch_alloc(), CELL_CMD_CLEAR_SURFACE, cell_context(), cell_update_derived(), convert_color(), cell_context::dirty, pipe_surface::format, cell_context::framebuffer, cell_command_clear_surface::opcode, PIPE_BUFFER_USAGE_GPU_WRITE, PIPE_FORMAT_A8R8G8B8_UNORM, pipe_context::screen, cell_command_clear_surface::surface, pipe_screen::surface_map, cell_command_clear_surface::value, and pipe_framebuffer_state::zsbuf.
00072 { 00073 struct pipe_screen *screen = pipe->screen; 00074 struct cell_context *cell = cell_context(pipe); 00075 uint surfIndex; 00076 00077 if (cell->dirty) 00078 cell_update_derived(cell); 00079 00080 00081 if (!cell->cbuf_map[0]) 00082 cell->cbuf_map[0] = screen->surface_map(screen, ps, 00083 PIPE_BUFFER_USAGE_GPU_WRITE); 00084 00085 if (ps == cell->framebuffer.zsbuf) { 00086 /* clear z/stencil buffer */ 00087 surfIndex = 1; 00088 } 00089 else { 00090 /* clear color buffer */ 00091 surfIndex = 0; 00092 00093 if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) { 00094 clearValue = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue, 00095 ps->format); 00096 } 00097 } 00098 00099 00100 /* Build a CLEAR command and place it in the current batch buffer */ 00101 { 00102 struct cell_command_clear_surface *clr 00103 = (struct cell_command_clear_surface *) 00104 cell_batch_alloc(cell, sizeof(*clr)); 00105 clr->opcode = CELL_CMD_CLEAR_SURFACE; 00106 clr->surface = surfIndex; 00107 clr->value = clearValue; 00108 } 00109 }