summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-10-05 01:48:07 +0000
committerBrian Paul <[email protected]>2005-10-05 01:48:07 +0000
commita9fc8ba756dd25a07dc19058fe60f65bda82a055 (patch)
treeaa863fa82d93ea468d6c16e3db6fa74ad1ffb5cb /src/mesa/main
parent91802fdf730451aaa0246f514f6778ffaef92c50 (diff)
In gl_texture_image replace IntFormat with InternalFormat and Format with
_BaseFormat to be consistant with gl_renderbuffer.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/fbobject.c8
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/teximage.c22
-rw-r--r--src/mesa/main/texobj.c4
-rw-r--r--src/mesa/main/texrender.c2
-rw-r--r--src/mesa/main/texstate.c23
-rw-r--r--src/mesa/main/texstore.c44
7 files changed, 56 insertions, 51 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index f2ab7dc9c06..6fc7c8ab631 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -406,9 +406,11 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
}
if (att->Type == GL_TEXTURE) {
- w = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Width;
- h = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Height;
- f = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Format;
+ const struct gl_texture_image *texImg
+ = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
+ w = texImg->Width;
+ h = texImg->Height;
+ f = texImg->_BaseFormat;
numImages++;
if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) {
/* XXX need GL_DEPTH_STENCIL_EXT test? */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 962d9f29cfa..b551abae344 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1206,13 +1206,13 @@ struct gl_texture_format
*/
struct gl_texture_image
{
- GLenum Format; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
+ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
* GL_LUMINANCE, GL_LUMINANCE_ALPHA,
* GL_INTENSITY, GL_COLOR_INDEX,
* GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT
* only. Used for choosing TexEnv arithmetic.
*/
- GLint IntFormat; /**< Internal format as given by the user */
+ GLint InternalFormat; /**< Internal format as given by the user */
GLuint Border; /**< 0 or 1 */
GLuint Width; /**< = 2^WidthLog2 + 2*Border */
GLuint Height; /**< = 2^HeightLog2 + 2*Border */
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 862a0d40712..9731185f443 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1037,8 +1037,8 @@ static void
clear_teximage_fields(struct gl_texture_image *img)
{
ASSERT(img);
- img->Format = 0;
- img->IntFormat = 0;
+ img->_BaseFormat = 0;
+ img->InternalFormat = 0;
img->Border = 0;
img->Width = 0;
img->Height = 0;
@@ -1081,9 +1081,9 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
GLint border, GLenum internalFormat)
{
ASSERT(img);
- img->Format = _mesa_base_tex_format( ctx, internalFormat );
- ASSERT(img->Format > 0);
- img->IntFormat = internalFormat;
+ img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
+ ASSERT(img->_BaseFormat > 0);
+ img->InternalFormat = internalFormat;
img->Border = border;
img->Width = width;
img->Height = height;
@@ -1969,12 +1969,12 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
}
}
- if (teximage->IntFormat == GL_YCBCR_MESA) {
+ if (teximage->InternalFormat == GL_YCBCR_MESA) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D");
return GL_TRUE;
}
- if (teximage->Format == GL_DEPTH_COMPONENT) {
+ if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) {
if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyTexSubImage%D(no depth buffer)",
@@ -1982,7 +1982,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions,
return GL_TRUE;
}
}
- else if (teximage->Format == GL_DEPTH_STENCIL_EXT) {
+ else if (teximage->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer ||
!ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -3191,7 +3191,7 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
assert(texImage);
- if ((GLint) format != texImage->IntFormat) {
+ if ((GLint) format != texImage->InternalFormat) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCompressedTexSubImage1D(format)");
return;
@@ -3241,7 +3241,7 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
assert(texImage);
- if ((GLint) format != texImage->IntFormat) {
+ if ((GLint) format != texImage->InternalFormat) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCompressedTexSubImage2D(format)");
return;
@@ -3291,7 +3291,7 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
assert(texImage);
- if ((GLint) format != texImage->IntFormat) {
+ if ((GLint) format != texImage->InternalFormat) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCompressedTexSubImage3D(format)");
return;
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index c4cfe3310c8..7b61bfadd99 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -435,7 +435,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
t->Complete = GL_FALSE;
return;
}
- if (t->Image[0][i]->Format == GL_DEPTH_COMPONENT) {
+ if (t->Image[0][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
t->Complete = GL_FALSE;
incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
return;
@@ -482,7 +482,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
return;
}
/* Don't support GL_DEPTH_COMPONENT for cube maps */
- if (t->Image[face][i]->Format == GL_DEPTH_COMPONENT) {
+ if (t->Image[face][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
t->Complete = GL_FALSE;
incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
return;
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index ae4a2a5527b..9c21e03515a 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -164,7 +164,7 @@ wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
trb->Base.Width = trb->TexImage->Width;
trb->Base.Height = trb->TexImage->Height;
- trb->Base.InternalFormat = trb->TexImage->IntFormat; /* XXX fix? */
+ trb->Base.InternalFormat = trb->TexImage->InternalFormat; /* XXX fix? */
trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat;
#if 0
/* fix/avoid this assertion someday */
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 3dc3292dd7d..3cc343d287e 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1717,38 +1717,39 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
*params = img->Depth;
return;
case GL_TEXTURE_INTERNAL_FORMAT:
- *params = img->IntFormat;
+ *params = img->InternalFormat;
return;
case GL_TEXTURE_BORDER:
*params = img->Border;
return;
case GL_TEXTURE_RED_SIZE:
- if (img->Format == GL_RGB || img->Format == GL_RGBA)
+ if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
*params = img->TexFormat->RedBits;
else
*params = 0;
return;
case GL_TEXTURE_GREEN_SIZE:
- if (img->Format == GL_RGB || img->Format == GL_RGBA)
+ if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
*params = img->TexFormat->GreenBits;
else
*params = 0;
return;
case GL_TEXTURE_BLUE_SIZE:
- if (img->Format == GL_RGB || img->Format == GL_RGBA)
+ if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
*params = img->TexFormat->BlueBits;
else
*params = 0;
return;
case GL_TEXTURE_ALPHA_SIZE:
- if (img->Format == GL_ALPHA || img->Format == GL_LUMINANCE_ALPHA ||
- img->Format == GL_RGBA)
+ if (img->_BaseFormat == GL_ALPHA ||
+ img->_BaseFormat == GL_LUMINANCE_ALPHA ||
+ img->_BaseFormat == GL_RGBA)
*params = img->TexFormat->AlphaBits;
else
*params = 0;
return;
case GL_TEXTURE_INTENSITY_SIZE:
- if (img->Format != GL_INTENSITY)
+ if (img->_BaseFormat != GL_INTENSITY)
*params = 0;
else if (img->TexFormat->IntensityBits > 0)
*params = img->TexFormat->IntensityBits;
@@ -1756,8 +1757,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
return;
case GL_TEXTURE_LUMINANCE_SIZE:
- if (img->Format != GL_LUMINANCE &&
- img->Format != GL_LUMINANCE_ALPHA)
+ if (img->_BaseFormat != GL_LUMINANCE &&
+ img->_BaseFormat != GL_LUMINANCE_ALPHA)
*params = 0;
else if (img->TexFormat->LuminanceBits > 0)
*params = img->TexFormat->LuminanceBits;
@@ -1765,7 +1766,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
return;
case GL_TEXTURE_INDEX_SIZE_EXT:
- if (img->Format == GL_COLOR_INDEX)
+ if (img->_BaseFormat == GL_COLOR_INDEX)
*params = img->TexFormat->IndexBits;
else
*params = 0;
@@ -3033,7 +3034,7 @@ update_texture_state( GLcontext *ctx )
texUnit->_CurrentCombine = & texUnit->Combine;
}
else {
- GLenum format = texUnit->_Current->Image[0][0]->Format;
+ GLenum format = texUnit->_Current->Image[0][0]->_BaseFormat;
if (format == GL_COLOR_INDEX) {
format = GL_RGBA; /* a bit of a hack */
}
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 9423b643db4..f4da9053f7c 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -2338,7 +2338,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
const GLint dstRowStride = 0, dstImageStride = 0;
GLboolean success;
ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format,
+ success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
@@ -2425,13 +2425,14 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
GLint dstRowStride, dstImageStride = 0;
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width);
+ dstRowStride
+ = _mesa_compressed_row_stride(texImage->InternalFormat,width);
}
else {
dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes;
}
ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
@@ -2504,7 +2505,8 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
GLint dstRowStride, dstImageStride;
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width);
+ dstRowStride
+ = _mesa_compressed_row_stride(texImage->InternalFormat,width);
dstImageStride = 0;
}
else {
@@ -2512,7 +2514,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
dstImageStride = dstRowStride * height;
}
ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format,
+ success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
@@ -2558,7 +2560,7 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
const GLint dstRowStride = 0, dstImageStride = 0;
GLboolean success;
ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format,
+ success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
xoffset, 0, 0, /* offsets */
@@ -2604,14 +2606,14 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
GLint dstRowStride = 0, dstImageStride = 0;
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
+ dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,
texImage->Width);
}
else {
dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
}
ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
+ success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
xoffset, yoffset, 0,
@@ -2657,7 +2659,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
GLint dstRowStride, dstImageStride;
GLboolean success;
if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
+ dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,
texImage->Width);
dstImageStride = 0; /* XXX fix */
}
@@ -2666,7 +2668,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
dstImageStride = dstRowStride * texImage->Height;
}
ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format,
+ success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data,
xoffset, yoffset, zoffset,
@@ -2850,13 +2852,13 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
if (!data)
return;
- srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width);
+ srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, width);
src = (const GLubyte *) data;
- destRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
+ destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,
texImage->Width);
dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texImage->IntFormat,
+ texImage->InternalFormat,
texImage->Width,
(GLubyte*) texImage->Data);
@@ -3683,21 +3685,21 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
assert(texObj->Target == GL_TEXTURE_2D);
- if (srcImage->Format == GL_RGB) {
+ if (srcImage->_BaseFormat == GL_RGB) {
convertFormat = &_mesa_texformat_rgb;
components = 3;
}
- else if (srcImage->Format == GL_RGBA) {
+ else if (srcImage->_BaseFormat == GL_RGBA) {
convertFormat = &_mesa_texformat_rgba;
components = 4;
}
else {
- _mesa_problem(ctx, "bad srcImage->Format in _mesa_generate_mipmaps");
+ _mesa_problem(ctx, "bad srcImage->_BaseFormat in _mesa_generate_mipmaps");
return;
}
/* allocate storage for uncompressed GL_RGB or GL_RGBA images */
- size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE)
+ size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE)
* srcImage->Width * srcImage->Height * srcImage->Depth + 20;
/* 20 extra bytes, just be safe when calling last FetchTexel */
srcData = (GLubyte *) _mesa_malloc(size);
@@ -3788,7 +3790,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
/* initialize new image */
_mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
- dstDepth, border, srcImage->IntFormat);
+ dstDepth, border, srcImage->InternalFormat);
dstImage->DriverData = NULL;
dstImage->TexFormat = srcImage->TexFormat;
dstImage->FetchTexelc = srcImage->FetchTexelc;
@@ -3861,10 +3863,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
GLubyte *temp;
/* compress image from dstData into dstImage->Data */
const GLenum srcFormat = convertFormat->BaseFormat;
- GLint dstRowStride = _mesa_compressed_row_stride(srcImage->IntFormat,
- dstWidth);
+ GLint dstRowStride
+ = _mesa_compressed_row_stride(srcImage->InternalFormat, dstWidth);
ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
- dstImage->TexFormat->StoreImage(ctx, 2, dstImage->Format,
+ dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat,
dstImage->TexFormat,
dstImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */