aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/swrast/swrast.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/swrast/swrast.c')
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c86
1 files changed, 37 insertions, 49 deletions
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index e9224ae70..e968ce4ba 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -137,7 +137,8 @@ swrastFillInModes(__DRIscreen *psp,
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, msaa_samples_array, 1);
+ back_buffer_factor, msaa_samples_array, 1,
+ GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __FUNCTION__,
__LINE__);
@@ -159,7 +160,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
TRACE;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@@ -188,7 +189,7 @@ static void driDestroyScreen(__DRIscreen *psp)
TRACE;
if (psp) {
- _mesa_free(psp);
+ free(psp);
}
}
@@ -207,34 +208,28 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp)
static GLuint
choose_pixel_format(const GLvisual *v)
{
- if (v->rgbMode) {
- int depth = v->rgbBits;
-
- if (depth == 32
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_A8R8G8B8;
- else if (depth == 24
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_X8R8G8B8;
- else if (depth == 16
- && v->redMask == 0xf800
- && v->greenMask == 0x07e0
- && v->blueMask == 0x001f)
- return PF_R5G6B5;
- else if (depth == 8
- && v->redMask == 0x07
- && v->greenMask == 0x38
- && v->blueMask == 0xc0)
- return PF_R3G3B2;
- }
- else {
- if (v->indexBits == 8)
- return PF_CI8;
- }
+ int depth = v->rgbBits;
+
+ if (depth == 32
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_A8R8G8B8;
+ else if (depth == 24
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_X8R8G8B8;
+ else if (depth == 16
+ && v->redMask == 0xf800
+ && v->greenMask == 0x07e0
+ && v->blueMask == 0x001f)
+ return PF_R5G6B5;
+ else if (depth == 8
+ && v->redMask == 0x07
+ && v->greenMask == 0x38
+ && v->blueMask == 0xc0)
+ return PF_R3G3B2;
_mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ );
return 0;
@@ -245,8 +240,8 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
{
TRACE;
- _mesa_free(rb->Data);
- _mesa_free(rb);
+ free(rb->Data);
+ free(rb);
}
static GLboolean
@@ -276,11 +271,11 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
TRACE;
- _mesa_free(rb->Data);
+ free(rb->Data);
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
- rb->Data = _mesa_malloc(height * xrb->pitch);
+ rb->Data = malloc(height * xrb->pitch);
return GL_TRUE;
}
@@ -288,7 +283,7 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
static struct swrast_renderbuffer *
swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
{
- struct swrast_renderbuffer *xrb = _mesa_calloc(sizeof *xrb);
+ struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
GLuint pixel_format;
TRACE;
@@ -339,13 +334,6 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 8;
break;
- case PF_CI8:
- xrb->Base.Format = MESA_FORMAT_CI8;
- xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
- xrb->Base._BaseFormat = GL_COLOR_INDEX;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->bpp = 8;
- break;
default:
return NULL;
}
@@ -362,7 +350,7 @@ driCreateNewDrawable(__DRIscreen *screen,
TRACE;
- buf = _mesa_calloc(sizeof *buf);
+ buf = calloc(1, sizeof *buf);
if (!buf)
return NULL;
@@ -370,10 +358,10 @@ driCreateNewDrawable(__DRIscreen *screen,
buf->driScreenPriv = screen;
- buf->row = _mesa_malloc(MAX_WIDTH * 4);
+ buf->row = malloc(MAX_WIDTH * 4);
/* basic framebuffer setup */
- _mesa_initialize_framebuffer(&buf->Base, &config->modes);
+ _mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
/* add front renderbuffer */
frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE);
@@ -405,7 +393,7 @@ driDestroyDrawable(__DRIdrawable *buf)
if (buf) {
struct gl_framebuffer *fb = &buf->Base;
- _mesa_free(buf->row);
+ free(buf->row);
fb->DeletePending = GL_TRUE;
_mesa_reference_framebuffer(&fb, NULL);
@@ -529,7 +517,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
TRACE;
- ctx = _mesa_calloc(sizeof *ctx);
+ ctx = calloc(1, sizeof *ctx);
if (!ctx)
return NULL;
@@ -544,7 +532,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
if (!_mesa_initialize_context(&ctx->Base, &config->modes,
shared ? &shared->Base : NULL,
&functions, (void *) ctx)) {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}