summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/renderbuffer.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2010-03-10 15:49:30 +0100
committerMichal Krol <[email protected]>2010-03-10 15:49:30 +0100
commit3ce4375912c8ea488460e593e07c5bb15b92dca9 (patch)
tree1011fa439bd829fd46a44fd99478135848800e73 /src/mesa/main/renderbuffer.c
parentf59f28093ea827bd234d8e1a36bdd56a9fce5f09 (diff)
parent9b348d0ed125a22be3f318ac60cef6f201edfdab (diff)
Merge branch 'master' into gallium-sampler-view
Conflicts: src/gallium/auxiliary/Makefile src/gallium/auxiliary/SConscript src/gallium/auxiliary/tgsi/tgsi_exec.c src/gallium/auxiliary/util/u_blitter.c src/gallium/drivers/i915/i915_context.h src/gallium/drivers/i965/brw_context.h src/gallium/drivers/llvmpipe/lp_context.h src/gallium/drivers/nv50/nv50_context.h src/gallium/drivers/nv50/nv50_state_validate.c src/gallium/drivers/nv50/nv50_tex.c src/gallium/drivers/r300/r300_blit.c src/gallium/drivers/r300/r300_context.h src/gallium/drivers/r300/r300_emit.c src/gallium/drivers/r300/r300_state.c src/gallium/drivers/softpipe/sp_context.h src/gallium/drivers/svga/svga_context.h src/gallium/drivers/svga/svga_pipe_sampler.c
Diffstat (limited to 'src/mesa/main/renderbuffer.c')
-rw-r--r--src/mesa/main/renderbuffer.c130
1 files changed, 32 insertions, 98 deletions
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 3bb062bae2a..4d7b0aff046 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -87,7 +87,7 @@ get_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
{
const GLubyte *src = (const GLubyte *) rb->Data + y * rb->Width + x;
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
- _mesa_memcpy(values, src, count * sizeof(GLubyte));
+ memcpy(values, src, count * sizeof(GLubyte));
}
@@ -121,7 +121,7 @@ put_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
else {
- _mesa_memcpy(dst, values, count * sizeof(GLubyte));
+ memcpy(dst, values, count * sizeof(GLubyte));
}
}
@@ -207,7 +207,7 @@ get_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
{
const void *src = rb->GetPointer(ctx, rb, x, y);
ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
- _mesa_memcpy(values, src, count * sizeof(GLushort));
+ memcpy(values, src, count * sizeof(GLushort));
}
@@ -241,7 +241,7 @@ put_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
else {
- _mesa_memcpy(dst, src, count * sizeof(GLushort));
+ memcpy(dst, src, count * sizeof(GLushort));
}
}
@@ -337,7 +337,7 @@ get_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
const void *src = rb->GetPointer(ctx, rb, x, y);
ASSERT(rb->DataType == GL_UNSIGNED_INT ||
rb->DataType == GL_UNSIGNED_INT_24_8_EXT);
- _mesa_memcpy(values, src, count * sizeof(GLuint));
+ memcpy(values, src, count * sizeof(GLuint));
}
@@ -373,7 +373,7 @@ put_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
else {
- _mesa_memcpy(dst, src, count * sizeof(GLuint));
+ memcpy(dst, src, count * sizeof(GLuint));
}
}
@@ -548,7 +548,7 @@ put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
if (!mask && val0 == val1 && val1 == val2) {
/* optimized case */
- _mesa_memset(dst, val0, 3 * count);
+ memset(dst, val0, 3 * count);
}
else {
GLuint i;
@@ -631,7 +631,7 @@ get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x);
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
- _mesa_memcpy(values, src, 4 * count * sizeof(GLubyte));
+ memcpy(values, src, 4 * count * sizeof(GLubyte));
}
@@ -669,7 +669,7 @@ put_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
else {
- _mesa_memcpy(dst, src, 4 * count * sizeof(GLubyte));
+ memcpy(dst, src, 4 * count * sizeof(GLubyte));
}
}
@@ -706,7 +706,7 @@ put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
ASSERT(rb->Format == MESA_FORMAT_RGBA8888);
if (!mask && val == 0) {
/* common case */
- _mesa_bzero(dst, count * 4 * sizeof(GLubyte));
+ memset(dst, 0, count * 4 * sizeof(GLubyte));
}
else {
/* general case */
@@ -788,7 +788,7 @@ get_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
{
const GLshort *src = (const GLshort *) rb->Data + 4 * (y * rb->Width + x);
ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
- _mesa_memcpy(values, src, 4 * count * sizeof(GLshort));
+ memcpy(values, src, 4 * count * sizeof(GLshort));
}
@@ -826,7 +826,7 @@ put_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
else {
- _mesa_memcpy(dst, src, 4 * count * sizeof(GLushort));
+ memcpy(dst, src, 4 * count * sizeof(GLushort));
}
}
@@ -851,7 +851,7 @@ put_row_rgb_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
else {
- _mesa_memcpy(dst, src, 4 * count * sizeof(GLushort));
+ memcpy(dst, src, 4 * count * sizeof(GLushort));
}
}
@@ -868,7 +868,7 @@ put_mono_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT);
if (!mask && val0 == 0 && val1 == 0 && val2 == 0 && val3 == 0) {
/* common case for clearing accum buffer */
- _mesa_bzero(dst, count * 4 * sizeof(GLushort));
+ memset(dst, 0, count * 4 * sizeof(GLushort));
}
else {
GLuint i;
@@ -1122,7 +1122,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
/* free old buffer storage */
if (rb->Data) {
- _mesa_free(rb->Data);
+ free(rb->Data);
rb->Data = NULL;
}
@@ -1142,7 +1142,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->Width = width;
rb->Height = height;
- rb->_BaseFormat = _mesa_base_fbo_format(ctx, rb->InternalFormat);
+ rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
+ ASSERT(rb->_BaseFormat);
return GL_TRUE;
}
@@ -1179,10 +1180,10 @@ alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb,
/* next, resize my alpha buffer */
if (arb->Data) {
- _mesa_free(arb->Data);
+ free(arb->Data);
}
- arb->Data = _mesa_malloc(width * height * sizeof(GLubyte));
+ arb->Data = malloc(width * height * sizeof(GLubyte));
if (arb->Data == NULL) {
arb->Width = 0;
arb->Height = 0;
@@ -1204,13 +1205,13 @@ static void
delete_renderbuffer_alpha8(struct gl_renderbuffer *arb)
{
if (arb->Data) {
- _mesa_free(arb->Data);
+ free(arb->Data);
}
ASSERT(arb->Wrapped);
ASSERT(arb != arb->Wrapped);
arb->Wrapped->Delete(arb->Wrapped);
arb->Wrapped = NULL;
- _mesa_free(arb);
+ free(arb);
}
@@ -1319,7 +1320,7 @@ put_mono_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count,
}
}
else {
- _mesa_memset(dst, val, count);
+ memset(dst, val, count);
}
}
@@ -1374,7 +1375,7 @@ copy_buffer_alpha8(struct gl_renderbuffer* dst, struct gl_renderbuffer* src)
ASSERT(dst->Width == src->Width);
ASSERT(dst->Height == src->Height);
- _mesa_memcpy(dst->Data, src->Data, dst->Width * dst->Height * sizeof(GLubyte));
+ memcpy(dst->Data, src->Data, dst->Width * dst->Height * sizeof(GLubyte));
}
@@ -1460,9 +1461,9 @@ void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
if (rb->Data) {
- _mesa_free(rb->Data);
+ free(rb->Data);
}
- _mesa_free(rb);
+ free(rb);
}
@@ -1552,62 +1553,6 @@ _mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
/**
- * Add software-based color index renderbuffers to the given framebuffer.
- * This is a helper routine for device drivers when creating a
- * window system framebuffer (not a user-created render/framebuffer).
- * Once this function is called, you can basically forget about this
- * renderbuffer; core Mesa will handle all the buffer management and
- * rendering!
- */
-GLboolean
-_mesa_add_color_index_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
- GLuint indexBits,
- GLboolean frontLeft, GLboolean backLeft,
- GLboolean frontRight, GLboolean backRight)
-{
- GLuint b;
-
- if (indexBits > 8) {
- _mesa_problem(ctx,
- "Unsupported bit depth in _mesa_add_color_index_renderbuffers");
- return GL_FALSE;
- }
-
- assert(MAX_COLOR_ATTACHMENTS >= 4);
-
- for (b = BUFFER_FRONT_LEFT; b <= BUFFER_BACK_RIGHT; b++) {
- struct gl_renderbuffer *rb;
-
- if (b == BUFFER_FRONT_LEFT && !frontLeft)
- continue;
- else if (b == BUFFER_BACK_LEFT && !backLeft)
- continue;
- else if (b == BUFFER_FRONT_RIGHT && !frontRight)
- continue;
- else if (b == BUFFER_BACK_RIGHT && !backRight)
- continue;
-
- assert(fb->Attachment[b].Renderbuffer == NULL);
-
- rb = _mesa_new_renderbuffer(ctx, 0);
- if (!rb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating color buffer");
- return GL_FALSE;
- }
-
- assert(indexBits <= 8);
- rb->Format = MESA_FORMAT_CI8;
- rb->InternalFormat = GL_COLOR_INDEX;
-
- rb->AllocStorage = _mesa_soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, b, rb);
- }
-
- return GL_TRUE;
-}
-
-
-/**
* Add software-based alpha renderbuffers to the given framebuffer.
* This is a helper routine for device drivers when creating a
* window system framebuffer (not a user-created render/framebuffer).
@@ -1906,21 +1851,13 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
GLboolean backRight = fb->Visual.stereoMode && fb->Visual.doubleBufferMode;
if (color) {
- if (fb->Visual.rgbMode) {
- assert(fb->Visual.redBits == fb->Visual.greenBits);
- assert(fb->Visual.redBits == fb->Visual.blueBits);
- _mesa_add_color_renderbuffers(NULL, fb,
- fb->Visual.redBits,
- fb->Visual.alphaBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
- else {
- _mesa_add_color_index_renderbuffers(NULL, fb,
- fb->Visual.indexBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
+ assert(fb->Visual.redBits == fb->Visual.greenBits);
+ assert(fb->Visual.redBits == fb->Visual.blueBits);
+ _mesa_add_color_renderbuffers(NULL, fb,
+ fb->Visual.redBits,
+ fb->Visual.alphaBits,
+ frontLeft, backLeft,
+ frontRight, backRight);
}
if (depth) {
@@ -1934,7 +1871,6 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
}
if (accum) {
- assert(fb->Visual.rgbMode);
assert(fb->Visual.accumRedBits > 0);
assert(fb->Visual.accumGreenBits > 0);
assert(fb->Visual.accumBlueBits > 0);
@@ -1946,14 +1882,12 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
}
if (aux) {
- assert(fb->Visual.rgbMode);
assert(fb->Visual.numAuxBuffers > 0);
_mesa_add_aux_renderbuffers(NULL, fb, fb->Visual.redBits,
fb->Visual.numAuxBuffers);
}
if (alpha) {
- assert(fb->Visual.rgbMode);
assert(fb->Visual.alphaBits > 0);
_mesa_add_alpha_renderbuffers(NULL, fb, fb->Visual.alphaBits,
frontLeft, backLeft,