assorted clean-ups, fixes
This commit is contained in:
@@ -48,7 +48,7 @@ static GLboolean
|
|||||||
xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
|
xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||||
GLenum internalFormat, GLuint width, GLuint height)
|
GLenum internalFormat, GLuint width, GLuint height)
|
||||||
{
|
{
|
||||||
struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;
|
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
|
||||||
|
|
||||||
/* just clear these to be sure we don't accidentally use them */
|
/* just clear these to be sure we don't accidentally use them */
|
||||||
xrb->origin1 = NULL;
|
xrb->origin1 = NULL;
|
||||||
@@ -74,7 +74,7 @@ static GLboolean
|
|||||||
xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
|
xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||||
GLenum internalFormat, GLuint width, GLuint height)
|
GLenum internalFormat, GLuint width, GLuint height)
|
||||||
{
|
{
|
||||||
struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;
|
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
|
||||||
|
|
||||||
/* same as front buffer */
|
/* same as front buffer */
|
||||||
(void) xmesa_alloc_front_storage(ctx, rb, internalFormat, width, height);
|
(void) xmesa_alloc_front_storage(ctx, rb, internalFormat, width, height);
|
||||||
|
@@ -302,11 +302,12 @@ clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
|
|||||||
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
|
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
|
||||||
|
|
||||||
if (all) {
|
if (all) {
|
||||||
GLint i, c16 = (xrb->ximage->bytes_per_line>>4)<<4;
|
const GLuint c16 = xrb->ximage->bytes_per_line & ~0xf;
|
||||||
|
GLuint i;
|
||||||
GLubyte *ptr = (GLubyte *) xrb->ximage->data;
|
GLubyte *ptr = (GLubyte *) xrb->ximage->data;
|
||||||
for (i = 0; i < xrb->Base.Height; i++) {
|
for (i = 0; i < xrb->Base.Height; i++) {
|
||||||
GLint j;
|
GLuint j;
|
||||||
GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0];
|
const GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0];
|
||||||
if (i&1) {
|
if (i&1) {
|
||||||
sptr += 16;
|
sptr += 16;
|
||||||
}
|
}
|
||||||
@@ -329,7 +330,7 @@ clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
|
|||||||
ptr[15] = sptr[15];
|
ptr[15] = sptr[15];
|
||||||
ptr += 16;
|
ptr += 16;
|
||||||
}
|
}
|
||||||
for (; j < xrb->ximage->bytes_per_line; j++) {
|
for (; j < (GLuint) xrb->ximage->bytes_per_line; j++) {
|
||||||
*ptr = sptr[j&15];
|
*ptr = sptr[j&15];
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
@@ -530,14 +531,15 @@ clear_buffers( GLcontext *ctx, GLbitfield mask,
|
|||||||
if (ctx->DrawBuffer->Name == 0) {
|
if (ctx->DrawBuffer->Name == 0) {
|
||||||
/* this is a window system framebuffer */
|
/* this is a window system framebuffer */
|
||||||
const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
|
const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
|
||||||
XMesaBuffer b = (XMesaBuffer) ctx->DrawBuffer;
|
XMesaBuffer b = XMESA_BUFFER(ctx->DrawBuffer);
|
||||||
|
|
||||||
/* we can't handle color or index masking */
|
/* we can't handle color or index masking */
|
||||||
if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) {
|
if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) {
|
||||||
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
||||||
/* clear front color buffer */
|
/* clear front color buffer */
|
||||||
if (b->frontxrb == (struct xmesa_renderbuffer *)
|
struct gl_renderbuffer *frontRb
|
||||||
ctx->DrawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer) {
|
= ctx->DrawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
|
||||||
|
if (b->frontxrb == xmesa_renderbuffer(frontRb)) {
|
||||||
/* renderbuffer is not wrapped - great! */
|
/* renderbuffer is not wrapped - great! */
|
||||||
b->frontxrb->clearFunc(ctx, b->frontxrb, all, x, y,
|
b->frontxrb->clearFunc(ctx, b->frontxrb, all, x, y,
|
||||||
width, height);
|
width, height);
|
||||||
@@ -549,8 +551,9 @@ clear_buffers( GLcontext *ctx, GLbitfield mask,
|
|||||||
}
|
}
|
||||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||||
/* clear back color buffer */
|
/* clear back color buffer */
|
||||||
if (b->backxrb == (struct xmesa_renderbuffer *)
|
struct gl_renderbuffer *backRb
|
||||||
ctx->DrawBuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer) {
|
= ctx->DrawBuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
|
||||||
|
if (b->backxrb == xmesa_renderbuffer(backRb)) {
|
||||||
/* renderbuffer is not wrapped - great! */
|
/* renderbuffer is not wrapped - great! */
|
||||||
b->backxrb->clearFunc(ctx, b->backxrb, all, x, y,
|
b->backxrb->clearFunc(ctx, b->backxrb, all, x, y,
|
||||||
width, height);
|
width, height);
|
||||||
@@ -600,7 +603,7 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx,
|
|||||||
const GLvoid *pixels )
|
const GLvoid *pixels )
|
||||||
{
|
{
|
||||||
struct xmesa_renderbuffer *xrb
|
struct xmesa_renderbuffer *xrb
|
||||||
= (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0];
|
= (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped;
|
||||||
|
|
||||||
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
|
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
|
||||||
const SWcontext *swrast = SWRAST_CONTEXT( ctx );
|
const SWcontext *swrast = SWRAST_CONTEXT( ctx );
|
||||||
@@ -1151,10 +1154,15 @@ update_framebuffer_size(GLcontext *ctx)
|
|||||||
* Thus, we poll.
|
* Thus, we poll.
|
||||||
* Note that this trick isn't fool-proof. If the application never calls
|
* Note that this trick isn't fool-proof. If the application never calls
|
||||||
* glViewport, our notion of the current window size may be incorrect.
|
* glViewport, our notion of the current window size may be incorrect.
|
||||||
|
* That problem led to the GLX_MESA_resize_buffers extension.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
|
xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
|
||||||
{
|
{
|
||||||
|
(void) x;
|
||||||
|
(void) y;
|
||||||
|
(void) w;
|
||||||
|
(void) h;
|
||||||
update_framebuffer_size(ctx);
|
update_framebuffer_size(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,7 +118,7 @@ void xmesa_choose_point( GLcontext *ctx )
|
|||||||
|
|
||||||
|
|
||||||
#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \
|
#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \
|
||||||
(struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped
|
xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -547,8 +547,7 @@ xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1)
|
|||||||
XMesaContext xmesa = XMESA_CONTEXT(ctx);
|
XMesaContext xmesa = XMESA_CONTEXT(ctx);
|
||||||
XMesaDisplay *dpy = xmesa->xm_visual->display;
|
XMesaDisplay *dpy = xmesa->xm_visual->display;
|
||||||
XMesaGC gc = xmesa->xm_buffer->gc;
|
XMesaGC gc = xmesa->xm_buffer->gc;
|
||||||
struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *)
|
GET_XRB(xrb);
|
||||||
ctx->DrawBuffer->_ColorDrawBuffers[0][0];
|
|
||||||
unsigned long pixel = xmesa_color_to_pixel(ctx,
|
unsigned long pixel = xmesa_color_to_pixel(ctx,
|
||||||
vert1->color[0], vert1->color[1],
|
vert1->color[0], vert1->color[1],
|
||||||
vert1->color[2], vert1->color[3],
|
vert1->color[2], vert1->color[3],
|
||||||
@@ -589,8 +588,7 @@ get_line_func(GLcontext *ctx)
|
|||||||
if (ctx->Line.StippleFlag) return (swrast_line_func) NULL;
|
if (ctx->Line.StippleFlag) return (swrast_line_func) NULL;
|
||||||
if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
|
if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
|
||||||
|
|
||||||
xrb = (struct xmesa_renderbuffer *)
|
xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped);
|
||||||
ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped;
|
|
||||||
|
|
||||||
if (xrb->ximage
|
if (xrb->ximage
|
||||||
&& swrast->_RasterMask==DEPTH_BIT
|
&& swrast->_RasterMask==DEPTH_BIT
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \
|
#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \
|
||||||
(struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped
|
xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped)
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@@ -53,6 +53,8 @@
|
|||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#if CHAN_BITS == 8
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XImage, smooth, depth-buffered, PF_TRUECOLOR triangle.
|
* XImage, smooth, depth-buffered, PF_TRUECOLOR triangle.
|
||||||
*/
|
*/
|
||||||
@@ -1307,8 +1309,10 @@
|
|||||||
#include "swrast/s_tritemp.h"
|
#include "swrast/s_tritemp.h"
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CHAN_BITS == 8 */
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
#if defined(DEBUG) && CHAN_BITS == 8
|
||||||
extern void _xmesa_print_triangle_func( swrast_tri_func triFunc );
|
extern void _xmesa_print_triangle_func( swrast_tri_func triFunc );
|
||||||
void _xmesa_print_triangle_func( swrast_tri_func triFunc )
|
void _xmesa_print_triangle_func( swrast_tri_func triFunc )
|
||||||
{
|
{
|
||||||
@@ -1441,19 +1445,24 @@ get_triangle_func(GLcontext *ctx)
|
|||||||
triFuncName = NULL;
|
triFuncName = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CHAN_BITS == 8
|
||||||
|
/* trivial fallback tests */
|
||||||
if ((ctx->DrawBuffer->_ColorDrawBufferMask[0]
|
if ((ctx->DrawBuffer->_ColorDrawBufferMask[0]
|
||||||
& (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0)
|
& (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0)
|
||||||
return (swrast_tri_func) NULL;
|
return (swrast_tri_func) NULL;
|
||||||
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
|
if (ctx->RenderMode != GL_RENDER)
|
||||||
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
|
return (swrast_tri_func) NULL;
|
||||||
if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;
|
if (ctx->Polygon.SmoothFlag)
|
||||||
if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_tri_func) NULL;
|
return (swrast_tri_func) NULL;
|
||||||
|
if (ctx->Texture._EnabledUnits)
|
||||||
|
return (swrast_tri_func) NULL;
|
||||||
|
if (swrast->_RasterMask & MULTI_DRAW_BIT)
|
||||||
|
return (swrast_tri_func) NULL;
|
||||||
if (ctx->Polygon.CullFlag &&
|
if (ctx->Polygon.CullFlag &&
|
||||||
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
|
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
|
||||||
return (swrast_tri_func) NULL;
|
return (swrast_tri_func) NULL;
|
||||||
|
|
||||||
xrb = (struct xmesa_renderbuffer *)
|
xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped);
|
||||||
ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped;
|
|
||||||
|
|
||||||
if (xrb->ximage) {
|
if (xrb->ximage) {
|
||||||
if ( ctx->Light.ShadeModel==GL_SMOOTH
|
if ( ctx->Light.ShadeModel==GL_SMOOTH
|
||||||
@@ -1607,13 +1616,11 @@ get_triangle_func(GLcontext *ctx)
|
|||||||
return (swrast_tri_func) NULL;
|
return (swrast_tri_func) NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (swrast_tri_func) NULL;
|
#else
|
||||||
}
|
return (swrast_tri_func) NULL;
|
||||||
else {
|
#endif /* CHAN_BITS == 8 */
|
||||||
/* draw to pixmap */
|
|
||||||
return (swrast_tri_func) NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -480,12 +480,14 @@ extern const int xmesa_kernel1[16];
|
|||||||
/*
|
/*
|
||||||
* Return pointer to XMesaContext corresponding to a Mesa GLcontext.
|
* Return pointer to XMesaContext corresponding to a Mesa GLcontext.
|
||||||
* Since we're using structure containment, it's just a cast!.
|
* Since we're using structure containment, it's just a cast!.
|
||||||
|
* XXX should use inlined function for better type safety.
|
||||||
*/
|
*/
|
||||||
#define XMESA_CONTEXT(MESACTX) ((XMesaContext) (MESACTX))
|
#define XMESA_CONTEXT(MESACTX) ((XMesaContext) (MESACTX))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer.
|
* Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer.
|
||||||
* Since we're using structure containment, it's just a cast!.
|
* Since we're using structure containment, it's just a cast!.
|
||||||
|
* XXX should use inlined function for better type safety.
|
||||||
*/
|
*/
|
||||||
#define XMESA_BUFFER(MESABUFF) ((XMesaBuffer) (MESABUFF))
|
#define XMESA_BUFFER(MESABUFF) ((XMesaBuffer) (MESABUFF))
|
||||||
|
|
||||||
@@ -520,6 +522,16 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,
|
|||||||
enum pixel_format pixelformat, GLint depth);
|
enum pixel_format pixelformat, GLint depth);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Using a function instead of an ordinary cast is safer.
|
||||||
|
*/
|
||||||
|
static INLINE struct xmesa_renderbuffer *
|
||||||
|
xmesa_renderbuffer(struct gl_renderbuffer *rb)
|
||||||
|
{
|
||||||
|
return (struct xmesa_renderbuffer *) rb;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Plugged into the software rasterizer. Try to use internal
|
/* Plugged into the software rasterizer. Try to use internal
|
||||||
* swrast-style point, line and triangle functions.
|
* swrast-style point, line and triangle functions.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user