summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-03-30 16:32:16 +0000
committerBrian Paul <[email protected]>2006-03-30 16:32:16 +0000
commit94d6bf883b3c2bfa52e178aa8abf5929ff524949 (patch)
tree469ec7c21f49f575a47b88511ef194326453ae58 /src/mesa
parent84c5d0a789d40f625932e4006cdde19eca2f5558 (diff)
Init the Red/Green/Blue/Alpha/Depth/StencilBits fields in driNewRenderbuffer()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
index 990f71450db..2e477815ba8 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -40,6 +40,10 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
* Allocate a new driRenderbuffer object.
* Individual drivers are free to implement different versions of
* this function.
+ *
+ * At this time, this function can only be used for window-system
+ * renderbuffers, not user-created RBOs.
+ *
* \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24,
* GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now).
* \param addr address in main memory of the buffer. Probably a memory
@@ -81,30 +85,45 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
/* Color */
drb->Base._BaseFormat = GL_RGBA;
drb->Base.DataType = GL_UNSIGNED_BYTE;
+ if (format == GL_RGB5) {
+ drb->Base.RedBits = 5;
+ drb->Base.GreenBits = 6;
+ drb->Base.BlueBits = 5;
+ }
+ else {
+ drb->Base.RedBits =
+ drb->Base.GreenBits =
+ drb->Base.BlueBits =
+ drb->Base.AlphaBits = 8;
+ }
}
else if (format == GL_DEPTH_COMPONENT16) {
/* Depth */
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
+ drb->Base.DepthBits = 16;
}
else if (format == GL_DEPTH_COMPONENT24) {
/* Depth */
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
+ drb->Base.DepthBits = 24;
}
else if (format == GL_DEPTH_COMPONENT32) {
/* Depth */
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
+ drb->Base.DepthBits = 32;
}
else {
/* Stencil */
ASSERT(format == GL_STENCIL_INDEX8_EXT);
drb->Base._BaseFormat = GL_STENCIL_INDEX;
drb->Base.DataType = GL_UNSIGNED_BYTE;
+ drb->Base.StencilBits = 8;
}
/* XXX if we were allocating a user-created renderbuffer, we'd have