summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/common/drirenderbuffer.h
blob: bd07bc790f21dbba89a66578196837eee80f7977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

/**
 * A driRenderbuffer is dervied from gl_renderbuffer.
 * It describes a color buffer (front or back), a depth buffer, or stencil
 * buffer etc.
 * Specific to DRI drivers are the offset and pitch fields.
 */


#ifndef DRIRENDERBUFFER_H
#define DRIRENDERBUFFER_H

#include "mtypes.h"

typedef struct {
   struct gl_renderbuffer Base;

   /* Chars or bytes per pixel.  If Z and Stencil are stored together this
    * will typically be 32 whether this a depth or stencil renderbuffer.
    */
   GLint cpp;

   /* Buffer position and pitch (row stride).  Recall that for today's DRI
    * drivers, we have statically allocated color/depth/stencil buffers.
    * So this information describes the whole screen, not just a window.
    * To address pixels in a window, we need to know the window's position
    * and size with respect to the screen.
    */
   GLint offset;  /* in bytes */
   GLint pitch;   /* in pixels */

   /* If the driver can do page flipping (full-screen double buffering)
    * the current front/back buffers may get swapped.
    * If page flipping is disabled, these  fields will be identical to
    * the offset/pitch/Data above.
    * If page flipping is enabled, and this is the front(back) renderbuffer,
    * flippedOffset/Pitch/Data will have the back(front) renderbuffer's values.
    */
   GLint flippedOffset;
   GLint flippedPitch;
   GLubyte *flippedData;  /* mmap'd memory, if used */

   /* XXX this is for radeon/r200 only.  We should really create a new
    * r200Renderbuffer class, derived from this class...  not a huge deal.
    */
   GLboolean depthHasSurface;

   /* XXX this is for s3v only.  A handy flag to know if this is the back
    * color buffer.
    */
   GLboolean backBuffer;
} driRenderbuffer;


extern driRenderbuffer *
driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch);

extern void
driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);

#endif /* DRIRENDERBUFFER_H */