radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
struct radeon_bo *bo);
struct radeon_renderbuffer *
-radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv);
+radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv);
static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
{
struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
return GL_FALSE;
}
+
+/**
+ * Create a renderbuffer for a window's color, depth and/or stencil buffer.
+ * Not used for user-created renderbuffers.
+ */
struct radeon_renderbuffer *
-radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv)
+radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv)
{
struct radeon_renderbuffer *rrb;
_mesa_init_renderbuffer(&rrb->base, 0);
rrb->base.ClassID = RADEON_RB_CLASS;
- /* XXX format junk */
+ rrb->base.Format = format;
+
switch (format) {
- case GL_RGB5:
- rrb->base.Format = MESA_FORMAT_RGB565;
+ case MESA_FORMAT_RGB565:
rrb->base.DataType = GL_UNSIGNED_BYTE;
rrb->base._BaseFormat = GL_RGB;
break;
- case GL_RGB8:
- rrb->base.Format = MESA_FORMAT_ARGB8888;
+ case MESA_FORMAT_XRGB8888:
rrb->base.DataType = GL_UNSIGNED_BYTE;
rrb->base._BaseFormat = GL_RGB;
break;
- case GL_RGBA8:
- rrb->base.Format = MESA_FORMAT_ARGB8888;
+ case MESA_FORMAT_ARGB8888:
rrb->base.DataType = GL_UNSIGNED_BYTE;
rrb->base._BaseFormat = GL_RGBA;
break;
- case GL_STENCIL_INDEX8_EXT:
- rrb->base.Format = MESA_FORMAT_S8;
+ case MESA_FORMAT_S8:
rrb->base.DataType = GL_UNSIGNED_BYTE;
rrb->base._BaseFormat = GL_STENCIL_INDEX;
break;
- case GL_DEPTH_COMPONENT16:
- rrb->base.Format = MESA_FORMAT_Z16;
+ case MESA_FORMAT_Z16:
rrb->base.DataType = GL_UNSIGNED_SHORT;
rrb->base._BaseFormat = GL_DEPTH_COMPONENT;
break;
- case GL_DEPTH_COMPONENT24:
- rrb->base.Format = MESA_FORMAT_S8_Z24;
- rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- rrb->base._BaseFormat = GL_DEPTH_STENCIL;
- break;
- case GL_DEPTH24_STENCIL8_EXT:
- rrb->base.Format = MESA_FORMAT_S8_Z24;
+ case MESA_FORMAT_S8_Z24:
rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
rrb->base._BaseFormat = GL_DEPTH_STENCIL;
break;
}
rrb->dPriv = driDrawPriv;
- rrb->base.InternalFormat = format;
+ rrb->base.InternalFormat = _mesa_get_format_base_format(format);
rrb->base.Delete = radeon_delete_renderbuffer;
rrb->base.AllocStorage = radeon_alloc_window_storage;
const GLboolean swAccum = mesaVis->accumRedBits > 0;
const GLboolean swStencil = mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24;
- GLenum rgbFormat;
+ gl_format rgbFormat;
struct radeon_framebuffer *rfb;
if (isPixmap)
_mesa_initialize_framebuffer(&rfb->base, mesaVis);
if (mesaVis->redBits == 5)
- rgbFormat = GL_RGB5;
+ rgbFormat = MESA_FORMAT_RGB565;
else if (mesaVis->alphaBits == 0)
- rgbFormat = GL_RGB8;
+ rgbFormat = MESA_FORMAT_XRGB8888;
else
- rgbFormat = GL_RGBA8;
+ rgbFormat = MESA_FORMAT_ARGB8888;
/* front color renderbuffer */
rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
if (mesaVis->depthBits == 24) {
if (mesaVis->stencilBits == 8) {
- struct radeon_renderbuffer *depthStencilRb = radeon_create_renderbuffer(GL_DEPTH24_STENCIL8_EXT, driDrawPriv);
+ struct radeon_renderbuffer *depthStencilRb =
+ radeon_create_renderbuffer(MESA_FORMAT_S8_Z24, driDrawPriv);
_mesa_add_renderbuffer(&rfb->base, BUFFER_DEPTH, &depthStencilRb->base);
_mesa_add_renderbuffer(&rfb->base, BUFFER_STENCIL, &depthStencilRb->base);
depthStencilRb->has_surface = screen->depthHasSurface;
} else {
/* depth renderbuffer */
- struct radeon_renderbuffer *depth = radeon_create_renderbuffer(GL_DEPTH_COMPONENT24, driDrawPriv);
+ struct radeon_renderbuffer *depth =
+ radeon_create_renderbuffer(MESA_FORMAT_X8_Z24, driDrawPriv);
_mesa_add_renderbuffer(&rfb->base, BUFFER_DEPTH, &depth->base);
depth->has_surface = screen->depthHasSurface;
}
} else if (mesaVis->depthBits == 16) {
- /* just 16-bit depth buffer, no hw stencil */
- struct radeon_renderbuffer *depth = radeon_create_renderbuffer(GL_DEPTH_COMPONENT16, driDrawPriv);
+ /* just 16-bit depth buffer, no hw stencil */
+ struct radeon_renderbuffer *depth =
+ radeon_create_renderbuffer(MESA_FORMAT_Z16, driDrawPriv);
_mesa_add_renderbuffer(&rfb->base, BUFFER_DEPTH, &depth->base);
depth->has_surface = screen->depthHasSurface;
}