aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-03-07 16:00:29 +0000
committermarha <marha@users.sourceforge.net>2010-03-07 16:00:29 +0000
commitb40894093babb10f3cd155f11ff2d6c710372395 (patch)
treee6e94e5aa39ca9d5a653af567145e4b5dda25d61 /mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
parentd27419efcdaaccb40e0f10c549a6b732a2f29e81 (diff)
parent14b1cb8d5a27ec9716d3f790fce95f0469e35605 (diff)
downloadvcxsrv-b40894093babb10f3cd155f11ff2d6c710372395.tar.gz
vcxsrv-b40894093babb10f3cd155f11ff2d6c710372395.tar.bz2
vcxsrv-b40894093babb10f3cd155f11ff2d6c710372395.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c72
1 files changed, 32 insertions, 40 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
index 15af99136..4e7e92c82 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -1,5 +1,6 @@
#include "main/mtypes.h"
+#include "main/formats.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/imports.h"
@@ -53,7 +54,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
* \param pitch pixels per row
*/
driRenderbuffer *
-driNewRenderbuffer(GLenum format, GLvoid *addr,
+driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
__DRIdrawablePrivate *dPriv)
{
@@ -79,56 +80,47 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
/* Make sure we're using a null-valued GetPointer routine */
assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL);
- drb->Base.InternalFormat = format;
-
- if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) {
- /* 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;
+ switch (format) {
+ case MESA_FORMAT_ARGB8888:
+ if (cpp == 2) {
+ /* override format */
+ format = MESA_FORMAT_RGB565;
}
- 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) {
+ drb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
+ case MESA_FORMAT_Z16:
/* 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) {
+ assert(cpp == 2);
+ break;
+ case MESA_FORMAT_Z32:
/* 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 {
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_Z24_S8:
+ drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_S8_Z24:
+ drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_S8:
/* Stencil */
- ASSERT(format == GL_STENCIL_INDEX8_EXT);
- drb->Base._BaseFormat = GL_STENCIL_INDEX;
drb->Base.DataType = GL_UNSIGNED_BYTE;
- drb->Base.StencilBits = 8;
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format 0x%x in driNewRenderbuffer", format);
+ return NULL;
}
- /* XXX if we were allocating a user-created renderbuffer, we'd have
- * to fill in the Red/Green/Blue/.../Bits values too.
- */
+ drb->Base.Format = format;
+
+ drb->Base.InternalFormat =
+ drb->Base._BaseFormat = _mesa_get_format_base_format(format);
drb->Base.AllocStorage = driRenderbufferStorage;
drb->Base.Delete = driDeleteRenderbuffer;