Files
third_party_mesa3d/src/mesa/state_tracker/st_cb_clear.c

526 lines
16 KiB
C
Raw Normal View History

/**************************************************************************
*
* Copyright 2007 VMware, Inc.
* All Rights Reserved.
* Copyright 2009 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keithw@vmware.com>
* Brian Paul
* Michel Dänzer
*/
#include "main/glheader.h"
#include "main/accum.h"
#include "main/formats.h"
#include "main/macros.h"
#include "main/glformats.h"
#include "program/prog_instruction.h"
2007-08-02 10:29:42 -06:00
#include "st_context.h"
2008-05-02 10:08:03 +00:00
#include "st_atom.h"
2007-08-02 10:29:42 -06:00
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
#include "st_format.h"
#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/p_state.h"
2007-08-02 10:29:42 -06:00
#include "pipe/p_defines.h"
#include "util/u_format.h"
#include "util/u_framebuffer.h"
#include "util/u_inlines.h"
#include "util/u_simple_shaders.h"
#include "util/u_draw_quad.h"
#include "util/u_upload_mgr.h"
#include "cso_cache/cso_context.h"
/**
* Do per-context initialization for glClear.
*/
void
st_init_clear(struct st_context *st)
{
memset(&st->clear, 0, sizeof(st->clear));
st->clear.raster.half_pixel_center = 1;
st->clear.raster.bottom_edge_rule = 1;
Squash-merge branch 'gallium-clip-state' Conflicts: src/gallium/auxiliary/tgsi/tgsi_strings.c src/mesa/state_tracker/st_atom_clip.c commit d919791f2742e913173d6b335128e7d4c63c0840 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Fri Jan 6 17:59:22 2012 +0100 d3d1x: adapt to new clip state commit cfec82bca3fefcdefafca3f4555285ec1d1ae421 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Fri Jan 6 14:16:51 2012 +0100 gallium/docs: update for clip state changes commit c02bfeb81ad9f62041a2285ea6373bbbd602912a Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Fri Jan 6 14:21:43 2012 +0100 tgsi: add TGSI_PROPERTY_PROHIBIT_UCPS commit d4e0a785a6a23ad2f6819fd72e236acb9750028d Author: Brian Paul <brianp@vmware.com> Date: Thu Jan 5 08:30:00 2012 -0700 tgsi: consolidate TGSI string arrays in new tgsi_strings.h There was some duplication between the tgsi_dump.c and tgsi_text.c files. Also use some static assertions to help catch errors when adding new TGSI values. v2: put strings in tgsi_strings.c file instead of the .h file. Reviewed-by: Dave Airlie <airlied@redhat.com> commit c28584ce0d8c62bd92c8f140729d344f88a0b3cd Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Fri Jan 6 12:48:09 2012 +0100 gallium: extend user_clip_plane_enable to apply to clip distances commit f1d5016c07f786229ed057effbe55fbfd160b019 Author: Marek Olšák <maraeo@gmail.com> Date: Fri Jan 6 02:39:09 2012 +0100 nvfx: adapt to new clip state commit 6f6fa1c26bd19f797c1996731708e3569c9bfe24 Author: Marek Olšák <maraeo@gmail.com> Date: Fri Jan 6 01:41:39 2012 +0100 st/mesa: fix DrawPixels with GL_DEPTH_CLAMP commit c86ad730aa1c017788ae88a55f54071bf222be12 Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Tue Jan 3 23:51:30 2012 +0100 nv50: adapt to new clip state commit 3a8ae6ac243bae5970729dc4057fe02d992543dc Author: Christoph Bumiller <e0425955@student.tuwien.ac.at> Date: Tue Jan 3 23:32:36 2012 +0100 nvc0: adapt to new clip state commit 6243a8246997f8d2fcc69ab741a2c2dea080ff11 Author: Marek Olšák <maraeo@gmail.com> Date: Thu Dec 29 01:32:51 2011 +0100 draw: initalize pt.user.planes in draw_init This fixes a crash in glean/fpexceptions. commit e3056524b19b56d473f4faff84ffa0eb41497408 Author: Marek Olšák <maraeo@gmail.com> Date: Mon Dec 26 06:26:55 2011 +0100 svga: adapt to new clip state commit c5bfa8b37d6d489271df457229081d6bbb51b4b7 Author: Marek Olšák <maraeo@gmail.com> Date: Sun Dec 25 14:11:51 2011 +0100 r600g: adapt to new clip state commit f11890905362f62627c4a28a8255b76eb7de7df2 Author: Marek Olšák <maraeo@gmail.com> Date: Sun Dec 25 14:10:26 2011 +0100 r300g: adapt to new clip state commit e37465327c79a01112f15f6278d9accc5bf3103f Author: Marek Olšák <maraeo@gmail.com> Date: Sun Dec 25 12:39:16 2011 +0100 draw: adapt to new clip state This adds a regression in the LLVM clipping path. Can anybody see anything wrong with the code? It works for every other case, just glean/fpexceptions crashes when doing the "Infinite clip plane test". commit b474d2b18c72d965eefae4e427c269cba5ce6ba2 Author: Marek Olšák <maraeo@gmail.com> Date: Sun Dec 25 13:14:59 2011 +0100 u_blitter: don't save/set/restore clip state commit 9dd240ea91f523a677af45e8d0adb9e661e28602 Author: Marek Olšák <maraeo@gmail.com> Date: Sun Dec 25 13:11:56 2011 +0100 gallium: don't cso_save/set/restore clip state The enable bits are in the rasterizer state. commit a4f7031179f5f4ad524b34b394214b984ac950f6 Author: Marek Olšák <maraeo@gmail.com> Date: Sun Dec 25 12:58:55 2011 +0100 gallium: default depth_clip to 1 depth_clip = !depth_clamp commit fe21147a00ab90e549d63fe12ee4625c9c2ffcc3 Author: Marek Olšák <maraeo@gmail.com> Date: Mon Dec 26 06:14:19 2011 +0100 trace,util: update state logging to new clip state Also dump the other missing flags. commit 2a3b96e84ac872dcc5bc1de049fe76bb58d64b23 Author: Marek Olšák <maraeo@gmail.com> Date: Sun Dec 25 10:43:43 2011 +0100 st/mesa: adapt to new clip state commit b7b656a42fca19d7c85267f42649a206a85a2c72 Author: Marek Olšák <maraeo@gmail.com> Date: Sat Dec 17 15:45:19 2011 +0100 gallium: move state enable bits from clip_state to rasterizer_state
2012-01-10 00:19:00 +01:00
st->clear.raster.depth_clip = 1;
}
/**
* Free per-context state for glClear.
*/
void
st_destroy_clear(struct st_context *st)
{
if (st->clear.fs) {
cso_delete_fragment_shader(st->cso_context, st->clear.fs);
st->clear.fs = NULL;
}
if (st->clear.vs) {
cso_delete_vertex_shader(st->cso_context, st->clear.vs);
st->clear.vs = NULL;
}
}
/**
* Helper function to set the fragment shaders.
*/
static INLINE void
set_fragment_shader(struct st_context *st)
{
if (!st->clear.fs)
st->clear.fs =
util_make_fragment_passthrough_shader(st->pipe, TGSI_SEMANTIC_GENERIC,
TGSI_INTERPOLATE_CONSTANT,
TRUE);
cso_set_fragment_shader_handle(st->cso_context, st->clear.fs);
}
/**
* Helper function to set the vertex shader.
*/
static INLINE void
set_vertex_shader(struct st_context *st)
{
/* vertex shader - still required to provide the linkage between
* fragment shader input semantics and vertex_element/buffers.
*/
if (!st->clear.vs)
{
const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
TGSI_SEMANTIC_GENERIC };
const uint semantic_indexes[] = { 0, 0 };
st->clear.vs = util_make_vertex_passthrough_shader(st->pipe, 2,
semantic_names,
semantic_indexes);
}
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
}
static void
set_vertex_shader_layered(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID) ||
!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER)) {
assert(!"Got layered clear, but the VS layer output is unsupported");
set_vertex_shader(st);
return;
}
if (!st->clear.vs_layered) {
st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe);
}
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs_layered);
}
/**
* Draw a screen-aligned quadrilateral.
* Coords are clip coords with y=0=bottom.
*/
static void
draw_quad(struct st_context *st,
float x0, float y0, float x1, float y1, GLfloat z,
unsigned num_instances,
const union pipe_color_union *color)
{
struct cso_context *cso = st->cso_context;
struct pipe_vertex_buffer vb = {0};
GLuint i;
float (*vertices)[2][4]; /**< vertex pos + color */
vb.stride = 8 * sizeof(float);
if (u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]),
&vb.buffer_offset, &vb.buffer,
(void **) &vertices) != PIPE_OK) {
return;
}
/* positions */
vertices[0][0][0] = x0;
vertices[0][0][1] = y0;
vertices[1][0][0] = x1;
vertices[1][0][1] = y0;
vertices[2][0][0] = x1;
vertices[2][0][1] = y1;
vertices[3][0][0] = x0;
vertices[3][0][1] = y1;
/* same for all verts: */
for (i = 0; i < 4; i++) {
vertices[i][0][2] = z;
vertices[i][0][3] = 1.0;
vertices[i][1][0] = color->f[0];
vertices[i][1][1] = color->f[1];
vertices[i][1][2] = color->f[2];
vertices[i][1][3] = color->f[3];
}
u_upload_unmap(st->uploader);
/* draw */
cso_set_vertex_buffers(cso, cso_get_aux_vertex_buffer_slot(cso), 1, &vb);
cso_draw_arrays_instanced(cso, PIPE_PRIM_TRIANGLE_FAN, 0, 4,
0, num_instances);
pipe_resource_reference(&vb.buffer, NULL);
}
2007-08-02 10:29:42 -06:00
/**
* Do glClear by drawing a quadrilateral.
2007-08-10 16:25:21 -06:00
* The vertices of the quad will be computed from the
* ctx->DrawBuffer->_X/Ymin/max fields.
2007-08-02 10:29:42 -06:00
*/
static void
clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
2007-08-02 10:29:42 -06:00
{
struct st_context *st = st_context(ctx);
const struct gl_framebuffer *fb = ctx->DrawBuffer;
const GLfloat fb_width = (GLfloat) fb->Width;
const GLfloat fb_height = (GLfloat) fb->Height;
const GLfloat x0 = (GLfloat) ctx->DrawBuffer->_Xmin / fb_width * 2.0f - 1.0f;
const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax / fb_width * 2.0f - 1.0f;
const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin / fb_height * 2.0f - 1.0f;
const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax / fb_height * 2.0f - 1.0f;
unsigned num_layers =
util_framebuffer_get_num_layers(&st->state.framebuffer);
2007-08-02 13:48:02 -06:00
2008-02-14 16:53:51 +00:00
/*
printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__,
color ? "color, " : "",
depth ? "depth, " : "",
stencil ? "stencil" : "",
x0, y0,
x1, y1);
*/
2007-08-02 13:48:02 -06:00
cso_save_blend(st->cso_context);
cso_save_stencil_ref(st->cso_context);
cso_save_depth_stencil_alpha(st->cso_context);
cso_save_rasterizer(st->cso_context);
cso_save_sample_mask(st->cso_context);
cso_save_viewport(st->cso_context);
2008-04-21 17:51:39 +01:00
cso_save_fragment_shader(st->cso_context);
cso_save_stream_outputs(st->cso_context);
2008-04-21 17:51:39 +01:00
cso_save_vertex_shader(st->cso_context);
cso_save_geometry_shader(st->cso_context);
cso_save_vertex_elements(st->cso_context);
cso_save_aux_vertex_buffer_slot(st->cso_context);
2007-08-02 13:48:02 -06:00
/* blend state: RGBA masking */
2007-08-10 16:25:21 -06:00
{
struct pipe_blend_state blend;
memset(&blend, 0, sizeof(blend));
if (clear_buffers & PIPE_CLEAR_COLOR) {
int num_buffers = ctx->Extensions.EXT_draw_buffers2 ?
ctx->DrawBuffer->_NumColorDrawBuffers : 1;
int i;
blend.independent_blend_enable = num_buffers > 1;
for (i = 0; i < num_buffers; i++) {
if (!(clear_buffers & (PIPE_CLEAR_COLOR0 << i)))
continue;
if (ctx->Color.ColorMask[i][0])
blend.rt[i].colormask |= PIPE_MASK_R;
if (ctx->Color.ColorMask[i][1])
blend.rt[i].colormask |= PIPE_MASK_G;
if (ctx->Color.ColorMask[i][2])
blend.rt[i].colormask |= PIPE_MASK_B;
if (ctx->Color.ColorMask[i][3])
blend.rt[i].colormask |= PIPE_MASK_A;
}
2007-08-10 16:25:21 -06:00
if (st->ctx->Color.DitherFlag)
blend.dither = 1;
}
cso_set_blend(st->cso_context, &blend);
2007-08-02 13:48:02 -06:00
}
2007-08-02 10:29:42 -06:00
/* depth_stencil state: always pass/set to ref value */
2007-08-10 16:25:21 -06:00
{
struct pipe_depth_stencil_alpha_state depth_stencil;
memset(&depth_stencil, 0, sizeof(depth_stencil));
if (clear_buffers & PIPE_CLEAR_DEPTH) {
depth_stencil.depth.enabled = 1;
depth_stencil.depth.writemask = 1;
depth_stencil.depth.func = PIPE_FUNC_ALWAYS;
2007-08-10 16:25:21 -06:00
}
if (clear_buffers & PIPE_CLEAR_STENCIL) {
struct pipe_stencil_ref stencil_ref;
memset(&stencil_ref, 0, sizeof(stencil_ref));
depth_stencil.stencil[0].enabled = 1;
depth_stencil.stencil[0].func = PIPE_FUNC_ALWAYS;
depth_stencil.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE;
depth_stencil.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
depth_stencil.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
2009-01-26 14:37:21 -05:00
depth_stencil.stencil[0].valuemask = 0xff;
depth_stencil.stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff;
stencil_ref.ref_value[0] = ctx->Stencil.Clear;
cso_set_stencil_ref(st->cso_context, &stencil_ref);
}
cso_set_depth_stencil_alpha(st->cso_context, &depth_stencil);
2007-08-02 10:29:42 -06:00
}
cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw);
cso_set_stream_outputs(st->cso_context, 0, NULL, 0);
cso_set_sample_mask(st->cso_context, ~0);
cso_set_rasterizer(st->cso_context, &st->clear.raster);
2007-08-02 13:48:02 -06:00
/* viewport state: viewport matching window dims */
{
const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP);
struct pipe_viewport_state vp;
vp.scale[0] = 0.5f * fb_width;
vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f);
vp.scale[2] = 1.0f;
vp.scale[3] = 1.0f;
vp.translate[0] = 0.5f * fb_width;
vp.translate[1] = 0.5f * fb_height;
vp.translate[2] = 0.0f;
vp.translate[3] = 0.0f;
cso_set_viewport(st->cso_context, &vp);
}
set_fragment_shader(st);
cso_set_geometry_shader_handle(st->cso_context, NULL);
if (num_layers > 1)
set_vertex_shader_layered(st);
else
set_vertex_shader(st);
/* We can't translate the clear color to the colorbuffer format,
* because different colorbuffers may have different formats.
*/
/* draw quad matching scissor rect */
draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, num_layers,
(union pipe_color_union*)&ctx->Color.ClearColor);
/* Restore pipe state */
cso_restore_blend(st->cso_context);
cso_restore_stencil_ref(st->cso_context);
cso_restore_depth_stencil_alpha(st->cso_context);
cso_restore_rasterizer(st->cso_context);
cso_restore_sample_mask(st->cso_context);
cso_restore_viewport(st->cso_context);
2008-04-21 17:51:39 +01:00
cso_restore_fragment_shader(st->cso_context);
cso_restore_vertex_shader(st->cso_context);
cso_restore_geometry_shader(st->cso_context);
cso_restore_vertex_elements(st->cso_context);
cso_restore_aux_vertex_buffer_slot(st->cso_context);
cso_restore_stream_outputs(st->cso_context);
2007-08-02 10:29:42 -06:00
}
2007-08-24 19:36:23 -06:00
/**
* Return if the scissor must be enabled during the clear.
2007-08-24 19:36:23 -06:00
*/
static INLINE GLboolean
is_scissor_enabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
2008-02-14 16:53:51 +00:00
{
return ctx->Scissor.Enabled &&
(ctx->Scissor.X > 0 ||
ctx->Scissor.Y > 0 ||
(unsigned) ctx->Scissor.Width < rb->Width ||
(unsigned) ctx->Scissor.Height < rb->Height);
2007-08-24 19:36:23 -06:00
}
/**
* Return if all of the color channels are masked.
*/
static INLINE GLboolean
is_color_disabled(struct gl_context *ctx, int i)
{
return !ctx->Color.ColorMask[i][0] &&
!ctx->Color.ColorMask[i][1] &&
!ctx->Color.ColorMask[i][2] &&
!ctx->Color.ColorMask[i][3];
}
2007-08-24 19:36:23 -06:00
/**
* Return if any of the color channels are masked.
2007-08-24 19:36:23 -06:00
*/
static INLINE GLboolean
is_color_masked(struct gl_context *ctx, int i)
2007-08-24 19:36:23 -06:00
{
return !ctx->Color.ColorMask[i][0] ||
!ctx->Color.ColorMask[i][1] ||
!ctx->Color.ColorMask[i][2] ||
!ctx->Color.ColorMask[i][3];
2007-08-24 19:36:23 -06:00
}
/**
* Return if all of the stencil bits are masked.
*/
static INLINE GLboolean
is_stencil_disabled(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
const GLuint stencilMax = 0xff;
assert(_mesa_get_format_bits(rb->Format, GL_STENCIL_BITS) > 0);
return (ctx->Stencil.WriteMask[0] & stencilMax) == 0;
}
2007-08-24 19:36:23 -06:00
/**
* Return if any of the stencil bits are masked.
2007-08-24 19:36:23 -06:00
*/
static INLINE GLboolean
is_stencil_masked(struct gl_context *ctx, struct gl_renderbuffer *rb)
2007-08-24 19:36:23 -06:00
{
const GLuint stencilMax = 0xff;
2008-02-14 16:53:51 +00:00
assert(_mesa_get_format_bits(rb->Format, GL_STENCIL_BITS) > 0);
return (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
2007-08-24 19:36:23 -06:00
}
2007-08-02 10:29:42 -06:00
/**
* Called via ctx->Driver.Clear()
*/
static void
st_Clear(struct gl_context *ctx, GLbitfield mask)
{
struct st_context *st = st_context(ctx);
struct gl_renderbuffer *depthRb
= ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
struct gl_renderbuffer *stencilRb
= ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
GLbitfield quad_buffers = 0x0;
GLbitfield clear_buffers = 0x0;
GLuint i;
/* This makes sure the pipe has the latest scissor, etc values */
st_validate_state( st );
if (mask & BUFFER_BITS_COLOR) {
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
GLint b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
if (b >= 0 && mask & (1 << b)) {
2007-08-13 16:16:42 -06:00
struct gl_renderbuffer *rb
= ctx->DrawBuffer->Attachment[b].Renderbuffer;
struct st_renderbuffer *strb = st_renderbuffer(rb);
int colormask_index = ctx->Extensions.EXT_draw_buffers2 ? i : 0;
if (!strb || !strb->surface)
continue;
if (is_color_disabled(ctx, colormask_index))
continue;
if (is_scissor_enabled(ctx, rb) ||
is_color_masked(ctx, colormask_index))
quad_buffers |= PIPE_CLEAR_COLOR0 << i;
else
clear_buffers |= PIPE_CLEAR_COLOR0 << i;
}
}
}
if (mask & BUFFER_BIT_DEPTH) {
struct st_renderbuffer *strb = st_renderbuffer(depthRb);
if (strb->surface && ctx->Depth.Mask) {
if (is_scissor_enabled(ctx, depthRb))
quad_buffers |= PIPE_CLEAR_DEPTH;
else
clear_buffers |= PIPE_CLEAR_DEPTH;
}
}
if (mask & BUFFER_BIT_STENCIL) {
struct st_renderbuffer *strb = st_renderbuffer(stencilRb);
if (strb->surface && !is_stencil_disabled(ctx, stencilRb)) {
if (is_scissor_enabled(ctx, stencilRb) ||
is_stencil_masked(ctx, stencilRb))
quad_buffers |= PIPE_CLEAR_STENCIL;
else
clear_buffers |= PIPE_CLEAR_STENCIL;
}
}
/* Always clear depth and stencil together.
* This can only happen when the stencil writemask is not a full mask.
*/
if (quad_buffers & PIPE_CLEAR_DEPTHSTENCIL &&
clear_buffers & PIPE_CLEAR_DEPTHSTENCIL) {
quad_buffers |= clear_buffers & PIPE_CLEAR_DEPTHSTENCIL;
clear_buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
}
/* Only use quad-based clearing for the renderbuffers which cannot
* use pipe->clear. We want to always use pipe->clear for the other
* renderbuffers, because it's likely to be faster.
*/
if (quad_buffers) {
clear_with_quad(ctx, quad_buffers);
}
if (clear_buffers) {
/* We can't translate the clear color to the colorbuffer format,
* because different colorbuffers may have different formats.
*/
st->pipe->clear(st->pipe, clear_buffers,
(union pipe_color_union*)&ctx->Color.ClearColor,
ctx->Depth.Clear, ctx->Stencil.Clear);
}
if (mask & BUFFER_BIT_ACCUM)
_mesa_clear_accum_buffer(ctx);
}
void
st_init_clear_functions(struct dd_function_table *functions)
{
functions->Clear = st_Clear;
}