summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-01-16 12:03:09 -0700
committerIan Romanick <ian.d.romanick@intel.com>2012-01-27 18:02:39 -0800
commit8e5e73542459dabd241c35d0aa3ea7c0e30bf2ed (patch)
treeac08013a69572c5cfabe308a243e41518e9eab5d
parentf5367c45031cac167f3ef8ee273880318156e787 (diff)
mesa: remove gl_renderbuffer::DataType
(cherry picked from commit f9874feef4d8952df5054bd8e8f4e0deda4ef44f)
-rw-r--r--src/mesa/drivers/dri/i965/gen6_hiz.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_fbo.c5
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c80
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c2
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c4
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c34
-rw-r--r--src/mesa/drivers/windows/gdi/wmesa.c1
-rw-r--r--src/mesa/drivers/x11/xm_buffer.c1
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/renderbuffer.c1
-rw-r--r--src/mesa/swrast/s_renderbuffer.c96
-rw-r--r--src/mesa/swrast/s_span.c39
-rw-r--r--src/mesa/swrast/s_span.h1
-rw-r--r--src/mesa/swrast/s_texrender.c10
-rw-r--r--src/mesa/swrast/s_triangle.c6
17 files changed, 39 insertions, 249 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_hiz.c b/src/mesa/drivers/dri/i965/gen6_hiz.c
index 4d36729e7c5..d7698ed2aa2 100644
--- a/src/mesa/drivers/dri/i965/gen6_hiz.c
+++ b/src/mesa/drivers/dri/i965/gen6_hiz.c
@@ -230,7 +230,6 @@ gen6_hiz_setup_depth_buffer(struct brw_context *brw,
rb->Format = mt->format;
rb->_BaseFormat = _mesa_get_format_base_format(rb->Format);
- rb->DataType = intel_mesa_format_to_rb_datatype(rb->Format);
rb->InternalFormat = rb->_BaseFormat;
rb->Width = mt->level[level].width;
rb->Height = mt->level[level].height;
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index bd4fc7f589d..e13d62cc914 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -237,7 +237,6 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
rb->Width = width;
rb->Height = height;
rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
- rb->DataType = intel_mesa_format_to_rb_datatype(rb->Format);
intel_miptree_release(&irb->mt);
@@ -303,7 +302,6 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
rb->Width = image->region->width;
rb->Height = image->region->height;
rb->Format = image->format;
- rb->DataType = image->data_type;
rb->_BaseFormat = _mesa_base_fbo_format(&intel->ctx,
image->internal_format);
}
@@ -385,7 +383,6 @@ intel_create_renderbuffer(gl_format format)
irb->Base._BaseFormat = _mesa_get_format_base_format(format);
irb->Base.Format = format;
irb->Base.InternalFormat = irb->Base._BaseFormat;
- irb->Base.DataType = intel_mesa_format_to_rb_datatype(format);
/* intel-specific methods */
irb->Base.Delete = intel_delete_renderbuffer;
@@ -486,7 +483,6 @@ intel_renderbuffer_update_wrapper(struct intel_context *intel,
rb->Format = format;
rb->InternalFormat = internal_format;
- rb->DataType = intel_mesa_format_to_rb_datatype(rb->Format);
rb->_BaseFormat = _mesa_get_format_base_format(rb->Format);
rb->Width = mt->level[level].width;
rb->Height = mt->level[level].height;
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 0566907fb3d..cf046a267c8 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -208,7 +208,7 @@ intel_create_image_from_renderbuffer(__DRIcontext *context,
image->internal_format = rb->InternalFormat;
image->format = rb->Format;
- image->data_type = rb->DataType;
+ image->data_type = GL_UNSIGNED_BYTE;
image->data = loaderPrivate;
intel_region_reference(&image->region, irb->mt->region);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index d56e954e45a..6f4956efe8c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -46,26 +46,22 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum internalFormat)
case GL_RGB8:
rb->_BaseFormat = GL_RGB;
rb->Format = MESA_FORMAT_XRGB8888;
- rb->DataType = GL_UNSIGNED_BYTE;
s->cpp = 4;
break;
case GL_RGBA:
case GL_RGBA8:
rb->_BaseFormat = GL_RGBA;
rb->Format = MESA_FORMAT_ARGB8888;
- rb->DataType = GL_UNSIGNED_BYTE;
s->cpp = 4;
break;
case GL_RGB5:
rb->_BaseFormat = GL_RGB;
rb->Format = MESA_FORMAT_RGB565;
- rb->DataType = GL_UNSIGNED_BYTE;
s->cpp = 2;
break;
case GL_DEPTH_COMPONENT16:
rb->_BaseFormat = GL_DEPTH_COMPONENT;
rb->Format = MESA_FORMAT_Z16;
- rb->DataType = GL_UNSIGNED_SHORT;
s->cpp = 2;
break;
case GL_DEPTH_COMPONENT:
@@ -74,7 +70,6 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum internalFormat)
case GL_DEPTH24_STENCIL8_EXT:
rb->_BaseFormat = GL_DEPTH_STENCIL;
rb->Format = MESA_FORMAT_Z24_S8;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
s->cpp = 4;
break;
default:
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index a0d79560818..026587c1bab 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -481,7 +481,6 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
case GL_RGB4:
case GL_RGB5:
rb->Format = _radeon_texformat_rgb565;
- rb->DataType = GL_UNSIGNED_BYTE;
cpp = 2;
break;
case GL_RGB:
@@ -490,7 +489,6 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
case GL_RGB12:
case GL_RGB16:
rb->Format = _radeon_texformat_argb8888;
- rb->DataType = GL_UNSIGNED_BYTE;
cpp = 4;
break;
case GL_RGBA:
@@ -502,7 +500,6 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
case GL_RGBA12:
case GL_RGBA16:
rb->Format = _radeon_texformat_argb8888;
- rb->DataType = GL_UNSIGNED_BYTE;
cpp = 4;
break;
case GL_STENCIL_INDEX:
@@ -512,25 +509,21 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
case GL_STENCIL_INDEX16_EXT:
/* alloc a depth+stencil buffer */
rb->Format = MESA_FORMAT_S8_Z24;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
cpp = 4;
break;
case GL_DEPTH_COMPONENT16:
rb->Format = MESA_FORMAT_Z16;
- rb->DataType = GL_UNSIGNED_SHORT;
cpp = 2;
break;
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32:
rb->Format = MESA_FORMAT_X8_Z24;
- rb->DataType = GL_UNSIGNED_INT;
cpp = 4;
break;
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
rb->Format = MESA_FORMAT_S8_Z24;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
cpp = 4;
break;
default:
@@ -604,7 +597,6 @@ radeon_image_target_renderbuffer_storage(struct gl_context *ctx,
rb->Width = image->width;
rb->Height = image->height;
rb->Format = image->format;
- rb->DataType = image->data_type;
rb->_BaseFormat = _mesa_base_fbo_format(radeon->glCtx,
image->internal_format);
}
@@ -696,49 +688,6 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv)
rrb->base.Format = format;
- switch (format) {
- case MESA_FORMAT_RGB565:
- assert(_mesa_little_endian());
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_RGB565_REV:
- assert(!_mesa_little_endian());
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_XRGB8888:
- assert(_mesa_little_endian());
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_XRGB8888_REV:
- assert(!_mesa_little_endian());
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_ARGB8888:
- assert(_mesa_little_endian());
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_ARGB8888_REV:
- assert(!_mesa_little_endian());
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_S8:
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_Z16:
- rrb->base.DataType = GL_UNSIGNED_SHORT;
- break;
- case MESA_FORMAT_X8_Z24:
- rrb->base.DataType = GL_UNSIGNED_INT;
- break;
- case MESA_FORMAT_S8_Z24:
- rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- break;
- default:
- fprintf(stderr, "%s: Unknown format %s\n",
- __FUNCTION__, _mesa_get_format_name(format));
- _mesa_delete_renderbuffer(&rrb->base);
- return NULL;
- }
rrb->base._BaseFormat = _mesa_get_format_base_format(format);
rrb->dPriv = driDrawPriv;
@@ -816,35 +765,6 @@ radeon_update_wrapper(struct gl_context *ctx, struct radeon_renderbuffer *rrb,
"%s(%p, rrb %p, texImage %p, texFormat %s) \n",
__func__, ctx, rrb, texImage, _mesa_get_format_name(texImage->TexFormat));
- switch (texImage->TexFormat) {
- case MESA_FORMAT_RGBA8888:
- case MESA_FORMAT_RGBA8888_REV:
- case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_ARGB8888_REV:
- case MESA_FORMAT_XRGB8888:
- case MESA_FORMAT_XRGB8888_REV:
- case MESA_FORMAT_RGB565:
- case MESA_FORMAT_RGB565_REV:
- case MESA_FORMAT_RGBA5551:
- case MESA_FORMAT_ARGB1555:
- case MESA_FORMAT_ARGB1555_REV:
- case MESA_FORMAT_ARGB4444:
- case MESA_FORMAT_ARGB4444_REV:
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- break;
- case MESA_FORMAT_Z16:
- rrb->base.DataType = GL_UNSIGNED_SHORT;
- break;
- case MESA_FORMAT_X8_Z24:
- rrb->base.DataType = GL_UNSIGNED_INT;
- break;
- case MESA_FORMAT_S8_Z24:
- rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- break;
- default:
- _mesa_problem(ctx, "Unexpected texture format in radeon_update_wrapper()");
- }
-
rrb->cpp = _mesa_get_format_bytes(texImage->TexFormat);
rrb->pitch = texImage->Width * rrb->cpp;
rrb->base.Format = texImage->TexFormat;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 2e364d02807..51a1ef54ec1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -282,7 +282,7 @@ radeon_create_image_from_renderbuffer(__DRIcontext *context,
image->internal_format = rb->InternalFormat;
image->format = rb->Format;
image->cpp = rrb->cpp;
- image->data_type = rb->DataType;
+ image->data_type = GL_UNSIGNED_BYTE;
image->data = loaderPrivate;
radeon_bo_ref(rrb->bo);
image->bo = rrb->bo;
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index efc55272508..19da7028e8a 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -344,28 +344,24 @@ swrast_new_renderbuffer(const struct gl_config *visual, __DRIdrawable *dPriv,
xrb->Base.Format = MESA_FORMAT_ARGB8888;
xrb->Base.InternalFormat = GL_RGBA;
xrb->Base._BaseFormat = GL_RGBA;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 32;
break;
case PF_X8R8G8B8:
xrb->Base.Format = MESA_FORMAT_ARGB8888; /* XXX */
xrb->Base.InternalFormat = GL_RGB;
xrb->Base._BaseFormat = GL_RGB;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 32;
break;
case PF_R5G6B5:
xrb->Base.Format = MESA_FORMAT_RGB565;
xrb->Base.InternalFormat = GL_RGB;
xrb->Base._BaseFormat = GL_RGB;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 16;
break;
case PF_R3G3B2:
xrb->Base.Format = MESA_FORMAT_RGB332;
xrb->Base.InternalFormat = GL_RGB;
xrb->Base._BaseFormat = GL_RGB;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 8;
break;
default:
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 543bcbfcb13..5c1a3f3b783 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -75,6 +75,7 @@ struct osmesa_context
GLvoid *rowaddr[MAX_HEIGHT]; /*< address of first pixel in each image row */
GLboolean yup; /*< TRUE -> Y increases upward */
/*< FALSE -> Y increases downward */
+ GLboolean DataType;
};
@@ -192,9 +193,6 @@ osmesa_choose_line_function( struct gl_context *ctx )
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
- if (osmesa->rb->DataType != GL_UNSIGNED_BYTE)
- return NULL;
-
if (ctx->RenderMode != GL_RENDER) return NULL;
if (ctx->Line.SmoothFlag) return NULL;
if (ctx->Texture._EnabledUnits) return NULL;
@@ -296,9 +294,6 @@ osmesa_choose_triangle_function( struct gl_context *ctx )
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
- if (osmesa->rb->DataType != GL_UNSIGNED_BYTE)
- return (swrast_tri_func) NULL;
-
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
if (ctx->Polygon.StippleFlag) return (swrast_tri_func) NULL;
@@ -419,13 +414,13 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
* XXX The 8-bit/channel formats should all be OK.
*/
if (osmesa->format == OSMESA_RGBA) {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (osmesa->DataType == GL_UNSIGNED_BYTE) {
if (_mesa_little_endian())
rb->Format = MESA_FORMAT_RGBA8888_REV;
else
rb->Format = MESA_FORMAT_RGBA8888;
}
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
+ else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
rb->Format = MESA_FORMAT_RGBA_16;
}
else {
@@ -433,13 +428,13 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
}
else if (osmesa->format == OSMESA_BGRA) {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (osmesa->DataType == GL_UNSIGNED_BYTE) {
if (_mesa_little_endian())
rb->Format = MESA_FORMAT_ARGB8888;
else
rb->Format = MESA_FORMAT_ARGB8888_REV;
}
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
+ else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
_mesa_warning(ctx, "Unsupported OSMesa format BGRA/GLushort");
rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */
}
@@ -449,13 +444,13 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
}
else if (osmesa->format == OSMESA_ARGB) {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (osmesa->DataType == GL_UNSIGNED_BYTE) {
if (_mesa_little_endian())
rb->Format = MESA_FORMAT_ARGB8888_REV;
else
rb->Format = MESA_FORMAT_ARGB8888;
}
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
+ else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
_mesa_warning(ctx, "Unsupported OSMesa format ARGB/GLushort");
rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */
}
@@ -465,10 +460,10 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
}
else if (osmesa->format == OSMESA_RGB) {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (osmesa->DataType == GL_UNSIGNED_BYTE) {
rb->Format = MESA_FORMAT_RGB888;
}
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
+ else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
_mesa_warning(ctx, "Unsupported OSMesa format RGB/GLushort");
rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */
}
@@ -478,10 +473,10 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
}
else if (osmesa->format == OSMESA_BGR) {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (osmesa->DataType == GL_UNSIGNED_BYTE) {
rb->Format = MESA_FORMAT_BGR888;
}
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
+ else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
_mesa_warning(ctx, "Unsupported OSMesa format BGR/GLushort");
rb->Format = MESA_FORMAT_RGBA_16; /* not exactly right */
}
@@ -491,7 +486,7 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
}
else if (osmesa->format == OSMESA_RGB_565) {
- ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
+ ASSERT(osmesa->DataType == GL_UNSIGNED_BYTE);
rb->Format = MESA_FORMAT_RGB565;
}
else {
@@ -523,7 +518,6 @@ new_osmesa_renderbuffer(struct gl_context *ctx, GLenum format, GLenum type)
rb->InternalFormat = GL_RGBA;
rb->_BaseFormat = GL_RGBA;
- rb->DataType = type;
}
return rb;
}
@@ -892,6 +886,8 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
assert(osmesa->rb->RefCount == 2);
}
+ osmesa->DataType = type;
+
/* Set renderbuffer fields. Set width/height = 0 to force
* osmesa_renderbuffer_storage() being called by _mesa_resize_framebuffer()
*/
@@ -986,7 +982,7 @@ OSMesaGetIntegerv( GLint pname, GLint *value )
case OSMESA_TYPE:
/* current color buffer's data type */
if (osmesa->rb) {
- *value = osmesa->rb->DataType;
+ *value = osmesa->DataType;
}
else {
*value = 0;
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 255d811ca70..40aa56edec5 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -1233,7 +1233,6 @@ wmesa_new_renderbuffer(void)
rb->_BaseFormat = GL_RGBA;
rb->InternalFormat = GL_RGBA;
- rb->DataType = CHAN_TYPE;
rb->Delete = wmesa_delete_renderbuffer;
rb->AllocStorage = wmesa_renderbuffer_storage;
return rb;
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index 84e6fcd795c..0f1d96050e4 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -336,7 +336,6 @@ xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name,
xrb->Base.InternalFormat = GL_RGBA;
xrb->Base._BaseFormat = GL_RGBA;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->Base.ClassID = XMESA_RENDERBUFFER;
switch (xmvis->undithered_pf) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 37df03eeab0..3e8d171ed8c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2541,7 +2541,6 @@ struct gl_renderbuffer
/* XXX the following fields are obsolete and wil go away */
GLvoid *Data; /**< This may not be used by some kinds of RBs */
- GLenum DataType; /**< Type of values passed to the Get/Put functions */
/** The following fields are only valid while the buffer is mapped */
GLubyte *Map;
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 39c25b0f01e..9cdc4990bb1 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -55,7 +55,6 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
rb->InternalFormat = GL_RGBA;
rb->Format = MESA_FORMAT_NONE;
- rb->DataType = GL_NONE;
rb->Data = NULL;
/* Point back to ourself so that we don't have to check for Wrapped==NULL
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index 2ef3e030cc2..a78c6a191b9 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -40,98 +40,6 @@
#include "swrast/s_renderbuffer.h"
-
-/**
- * This is the default software fallback for gl_renderbuffer's span
- * access functions.
- *
- * The assumptions are that rb->Data will be a pointer to (0,0), that pixels
- * are packed in the type of rb->Format, and that subsequent rows appear
- * rb->RowStride pixels later.
- */
-void
-_swrast_set_renderbuffer_accessors(struct gl_renderbuffer *rb)
-{
- switch (rb->Format) {
- case MESA_FORMAT_RGB888:
- rb->DataType = GL_UNSIGNED_BYTE;
- break;
-
- case MESA_FORMAT_RGBA8888:
- case MESA_FORMAT_RGBA8888_REV:
- rb->DataType = GL_UNSIGNED_BYTE;
- break;
-
- case MESA_FORMAT_R8:
- rb->DataType = GL_UNSIGNED_BYTE;
-
- break;
-
- case MESA_FORMAT_GR88:
- rb->DataType = GL_UNSIGNED_BYTE;
- break;
-
- case MESA_FORMAT_R16:
- rb->DataType = GL_UNSIGNED_SHORT;
-
- break;
-
- case MESA_FORMAT_RG1616:
- rb->DataType = GL_UNSIGNED_SHORT;
- break;
-
- case MESA_FORMAT_SIGNED_RGBA_16:
- rb->DataType = GL_SHORT;
- break;
-
- case MESA_FORMAT_S8:
- rb->DataType = GL_UNSIGNED_BYTE;
- break;
-
- case MESA_FORMAT_Z16:
- rb->DataType = GL_UNSIGNED_SHORT;
- break;
-
- case MESA_FORMAT_Z32:
- case MESA_FORMAT_X8_Z24:
- case MESA_FORMAT_Z24_X8:
- rb->DataType = GL_UNSIGNED_INT;
- break;
-
- case MESA_FORMAT_Z24_S8:
- case MESA_FORMAT_S8_Z24:
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- break;
-
- case MESA_FORMAT_RGBA_FLOAT32:
- rb->DataType = GL_FLOAT;
- break;
-
- case MESA_FORMAT_INTENSITY_FLOAT32:
- rb->DataType = GL_FLOAT;
- break;
-
- case MESA_FORMAT_LUMINANCE_FLOAT32:
- rb->DataType = GL_FLOAT;
- break;
-
- case MESA_FORMAT_ALPHA_FLOAT32:
- rb->DataType = GL_FLOAT;
- break;
-
- case MESA_FORMAT_RG_FLOAT32:
- rb->DataType = GL_FLOAT;
- break;
-
- case MESA_FORMAT_R_FLOAT32:
- rb->DataType = GL_FLOAT;
- break;
-
- default:
- break;
- }
-}
-
/**
* This is a software fallback for the gl_renderbuffer->AllocStorage
* function.
@@ -204,10 +112,6 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
return GL_FALSE;
}
- _swrast_set_renderbuffer_accessors(rb);
-
- ASSERT(rb->DataType);
-
/* free old buffer storage */
if (rb->Data) {
free(rb->Data);
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 2b67d55767d..49529a87bb5 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1029,6 +1029,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span)
/** Put colors at x/y locations into a renderbuffer */
static void
put_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
+ GLenum datatype,
GLuint count, const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
@@ -1038,12 +1039,12 @@ put_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
if (mask[i]) {
GLubyte *dst = _swrast_pixel_address(rb, x[i], y[i]);
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (datatype == GL_UNSIGNED_BYTE) {
_mesa_pack_ubyte_rgba_row(rb->Format, 1,
(const GLubyte (*)[4]) values + i, dst);
}
else {
- assert(rb->DataType == GL_FLOAT);
+ assert(datatype == GL_FLOAT);
_mesa_pack_float_rgba_row(rb->Format, count,
(const GLfloat (*)[4]) values + i, dst);
}
@@ -1055,18 +1056,19 @@ put_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
/** Put row of colors into renderbuffer */
void
_swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
+ GLenum datatype,
GLuint count, GLint x, GLint y,
const void *values, const GLubyte *mask)
{
GLubyte *dst = _swrast_pixel_address(rb, x, y);
if (!mask) {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (datatype == GL_UNSIGNED_BYTE) {
_mesa_pack_ubyte_rgba_row(rb->Format, count,
(const GLubyte (*)[4]) values, dst);
}
else {
- assert(rb->DataType == GL_FLOAT);
+ assert(datatype == GL_FLOAT);
_mesa_pack_float_rgba_row(rb->Format, count,
(const GLfloat (*)[4]) values, dst);
}
@@ -1088,13 +1090,13 @@ _swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
if (!mask[i] || i == count - 1) {
/* might be the end of a run of pixels */
if (runLen > 0) {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
+ if (datatype == GL_UNSIGNED_BYTE) {
_mesa_pack_ubyte_rgba_row(rb->Format, runLen,
(const GLubyte (*)[4]) values + runStart,
dst + runStart * bpp);
}
else {
- assert(rb->DataType == GL_FLOAT);
+ assert(datatype == GL_FLOAT);
_mesa_pack_float_rgba_row(rb->Format, runLen,
(const GLfloat (*)[4]) values + runStart,
dst + runStart * bpp);
@@ -1310,23 +1312,13 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
if (rb) {
GLchan rgbaSave[MAX_WIDTH][4];
- const GLuint fragOutput = multiFragOutputs ? buf : 0;
- /* set span->array->rgba to colors for render buffer's datatype */
- if (rb->DataType != span->array->ChanType || fragOutput > 0) {
- convert_color_type(span, rb->DataType, fragOutput);
+ if (span->array->ChanType == GL_UNSIGNED_BYTE) {
+ span->array->rgba = span->array->rgba8;
}
else {
- if (rb->DataType == GL_UNSIGNED_BYTE) {
- span->array->rgba = span->array->rgba8;
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- span->array->rgba = (void *) span->array->rgba16;
- }
- else {
- span->array->rgba = (void *)
- span->array->attribs[FRAG_ATTRIB_COL0];
- }
+ span->array->rgba = (void *)
+ span->array->attribs[FRAG_ATTRIB_COL0];
}
if (!multiFragOutputs && numBuffers > 1) {
@@ -1354,13 +1346,16 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
- put_values(ctx, rb, span->end,
+ put_values(ctx, rb,
+ span->array->ChanType, span->end,
span->array->x, span->array->y,
span->array->rgba, span->array->mask);
}
else {
/* horizontal run of pixels */
- _swrast_put_row(ctx, rb, span->end, span->x, span->y,
+ _swrast_put_row(ctx, rb,
+ span->array->ChanType,
+ span->end, span->x, span->y,
span->array->rgba,
span->writeAll ? NULL: span->array->mask);
}
diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h
index 4d6eb7ec163..ff0fe6cd94c 100644
--- a/src/mesa/swrast/s_span.h
+++ b/src/mesa/swrast/s_span.h
@@ -205,6 +205,7 @@ _swrast_read_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
extern void
_swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
+ GLenum datatype,
GLuint count, GLint x, GLint y,
const void *values, const GLubyte *mask);
diff --git a/src/mesa/swrast/s_texrender.c b/src/mesa/swrast/s_texrender.c
index 4a944310376..368fa98b214 100644
--- a/src/mesa/swrast/s_texrender.c
+++ b/src/mesa/swrast/s_texrender.c
@@ -146,47 +146,37 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
/* XXX may need more special cases here */
switch (trb->TexImage->Base.TexFormat) {
case MESA_FORMAT_Z24_S8:
- trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
trb->Base._BaseFormat = GL_DEPTH_STENCIL;
break;
case MESA_FORMAT_S8_Z24:
- trb->Base.DataType = GL_UNSIGNED_INT_8_24_REV_MESA;
trb->Base._BaseFormat = GL_DEPTH_STENCIL;
break;
case MESA_FORMAT_Z24_X8:
- trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
break;
case MESA_FORMAT_X8_Z24:
- trb->Base.DataType = GL_UNSIGNED_INT_8_24_REV_MESA;
trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
break;
case MESA_FORMAT_Z16:
- trb->Base.DataType = GL_UNSIGNED_SHORT;
trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
break;
case MESA_FORMAT_Z32:
- trb->Base.DataType = GL_UNSIGNED_INT;
trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
break;
/* SRGB formats pre EXT_framebuffer_sRGB don't do sRGB translations on FBO readback */
case MESA_FORMAT_SRGB8:
trb->Fetch = _mesa_get_texel_fetch_func(MESA_FORMAT_RGB888, _mesa_get_texture_dimensions(att->Texture->Target));
- trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
break;
case MESA_FORMAT_SRGBA8:
trb->Fetch = _mesa_get_texel_fetch_func(MESA_FORMAT_RGBA8888, _mesa_get_texture_dimensions(att->Texture->Target));
- trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
break;
case MESA_FORMAT_SARGB8:
trb->Fetch = _mesa_get_texel_fetch_func(MESA_FORMAT_ARGB8888, _mesa_get_texture_dimensions(att->Texture->Target));
- trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
break;
default:
- trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
}
}
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 2b54cd13153..124aa5f8edd 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -157,7 +157,8 @@ _swrast_culltriangle( struct gl_context *ctx,
span.intTex[0] += span.intTexStep[0]; \
span.intTex[1] += span.intTexStep[1]; \
} \
- _swrast_put_row(ctx, rb, span.end, span.x, span.y, rgba, NULL);
+ _swrast_put_row(ctx, rb, GL_UNSIGNED_BYTE, span.end, \
+ span.x, span.y, rgba, NULL);
#include "s_tritemp.h"
@@ -223,7 +224,8 @@ _swrast_culltriangle( struct gl_context *ctx,
span.intTex[1] += span.intTexStep[1]; \
span.z += span.zStep; \
} \
- _swrast_put_row(ctx, rb, span.end, span.x, span.y, rgba, span.array->mask);
+ _swrast_put_row(ctx, rb, GL_UNSIGNED_BYTE, \
+ span.end, span.x, span.y, rgba, span.array->mask);
#include "s_tritemp.h"