Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / mesa / drivers / dri / common / drirenderbuffer.h
1
2 /**
3 * A driRenderbuffer is dervied from gl_renderbuffer.
4 * It describes a color buffer (front or back), a depth buffer, or stencil
5 * buffer etc.
6 * Specific to DRI drivers are the offset and pitch fields.
7 */
8
9
10 #ifndef DRIRENDERBUFFER_H
11 #define DRIRENDERBUFFER_H
12
13 #include "main/mtypes.h"
14 #include "dri_util.h"
15
16
17 typedef struct {
18 struct gl_renderbuffer Base;
19
20 /* Chars or bytes per pixel. If Z and Stencil are stored together this
21 * will typically be 32 whether this a depth or stencil renderbuffer.
22 */
23 GLint cpp;
24
25 /* Buffer position and pitch (row stride). Recall that for today's DRI
26 * drivers, we have statically allocated color/depth/stencil buffers.
27 * So this information describes the whole screen, not just a window.
28 * To address pixels in a window, we need to know the window's position
29 * and size with respect to the screen.
30 */
31 GLint offset; /* in bytes */
32 GLint pitch; /* in pixels */
33
34 /* If the driver can do page flipping (full-screen double buffering)
35 * the current front/back buffers may get swapped.
36 * If page flipping is disabled, these fields will be identical to
37 * the offset/pitch/Data above.
38 * If page flipping is enabled, and this is the front(back) renderbuffer,
39 * flippedOffset/Pitch/Data will have the back(front) renderbuffer's values.
40 */
41 GLint flippedOffset;
42 GLint flippedPitch;
43 GLvoid *flippedData; /* mmap'd address of buffer memory, if used */
44
45 /* Pointer to corresponding __DRIdrawablePrivate. This is used to compute
46 * the window's position within the framebuffer.
47 */
48 __DRIdrawablePrivate *dPriv;
49
50 /* XXX this is for radeon/r200 only. We should really create a new
51 * r200Renderbuffer class, derived from this class... not a huge deal.
52 */
53 GLboolean depthHasSurface;
54
55 /**
56 * A handy flag to know if this is the back color buffer.
57 *
58 * \note
59 * This is currently only used by s3v and tdfx.
60 */
61 GLboolean backBuffer;
62 } driRenderbuffer;
63
64
65 extern driRenderbuffer *
66 driNewRenderbuffer(GLenum format, GLvoid *addr,
67 GLint cpp, GLint offset, GLint pitch,
68 __DRIdrawablePrivate *dPriv);
69
70 extern void
71 driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);
72
73
74 extern void
75 driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv);
76
77
78 #endif /* DRIRENDERBUFFER_H */