1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
36 #include "pipe/p_inlines.h"
37 #include "util/u_memory.h"
38 #include "cell/common.h"
39 #include "cell_clear.h"
40 #include "cell_context.h"
41 #include "cell_batch.h"
42 #include "cell_flush.h"
44 #include "cell_state.h"
48 cell_clear_surface(struct pipe_context
*pipe
, struct pipe_surface
*ps
,
51 struct pipe_screen
*screen
= pipe
->screen
;
52 struct cell_context
*cell
= cell_context(pipe
);
56 cell_update_derived(cell
);
59 if (!cell
->cbuf_map
[0])
60 cell
->cbuf_map
[0] = screen
->surface_map(screen
, ps
,
61 PIPE_BUFFER_USAGE_GPU_WRITE
);
63 if (ps
== cell
->framebuffer
.zsbuf
) {
72 struct cell_command_clear_surface
*clr
73 = (struct cell_command_clear_surface
*)
74 cell_batch_alloc(cell
, sizeof(*clr
));
75 clr
->opcode
= CELL_CMD_CLEAR_SURFACE
;
76 clr
->surface
= surfIndex
;
77 clr
->value
= clearValue
;