~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/gallium/tests/graw/clear.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Display a cleared blue window.  This demo has no dependencies on
 
2
 * any utility code, just the graw interface and gallium.
 
3
 */
 
4
 
 
5
#include "state_tracker/graw.h"
 
6
#include "pipe/p_screen.h"
 
7
#include "pipe/p_context.h"
 
8
#include "pipe/p_state.h"
 
9
#include "pipe/p_defines.h"
 
10
 
 
11
#include "util/u_debug.h"       /* debug_dump_surface_bmp() */
 
12
 
 
13
enum pipe_format formats[] = {
 
14
   PIPE_FORMAT_R8G8B8A8_UNORM,
 
15
   PIPE_FORMAT_B8G8R8A8_UNORM,
 
16
   PIPE_FORMAT_NONE
 
17
};
 
18
 
 
19
static const int WIDTH = 300;
 
20
static const int HEIGHT = 300;
 
21
 
 
22
struct pipe_screen *screen;
 
23
struct pipe_context *ctx;
 
24
struct pipe_surface *surf;
 
25
static void *window = NULL;
 
26
 
 
27
static void draw( void )
 
28
{
 
29
   float clear_color[4] = {1,0,1,1};
 
30
 
 
31
   ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
 
32
   ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
33
 
 
34
#if 0
 
35
   /* At the moment, libgraw leaks out/makes available some of the
 
36
    * symbols from gallium/auxiliary, including these debug helpers.
 
37
    * Will eventually want to bless some of these paths, and lock the
 
38
    * others down so they aren't accessible from test programs.
 
39
    *
 
40
    * This currently just happens to work on debug builds - a release
 
41
    * build will probably fail to link here:
 
42
    */
 
43
   debug_dump_surface_bmp(ctx, "result.bmp", surf);
 
44
#endif
 
45
 
 
46
   screen->flush_frontbuffer(screen, surf, window);
 
47
}
 
48
 
 
49
static void init( void )
 
50
{
 
51
   struct pipe_framebuffer_state fb;
 
52
   struct pipe_resource *tex, templat;
 
53
   int i;
 
54
 
 
55
   /* It's hard to say whether window or screen should be created
 
56
    * first.  Different environments would prefer one or the other.
 
57
    *
 
58
    * Also, no easy way of querying supported formats if the screen
 
59
    * cannot be created first.
 
60
    */
 
61
   for (i = 0; 
 
62
        window == NULL && formats[i] != PIPE_FORMAT_NONE;
 
63
        i++) {
 
64
      
 
65
      screen = graw_create_window_and_screen(0,0,300,300,
 
66
                                             formats[i],
 
67
                                             &window);
 
68
   }
 
69
   if (window == NULL)
 
70
      exit(2);
 
71
   
 
72
   ctx = screen->context_create(screen, NULL);
 
73
   if (ctx == NULL)
 
74
      exit(3);
 
75
 
 
76
   templat.target = PIPE_TEXTURE_2D;
 
77
   templat.format = formats[i];
 
78
   templat.width0 = WIDTH;
 
79
   templat.height0 = HEIGHT;
 
80
   templat.depth0 = 1;
 
81
   templat.last_level = 0;
 
82
   templat.nr_samples = 1;
 
83
   templat.bind = (PIPE_BIND_RENDER_TARGET |
 
84
                   PIPE_BIND_DISPLAY_TARGET);
 
85
   
 
86
   tex = screen->resource_create(screen,
 
87
                                 &templat);
 
88
   if (tex == NULL)
 
89
      exit(4);
 
90
 
 
91
   surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
 
92
                                  PIPE_BIND_RENDER_TARGET |
 
93
                                  PIPE_BIND_DISPLAY_TARGET);
 
94
   if (surf == NULL)
 
95
      exit(5);
 
96
 
 
97
   memset(&fb, 0, sizeof fb);
 
98
   fb.nr_cbufs = 1;
 
99
   fb.width = WIDTH;
 
100
   fb.height = HEIGHT;
 
101
   fb.cbufs[0] = surf;
 
102
 
 
103
   ctx->set_framebuffer_state(ctx, &fb);
 
104
}
 
105
 
 
106
 
 
107
 
 
108
int main( int argc, char *argv[] )
 
109
{
 
110
   init();
 
111
 
 
112
   graw_set_display_func( draw );
 
113
   graw_main_loop();
 
114
   return 0;
 
115
}