summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-16 12:03:09 -0700
committerBrian Paul <[email protected]>2012-01-24 14:12:24 -0700
commitf9874feef4d8952df5054bd8e8f4e0deda4ef44f (patch)
treed3ac6f1405c4557b599332a0e4b99ab77884f349 /src/mesa/drivers
parent1e1b5cb01a10e39d01923e3c7e989c44210950cd (diff)
mesa: remove gl_renderbuffer::DataType
Diffstat (limited to 'src/mesa/drivers')
-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
10 files changed, 17 insertions, 117 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 094ff568c44..3d5689ab79e 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 a5dff983aa9..06eadd2262e 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) {