14a49301eSmrg/**************************************************************************
24a49301eSmrg *
3af69d88dSmrg * Copyright 2007 VMware, Inc.
44a49301eSmrg * All Rights Reserved.
54a49301eSmrg * Copyright 2009 VMware, Inc.  All Rights Reserved.
64a49301eSmrg *
74a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
84a49301eSmrg * copy of this software and associated documentation files (the
94a49301eSmrg * "Software"), to deal in the Software without restriction, including
104a49301eSmrg * without limitation the rights to use, copy, modify, merge, publish,
114a49301eSmrg * distribute, sub license, and/or sell copies of the Software, and to
124a49301eSmrg * permit persons to whom the Software is furnished to do so, subject to
134a49301eSmrg * the following conditions:
144a49301eSmrg *
154a49301eSmrg * The above copyright notice and this permission notice (including the
164a49301eSmrg * next paragraph) shall be included in all copies or substantial portions
174a49301eSmrg * of the Software.
184a49301eSmrg *
194a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
204a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
214a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22af69d88dSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
234a49301eSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
244a49301eSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
254a49301eSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
264a49301eSmrg *
274a49301eSmrg **************************************************************************/
284a49301eSmrg
294a49301eSmrg/* Author:
304a49301eSmrg *    Brian Paul
314a49301eSmrg *    Michel Dänzer
324a49301eSmrg */
334a49301eSmrg
344a49301eSmrg
354a49301eSmrg#include "pipe/p_defines.h"
364a49301eSmrg#include "lp_clear.h"
374a49301eSmrg#include "lp_context.h"
38cdc920a0Smrg#include "lp_setup.h"
39af69d88dSmrg#include "lp_query.h"
403464ebd5Sriastradh#include "lp_debug.h"
417ec681f3Smrg#include "lp_state.h"
424a49301eSmrg
434a49301eSmrg
444a49301eSmrg/**
454a49301eSmrg * Clear the given buffers to the specified values.
464a49301eSmrg * No masking, no scissor (clear entire buffer).
474a49301eSmrg */
484a49301eSmrgvoid
49cdc920a0Smrgllvmpipe_clear(struct pipe_context *pipe,
50cdc920a0Smrg               unsigned buffers,
517ec681f3Smrg               const struct pipe_scissor_state *scissor_state,
52af69d88dSmrg               const union pipe_color_union *color,
53cdc920a0Smrg               double depth,
54cdc920a0Smrg               unsigned stencil)
554a49301eSmrg{
564a49301eSmrg   struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
574a49301eSmrg
58af69d88dSmrg   if (!llvmpipe_check_render_cond(llvmpipe))
594a49301eSmrg      return;
604a49301eSmrg
617ec681f3Smrg   llvmpipe_update_derived_clear(llvmpipe);
627ec681f3Smrg
633464ebd5Sriastradh   if (LP_PERF & PERF_NO_DEPTH)
643464ebd5Sriastradh      buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
653464ebd5Sriastradh
66af69d88dSmrg   lp_setup_clear( llvmpipe->setup, color, depth, stencil, buffers );
674a49301eSmrg}
68