~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/gallium/drivers/cell/ppu/cell_clear.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**************************************************************************
2
 
 * 
3
 
 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4
 
 * All Rights Reserved.
5
 
 * 
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:
13
 
 * 
14
 
 * The above copyright notice and this permission notice (including the
15
 
 * next paragraph) shall be included in all copies or substantial portions
16
 
 * of the Software.
17
 
 * 
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.
25
 
 * 
26
 
 **************************************************************************/
27
 
 
28
 
/**
29
 
 * Authors
30
 
 *  Brian Paul
31
 
 */
32
 
 
33
 
#include <stdio.h>
34
 
#include <assert.h>
35
 
#include <stdint.h>
36
 
#include "util/u_inlines.h"
37
 
#include "util/u_memory.h"
38
 
#include "util/u_pack_color.h"
39
 
#include "cell/common.h"
40
 
#include "cell_clear.h"
41
 
#include "cell_context.h"
42
 
#include "cell_batch.h"
43
 
#include "cell_flush.h"
44
 
#include "cell_spu.h"
45
 
#include "cell_state.h"
46
 
 
47
 
 
48
 
/**
49
 
 * Called via pipe->clear()
50
 
 */
51
 
void
52
 
cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
53
 
           double depth, unsigned stencil)
54
 
{
55
 
   struct cell_context *cell = cell_context(pipe);
56
 
 
57
 
   if (cell->dirty)
58
 
      cell_update_derived(cell);
59
 
 
60
 
   if (buffers & PIPE_CLEAR_COLOR) {
61
 
      uint surfIndex = 0;
62
 
      union util_color uc;
63
 
 
64
 
      util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &uc);
65
 
 
66
 
      /* Build a CLEAR command and place it in the current batch buffer */
67
 
      STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
68
 
      struct cell_command_clear_surface *clr
69
 
         = (struct cell_command_clear_surface *)
70
 
         cell_batch_alloc16(cell, sizeof(*clr));
71
 
      clr->opcode[0] = CELL_CMD_CLEAR_SURFACE;
72
 
      clr->surface = surfIndex;
73
 
      clr->value = uc.ui;
74
 
   }
75
 
 
76
 
   if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
77
 
      uint surfIndex = 1;
78
 
      uint clearValue;
79
 
 
80
 
      clearValue = util_pack_z_stencil(cell->framebuffer.zsbuf->format,
81
 
                                       depth, stencil);
82
 
 
83
 
      /* Build a CLEAR command and place it in the current batch buffer */
84
 
      STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
85
 
      struct cell_command_clear_surface *clr
86
 
         = (struct cell_command_clear_surface *)
87
 
         cell_batch_alloc16(cell, sizeof(*clr));
88
 
      clr->opcode[0] = CELL_CMD_CLEAR_SURFACE;
89
 
      clr->surface = surfIndex;
90
 
      clr->value = clearValue;
91
 
   }
92
 
}