New glTexImage code.

The gl_texture_format struct now has a StoreTexImageFunc that's called
by glTex[Sub]Image[123]D to convert the user's texture data into the
specific texture format layout.  Now it's much easier to add new texture
formats (like the 16/32-bit floating point formats).
The texutil.[ch] and texutil_tmp.h files are obsolete.
This commit is contained in:
Brian Paul
2004-04-22 00:27:31 +00:00
parent 05a6f2fd48
commit f959f6e1dc
22 changed files with 3275 additions and 539 deletions

View File

@@ -445,7 +445,6 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
int texelBytes;
if (0)
fprintf(stderr, "intformat %s format %s type %s\n",
@@ -468,7 +467,6 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
case GL_RGBA:
if ( format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
texImage->TexFormat = &_mesa_texformat_argb8888;
texelBytes = 4;
}
else
return 0;
@@ -477,7 +475,6 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
case GL_RGB:
if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
texImage->TexFormat = &_mesa_texformat_rgb565;
texelBytes = 2;
}
else
return 0;
@@ -487,19 +484,16 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
if ( format == GL_YCBCR_MESA &&
type == GL_UNSIGNED_SHORT_8_8_REV_APPLE ) {
texImage->TexFormat = &_mesa_texformat_ycbcr_rev;
texelBytes = 2;
}
else if ( format == GL_YCBCR_MESA &&
(type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE)) {
texImage->TexFormat = &_mesa_texformat_ycbcr;
texelBytes = 2;
}
else
return 0;
break;
default:
return 0;
}
@@ -538,7 +532,8 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target,
*/
texImage->Data = (void *)pixels;
texImage->IsClientData = GL_TRUE;
texImage->RowStride = srcRowStride / texelBytes;
texImage->RowStride = srcRowStride / texImage->TexFormat->TexelBytes;
return 1;
}
}

View File

@@ -963,6 +963,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
}
/* unpack image, apply transfer ops and store in tempImage */
#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat,
tempImage,
@@ -970,6 +971,15 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
width * texelBytes,
0, /* dstImageStride */
format, type, pixels, packing);
#else
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
texImage->Format, tempImage,
0, 0, 0, /* dstX/Y/Zoffset */
width * texelBytes, /* dstRowStride */
0, /* dstImageStride */
width, height, 1,
format, type, pixels, packing);
#endif
assert(!texImage->Data);
texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
if (!texImage->Data) {
@@ -993,6 +1003,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
}
/* unpack image, apply transfer ops and store in texImage->Data */
#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,
texImage->TexFormat, texImage->Data,
width, height, 1, 0, 0, 0,
@@ -1000,6 +1011,15 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
0, /* dstImageStride */
format, type, pixels, packing);
}
#else
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
texImage->Format, texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
width * texelBytes, /* dstRowStride */
0, /* dstImageStride */
width, height, 1,
format, type, pixels, packing);
#endif
RevalidateTexture(ctx, texObj);
@@ -1050,6 +1070,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
}
#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format,/* Tex int format */
texImage->TexFormat, /* dest format */
(GLubyte *) tempImage, /* dest */
@@ -1058,6 +1079,15 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
width * texelBytes, /* dest row stride */
0, /* dst image stride */
format, type, pixels, packing);
#else
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
texImage->Format, texImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
width * texelBytes, /* dstRowStride */
0, /* dstImageStride */
width, height, 1,
format, type, pixels, packing);
#endif
/* now rescale */
scaledImage = MALLOC(newWidth * newHeight * texelBytes);
@@ -1083,6 +1113,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
}
else {
/* no rescaling needed */
#if !NEWTEXSTORE
_mesa_transfer_teximage(ctx, 2, texImage->Format, /* Tex int format */
texImage->TexFormat, /* dest format */
(GLubyte *) texImage->Data,/* dest */
@@ -1091,6 +1122,15 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
mml->width * texelBytes, /* dest row stride */
0, /* dst image stride */
format, type, pixels, packing);
#else
texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
texImage->Format, texImage->Data,
xoffset, yoffset, 0,
mml->width * texelBytes, /* dstRowStride */
0, /* dstImageStride */
width, height, 1,
format, type, pixels, packing);
#endif
}
ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */

View File

@@ -414,7 +414,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
assert(table);
if (!_mesa_is_legal_format_and_type(format, type) ||
if (!_mesa_is_legal_format_and_type(ctx, format, type) ||
format == GL_INTENSITY) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glColorTable(format or type)");
return;
@@ -596,7 +596,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start,
assert(table);
if (!_mesa_is_legal_format_and_type(format, type) ||
if (!_mesa_is_legal_format_and_type(ctx, format, type) ||
format == GL_INTENSITY) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glColorSubTable(format or type)");
return;

View File

@@ -123,7 +123,7 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G
return;
}
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)");
return;
}
@@ -201,7 +201,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G
return;
}
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)");
return;
}
@@ -532,7 +532,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im
_mesa_update_state(ctx);
}
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)");
return;
}
@@ -718,7 +718,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row,
return;
}
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)");
return;
}
@@ -787,7 +787,7 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLs
return;
}
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)");
return;
}

View File

@@ -43,6 +43,7 @@ static const struct {
} default_extensions[] = {
{ OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) },
{ OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
{ OFF, "GL_MESAX_half_float_pixel", F(ARB_half_float_pixel) },
{ OFF, "GL_ARB_imaging", F(ARB_imaging) },
{ OFF, "GL_ARB_multisample", F(ARB_multisample) },
{ OFF, "GL_ARB_multitexture", F(ARB_multitexture) },
@@ -58,6 +59,7 @@ static const struct {
{ OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) },
{ OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) },
{ OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) },
{ OFF, "GL_MESAX_texture_float", F(ARB_texture_float) },
{ OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
{ OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)},
{ ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) },
@@ -162,6 +164,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
#if FEATURE_ARB_fragment_program
/*ctx->Extensions.ARB_fragment_program = GL_TRUE;*/
#endif
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
ctx->Extensions.ARB_imaging = GL_TRUE;
ctx->Extensions.ARB_multitexture = GL_TRUE;
#if FEATURE_ARB_occlusion_query
@@ -174,6 +177,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
ctx->Extensions.ARB_texture_float = GL_TRUE;
ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
#if FEATURE_ARB_vertex_program

View File

@@ -220,6 +220,42 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
#endif
/* XXX temporary hack */
#ifndef GL_ARB_half_float_pixel
#define GL_ARB_half_float_pixel 1
#define GL_HALF_FLOAT_ARB 0x140B
typedef GLushort GLhalfARB;
#endif
/* XXX temporary hack */
#ifndef GL_ARB_texture_float
#define GL_ARB_texture_float 1
#define GL_TEXTURE_RED_TYPE_ARB 0x9000
#define GL_TEXTURE_GREEN_TYPE_ARB 0x9001
#define GL_TEXTURE_BLUE_TYPE_ARB 0x9002
#define GL_TEXTURE_ALPHA_TYPE_ARB 0x9003
#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x9004
#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x9005
#define GL_TEXTURE_DEPTH_TYPE_ARB 0x9006
#define GL_UNSIGNED_NORMALIZED_ARB 0x9007
#define GL_RGBA32F_ARB 0x8814
#define GL_RGB32F_ARB 0x8815
#define GL_ALPHA32F_ARB 0x8816
#define GL_INTENSITY32F_ARB 0x8817
#define GL_LUMINANCE32F_ARB 0x8818
#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
#define GL_RGBA16F_ARB 0x881A
#define GL_RGB16F_ARB 0x881B
#define GL_ALPHA16F_ARB 0x881C
#define GL_INTENSITY16F_ARB 0x881D
#define GL_LUMINANCE16F_ARB 0x881E
#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
#endif
/* Disable unreachable code warnings for Watcom C++ */
#ifdef __WATCOMC__
#pragma disable_message(201)

View File

@@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -247,6 +246,23 @@ pack_histogram( GLcontext *ctx,
}
}
break;
case GL_HALF_FLOAT_ARB:
{
/* temporarily store as GLuints */
GLuint temp[4*HISTOGRAM_TABLE_SIZE];
GLhalfARB *dst = (GLhalfARB *) destination;
GLuint i;
/* get GLuint values */
PACK_MACRO(GLuint);
/* convert to GLhalf */
for (i = 0; i < n * comps; i++) {
dst[i] = _mesa_float_to_half((GLfloat) temp[i]);
}
if (packing->SwapBytes) {
_mesa_swap2((GLushort *) dst, n * comps);
}
}
break;
case GL_UNSIGNED_BYTE_3_3_2:
if (format == GL_RGB) {
GLubyte *dst = (GLubyte *) destination;
@@ -678,31 +694,22 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo
return;
}
if (!_mesa_is_legal_format_and_type(format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)");
return;
if (format != GL_RED &&
format != GL_GREEN &&
format != GL_BLUE &&
format != GL_ALPHA &&
format != GL_RGB &&
format != GL_BGR &&
format != GL_RGBA &&
format != GL_BGRA &&
format != GL_ABGR_EXT &&
format != GL_LUMINANCE &&
format != GL_LUMINANCE_ALPHA) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)");
}
if (type != GL_UNSIGNED_BYTE &&
type != GL_BYTE &&
type != GL_UNSIGNED_SHORT &&
type != GL_SHORT &&
type != GL_UNSIGNED_INT &&
type != GL_INT &&
type != GL_FLOAT &&
type != GL_UNSIGNED_BYTE_3_3_2 &&
type != GL_UNSIGNED_BYTE_2_3_3_REV &&
type != GL_UNSIGNED_SHORT_5_6_5 &&
type != GL_UNSIGNED_SHORT_5_6_5_REV &&
type != GL_UNSIGNED_SHORT_4_4_4_4 &&
type != GL_UNSIGNED_SHORT_4_4_4_4_REV &&
type != GL_UNSIGNED_SHORT_5_5_5_1 &&
type != GL_UNSIGNED_SHORT_1_5_5_5_REV &&
type != GL_UNSIGNED_INT_8_8_8_8 &&
type != GL_UNSIGNED_INT_8_8_8_8_REV &&
type != GL_UNSIGNED_INT_10_10_10_2 &&
type != GL_UNSIGNED_INT_2_10_10_10_REV) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)");
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)");
return;
}
@@ -745,31 +752,22 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G
return;
}
if (!_mesa_is_legal_format_and_type(format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)");
return;
if (format != GL_RED &&
format != GL_GREEN &&
format != GL_BLUE &&
format != GL_ALPHA &&
format != GL_RGB &&
format != GL_BGR &&
format != GL_RGBA &&
format != GL_BGRA &&
format != GL_ABGR_EXT &&
format != GL_LUMINANCE &&
format != GL_LUMINANCE_ALPHA) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)");
}
if (type != GL_UNSIGNED_BYTE &&
type != GL_BYTE &&
type != GL_UNSIGNED_SHORT &&
type != GL_SHORT &&
type != GL_UNSIGNED_INT &&
type != GL_INT &&
type != GL_FLOAT &&
type != GL_UNSIGNED_BYTE_3_3_2 &&
type != GL_UNSIGNED_BYTE_2_3_3_REV &&
type != GL_UNSIGNED_SHORT_5_6_5 &&
type != GL_UNSIGNED_SHORT_5_6_5_REV &&
type != GL_UNSIGNED_SHORT_4_4_4_4 &&
type != GL_UNSIGNED_SHORT_4_4_4_4_REV &&
type != GL_UNSIGNED_SHORT_5_5_5_1 &&
type != GL_UNSIGNED_SHORT_1_5_5_5_REV &&
type != GL_UNSIGNED_INT_8_8_8_8 &&
type != GL_UNSIGNED_INT_8_8_8_8_REV &&
type != GL_UNSIGNED_INT_10_10_10_2 &&
type != GL_UNSIGNED_INT_2_10_10_10_REV) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)");
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)");
return;
}

View File

@@ -1,8 +1,3 @@
/**
* \file image.c
* Image handling.
*/
/*
* Mesa 3-D graphics library
* Version: 6.1
@@ -28,6 +23,12 @@
*/
/**
* \file image.c
* Image handling.
*/
#include "glheader.h"
#include "bufferobj.h"
#include "colormac.h"
@@ -141,8 +142,8 @@ GLint _mesa_sizeof_type( GLenum type )
return sizeof(GLint);
case GL_FLOAT:
return sizeof(GLfloat);
case GL_HALF_FLOAT_NV:
return sizeof(GLhalfNV);
case GL_HALF_FLOAT_ARB:
return sizeof(GLhalfARB);
default:
return -1;
}
@@ -170,8 +171,8 @@ GLint _mesa_sizeof_packed_type( GLenum type )
return sizeof(GLuint);
case GL_INT:
return sizeof(GLint);
case GL_HALF_FLOAT_NV:
return sizeof(GLhalfNV);
case GL_HALF_FLOAT_ARB:
return sizeof(GLhalfARB);
case GL_FLOAT:
return sizeof(GLfloat);
case GL_UNSIGNED_BYTE_3_3_2:
@@ -281,8 +282,8 @@ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type )
return comps * sizeof(GLint);
case GL_FLOAT:
return comps * sizeof(GLfloat);
case GL_HALF_FLOAT_NV:
return comps * sizeof(GLhalfNV);
case GL_HALF_FLOAT_ARB:
return comps * sizeof(GLhalfARB);
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
if (format == GL_RGB || format == GL_BGR)
@@ -333,7 +334,7 @@ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type )
* otherwise.
*/
GLboolean
_mesa_is_legal_format_and_type( GLenum format, GLenum type )
_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type )
{
switch (format) {
case GL_COLOR_INDEX:
@@ -347,8 +348,9 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type )
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
case GL_HALF_FLOAT_NV:
return GL_TRUE;
case GL_HALF_FLOAT_ARB:
return ctx->Extensions.ARB_half_float_pixel;
default:
return GL_FALSE;
}
@@ -368,8 +370,9 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type )
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
case GL_HALF_FLOAT_NV:
return GL_TRUE;
case GL_HALF_FLOAT_ARB:
return ctx->Extensions.ARB_half_float_pixel;
default:
return GL_FALSE;
}
@@ -383,12 +386,13 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type )
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
case GL_HALF_FLOAT_NV:
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
return GL_TRUE;
case GL_HALF_FLOAT_ARB:
return ctx->Extensions.ARB_half_float_pixel;
default:
return GL_FALSE;
}
@@ -403,7 +407,6 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type )
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
case GL_HALF_FLOAT_NV:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL_UNSIGNED_SHORT_5_5_5_1:
@@ -413,6 +416,8 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type )
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
return GL_TRUE;
case GL_HALF_FLOAT_ARB:
return ctx->Extensions.ARB_half_float_pixel;
default:
return GL_FALSE;
}
@@ -1547,9 +1552,9 @@ _mesa_pack_rgba_span_float( GLcontext *ctx,
}
}
break;
case GL_HALF_FLOAT_NV:
case GL_HALF_FLOAT_ARB:
{
GLhalfNV *dst = (GLhalfNV *) dstAddr;
GLhalfARB *dst = (GLhalfARB *) dstAddr;
switch (dstFormat) {
case GL_RED:
for (i=0;i<n;i++)
@@ -2010,7 +2015,7 @@ extract_uint_indexes(GLuint n, GLuint indexes[],
srcType == GL_SHORT ||
srcType == GL_UNSIGNED_INT ||
srcType == GL_INT ||
srcType == GL_HALF_FLOAT_NV ||
srcType == GL_HALF_FLOAT_ARB ||
srcType == GL_FLOAT);
switch (srcType) {
@@ -2148,13 +2153,13 @@ extract_uint_indexes(GLuint n, GLuint indexes[],
}
}
break;
case GL_HALF_FLOAT_NV:
case GL_HALF_FLOAT_ARB:
{
GLuint i;
const GLhalfNV *s = (const GLhalfNV *) src;
const GLhalfARB *s = (const GLhalfARB *) src;
if (unpack->SwapBytes) {
for (i = 0; i < n; i++) {
GLhalfNV value = s[i];
GLhalfARB value = s[i];
SWAP2BYTE(value);
indexes[i] = (GLuint) _mesa_half_to_float(value);
}
@@ -2216,7 +2221,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
srcType == GL_SHORT ||
srcType == GL_UNSIGNED_INT ||
srcType == GL_INT ||
srcType == GL_HALF_FLOAT_NV ||
srcType == GL_HALF_FLOAT_ARB ||
srcType == GL_FLOAT ||
srcType == GL_UNSIGNED_BYTE_3_3_2 ||
srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
@@ -2395,11 +2400,11 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
PROCESS(blueIndex, BCOMP, 0.0F, GLfloat, (GLfloat));
PROCESS(alphaIndex, ACOMP, 1.0F, GLfloat, (GLfloat));
break;
case GL_HALF_FLOAT_NV:
PROCESS(redIndex, RCOMP, 0.0F, GLhalfNV, _mesa_half_to_float);
PROCESS(greenIndex, GCOMP, 0.0F, GLhalfNV, _mesa_half_to_float);
PROCESS(blueIndex, BCOMP, 0.0F, GLhalfNV, _mesa_half_to_float);
PROCESS(alphaIndex, ACOMP, 1.0F, GLhalfNV, _mesa_half_to_float);
case GL_HALF_FLOAT_ARB:
PROCESS(redIndex, RCOMP, 0.0F, GLhalfARB, _mesa_half_to_float);
PROCESS(greenIndex, GCOMP, 0.0F, GLhalfARB, _mesa_half_to_float);
PROCESS(blueIndex, BCOMP, 0.0F, GLhalfARB, _mesa_half_to_float);
PROCESS(alphaIndex, ACOMP, 1.0F, GLhalfARB, _mesa_half_to_float);
break;
case GL_UNSIGNED_BYTE_3_3_2:
{
@@ -2736,7 +2741,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
srcType == GL_SHORT ||
srcType == GL_UNSIGNED_INT ||
srcType == GL_INT ||
srcType == GL_HALF_FLOAT_NV ||
srcType == GL_HALF_FLOAT_ARB ||
srcType == GL_FLOAT ||
srcType == GL_UNSIGNED_BYTE_3_3_2 ||
srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
@@ -2752,7 +2757,7 @@ _mesa_unpack_color_span_chan( GLcontext *ctx,
srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
/* Try simple cases first */
if (transferOps == 0 ){
if (transferOps == 0) {
if (srcType == CHAN_TYPE) {
if (dstFormat == GL_RGBA) {
if (srcFormat == GL_RGBA) {
@@ -3080,7 +3085,7 @@ _mesa_unpack_color_span_float( GLcontext *ctx,
srcType == GL_SHORT ||
srcType == GL_UNSIGNED_INT ||
srcType == GL_INT ||
srcType == GL_HALF_FLOAT_NV ||
srcType == GL_HALF_FLOAT_ARB ||
srcType == GL_FLOAT ||
srcType == GL_UNSIGNED_BYTE_3_3_2 ||
srcType == GL_UNSIGNED_BYTE_2_3_3_REV ||
@@ -3288,7 +3293,7 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
srcType == GL_SHORT ||
srcType == GL_UNSIGNED_INT ||
srcType == GL_INT ||
srcType == GL_HALF_FLOAT_NV ||
srcType == GL_HALF_FLOAT_ARB ||
srcType == GL_FLOAT);
ASSERT(dstType == GL_UNSIGNED_BYTE ||
@@ -3461,9 +3466,9 @@ _mesa_pack_index_span( const GLcontext *ctx, GLuint n,
}
}
break;
case GL_HALF_FLOAT_NV:
case GL_HALF_FLOAT_ARB:
{
GLhalfNV *dst = (GLhalfNV *) dest;
GLhalfARB *dst = (GLhalfARB *) dest;
GLuint i;
for (i = 0; i < n; i++) {
dst[i] = _mesa_float_to_half((GLfloat) source[i]);
@@ -3507,7 +3512,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
srcType == GL_SHORT ||
srcType == GL_UNSIGNED_INT ||
srcType == GL_INT ||
srcType == GL_HALF_FLOAT_NV ||
srcType == GL_HALF_FLOAT_ARB ||
srcType == GL_FLOAT);
ASSERT(dstType == GL_UNSIGNED_BYTE ||
@@ -3694,9 +3699,9 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
}
}
break;
case GL_HALF_FLOAT_NV:
case GL_HALF_FLOAT_ARB:
{
GLhalfNV *dst = (GLhalfNV *) dest;
GLhalfARB *dst = (GLhalfARB *) dest;
GLuint i;
for (i=0;i<n;i++) {
dst[i] = _mesa_float_to_half( (float) source[i] );
@@ -3807,10 +3812,10 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
case GL_FLOAT:
MEMCPY(dest, source, n * sizeof(GLfloat));
break;
case GL_HALF_FLOAT_NV:
case GL_HALF_FLOAT_ARB:
{
GLuint i;
const GLhalfNV *src = (const GLhalfNV *) source;
const GLhalfARB *src = (const GLhalfARB *) source;
for (i = 0; i < n; i++) {
dest[i] = _mesa_half_to_float(src[i]);
}
@@ -3936,9 +3941,9 @@ _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
}
}
break;
case GL_HALF_FLOAT_NV:
case GL_HALF_FLOAT_ARB:
{
GLhalfNV *dst = (GLhalfNV *) dest;
GLhalfARB *dst = (GLhalfARB *) dest;
GLuint i;
for (i = 0; i < n; i++) {
dst[i] = _mesa_float_to_half(depthSpan[i]);

View File

@@ -54,7 +54,7 @@ extern GLint
_mesa_bytes_per_pixel( GLenum format, GLenum type );
extern GLboolean
_mesa_is_legal_format_and_type( GLenum format, GLenum type );
_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type );
extern GLvoid *

View File

@@ -32,9 +32,9 @@
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -533,7 +533,7 @@ _mesa_bitcount(unsigned int n)
* Based on code from:
* http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
*/
GLhalfNV
GLhalfARB
_mesa_float_to_half(float val)
{
const int flt = *((int *) &val);
@@ -541,7 +541,7 @@ _mesa_float_to_half(float val)
const int flt_e = (flt >> 23) & 0xff;
const int flt_s = (flt >> 31) & 0x1;
int s, e, m = 0;
GLhalfNV result;
GLhalfARB result;
/* sign bit */
s = flt_s;
@@ -620,7 +620,7 @@ _mesa_float_to_half(float val)
* http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
*/
float
_mesa_half_to_float(GLhalfNV val)
_mesa_half_to_float(GLhalfARB val)
{
/* XXX could also use a 64K-entry lookup table */
const int m = val & 0x3ff;

View File

@@ -1,11 +1,3 @@
/**
* \file imports.h
* Standard C library function wrappers.
*
* This file provides wrappers for all the standard C library functions
* like malloc(), free(), printf(), getenv(), etc.
*/
/*
* Mesa 3-D graphics library
* Version: 6.1
@@ -31,6 +23,15 @@
*/
/**
* \file imports.h
* Standard C library function wrappers.
*
* This file provides wrappers for all the standard C library functions
* like malloc(), free(), printf(), getenv(), etc.
*/
#ifndef IMPORTS_H
#define IMPORTS_H
@@ -705,11 +706,11 @@ _mesa_log2(float x);
extern unsigned int
_mesa_bitcount(unsigned int n);
extern GLhalfNV
extern GLhalfARB
_mesa_float_to_half(float f);
extern float
_mesa_half_to_float(GLhalfNV h);
_mesa_half_to_float(GLhalfARB h);
extern char *

View File

@@ -143,6 +143,8 @@ struct gl_texture_object;
typedef struct __GLcontextRec GLcontext;
typedef struct __GLcontextModesRec GLvisual;
typedef struct gl_frame_buffer GLframebuffer;
struct gl_pixelstore_attrib;
struct gl_texture_format;
/*@}*/
@@ -1024,16 +1026,37 @@ typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage,
GLint col, GLint row, GLint img,
GLfloat *texelOut );
/**
* TexImage store function. This is called by the glTex[Sub]Image
* functions and is responsible for converting the user-specified texture
* image into a specific (hardware) image format.
*/
typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims,
GLenum baseInternalFormat,
const struct gl_texture_format *dstFormat,
GLvoid *dstAddr,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
GLint dstRowStride, GLint dstImageStride,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLenum srcFormat, GLenum srcType,
const GLvoid *srcAddr,
const struct gl_pixelstore_attrib *srcPacking);
/**
* Texture format record
*/
struct gl_texture_format {
GLint MesaFormat; /**< One of the MESA_FORMAT_* values */
GLenum BaseFormat; /**< Either GL_ALPHA, GL_INTENSITY, GL_LUMINANCE,
* GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA,
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT.
GLenum BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
* GL_LUMINANCE, GL_LUMINANCE_ALPHA,
* GL_INTENSITY, GL_COLOR_INDEX or
* GL_DEPTH_COMPONENT.
*/
GLenum DataType; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */
GLubyte RedBits; /**< Bits per texel component */
GLubyte GreenBits; /**< These are just rough approximations for */
GLubyte BlueBits; /**< compressed texture formats. */
@@ -1043,7 +1066,9 @@ struct gl_texture_format {
GLubyte IndexBits;
GLubyte DepthBits;
GLint TexelBytes; /**< Bytes per texel (0 for compressed formats */
GLint TexelBytes; /**< Bytes per texel, 0 if compressed format */
StoreTexImageFunc StoreImage;
/**
* \name Texel fetch function pointers
@@ -1063,9 +1088,10 @@ struct gl_texture_format {
* Texture image record
*/
struct gl_texture_image {
GLenum Format; /**< GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
* GL_INTENSITY, GL_RGB, GL_RGBA,
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT only.
GLenum Format; /**< Either GL_RGB, GL_RGBA, GL_ALPHA,
* GL_LUMINANCE, GL_LUMINANCE_ALPHA,
* GL_INTENSITY, GL_COLOR_INDEX or
* GL_DEPTH_COMPONENT only.
* Used for choosing TexEnv arithmetic.
*/
GLint IntFormat; /**< Internal format as given by the user */
@@ -1828,6 +1854,7 @@ struct gl_extensions
GLboolean dummy; /* don't remove this! */
GLboolean ARB_depth_texture;
GLboolean ARB_fragment_program;
GLboolean ARB_half_float_pixel;
GLboolean ARB_imaging;
GLboolean ARB_multisample;
GLboolean ARB_multitexture;
@@ -1840,6 +1867,7 @@ struct gl_extensions
GLboolean ARB_texture_env_combine;
GLboolean ARB_texture_env_crossbar;
GLboolean ARB_texture_env_dot3;
GLboolean ARB_texture_float;
GLboolean ARB_texture_mirrored_repeat;
GLboolean ARB_texture_non_power_of_two;
GLboolean ARB_transpose_matrix;

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,8 @@
/**
* \file texformat.h
* Texture formats definitions.
*
* \author Gareth Hughes
*/
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -30,16 +23,26 @@
*/
/**
* \file texformat.h
* Texture formats definitions.
*
* \author Gareth Hughes
*/
#ifndef TEXFORMAT_H
#define TEXFORMAT_H
#define NEWTEXSTORE 1
#include "mtypes.h"
/**
* Mesa internal texture image types.
*
* All texture images must be stored in one of these formats.
* Mesa internal texture image formats.
* All texture images are stored in one of these formats.
*
* NOTE: when you add a new format, be sure to update the do_row()
* function in texstore.c used for auto mipmap generation.
@@ -111,10 +114,8 @@ enum _format {
/**
* \name Generic GLchan-based formats.
*
* These are the default formats used by the software rasterizer and, unless
* the driver overrides the texture image functions, incoming images will be
* converted to one of these formats. Components are arrays of GLchan
* values, so there will be no big/little endian issues.
* Software-oriented texture formats. Texels are arrays of GLchan
* values so there will be no big/little endian issues.
*
* \note Because these are based on the GLchan data type, one cannot assume
* 8 bits per channel with these formats. If you require GLubyte channels,
@@ -130,30 +131,34 @@ enum _format {
MESA_FORMAT_COLOR_INDEX,
/*@}*/
/**
* Depth textures
*/
/*@{*/
MESA_FORMAT_DEPTH_COMPONENT_FLOAT32,
MESA_FORMAT_DEPTH_COMPONENT16,
/*@}*/
/**
* \name Floating point texture formats.
*/
/*@{*/
MESA_FORMAT_DEPTH_COMPONENT,
MESA_FORMAT_RGBA_FLOAT32,
MESA_FORMAT_RGBA_FLOAT16,
MESA_FORMAT_RGB_FLOAT32,
MESA_FORMAT_RGB_FLOAT16
MESA_FORMAT_RGB_FLOAT16,
MESA_FORMAT_ALPHA_FLOAT32,
MESA_FORMAT_ALPHA_FLOAT16,
MESA_FORMAT_LUMINANCE_FLOAT32,
MESA_FORMAT_LUMINANCE_FLOAT16,
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
MESA_FORMAT_INTENSITY_FLOAT32,
MESA_FORMAT_INTENSITY_FLOAT16
/*@}*/
};
extern GLboolean
_mesa_is_hardware_tex_format( const struct gl_texture_format *format );
extern const struct gl_texture_format *
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type );
extern GLint
_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat);
/** The default formats, GLchan per component */
/*@{*/
extern const struct gl_texture_format _mesa_texformat_rgba;
@@ -165,13 +170,26 @@ extern const struct gl_texture_format _mesa_texformat_intensity;
extern const struct gl_texture_format _mesa_texformat_color_index;
/*@}*/
/** Depth textures */
/*@{*/
extern const struct gl_texture_format _mesa_texformat_depth_component_float32;
extern const struct gl_texture_format _mesa_texformat_depth_component16;
/*@}*/
/** Floating point texture formats */
/*@{*/
extern const struct gl_texture_format _mesa_texformat_depth_component;
extern const struct gl_texture_format _mesa_texformat_rgba_float32;
extern const struct gl_texture_format _mesa_texformat_rgba_float16;
extern const struct gl_texture_format _mesa_texformat_rgb_float32;
extern const struct gl_texture_format _mesa_texformat_rgb_float16;
extern const struct gl_texture_format _mesa_texformat_alpha_float32;
extern const struct gl_texture_format _mesa_texformat_alpha_float16;
extern const struct gl_texture_format _mesa_texformat_luminance_float32;
extern const struct gl_texture_format _mesa_texformat_luminance_float16;
extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32;
extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16;
extern const struct gl_texture_format _mesa_texformat_intensity_float32;
extern const struct gl_texture_format _mesa_texformat_intensity_float16;
/*@}*/
/** \name The hardware-friendly formats */
@@ -203,4 +221,18 @@ extern const struct gl_texture_format _mesa_texformat_rgba_dxt5;
extern const struct gl_texture_format _mesa_null_texformat;
/*@}*/
#if !NEWTEXSTORE
extern GLboolean
_mesa_is_hardware_tex_format( const struct gl_texture_format *format );
#endif
extern const struct gl_texture_format *
_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type );
extern GLint
_mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat);
#endif

View File

@@ -1,20 +1,3 @@
/**
* \file texformat_tmp.h
* Texel fetch functions template.
*
* This template file is used by texformat.c to generate texel fetch functions
* for 1-D, 2-D and 3-D texture images.
*
* It should be expanded by definining \p DIM as the number texture dimensions
* (1, 2 or 3). According to the value of \p DIM a serie of macros is defined
* for the texel lookup in the gl_texture_image::Data.
*
* \sa texformat.c and FetchTexel.
*
* \author Gareth Hughes
* \author Brian Paul
*/
/*
* Mesa 3-D graphics library
* Version: 6.1
@@ -40,6 +23,24 @@
*/
/**
* \file texformat_tmp.h
* Texel fetch functions template.
*
* This template file is used by texformat.c to generate texel fetch functions
* for 1-D, 2-D and 3-D texture images.
*
* It should be expanded by defining \p DIM as the number texture dimensions
* (1, 2 or 3). According to the value of \p DIM a series of macros is defined
* for the texel lookup in the gl_texture_image::Data.
*
* \sa texformat.c and FetchTexel.
*
* \author Gareth Hughes
* \author Brian Paul
*/
#if DIM == 1
#define CHAN_SRC( t, i, j, k, sz ) \
@@ -51,7 +52,7 @@
#define FLOAT_SRC( t, i, j, k, sz ) \
((GLfloat *)(t)->Data + (i) * (sz))
#define HALF_SRC( t, i, j, k, sz ) \
((GLhalfNV *)(t)->Data + (i) * (sz))
((GLhalfARB *)(t)->Data + (i) * (sz))
#define FETCH(x) fetch_texel_1d_##x
@@ -66,7 +67,7 @@
#define FLOAT_SRC( t, i, j, k, sz ) \
((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define HALF_SRC( t, i, j, k, sz ) \
((GLhalfNV *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
((GLhalfARB *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))
#define FETCH(x) fetch_texel_2d_##x
@@ -85,7 +86,7 @@
((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->RowStride + (i)) * (sz))
#define HALF_SRC( t, i, j, k, sz ) \
((GLhalfNV *)(t)->Data + (((t)->Height * (k) + (j)) * \
((GLhalfARB *)(t)->Data + (((t)->Height * (k) + (j)) * \
(t)->RowStride + (i)) * (sz))
#define FETCH(x) fetch_texel_3d_##x
@@ -244,9 +245,11 @@ static void FETCH(f_color_index)( const struct gl_texture_image *texImage,
}
/* Fetch depth texel from 1D, 2D or 3D DEPTH texture, returning 1 GLfloat */
/* Note: no GLchan version of this function */
static void FETCH(f_depth_component)( const struct gl_texture_image *texImage,
/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
* returning 1 GLfloat.
* Note: no GLchan version of this function.
*/
static void FETCH(f_depth_component_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
@@ -254,6 +257,31 @@ static void FETCH(f_depth_component)( const struct gl_texture_image *texImage,
}
/* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture,
* returning 1 GLfloat.
* Note: no GLchan version of this function.
*/
static void FETCH(f_depth_component16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLushort *src = USHORT_SRC( texImage, i, j, k );
texel[0] = src[0] * (1.0F / 65535.0F);
}
/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(rgba_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 4 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]);
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]);
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[3]);
}
/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT32 texture,
* returning 4 GLfloats.
*/
@@ -267,19 +295,44 @@ static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = src[3];
}
/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(rgba_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 4 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1]));
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2]));
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[3]));
}
/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfNV *src = HALF_SRC( texImage, i, j, k, 4 );
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 4 );
texel[RCOMP] = _mesa_half_to_float(src[0]);
texel[GCOMP] = _mesa_half_to_float(src[1]);
texel[BCOMP] = _mesa_half_to_float(src[2]);
texel[ACOMP] = _mesa_half_to_float(src[3]);
}
/* Fetch color texel from 1D, 2D or 3D RGB_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(rgb_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 3 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]);
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]);
texel[ACOMP] = CHAN_MAX;
}
/* Fetch color texel from 1D, 2D or 3D RGB_FLOAT32 texture,
* returning 4 GLfloats.
@@ -294,19 +347,240 @@ static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage,
texel[ACOMP] = CHAN_MAXF;
}
/* Fetch color texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(rgb_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 3 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1]));
UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2]));
texel[ACOMP] = CHAN_MAX;
}
/* Fetch color texel from 1D, 2D or 3D RGB_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfNV *src = HALF_SRC( texImage, i, j, k, 3 );
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 3 );
texel[RCOMP] = _mesa_half_to_float(src[0]);
texel[GCOMP] = _mesa_half_to_float(src[1]);
texel[BCOMP] = _mesa_half_to_float(src[2]);
texel[ACOMP] = CHAN_MAXF;
}
/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0;
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[0]);
}
/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0.0F;
texel[ACOMP] = src[0];
}
/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(alpha_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0;
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[0]));
}
/* Fetch color texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0.0F;
texel[ACOMP] = _mesa_half_to_float(src[0]);
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
texel[GCOMP] =
texel[BCOMP] = texel[RCOMP];
texel[ACOMP] = CHAN_MAX;
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = src[0];
texel[ACOMP] = CHAN_MAXF;
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
texel[GCOMP] =
texel[BCOMP] = texel[RCOMP];
texel[ACOMP] = CHAN_MAX;
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = _mesa_half_to_float(src[0]);
texel[ACOMP] = CHAN_MAXF;
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(luminance_alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 2 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
texel[GCOMP] =
texel[BCOMP] = texel[RCOMP];
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[1]);
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 2 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = src[0];
texel[ACOMP] = src[1];
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(luminance_alpha_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 2 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
texel[GCOMP] =
texel[BCOMP] = texel[RCOMP];
UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[1]));
}
/* Fetch color texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 2 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = _mesa_half_to_float(src[0]);
texel[ACOMP] = _mesa_half_to_float(src[1]);
}
/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
* returning 4 GLchans.
*/
static void FETCH(intensity_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]);
texel[GCOMP] =
texel[BCOMP] =
texel[ACOMP] = texel[RCOMP];
}
/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLfloat *src = FLOAT_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] =
texel[ACOMP] = src[0];
}
/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
* returning 4 GLchans.
*/
static void FETCH(intensity_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0]));
texel[GCOMP] =
texel[BCOMP] =
texel[ACOMP] = texel[RCOMP];
}
/* Fetch color texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
* returning 4 GLfloats.
*/
static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel )
{
const GLhalfARB *src = HALF_SRC( texImage, i, j, k, 1 );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] =
texel[ACOMP] = _mesa_half_to_float(src[0]);
}
/*
@@ -510,8 +784,8 @@ static void FETCH(a8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
texel[RCOMP] = 0;
texel[GCOMP] = 0;
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = 0;
texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
}
@@ -533,8 +807,8 @@ static void FETCH(l8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
texel[GCOMP] = UBYTE_TO_CHAN( src[0] );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
texel[ACOMP] = CHAN_MAX;
}
@@ -556,9 +830,9 @@ static void FETCH(i8)( const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLchan *texel )
{
const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 );
texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
texel[GCOMP] = UBYTE_TO_CHAN( src[0] );
texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] =
texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
}

View File

@@ -199,6 +199,12 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
case GL_RGBA12:
case GL_RGBA16:
return GL_RGBA;
default:
; /* fallthrough */
}
if (ctx->Extensions.EXT_paletted_texture) {
switch (internalFormat) {
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
case GL_COLOR_INDEX2_EXT:
@@ -206,96 +212,111 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
if (ctx->Extensions.EXT_paletted_texture)
return GL_COLOR_INDEX;
else
return -1;
default:
; /* fallthrough */
}
}
if (ctx->Extensions.SGIX_depth_texture) {
switch (internalFormat) {
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16_SGIX:
case GL_DEPTH_COMPONENT24_SGIX:
case GL_DEPTH_COMPONENT32_SGIX:
if (ctx->Extensions.SGIX_depth_texture)
return GL_DEPTH_COMPONENT;
else
return -1;
default:
; /* fallthrough */
}
}
/* GL_ARB_texture_compression */
if (ctx->Extensions.ARB_texture_compression) {
switch (internalFormat) {
case GL_COMPRESSED_ALPHA:
if (ctx->Extensions.ARB_texture_compression)
return GL_ALPHA;
else
return -1;
case GL_COMPRESSED_LUMINANCE:
if (ctx->Extensions.ARB_texture_compression)
return GL_LUMINANCE;
else
return -1;
case GL_COMPRESSED_LUMINANCE_ALPHA:
if (ctx->Extensions.ARB_texture_compression)
return GL_LUMINANCE_ALPHA;
else
return -1;
case GL_COMPRESSED_INTENSITY:
if (ctx->Extensions.ARB_texture_compression)
return GL_INTENSITY;
else
return -1;
case GL_COMPRESSED_RGB:
if (ctx->Extensions.ARB_texture_compression)
return GL_RGB;
else
return -1;
case GL_COMPRESSED_RGBA:
if (ctx->Extensions.ARB_texture_compression)
return GL_RGBA;
else
return -1;
default:
; /* fallthrough */
}
}
if (ctx->Extensions.TDFX_texture_compression_FXT1) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_FXT1_3DFX:
if (ctx->Extensions.TDFX_texture_compression_FXT1)
return GL_RGB;
else
return -1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
if (ctx->Extensions.TDFX_texture_compression_FXT1)
return GL_RGBA;
else
return -1;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
return GL_RGB;
else
return -1;
default:
; /* fallthrough */
}
}
if (ctx->Extensions.EXT_texture_compression_s3tc) {
switch (internalFormat) {
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
return GL_RGBA;
else
return -1;
default:
; /* fallthrough */
}
}
if (ctx->Extensions.S3_s3tc) {
switch (internalFormat) {
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
if (ctx->Extensions.S3_s3tc)
return GL_RGB;
else
return -1;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
if (ctx->Extensions.S3_s3tc)
return GL_RGBA;
else
return -1;
case GL_YCBCR_MESA:
if (ctx->Extensions.MESA_ycbcr_texture)
return GL_YCBCR_MESA;
else
return -1;
/* XXX add float texture formats here */
default:
return -1; /* error */
; /* fallthrough */
}
}
if (ctx->Extensions.MESA_ycbcr_texture) {
if (internalFormat == GL_YCBCR_MESA)
return GL_YCBCR_MESA;
}
if (ctx->Extensions.ARB_texture_float) {
switch (internalFormat) {
case GL_ALPHA16F_ARB:
case GL_ALPHA32F_ARB:
return GL_ALPHA;
case GL_RGBA16F_ARB:
case GL_RGBA32F_ARB:
return GL_RGBA;
case GL_RGB16F_ARB:
case GL_RGB32F_ARB:
return GL_RGB;
case GL_INTENSITY16F_ARB:
case GL_INTENSITY32F_ARB:
return GL_INTENSITY;
case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE32F_ARB:
return GL_LUMINANCE;
case GL_LUMINANCE_ALPHA16F_ARB:
case GL_LUMINANCE_ALPHA32F_ARB:
return GL_LUMINANCE_ALPHA;
default:
; /* nothing */
}
}
return -1; /* error */
}
@@ -351,7 +372,19 @@ is_color_format(GLenum internalFormat)
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
/* XXX add float texture formats here */
/* float texture formats */
case GL_ALPHA16F_ARB:
case GL_ALPHA32F_ARB:
case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE32F_ARB:
case GL_LUMINANCE_ALPHA16F_ARB:
case GL_LUMINANCE_ALPHA32F_ARB:
case GL_INTENSITY16F_ARB:
case GL_INTENSITY32F_ARB:
case GL_RGB16F_ARB:
case GL_RGB32F_ARB:
case GL_RGBA16F_ARB:
case GL_RGBA32F_ARB:
return GL_TRUE;
case GL_YCBCR_MESA: /* not considered to be RGB */
default:
@@ -1241,7 +1274,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
/* Check incoming image format and type */
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
/* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there
* is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4.
*/
@@ -1449,7 +1482,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions,
}
}
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexSubImage%dD(format or type)", dimensions);
return GL_TRUE;

View File

@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -1794,6 +1794,70 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
}
return;
/* GL_ARB_texture_float */
case GL_TEXTURE_RED_TYPE_ARB:
if (ctx->Extensions.ARB_texture_float) {
*params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");
}
return;
case GL_TEXTURE_GREEN_TYPE_ARB:
if (ctx->Extensions.ARB_texture_float) {
*params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");
}
return;
case GL_TEXTURE_BLUE_TYPE_ARB:
if (ctx->Extensions.ARB_texture_float) {
*params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");
}
return;
case GL_TEXTURE_ALPHA_TYPE_ARB:
if (ctx->Extensions.ARB_texture_float) {
*params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");
}
return;
case GL_TEXTURE_LUMINANCE_TYPE_ARB:
if (ctx->Extensions.ARB_texture_float) {
*params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");
}
return;
case GL_TEXTURE_INTENSITY_TYPE_ARB:
if (ctx->Extensions.ARB_texture_float) {
*params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");
}
return;
case GL_TEXTURE_DEPTH_TYPE_ARB:
if (ctx->Extensions.ARB_texture_float) {
*params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE;
}
else {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");
}
return;
default:
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTexLevelParameter[if]v(pname)");

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,8 @@
/**
* \file texstore.h
* Texture image storage.
*
* \author Brian Paul
*/
/*
* Mesa 3-D graphics library
* Version: 5.1
* Version: 6.1
*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -30,12 +23,55 @@
*/
/**
* \file texstore.h
* Texture image storage routines.
*
* \author Brian Paul
*/
#ifndef TEXSTORE_H
#define TEXSTORE_H
#include "mtypes.h"
/*** NEWTEXSTORE ***/
/* Macro just to save some typing */
#define STORE_PARAMS \
GLcontext *ctx, GLuint dims, \
GLenum baseInternalFormat, \
const struct gl_texture_format *dstFormat, \
GLvoid *dstAddr, \
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
GLint dstRowStride, GLint dstImageStride, \
GLint srcWidth, GLint srcHeight, GLint srcDepth, \
GLenum srcFormat, GLenum srcType, \
const GLvoid *srcAddr, \
const struct gl_pixelstore_attrib *srcPacking
extern GLboolean _mesa_texstore_rgba(STORE_PARAMS);
extern GLboolean _mesa_texstore_color_index(STORE_PARAMS);
extern GLboolean _mesa_texstore_depth_component16(STORE_PARAMS);
extern GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgb565(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgba8888(STORE_PARAMS);
extern GLboolean _mesa_texstore_argb8888(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgb888(STORE_PARAMS);
extern GLboolean _mesa_texstore_argb4444(STORE_PARAMS);
extern GLboolean _mesa_texstore_argb1555(STORE_PARAMS);
extern GLboolean _mesa_texstore_al88(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgb332(STORE_PARAMS);
extern GLboolean _mesa_texstore_a8(STORE_PARAMS);
extern GLboolean _mesa_texstore_ci8(STORE_PARAMS);
extern GLboolean _mesa_texstore_ycbcr(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS);
extern GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS);
#if !NEWTEXSTORE
extern void
_mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
@@ -49,6 +85,8 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
const GLvoid *srcAddr,
const struct gl_pixelstore_attrib *srcPacking);
#endif /* NEWTEXSTORE */
extern void
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,

View File

@@ -46,6 +46,9 @@
#include "texutil.h"
#if !NEWTEXSTORE
#define DEBUG_TEXUTIL 0
@@ -1033,3 +1036,5 @@ do { \
_mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d");
}
}
#endif

View File

@@ -750,7 +750,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
if (!_mesa_is_legal_format_and_type(format, type)) {
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)");
return;
}

View File

@@ -366,12 +366,18 @@ read_rgba_pixels( GLcontext *ctx,
case GL_UNSIGNED_INT_2_10_10_10_REV:
/* valid pixel type */
break;
case GL_HALF_FLOAT_ARB:
if (!ctx->Extensions.ARB_half_float_pixel) {
_mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(type)" );
return;
}
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(type)" );
return;
}
if (!_mesa_is_legal_format_and_type(format, type) ||
if (!_mesa_is_legal_format_and_type(ctx, format, type) ||
format == GL_INTENSITY) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(format or type)");
return;