140
137
const union pipe_color_union *color)
142
139
struct pipe_context *pipe = st->pipe;
144
/* XXX: Need to improve buffer_write to allow NO_WAIT (as well as
145
* no_flush) updates to buffers where we know there is no conflict
146
* with previous data. Currently using max_slots > 1 will cause
147
* synchronous rendering if the driver flushes its command buffers
148
* between one bitmap and the next. Our flush hook below isn't
149
* sufficient to catch this as the driver doesn't tell us when it
150
* flushes its own command buffers. Until this gets fixed, pay the
151
* price of allocating a new buffer for each bitmap cache-flush to
152
* avoid synchronous rendering.
154
const GLuint max_slots = 1; /* 1024 / sizeof(st->clear.vertices); */
157
if (st->clear.vbuf_slot >= max_slots) {
158
pipe_resource_reference(&st->clear.vbuf, NULL);
159
st->clear.vbuf_slot = 0;
162
if (!st->clear.vbuf) {
163
st->clear.vbuf = pipe_buffer_create(pipe->screen,
164
PIPE_BIND_VERTEX_BUFFER,
166
max_slots * sizeof(st->clear.vertices));
169
if (!st->clear.vbuf) {
170
/* ran out of memory */
140
struct pipe_resource *vbuf = NULL;
142
float (*vertices)[2][4]; /**< vertex pos + color */
144
u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), &offset, &vbuf,
175
st->clear.vertices[0][0][0] = x0;
176
st->clear.vertices[0][0][1] = y0;
178
st->clear.vertices[1][0][0] = x1;
179
st->clear.vertices[1][0][1] = y0;
181
st->clear.vertices[2][0][0] = x1;
182
st->clear.vertices[2][0][1] = y1;
184
st->clear.vertices[3][0][0] = x0;
185
st->clear.vertices[3][0][1] = y1;
151
vertices[0][0][0] = x0;
152
vertices[0][0][1] = y0;
154
vertices[1][0][0] = x1;
155
vertices[1][0][1] = y0;
157
vertices[2][0][0] = x1;
158
vertices[2][0][1] = y1;
160
vertices[3][0][0] = x0;
161
vertices[3][0][1] = y1;
187
163
/* same for all verts: */
188
164
for (i = 0; i < 4; i++) {
189
st->clear.vertices[i][0][2] = z;
190
st->clear.vertices[i][0][3] = 1.0;
191
st->clear.vertices[i][1][0] = color->f[0];
192
st->clear.vertices[i][1][1] = color->f[1];
193
st->clear.vertices[i][1][2] = color->f[2];
194
st->clear.vertices[i][1][3] = color->f[3];
165
vertices[i][0][2] = z;
166
vertices[i][0][3] = 1.0;
167
vertices[i][1][0] = color->f[0];
168
vertices[i][1][1] = color->f[1];
169
vertices[i][1][2] = color->f[2];
170
vertices[i][1][3] = color->f[3];
197
/* put vertex data into vbuf */
198
pipe_buffer_write_nooverlap(st->pipe, st->clear.vbuf,
200
* sizeof(st->clear.vertices),
201
sizeof(st->clear.vertices),
173
u_upload_unmap(st->uploader);
205
176
util_draw_vertex_buffer(pipe,
208
st->clear.vbuf_slot * sizeof(st->clear.vertices),
209
179
PIPE_PRIM_TRIANGLE_FAN,
211
181
2); /* attribs/vert */
214
st->clear.vbuf_slot++;
183
pipe_resource_reference(&vbuf, NULL);
309
279
cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw);
310
280
cso_set_stream_outputs(st->cso_context, 0, NULL, 0);
281
cso_set_sample_mask(st->cso_context, ~0);
312
282
cso_set_rasterizer(st->cso_context, &st->clear.raster);
314
284
/* viewport state: viewport matching window dims */
388
359
GLboolean maskStencil
389
360
= (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
391
assert(rb->Format == MESA_FORMAT_S8 ||
392
rb->Format == MESA_FORMAT_Z24_S8 ||
393
rb->Format == MESA_FORMAT_S8_Z24 ||
394
rb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
362
assert(_mesa_get_format_bits(rb->Format, GL_STENCIL_BITS) > 0);
396
364
if (ctx->Scissor.Enabled &&
397
365
(ctx->Scissor.X != 0 ||
444
412
const GLboolean maskStencil
445
413
= (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
447
assert(rb->Format == MESA_FORMAT_S8 ||
448
rb->Format == MESA_FORMAT_Z24_S8 ||
449
rb->Format == MESA_FORMAT_S8_Z24 ||
450
rb->Format == MESA_FORMAT_Z32_FLOAT_X24S8);
415
assert(_mesa_get_format_bits(rb->Format, GL_STENCIL_BITS) > 0);