[OPENGL32/MESA]

- Get rid of non-power-of-two and 3D textures
 - Some cleanup of previous work
CORE-7499

svn path=/trunk/; revision=63607
This commit is contained in:
Jérôme Gardou 2014-06-16 19:16:37 +00:00
parent 00f730ca44
commit f2e556cc0a
30 changed files with 9 additions and 1291 deletions

View file

@ -84,14 +84,11 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->ChooseTextureFormat = _mesa_choose_tex_format;
driver->TexImage1D = _mesa_store_teximage1d;
driver->TexImage2D = _mesa_store_teximage2d;
driver->TexImage3D = _mesa_store_teximage3d;
driver->TexSubImage1D = _mesa_store_texsubimage1d;
driver->TexSubImage2D = _mesa_store_texsubimage2d;
driver->TexSubImage3D = _mesa_store_texsubimage3d;
driver->GetTexImage = _mesa_get_teximage;
driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D;
driver->TestProxyTexImage = _mesa_test_proxy_teximage;
driver->BindTexture = NULL;
driver->NewTextureObject = _mesa_new_texture_object;

View file

@ -152,23 +152,6 @@ struct save_state
GLboolean RasterDiscard;
};
/**
* Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
* This is currently shared by all the meta ops. But we could create a
* separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
*/
struct temp_texture
{
GLuint TexObj;
GLenum Target; /**< GL_TEXTURE_2D */
GLsizei MinSize; /**< Min texture size to allocate */
GLsizei MaxSize; /**< Max possible texture size */
GLboolean NPOT; /**< Non-power of two size OK? */
GLsizei Width, Height; /**< Current texture size */
GLenum IntFormat;
GLfloat Sright, Ttop; /**< right, top texcoords */
};
/**
* State for glBlitFramebufer()
@ -216,13 +199,9 @@ struct gl_meta_state
/** Save stack depth */
GLuint SaveStackDepth;
struct temp_texture TempTex;
struct copypix_state CopyPix; /**< For _mesa_meta_CopyPixels() */
};
static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex);
/**
* Initialize meta-ops for a context.
* To be called once during context creation.
@ -245,7 +224,6 @@ _mesa_meta_free(struct gl_context *ctx)
{
GET_CURRENT_CONTEXT(old_context);
_mesa_make_current(ctx, NULL, NULL);
cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
else
@ -382,7 +360,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
ctx->Texture.Unit.TexGenEnabled) {
_mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
if (ctx->Extensions.ARB_texture_cube_map)
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
@ -662,270 +639,6 @@ _mesa_meta_in_progress(struct gl_context *ctx)
}
/**
* Convert Z from a normalized value in the range [0, 1] to an object-space
* Z coordinate in [-1, +1] so that drawing at the new Z position with the
* default/identity ortho projection results in the original Z value.
* Used by the meta-Clear, Draw/CopyPixels and Bitmap functions where the Z
* value comes from the clear value or raster position.
*/
static INLINE GLfloat
invert_z(GLfloat normZ)
{
GLfloat objZ = 1.0f - 2.0f * normZ;
return objZ;
}
/**
* One-time init for a temp_texture object.
* Choose tex target, compute max tex size, etc.
*/
static void
init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
{
/* use 2D texture, NPOT if possible */
tex->Target = GL_TEXTURE_2D;
tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two;
tex->MinSize = 16; /* 16 x 16 at least */
assert(tex->MaxSize > 0);
_mesa_GenTextures(1, &tex->TexObj);
}
static void
cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
{
if (!tex->TexObj)
return;
_mesa_DeleteTextures(1, &tex->TexObj);
tex->TexObj = 0;
}
/**
* Return pointer to temp_texture info for non-bitmap ops.
* This does some one-time init if needed.
*/
static struct temp_texture *
get_temp_texture(struct gl_context *ctx)
{
struct temp_texture *tex = &ctx->Meta->TempTex;
if (!tex->TexObj) {
init_temp_texture(ctx, tex);
}
return tex;
}
/**
* Compute the width/height of texture needed to draw an image of the
* given size. Return a flag indicating whether the current texture
* can be re-used (glTexSubImage2D) or if a new texture needs to be
* allocated (glTexImage2D).
* Also, compute s/t texcoords for drawing.
*
* \return GL_TRUE if new texture is needed, GL_FALSE otherwise
*/
static GLboolean
alloc_texture(struct temp_texture *tex,
GLsizei width, GLsizei height, GLenum intFormat)
{
GLboolean newTex = GL_FALSE;
ASSERT(width <= tex->MaxSize);
ASSERT(height <= tex->MaxSize);
if (width > tex->Width ||
height > tex->Height ||
intFormat != tex->IntFormat) {
/* alloc new texture (larger or different format) */
if (tex->NPOT) {
/* use non-power of two size */
tex->Width = MAX2(tex->MinSize, width);
tex->Height = MAX2(tex->MinSize, height);
}
else {
/* find power of two size */
GLsizei w, h;
w = h = tex->MinSize;
while (w < width)
w *= 2;
while (h < height)
h *= 2;
tex->Width = w;
tex->Height = h;
}
tex->IntFormat = intFormat;
newTex = GL_TRUE;
}
/* compute texcoords */
tex->Sright = (GLfloat) width / tex->Width;
tex->Ttop = (GLfloat) height / tex->Height;
return newTex;
}
/**
* Setup/load texture for glCopyPixels or glBlitFramebuffer.
*/
static void
setup_copypix_texture(struct temp_texture *tex,
GLboolean newTex,
GLint srcX, GLint srcY,
GLsizei width, GLsizei height, GLenum intFormat,
GLenum filter)
{
_mesa_BindTexture(tex->Target, tex->TexObj);
_mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, filter);
_mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, filter);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
/* copy framebuffer image to texture */
if (newTex) {
/* create new tex image */
if (tex->Width == width && tex->Height == height) {
/* create new tex with framebuffer data */
_mesa_CopyTexImage2D(tex->Target, 0, tex->IntFormat,
srcX, srcY, width, height, 0);
}
else {
/* create empty texture */
_mesa_TexImage2D(tex->Target, 0, tex->IntFormat,
tex->Width, tex->Height, 0,
intFormat, GL_UNSIGNED_BYTE, NULL);
/* load image */
_mesa_CopyTexSubImage2D(tex->Target, 0,
0, 0, srcX, srcY, width, height);
}
}
else {
/* replace existing tex image */
_mesa_CopyTexSubImage2D(tex->Target, 0,
0, 0, srcX, srcY, width, height);
}
}
/**
* Meta implementation of ctx->Driver.CopyPixels() in terms
* of texture mapping and polygon rendering and GLSL shaders.
*/
void
_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
GLsizei width, GLsizei height,
GLint dstX, GLint dstY, GLenum type)
{
struct copypix_state *copypix = &ctx->Meta->CopyPix;
struct temp_texture *tex = get_temp_texture(ctx);
struct vertex {
GLfloat x, y, z, s, t;
};
struct vertex verts[4];
GLboolean newTex;
GLenum intFormat = GL_RGBA;
if (type != GL_COLOR ||
ctx->_ImageTransferState ||
ctx->Fog.Enabled ||
width > tex->MaxSize ||
height > tex->MaxSize) {
/* XXX avoid this fallback */
_swrast_CopyPixels(ctx, srcX, srcY, width, height, dstX, dstY, type);
return;
}
/* Most GL state applies to glCopyPixels, but a there's a few things
* we need to override:
*/
_mesa_meta_begin(ctx, (MESA_META_RASTERIZATION |
MESA_META_TEXTURE |
MESA_META_TRANSFORM |
MESA_META_CLIP |
MESA_META_VERTEX |
MESA_META_VIEWPORT));
if (copypix->ArrayObj == 0) {
/* one-time setup */
/* create vertex array object */
_mesa_GenVertexArrays(1, &copypix->ArrayObj);
_mesa_BindVertexArray(copypix->ArrayObj);
/* create vertex array buffer */
_mesa_GenBuffersARB(1, &copypix->VBO);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO);
_mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
NULL, GL_DYNAMIC_DRAW_ARB);
/* setup vertex arrays */
_mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
_mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
}
else {
_mesa_BindVertexArray(copypix->ArrayObj);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO);
}
newTex = alloc_texture(tex, width, height, intFormat);
/* vertex positions, texcoords (after texture allocation!) */
{
const GLfloat dstX0 = (GLfloat) dstX;
const GLfloat dstY0 = (GLfloat) dstY;
const GLfloat dstX1 = dstX + width * ctx->Pixel.ZoomX;
const GLfloat dstY1 = dstY + height * ctx->Pixel.ZoomY;
const GLfloat z = invert_z(ctx->Current.RasterPos[2]);
verts[0].x = dstX0;
verts[0].y = dstY0;
verts[0].z = z;
verts[0].s = 0.0F;
verts[0].t = 0.0F;
verts[1].x = dstX1;
verts[1].y = dstY0;
verts[1].z = z;
verts[1].s = tex->Sright;
verts[1].t = 0.0F;
verts[2].x = dstX1;
verts[2].y = dstY1;
verts[2].z = z;
verts[2].s = tex->Sright;
verts[2].t = tex->Ttop;
verts[3].x = dstX0;
verts[3].y = dstY1;
verts[3].z = z;
verts[3].s = 0.0F;
verts[3].t = tex->Ttop;
/* upload new vertex data */
_mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
}
/* Alloc/setup texture */
setup_copypix_texture(tex, newTex, srcX, srcY, width, height,
GL_RGBA, GL_NEAREST);
_mesa_set_enable(ctx, tex->Target, GL_TRUE);
/* draw textured quad */
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
_mesa_set_enable(ctx, tex->Target, GL_FALSE);
_mesa_meta_end(ctx);
}
/**
* Determine the GL data type to use for the temporary image read with
* ReadPixels() and passed to Tex[Sub]Image().
@ -1031,11 +744,6 @@ copy_tex_sub_image(struct gl_context *ctx,
xoffset, width,
format, type, buf, &ctx->Unpack);
}
else if (target == GL_TEXTURE_3D) {
ctx->Driver.TexSubImage3D(ctx, texImage,
xoffset, yoffset, zoffset, width, height, 1,
format, type, buf, &ctx->Unpack);
}
else {
ctx->Driver.TexSubImage2D(ctx, texImage,
xoffset, yoffset, width, height,
@ -1073,15 +781,3 @@ _mesa_meta_CopyTexSubImage2D(struct gl_context *ctx,
rb, x, y, width, height);
}
void
_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height)
{
copy_tex_sub_image(ctx, 3, texImage, xoffset, yoffset, zoffset,
rb, x, y, width, height);
}

View file

@ -88,12 +88,4 @@ _mesa_meta_CopyTexSubImage2D(struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height);
extern void
_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height);
#endif /* META_H */

View file

@ -208,13 +208,6 @@ _mesa_create_exec_table(void)
SET_VertexPointer(exec, _mesa_VertexPointer);
#endif
/* 1.2 */
#if _HAVE_FULL_GL
SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
SET_TexImage3D(exec, _mesa_TexImage3D);
SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
#endif
/* OpenGL 1.2 GL_ARB_imaging */
SET_BlendColor(exec, _mesa_BlendColor);
SET_BlendEquation(exec, _mesa_BlendEquation);
@ -234,13 +227,6 @@ _mesa_create_exec_table(void)
SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
#endif
/* 6. GL_EXT_texture3d */
#if 0
/* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */
/* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */
/* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */
#endif
/* 11. GL_EXT_histogram */
#if 0
SET_GetHistogramEXT(exec, _mesa_GetHistogram);

View file

@ -529,7 +529,6 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
if (ctx->Texture.Unit.Enabled != enabled) {
_mesa_set_enable(ctx, GL_TEXTURE_1D, !!(enabled & TEXTURE_1D_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_2D, !!(enabled & TEXTURE_2D_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_3D, !!(enabled & TEXTURE_3D_BIT));
if (ctx->Extensions.ARB_texture_cube_map) {
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP,
!!(enabled & TEXTURE_CUBE_BIT));
@ -561,7 +560,6 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
_mesa_set_enable(ctx, GL_TEXTURE_1D, !!(unit->Enabled & TEXTURE_1D_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_2D, !!(unit->Enabled & TEXTURE_2D_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_3D, !!(unit->Enabled & TEXTURE_3D_BIT));
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode);
_mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor);

View file

@ -135,7 +135,6 @@
#undef MAX_WIDTH
#undef MAX_HEIGHT
#define MAX_TEXTURE_LEVELS 13
#define MAX_3D_TEXTURE_LEVELS 9
#define MAX_CUBE_TEXTURE_LEVELS 13
#define MAX_WIDTH 4096
#define MAX_HEIGHT 4096
@ -155,9 +154,6 @@
/** Max convolution filter height */
#define MAX_CONVOLUTION_HEIGHT 9
/** For GL_ARB_texture_compression */
#define MAX_COMPRESSED_TEXTURE_FORMATS 25
/** For GL_EXT_texture_filter_anisotropic */
#define MAX_TEXTURE_MAX_ANISOTROPY 16.0

View file

@ -392,7 +392,6 @@ _mesa_init_constants(struct gl_context *ctx)
/* Constants, may be overriden (usually only reduced) by device drivers */
ctx->Const.MaxTextureMbytes = MAX_TEXTURE_MBYTES;
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;

View file

@ -220,18 +220,6 @@ struct dd_function_table {
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
/**
* Called by glTexImage3D().
*
* \sa dd_function_table::TexImage1D.
*/
void (*TexImage3D)(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
/**
* Called by glTexSubImage1D(). Replace a subset of the target texture
@ -257,19 +245,6 @@ struct dd_function_table {
GLenum format, GLenum type,
const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
/**
* Called by glTexSubImage3D().
*
* \sa dd_function_table::TexSubImage1D.
*/
void (*TexSubImage3D)(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLint depth,
GLenum format, GLenum type,
const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
/**
@ -298,16 +273,6 @@ struct dd_function_table {
GLint x, GLint y,
GLsizei width, GLsizei height);
/**
* Called by glCopyTexSubImage3D() and glCopyTexImage3D().
*/
void (*CopyTexSubImage3D)(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
struct gl_renderbuffer *rb,
GLint x, GLint y,
GLsizei width, GLsizei height);
/**
* Called by glTexImage[123]D when user specifies a proxy texture
* target.
@ -348,18 +313,6 @@ struct dd_function_table {
GLsizei width, GLsizei height, GLint border,
GLsizei imageSize, const GLvoid *data);
/**
* Called by glCompressedTexImage3D().
*
* \sa dd_function_table::CompressedTexImage3D.
*/
void (*CompressedTexImage3D)(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint internalFormat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border,
GLsizei imageSize, const GLvoid *data);
/**
* Called by glCompressedTexSubImage1D().
*/
@ -378,16 +331,6 @@ struct dd_function_table {
GLsizei width, GLint height,
GLenum format,
GLsizei imageSize, const GLvoid *data);
/**
* Called by glCompressedTexSubImage3D().
*/
void (*CompressedTexSubImage3D)(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLint height, GLint depth,
GLenum format,
GLsizei imageSize, const GLvoid *data);
/*@}*/
/**

View file

@ -438,9 +438,6 @@ typedef PROC _glapi_proc;
#define _gloffset_Minmax 368
#define _gloffset_ResetHistogram 369
#define _gloffset_ResetMinmax 370
#define _gloffset_TexImage3D 371
#define _gloffset_TexSubImage3D 372
#define _gloffset_CopyTexSubImage3D 373
#if !FEATURE_remap_table
@ -5173,39 +5170,6 @@ static inline void SET_ResetMinmax(struct _glapi_table *disp, void (GLAPIENTRYP
SET_by_offset(disp, _gloffset_ResetMinmax, fn);
}
typedef void (GLAPIENTRYP _glptr_TexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
#define CALL_TexImage3D(disp, parameters) \
(* GET_TexImage3D(disp)) parameters
static inline _glptr_TexImage3D GET_TexImage3D(struct _glapi_table *disp) {
return (_glptr_TexImage3D) (GET_by_offset(disp, _gloffset_TexImage3D));
}
static inline void SET_TexImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) {
SET_by_offset(disp, _gloffset_TexImage3D, fn);
}
typedef void (GLAPIENTRYP _glptr_TexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
#define CALL_TexSubImage3D(disp, parameters) \
(* GET_TexSubImage3D(disp)) parameters
static inline _glptr_TexSubImage3D GET_TexSubImage3D(struct _glapi_table *disp) {
return (_glptr_TexSubImage3D) (GET_by_offset(disp, _gloffset_TexSubImage3D));
}
static inline void SET_TexSubImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) {
SET_by_offset(disp, _gloffset_TexSubImage3D, fn);
}
typedef void (GLAPIENTRYP _glptr_CopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
#define CALL_CopyTexSubImage3D(disp, parameters) \
(* GET_CopyTexSubImage3D(disp)) parameters
static inline _glptr_CopyTexSubImage3D GET_CopyTexSubImage3D(struct _glapi_table *disp) {
return (_glptr_CopyTexSubImage3D) (GET_by_offset(disp, _gloffset_CopyTexSubImage3D));
}
static inline void SET_CopyTexSubImage3D(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)) {
SET_by_offset(disp, _gloffset_CopyTexSubImage3D, fn);
}
typedef const GLubyte * (GLAPIENTRYP _glptr_GetStringi)(GLenum, GLuint);
#define CALL_GetStringi(disp, parameters) \
(* GET_GetStringi(disp)) parameters

View file

@ -179,7 +179,6 @@ typedef enum
OPCODE_COPY_TEX_IMAGE2D,
OPCODE_COPY_TEX_SUB_IMAGE1D,
OPCODE_COPY_TEX_SUB_IMAGE2D,
OPCODE_COPY_TEX_SUB_IMAGE3D,
OPCODE_CULL_FACE,
OPCODE_DEPTH_FUNC,
OPCODE_DEPTH_MASK,
@ -248,10 +247,8 @@ typedef enum
OPCODE_TEXPARAMETER,
OPCODE_TEX_IMAGE1D,
OPCODE_TEX_IMAGE2D,
OPCODE_TEX_IMAGE3D,
OPCODE_TEX_SUB_IMAGE1D,
OPCODE_TEX_SUB_IMAGE2D,
OPCODE_TEX_SUB_IMAGE3D,
OPCODE_TRANSLATE,
OPCODE_VIEWPORT,
OPCODE_WINDOW_POS,
@ -502,10 +499,6 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
free(n[9].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE3D:
free(n[10].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE1D:
free(n[7].data);
n += InstSize[n[0].opcode];
@ -514,10 +507,6 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
free(n[9].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE3D:
free(n[11].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
free(block);
@ -1607,34 +1596,6 @@ save_CopyTexSubImage2D(GLenum target, GLint level,
}
static void GLAPIENTRY
save_CopyTexSubImage3D(GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLint height)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9);
if (n) {
n[1].e = target;
n[2].i = level;
n[3].i = xoffset;
n[4].i = yoffset;
n[5].i = zoffset;
n[6].i = x;
n[7].i = y;
n[8].i = width;
n[9].i = height;
}
if (ctx->ExecuteFlag) {
CALL_CopyTexSubImage3D(ctx->Exec, (target, level,
xoffset, yoffset, zoffset,
x, y, width, height));
}
}
static void GLAPIENTRY
save_CullFace(GLenum mode)
{
@ -3519,46 +3480,6 @@ save_TexImage2D(GLenum target,
}
static void GLAPIENTRY
save_TexImage3D(GLenum target,
GLint level, GLint internalFormat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border,
GLenum format, GLenum type, const GLvoid * pixels)
{
GET_CURRENT_CONTEXT(ctx);
if (target == GL_PROXY_TEXTURE_3D) {
/* don't compile, execute immediately */
CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
height, depth, border, format, type,
pixels));
}
else {
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 10);
if (n) {
n[1].e = target;
n[2].i = level;
n[3].i = (GLint) internalFormat;
n[4].i = (GLint) width;
n[5].i = (GLint) height;
n[6].i = (GLint) depth;
n[7].i = border;
n[8].e = format;
n[9].e = type;
n[10].data = unpack_image(ctx, 3, width, height, depth, format, type,
pixels, &ctx->Unpack);
}
if (ctx->ExecuteFlag) {
CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
height, depth, border, format, type,
pixels));
}
}
}
static void GLAPIENTRY
save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
GLsizei width, GLenum format, GLenum type,
@ -3618,41 +3539,6 @@ save_TexSubImage2D(GLenum target, GLint level,
}
static void GLAPIENTRY
save_TexSubImage3D(GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid * pixels)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
if (n) {
n[1].e = target;
n[2].i = level;
n[3].i = xoffset;
n[4].i = yoffset;
n[5].i = zoffset;
n[6].i = (GLint) width;
n[7].i = (GLint) height;
n[8].i = (GLint) depth;
n[9].e = format;
n[10].e = type;
n[11].data = unpack_image(ctx, 3, width, height, depth, format, type,
pixels, &ctx->Unpack);
}
if (ctx->ExecuteFlag) {
CALL_TexSubImage3D(ctx->Exec, (target, level,
xoffset, yoffset, zoffset,
width, height, depth, format, type,
pixels));
}
}
static void GLAPIENTRY
save_Translatef(GLfloat x, GLfloat y, GLfloat z)
{
@ -4980,11 +4866,6 @@ execute_list(struct gl_context *ctx, GLuint list)
n[4].i, n[5].i, n[6].i, n[7].i,
n[8].i));
break;
case OPCODE_COPY_TEX_SUB_IMAGE3D:
CALL_CopyTexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
n[4].i, n[5].i, n[6].i, n[7].i,
n[8].i, n[9].i));
break;
case OPCODE_CULL_FACE:
CALL_CullFace(ctx->Exec, (n[1].e));
break;
@ -5314,23 +5195,6 @@ execute_list(struct gl_context *ctx, GLuint list)
ctx->Unpack = save; /* restore */
}
break;
case OPCODE_TEX_IMAGE3D:
{
const struct gl_pixelstore_attrib save = ctx->Unpack;
ctx->Unpack = ctx->DefaultPacking;
CALL_TexImage3D(ctx->Exec, (n[1].e, /* target */
n[2].i, /* level */
n[3].i, /* components */
n[4].i, /* width */
n[5].i, /* height */
n[6].i, /* depth */
n[7].e, /* border */
n[8].e, /* format */
n[9].e, /* type */
n[10].data));
ctx->Unpack = save; /* restore */
}
break;
case OPCODE_TEX_SUB_IMAGE1D:
{
const struct gl_pixelstore_attrib save = ctx->Unpack;
@ -5352,17 +5216,6 @@ execute_list(struct gl_context *ctx, GLuint list)
ctx->Unpack = save; /* restore */
}
break;
case OPCODE_TEX_SUB_IMAGE3D:
{
const struct gl_pixelstore_attrib save = ctx->Unpack;
ctx->Unpack = ctx->DefaultPacking;
CALL_TexSubImage3D(ctx->Exec, (n[1].e, n[2].i, n[3].i,
n[4].i, n[5].i, n[6].i, n[7].i,
n[8].i, n[9].e, n[10].e,
n[11].data));
ctx->Unpack = save; /* restore */
}
break;
case OPCODE_TRANSLATE:
CALL_Translatef(ctx->Exec, (n[1].f, n[2].f, n[3].f));
break;
@ -6729,11 +6582,6 @@ _mesa_create_save_table(void)
SET_TexSubImage2D(table, save_TexSubImage2D);
SET_VertexPointer(table, exec_VertexPointer);
/* GL 1.2 */
SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
SET_TexImage3D(table, save_TexImage3D);
SET_TexSubImage3D(table, save_TexSubImage3D);
/* GL_ARB_imaging */
/* Not all are supported */
SET_BlendColor(table, save_BlendColor);
@ -6779,13 +6627,6 @@ _mesa_create_save_table(void)
/* 3. GL_EXT_polygon_offset */
SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
/* 6. GL_EXT_texture3d */
#if 0
SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
SET_TexImage3DEXT(table, save_TexImage3DEXT);
SET_TexSubImage3DEXT(table, save_TexSubImage3D);
#endif
/* 14. GL_SGI_color_table */
#if 0
SET_ColorTableSGI(table, save_ColorTable);

View file

@ -568,11 +568,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
return;
}
break;
case GL_TEXTURE_3D:
if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
return;
}
break;
case GL_TEXTURE_GEN_S:
case GL_TEXTURE_GEN_T:
case GL_TEXTURE_GEN_R:
@ -886,8 +881,6 @@ _mesa_IsEnabled( GLenum cap )
return is_texture_enabled(ctx, TEXTURE_1D_BIT);
case GL_TEXTURE_2D:
return is_texture_enabled(ctx, TEXTURE_2D_BIT);
case GL_TEXTURE_3D:
return is_texture_enabled(ctx, TEXTURE_3D_BIT);
case GL_TEXTURE_GEN_S:
case GL_TEXTURE_GEN_T:
case GL_TEXTURE_GEN_R:

View file

@ -71,7 +71,6 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), 2001 },
{ "GL_ARB_texture_env_dot3", o(ARB_texture_env_dot3), 2001 },
{ "GL_ARB_texture_mirrored_repeat", o(dummy_true), 2001 },
{ "GL_ARB_texture_non_power_of_two", o(ARB_texture_non_power_of_two), 2003 },
{ "GL_ARB_texture_storage", o(ARB_texture_storage), 2011 },
{ "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), 1999 },
{ "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), 2006 },
@ -206,7 +205,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
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_non_power_of_two = GL_TRUE;
ctx->Extensions.ARB_texture_storage = GL_TRUE;
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
@ -234,9 +232,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.NV_point_sprite = GL_TRUE;
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
/*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
#if FEATURE_texture_fxt1
_mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
#endif
}
@ -293,7 +288,6 @@ _mesa_enable_2_0_extensions(struct gl_context *ctx)
{
ctx->Extensions.ARB_point_sprite = GL_TRUE;
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
}

View file

@ -357,10 +357,6 @@ static const struct value_desc values[] = {
{ GL_BLEND_EQUATION, CONTEXT_ENUM(Color.EquationRGB), NO_EXTRA },
{ GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.EquationA), NO_EXTRA },
/* GL_ARB_texture_compression */
{ GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
{ GL_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA },
/* GL_ARB_multisample */
{ GL_SAMPLE_ALPHA_TO_COVERAGE_ARB,
CONTEXT_BOOL(Multisample.SampleAlphaToCoverage), NO_EXTRA },
@ -512,11 +508,6 @@ static const struct value_desc values[] = {
{ GL_BLEND_COLOR_EXT, LOC_CUSTOM, TYPE_FLOATN_4, 0, NO_EXTRA },
/* OES_texture_3D */
{ GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA },
{ GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
offsetof(struct gl_context, Const.Max3DTextureLevels), NO_EXTRA },
{ GL_ACCUM_RED_BITS, BUFFER_INT(Visual.accumRedBits), NO_EXTRA },
{ GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits), NO_EXTRA },
{ GL_ACCUM_BLUE_BITS, BUFFER_INT(Visual.accumBlueBits), NO_EXTRA },
@ -638,7 +629,6 @@ static const struct value_desc values[] = {
{ GL_STEREO, BUFFER_INT(Visual.stereoMode), NO_EXTRA },
{ GL_TEXTURE_1D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA },
{ GL_TEXTURE_3D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA },
{ GL_TEXTURE_BINDING_1D, LOC_CUSTOM, TYPE_INT, TEXTURE_1D_INDEX, NO_EXTRA },
@ -882,7 +872,6 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
switch (d->pname) {
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
case GL_TEXTURE_CUBE_MAP_ARB:
v->value_bool = _mesa_IsEnabled(d->pname);
break;

View file

@ -153,11 +153,6 @@ typedef void *GLeglImageOES;
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#endif
#ifndef GL_ATI_texture_compression_3dc
#define GL_ATI_texture_compression_3dc 1
#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837
#endif
/**
* Internal token to represent a GLSL shader program (a collection of

View file

@ -103,14 +103,10 @@
#define FEATURE_pixel_transfer FEATURE_GL
#define FEATURE_queryobj FEATURE_GL
#define FEATURE_rastpos FEATURE_GL
#define FEATURE_texture_fxt1 FEATURE_GL
#define FEATURE_texture_s3tc FEATURE_GL
#define FEATURE_extra_context_init FEATURE_ES
#define FEATURE_point_size_array FEATURE_ES
#define FEATURE_es2_glsl FEATURE_ES2
#define FEATURE_ARB_fragment_program 1
#define FEATURE_ARB_vertex_program 1
#define FEATURE_ARB_vertex_shader 1

View file

@ -833,7 +833,6 @@ struct gl_stencil_attrib
typedef enum
{
TEXTURE_CUBE_INDEX,
TEXTURE_3D_INDEX,
TEXTURE_2D_INDEX,
TEXTURE_1D_INDEX,
NUM_TEXTURE_TARGETS
@ -846,7 +845,6 @@ typedef enum
*/
/*@{*/
#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
/*@}*/
@ -1512,8 +1510,7 @@ struct gl_precision
struct gl_constants
{
GLint MaxTextureMbytes; /**< Max memory per image, in MB */
GLint MaxTextureLevels; /**< Max mipmap levels. */
GLint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */
GLint MaxTextureLevels; /**< Max mipmap levels. */
GLint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */
GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
@ -1583,7 +1580,6 @@ struct gl_extensions
GLboolean ARB_texture_env_combine;
GLboolean ARB_texture_env_crossbar;
GLboolean ARB_texture_env_dot3;
GLboolean ARB_texture_non_power_of_two;
GLboolean ARB_texture_storage;
GLboolean ARB_transpose_matrix;
GLboolean ARB_vertex_array_object;

View file

@ -63,7 +63,6 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
/* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */
static const GLenum targets[NUM_TEXTURE_TARGETS] = {
GL_TEXTURE_CUBE_MAP,
GL_TEXTURE_3D,
GL_TEXTURE_2D,
GL_TEXTURE_1D
};

View file

@ -95,7 +95,6 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
break;
case GL_RGBA12:
case GL_RGBA16:
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);

View file

@ -397,9 +397,6 @@ _mesa_get_teximage(struct gl_context *ctx,
case GL_TEXTURE_1D:
dimensions = 1;
break;
case GL_TEXTURE_3D:
dimensions = 3;
break;
default:
dimensions = 2;
}

View file

@ -279,7 +279,6 @@ _mesa_is_proxy_texture(GLenum target)
return (target == GL_PROXY_TEXTURE_1D ||
target == GL_PROXY_TEXTURE_2D ||
target == GL_PROXY_TEXTURE_3D ||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
}
@ -297,9 +296,6 @@ get_proxy_target(GLenum target)
case GL_TEXTURE_2D:
case GL_PROXY_TEXTURE_2D:
return GL_PROXY_TEXTURE_2D;
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
return GL_PROXY_TEXTURE_3D;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
@ -339,10 +335,6 @@ _mesa_select_tex_object(struct gl_context *ctx,
return ctx->Texture.Unit.CurrentTex[TEXTURE_2D_INDEX];
case GL_PROXY_TEXTURE_2D:
return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX];
case GL_TEXTURE_3D:
return ctx->Texture.Unit.CurrentTex[TEXTURE_3D_INDEX];
case GL_PROXY_TEXTURE_3D:
return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX];
default:
_mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
return NULL;
@ -432,11 +424,6 @@ _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
return NULL;
texIndex = TEXTURE_2D_INDEX;
break;
case GL_PROXY_TEXTURE_3D:
if (level >= ctx->Const.Max3DTextureLevels)
return NULL;
texIndex = TEXTURE_3D_INDEX;
break;
case GL_PROXY_TEXTURE_CUBE_MAP:
if (level >= ctx->Const.MaxCubeTextureLevels)
return NULL;
@ -481,9 +468,6 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
case GL_TEXTURE_2D:
case GL_PROXY_TEXTURE_2D:
return ctx->Const.MaxTextureLevels;
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
return ctx->Const.Max3DTextureLevels;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
@ -520,9 +504,6 @@ _mesa_get_texture_dimensions(GLenum target)
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
return 2;
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
return 3;
default:
_mesa_problem(NULL, "invalid target 0x%x in get_texture_dimensions()",
target);
@ -683,13 +664,6 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
img->Depth2 = 1;
img->DepthLog2 = 0;
break;
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
img->HeightLog2 = _mesa_logbase2(img->Height2);
img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */
img->DepthLog2 = _mesa_logbase2(img->Depth2);
break;
default:
_mesa_problem(NULL, "invalid target 0x%x in _mesa_init_teximage_fields()",
target);
@ -760,10 +734,8 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
return GL_FALSE;
if (level >= ctx->Const.MaxTextureLevels)
return GL_FALSE;
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
return GL_FALSE;
}
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
return GL_FALSE;
return GL_TRUE;
case GL_PROXY_TEXTURE_2D:
@ -774,32 +746,10 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
return GL_FALSE;
if (level >= ctx->Const.MaxTextureLevels)
return GL_FALSE;
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
return GL_FALSE;
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
return GL_FALSE;
}
return GL_TRUE;
case GL_PROXY_TEXTURE_3D:
maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
if (width < 2 * border || width > 2 * border + maxSize)
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
return GL_FALSE;
if (height < 2 * border || height > 2 * border + maxSize)
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
return GL_FALSE;
if (depth < 2 * border || depth > 2 * border + maxSize)
return GL_FALSE;
if (level >= ctx->Const.Max3DTextureLevels)
return GL_FALSE;
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
return GL_FALSE;
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
return GL_FALSE;
if (depth > 0 && !_mesa_is_pow_two(depth - 2 * border))
return GL_FALSE;
}
return GL_TRUE;
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
@ -810,12 +760,10 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
return GL_FALSE;
if (level >= ctx->Const.MaxCubeTextureLevels)
return GL_FALSE;
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
return GL_FALSE;
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
return GL_FALSE;
}
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
return GL_FALSE;
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
return GL_FALSE;
return GL_TRUE;
default:
@ -873,14 +821,6 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
default:
return GL_FALSE;
}
case 3:
switch (target) {
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
return GL_TRUE;
default:
return GL_FALSE;
}
default:
_mesa_problem(ctx, "invalid dims=%u in legal_teximage_target()", dims);
return GL_FALSE;
@ -914,13 +854,6 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
default:
return GL_FALSE;
}
case 3:
switch (target) {
case GL_TEXTURE_3D:
return GL_TRUE;
default:
return GL_FALSE;
}
default:
_mesa_problem(ctx, "invalid dims=%u in legal_texsubimage_target()",
dims);
@ -1243,16 +1176,6 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
}
if (dimensions > 2) {
if (zoffset < -((GLint)destTex->Border)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
return GL_TRUE;
}
if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
return GL_TRUE;
}
}
if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) {
/* both source and dest must be integer-valued, or neither */
@ -1761,7 +1684,6 @@ teximage(struct gl_context *ctx, GLuint dims,
border, internalFormat, texFormat);
/* Give the texture to the driver. <pixels> may be null. */
ASSERT(ctx->Driver.TexImage3D);
switch (dims) {
case 1:
ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
@ -1773,11 +1695,6 @@ teximage(struct gl_context *ctx, GLuint dims,
width, height, border, format,
type, pixels, unpack);
break;
case 3:
ctx->Driver.TexImage3D(ctx, texImage, internalFormat,
width, height, depth, border, format,
type, pixels, unpack);
break;
default:
_mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
}
@ -1822,33 +1739,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
}
/*
* Called by the API or display list executor.
* Note that width and height include the border.
*/
void GLAPIENTRY
_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
teximage(ctx, 3, target, level, internalFormat, width, height, depth,
border, format, type, pixels);
}
void GLAPIENTRY
_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels )
{
_mesa_TexImage3D(target, level, (GLint) internalFormat, width, height,
depth, border, format, type, pixels);
}
/**
* Implement all the glTexSubImage1/2/3D() functions.
*/
@ -1922,12 +1812,6 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
xoffset, yoffset, width, height,
format, type, pixels, &ctx->Unpack);
break;
case 3:
ctx->Driver.TexSubImage3D(ctx, texImage,
xoffset, yoffset, zoffset,
width, height, depth,
format, type, pixels, &ctx->Unpack);
break;
default:
_mesa_problem(ctx, "unexpected dims in subteximage()");
}
@ -1969,22 +1853,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
void GLAPIENTRY
_mesa_TexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
texsubimage(ctx, 3, target, level,
xoffset, yoffset, zoffset,
width, height, depth,
format, type, pixels);
}
/**
* For glCopyTexSubImage, return the source renderbuffer to copy texel data
* from. This depends on whether the texture contains color or depth values.
@ -2193,11 +2061,6 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
ctx->Driver.CopyTexSubImage2D(ctx, texImage, xoffset, yoffset,
srcRb, x, y, width, height);
break;
case 3:
ctx->Driver.CopyTexSubImage3D(ctx, texImage,
xoffset, yoffset, zoffset,
srcRb, x, y, width, height);
break;
default:
_mesa_problem(ctx, "bad dims in copytexsubimage()");
}
@ -2229,15 +2092,3 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
copytexsubimage(ctx, 2, target, level, xoffset, yoffset, 0, x, y,
width, height);
}
void GLAPIENTRY
_mesa_CopyTexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height )
{
GET_CURRENT_CONTEXT(ctx);
copytexsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
x, y, width, height);
}

View file

@ -164,18 +164,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, const GLvoid *pixels );
extern void GLAPIENTRY
_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLsizei depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels );
extern void GLAPIENTRY
_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels );
extern void GLAPIENTRY
_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
GLsizei width,
@ -191,14 +179,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
const GLvoid *pixels );
extern void GLAPIENTRY
_mesa_TexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
const GLvoid *pixels );
extern void GLAPIENTRY
_mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLint border );
@ -220,12 +200,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height );
extern void GLAPIENTRY
_mesa_CopyTexSubImage3D( GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height );
/*@}*/
#endif

View file

@ -216,7 +216,6 @@ valid_texture_object(const struct gl_texture_object *tex)
case 0:
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
case GL_TEXTURE_CUBE_MAP_ARB:
return GL_TRUE;
case 0x99:
@ -365,12 +364,6 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
t->Image[0][baseLevel]->HeightLog2);
maxLevels = ctx->Const.MaxTextureLevels;
}
else if (t->Target == GL_TEXTURE_3D) {
GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2,
t->Image[0][baseLevel]->HeightLog2);
maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2));
maxLevels = ctx->Const.Max3DTextureLevels;
}
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
t->Image[0][baseLevel]->HeightLog2);
@ -503,49 +496,6 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
}
}
}
else if (t->Target == GL_TEXTURE_3D) {
/* Test 3-D mipmaps */
GLuint width = t->Image[0][baseLevel]->Width2;
GLuint height = t->Image[0][baseLevel]->Height2;
GLuint depth = t->Image[0][baseLevel]->Depth2;
for (i = baseLevel + 1; i < maxLevels; i++) {
if (width > 1) {
width /= 2;
}
if (height > 1) {
height /= 2;
}
if (depth > 1) {
depth /= 2;
}
if (i >= minLevel && i <= maxLevel) {
const struct gl_texture_image *img = t->Image[0][i];
if (!img) {
incomplete(t, "3D Image[%d] is missing", i);
return;
}
if (img->_BaseFormat == GL_DEPTH_COMPONENT) {
incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
return;
}
if (img->Width2 != width) {
incomplete(t, "3D Image[%d] bad width %u", i, img->Width2);
return;
}
if (img->Height2 != height) {
incomplete(t, "3D Image[%d] bad height %u", i, img->Height2);
return;
}
if (img->Depth2 != depth) {
incomplete(t, "3D Image[%d] bad depth %u", i, img->Depth2);
return;
}
}
if (width == 1 && height == 1 && depth == 1) {
return; /* found smallest needed mipmap, all done! */
}
}
}
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
/* make sure 6 cube faces are consistant */
GLuint width = t->Image[0][baseLevel]->Width2;
@ -863,8 +813,6 @@ target_enum_to_index(GLenum target)
return TEXTURE_1D_INDEX;
case GL_TEXTURE_2D:
return TEXTURE_2D_INDEX;
case GL_TEXTURE_3D:
return TEXTURE_3D_INDEX;
case GL_TEXTURE_CUBE_MAP_ARB:
return TEXTURE_CUBE_INDEX;
default:

View file

@ -71,8 +71,6 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
return texUnit->CurrentTex[TEXTURE_1D_INDEX];
case GL_TEXTURE_2D:
return texUnit->CurrentTex[TEXTURE_2D_INDEX];
case GL_TEXTURE_3D:
return texUnit->CurrentTex[TEXTURE_3D_INDEX];
case GL_TEXTURE_CUBE_MAP:
if (ctx->Extensions.ARB_texture_cube_map) {
return texUnit->CurrentTex[TEXTURE_CUBE_INDEX];

View file

@ -502,7 +502,6 @@ alloc_proxy_textures( struct gl_context *ctx )
*/
static const GLenum targets[] = {
GL_TEXTURE_CUBE_MAP_ARB,
GL_TEXTURE_3D,
GL_TEXTURE_2D,
GL_TEXTURE_1D,
};

View file

@ -58,14 +58,6 @@ legal_texobj_target(struct gl_context *ctx, GLuint dims, GLenum target)
default:
return GL_FALSE;
}
case 3:
switch (target) {
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
return GL_TRUE;
default:
return GL_FALSE;
}
default:
_mesa_problem(ctx, "invalid dims=%u in legal_texobj_target()", dims);
return GL_FALSE;

View file

@ -39,7 +39,6 @@
* code:
* ctx->Driver.TexImage1D = _mesa_store_teximage1d;
* ctx->Driver.TexImage2D = _mesa_store_teximage2d;
* ctx->Driver.TexImage3D = _mesa_store_teximage3d;
* etc...
*
* Texture image processing is actually kind of complicated. We have to do:
@ -3159,9 +3158,6 @@ store_texsubimage(struct gl_context *ctx,
case GL_TEXTURE_1D:
dims = 1;
break;
case GL_TEXTURE_3D:
dims = 3;
break;
default:
dims = 2;
}
@ -3183,13 +3179,6 @@ store_texsubimage(struct gl_context *ctx,
assert(yoffset == 0);
assert(zoffset == 0);
break;
case GL_TEXTURE_3D:
/* we'll store 3D images as a series of slices */
numSlices = depth;
sliceOffset = zoffset;
srcImageStride = _mesa_image_image_stride(packing, width, height,
format, type);
break;
default:
_mesa_warning(ctx, "Unexpected target 0x%x in store_texsubimage()", target);
return;
@ -3287,34 +3276,6 @@ _mesa_store_teximage2d(struct gl_context *ctx,
/**
* This is the fallback for Driver.TexImage3D().
*/
void
_mesa_store_teximage3d(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing)
{
if (width == 0 || height == 0 || depth == 0)
return;
/* allocate storage for texture data */
if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
width, height, depth)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
return;
}
store_texsubimage(ctx, texImage,
0, 0, 0, width, height, depth,
format, type, pixels, packing, "glTexImage3D");
}
/*
* This is the fallback for Driver.TexSubImage1D().
@ -3348,20 +3309,3 @@ _mesa_store_texsubimage2d(struct gl_context *ctx,
xoffset, yoffset, 0, width, height, 1,
format, type, pixels, packing, "glTexSubImage2D");
}
/*
* This is the fallback for Driver.TexSubImage3D().
*/
void
_mesa_store_texsubimage3d(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing)
{
store_texsubimage(ctx, texImage,
xoffset, yoffset, zoffset, width, height, depth,
format, type, pixels, packing, "glTexSubImage3D");
}

View file

@ -107,15 +107,6 @@ _mesa_store_teximage2d(struct gl_context *ctx,
const struct gl_pixelstore_attrib *packing);
extern void
_mesa_store_teximage3d(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
extern void
_mesa_store_texsubimage1d(struct gl_context *ctx,
struct gl_texture_image *texImage,
@ -133,13 +124,4 @@ _mesa_store_texsubimage2d(struct gl_context *ctx,
const struct gl_pixelstore_attrib *packing);
extern void
_mesa_store_texsubimage3d(struct gl_context *ctx,
struct gl_texture_image *texImage,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
#endif

View file

@ -75,7 +75,6 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.EXT_shadow_funcs);
const GLboolean ver_2_0 = (ver_1_5 &&
ctx->Extensions.ARB_point_sprite &&
ctx->Extensions.ARB_texture_non_power_of_two &&
ctx->Extensions.EXT_blend_equation_separate);
const GLboolean ver_2_1 = (ver_2_0);
const GLboolean ver_3_0 = (ver_2_1 &&

View file

@ -1665,325 +1665,6 @@ sample_lambda_2d_aniso(struct gl_context *ctx,
}
/**********************************************************************/
/* 3-D Texture Sampling Functions */
/**********************************************************************/
/**
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
static inline void
sample_3d_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2; /* without border, power of two */
const GLint height = img->Height2; /* without border, power of two */
const GLint depth = img->Depth2; /* without border, power of two */
GLint i, j, k;
(void) ctx;
i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]);
j = nearest_texel_location(tObj->Sampler.WrapT, img, height, texcoord[1]);
k = nearest_texel_location(tObj->Sampler.WrapR, img, depth, texcoord[2]);
if (i < 0 || i >= (GLint) img->Width ||
j < 0 || j >= (GLint) img->Height ||
k < 0 || k >= (GLint) img->Depth) {
/* Need this test for GL_CLAMP_TO_BORDER mode */
get_border_color(tObj, img, rgba);
}
else {
swImg->FetchTexel(swImg, i, j, k, rgba);
}
}
/**
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
static void
sample_3d_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
GLfloat rgba[4])
{
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
const GLint width = img->Width2;
const GLint height = img->Height2;
const GLint depth = img->Depth2;
GLint i0, j0, k0, i1, j1, k1;
GLbitfield useBorderColor = 0x0;
GLfloat a, b, c;
GLfloat t000[4], t010[4], t001[4], t011[4];
GLfloat t100[4], t110[4], t101[4], t111[4];
linear_texel_locations(tObj->Sampler.WrapS, img, width, texcoord[0], &i0, &i1, &a);
linear_texel_locations(tObj->Sampler.WrapT, img, height, texcoord[1], &j0, &j1, &b);
linear_texel_locations(tObj->Sampler.WrapR, img, depth, texcoord[2], &k0, &k1, &c);
if (img->Border) {
i0 += img->Border;
i1 += img->Border;
j0 += img->Border;
j1 += img->Border;
k0 += img->Border;
k1 += img->Border;
}
else {
/* check if sampling texture border color */
if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT;
if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT;
if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT;
if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT;
if (k0 < 0 || k0 >= depth) useBorderColor |= K0BIT;
if (k1 < 0 || k1 >= depth) useBorderColor |= K1BIT;
}
/* Fetch texels */
if (useBorderColor & (I0BIT | J0BIT | K0BIT)) {
get_border_color(tObj, img, t000);
}
else {
swImg->FetchTexel(swImg, i0, j0, k0, t000);
}
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
get_border_color(tObj, img, t100);
}
else {
swImg->FetchTexel(swImg, i1, j0, k0, t100);
}
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
get_border_color(tObj, img, t010);
}
else {
swImg->FetchTexel(swImg, i0, j1, k0, t010);
}
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
get_border_color(tObj, img, t110);
}
else {
swImg->FetchTexel(swImg, i1, j1, k0, t110);
}
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
get_border_color(tObj, img, t001);
}
else {
swImg->FetchTexel(swImg, i0, j0, k1, t001);
}
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
get_border_color(tObj, img, t101);
}
else {
swImg->FetchTexel(swImg, i1, j0, k1, t101);
}
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
get_border_color(tObj, img, t011);
}
else {
swImg->FetchTexel(swImg, i0, j1, k1, t011);
}
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
get_border_color(tObj, img, t111);
}
else {
swImg->FetchTexel(swImg, i1, j1, k1, t111);
}
/* trilinear interpolation of samples */
lerp_rgba_3d(rgba, a, b, c, t000, t100, t010, t110, t001, t101, t011, t111);
}
static void
sample_3d_nearest_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4] )
{
GLuint i;
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_3d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]);
}
}
static void
sample_3d_linear_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
ASSERT(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = nearest_mipmap_level(tObj, lambda[i]);
sample_3d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]);
}
}
static void
sample_3d_nearest_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
ASSERT(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel],
texcoord[i], rgba[i]);
}
else {
GLfloat t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda[i]);
sample_3d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
lerp_rgba(rgba[i], f, t0, t1);
}
}
}
static void
sample_3d_linear_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
ASSERT(lambda != NULL);
for (i = 0; i < n; i++) {
GLint level = linear_mipmap_level(tObj, lambda[i]);
if (level >= tObj->_MaxLevel) {
sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel],
texcoord[i], rgba[i]);
}
else {
GLfloat t0[4], t1[4]; /* texels */
const GLfloat f = FRAC(lambda[i]);
sample_3d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
lerp_rgba(rgba[i], f, t0, t1);
}
}
}
/** Sample 3D texture, nearest filtering for both min/magnification */
static void
sample_nearest_3d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
for (i = 0; i < n; i++) {
sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
/** Sample 3D texture, linear filtering for both min/magnification */
static void
sample_linear_3d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
{
GLuint i;
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
(void) lambda;
for (i = 0; i < n; i++) {
sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
}
}
/** Sample 3D texture, using lambda to choose between min/magnification */
static void
sample_lambda_3d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
{
GLuint minStart, minEnd; /* texels with minification */
GLuint magStart, magEnd; /* texels with magnification */
GLuint i;
ASSERT(lambda != NULL);
compute_min_mag_ranges(tObj, n, lambda,
&minStart, &minEnd, &magStart, &magEnd);
if (minStart < minEnd) {
/* do the minified texels */
GLuint m = minEnd - minStart;
switch (tObj->Sampler.MinFilter) {
case GL_NEAREST:
for (i = minStart; i < minEnd; i++)
sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
texcoords[i], rgba[i]);
break;
case GL_LINEAR:
for (i = minStart; i < minEnd; i++)
sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
texcoords[i], rgba[i]);
break;
case GL_NEAREST_MIPMAP_NEAREST:
sample_3d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_LINEAR_MIPMAP_NEAREST:
sample_3d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_NEAREST_MIPMAP_LINEAR:
sample_3d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
case GL_LINEAR_MIPMAP_LINEAR:
sample_3d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart,
lambda + minStart, rgba + minStart);
break;
default:
_mesa_problem(ctx, "Bad min filter in sample_3d_texture");
return;
}
}
if (magStart < magEnd) {
/* do the magnified texels */
switch (tObj->Sampler.MagFilter) {
case GL_NEAREST:
for (i = magStart; i < magEnd; i++)
sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
texcoords[i], rgba[i]);
break;
case GL_LINEAR:
for (i = magStart; i < magEnd; i++)
sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
texcoords[i], rgba[i]);
break;
default:
_mesa_problem(ctx, "Bad mag filter in sample_3d_texture");
return;
}
}
}
/**********************************************************************/
/* Texture Cube Map Sampling Functions */
/**********************************************************************/
@ -2461,17 +2142,6 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return func;
}
case GL_TEXTURE_3D:
if (needLambda) {
return &sample_lambda_3d;
}
else if (t->Sampler.MinFilter == GL_LINEAR) {
return &sample_linear_3d;
}
else {
ASSERT(t->Sampler.MinFilter == GL_NEAREST);
return &sample_nearest_3d;
}
case GL_TEXTURE_CUBE_MAP:
if (needLambda) {
return &sample_lambda_cube;

View file

@ -203,15 +203,6 @@ _swrast_map_teximage(struct gl_context *ctx,
map = swImage->Buffer;
if (texImage->TexObject->Target == GL_TEXTURE_3D) {
GLuint sliceSize = _mesa_format_image_size(texImage->TexFormat,
texImage->Width,
texImage->Height,
1);
assert(slice < texImage->Depth);
map += slice * sliceSize;
}
/* apply x/y offset to map address */
map += stride * (y / bh) + texelSize * (x / bw);