summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-01-16 12:35:49 -0700
committerBrian Paul <brianp@vmware.com>2012-01-24 14:12:31 -0700
commitd16e71eeb47d1e67930f6e86a80dc926468224d9 (patch)
treeb36b872c2d2885d112119d2c3dee39ece0892cf2
parentf2479530b8be3866c234ac759a7fa84e634dd1aa (diff)
xlib: derive xmesa_renderbuffer from swrast_renderbuffer
-rw-r--r--src/mesa/drivers/x11/xm_api.c10
-rw-r--r--src/mesa/drivers/x11/xm_buffer.c28
-rw-r--r--src/mesa/drivers/x11/xm_dd.c10
-rw-r--r--src/mesa/drivers/x11/xmesaP.h3
4 files changed, 27 insertions, 24 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 0f41218e63..fb8288922c 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -309,7 +309,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
b->frontxrb->drawable = d;
b->frontxrb->pixmap = (XMesaPixmap) d;
_mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_FRONT_LEFT,
- &b->frontxrb->Base);
+ &b->frontxrb->Base.Base);
/*
* Back renderbuffer
@@ -326,7 +326,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
b->db_mode = vis->ximage_flag ? BACK_XIMAGE : BACK_PIXMAP;
_mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_BACK_LEFT,
- &b->backxrb->Base);
+ &b->backxrb->Base.Base);
}
/*
@@ -1469,7 +1469,9 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
{
struct gl_renderbuffer *rb
= b->mesa_buffer.Attachment[BUFFER_DEPTH].Renderbuffer;
- if (!rb || !rb->Buffer) {
+ struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
+
+ if (!xrb || !xrb->Base.Buffer) {
*width = 0;
*height = 0;
*bytesPerValue = 0;
@@ -1481,7 +1483,7 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
*height = b->mesa_buffer.Height;
*bytesPerValue = b->mesa_buffer.Visual.depthBits <= 16
? sizeof(GLushort) : sizeof(GLuint);
- *buffer = (void *) rb->Buffer;
+ *buffer = (void *) xrb->Base.Buffer;
return GL_TRUE;
}
}
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index 64a8f4321b..a7395a317b 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -326,37 +326,37 @@ xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name,
struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer);
if (xrb) {
GLuint name = 0;
- _mesa_init_renderbuffer(&xrb->Base, name);
+ _mesa_init_renderbuffer(&xrb->Base.Base, name);
- xrb->Base.Delete = xmesa_delete_renderbuffer;
+ xrb->Base.Base.Delete = xmesa_delete_renderbuffer;
if (backBuffer)
- xrb->Base.AllocStorage = xmesa_alloc_back_storage;
+ xrb->Base.Base.AllocStorage = xmesa_alloc_back_storage;
else
- xrb->Base.AllocStorage = xmesa_alloc_front_storage;
+ xrb->Base.Base.AllocStorage = xmesa_alloc_front_storage;
- xrb->Base.InternalFormat = GL_RGBA;
- xrb->Base._BaseFormat = GL_RGBA;
- xrb->Base.ClassID = XMESA_RENDERBUFFER;
+ xrb->Base.Base.InternalFormat = GL_RGBA;
+ xrb->Base.Base._BaseFormat = GL_RGBA;
+ xrb->Base.Base.ClassID = XMESA_RENDERBUFFER;
switch (xmvis->undithered_pf) {
case PF_8R8G8B:
/* This will really only happen for pixmaps. We'll access the
* pixmap via a temporary XImage which will be 32bpp.
*/
- xrb->Base.Format = MESA_FORMAT_XRGB8888;
+ xrb->Base.Base.Format = MESA_FORMAT_XRGB8888;
break;
case PF_8A8R8G8B:
- xrb->Base.Format = MESA_FORMAT_ARGB8888;
+ xrb->Base.Base.Format = MESA_FORMAT_ARGB8888;
break;
case PF_8A8B8G8R:
- xrb->Base.Format = MESA_FORMAT_RGBA8888_REV;
+ xrb->Base.Base.Format = MESA_FORMAT_RGBA8888_REV;
break;
case PF_5R6G5B:
- xrb->Base.Format = MESA_FORMAT_RGB565;
+ xrb->Base.Base.Format = MESA_FORMAT_RGB565;
break;
default:
_mesa_warning(ctx, "Bad pixel format in xmesa_new_renderbuffer");
- xrb->Base.Format = MESA_FORMAT_ARGB8888;
+ xrb->Base.Base.Format = MESA_FORMAT_ARGB8888;
break;
}
@@ -426,7 +426,7 @@ xmesa_MapRenderbuffer(struct gl_context *ctx,
{
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
- if (xrb->Base.ClassID == XMESA_RENDERBUFFER) {
+ if (xrb->Base.Base.ClassID == XMESA_RENDERBUFFER) {
XImage *ximage = xrb->ximage;
assert(!xrb->map_mode); /* only a single mapping allowed */
@@ -488,7 +488,7 @@ xmesa_UnmapRenderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
- if (xrb->Base.ClassID == XMESA_RENDERBUFFER) {
+ if (xrb->Base.Base.ClassID == XMESA_RENDERBUFFER) {
XImage *ximage = xrb->ximage;
if (!ximage) {
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 342d2d9073..d0bf2f0b7d 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -138,7 +138,7 @@ clear_pixmap(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
assert(xmbuf->cleargc);
XMesaFillRectangle( xmesa->display, xrb->pixmap, xmbuf->cleargc,
- x, xrb->Base.Height - y - height,
+ x, xrb->Base.Base.Height - y - height,
width, height );
}
@@ -215,9 +215,9 @@ clear_32bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
| ((pixel << 24) & 0xff000000);
}
- if (width == xrb->Base.Width && height == xrb->Base.Height) {
+ if (width == xrb->Base.Base.Width && height == xrb->Base.Base.Height) {
/* clearing whole buffer */
- const GLuint n = xrb->Base.Width * xrb->Base.Height;
+ const GLuint n = xrb->Base.Base.Width * xrb->Base.Base.Height;
GLuint *ptr4 = (GLuint *) xrb->ximage->data;
if (pixel == 0) {
/* common case */
@@ -332,7 +332,7 @@ can_do_DrawPixels_8R8G8B(struct gl_context *ctx, GLenum format, GLenum type)
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
if (xrb &&
xrb->pixmap && /* drawing to pixmap or window */
- _mesa_get_format_bits(xrb->Base.Format, GL_ALPHA_BITS) == 0) {
+ _mesa_get_format_bits(xrb->Base.Base.Format, GL_ALPHA_BITS) == 0) {
return GL_TRUE;
}
}
@@ -465,7 +465,7 @@ can_do_DrawPixels_5R6G5B(struct gl_context *ctx, GLenum format, GLenum type)
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
if (xrb &&
xrb->pixmap && /* drawing to pixmap or window */
- _mesa_get_format_bits(xrb->Base.Format, GL_ALPHA_BITS) == 0) {
+ _mesa_get_format_bits(xrb->Base.Base.Format, GL_ALPHA_BITS) == 0) {
return GL_TRUE;
}
}
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 7caa356198..7e7b1f8a43 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -29,6 +29,7 @@
#include "xmesa.h"
#include "main/mtypes.h"
+#include "swrast/s_context.h"
extern _glthread_Mutex _xmesa_lock;
@@ -151,7 +152,7 @@ typedef enum {
*/
struct xmesa_renderbuffer
{
- struct gl_renderbuffer Base; /* Base class */
+ struct swrast_renderbuffer Base; /* Base class */
XMesaBuffer Parent; /**< The XMesaBuffer this renderbuffer belongs to */
XMesaDrawable drawable; /* Usually the X window ID */