diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/config.h | 6 | ||||
-rw-r--r-- | src/mesa/main/context.c | 6 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 68 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 4 | ||||
-rw-r--r-- | src/mesa/main/get.c | 102 | ||||
-rw-r--r-- | src/mesa/main/hint.c | 16 | ||||
-rw-r--r-- | src/mesa/main/state.c | 13 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 60 | ||||
-rw-r--r-- | src/mesa/main/teximage.h | 44 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 34 |
10 files changed, 339 insertions, 14 deletions
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 5edc3b4f5c..3ccd49614a 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h,v 1.13 2000/05/07 20:41:30 brianp Exp $ */ +/* $Id: config.h,v 1.14 2000/05/23 20:10:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -122,6 +122,10 @@ #define MAX_CONVOLUTION_WIDTH 5 #define MAX_CONVOLUTION_HEIGHT 5 +/* GL_ARB_texture_compression */ +#define MAX_COMPRESSED_TEXTURE_FORMATS 25 + + /* * Mesa-specific parameters diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index e106b0343e..cb463003c8 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.66 2000/05/22 16:33:20 brianp Exp $ */ +/* $Id: context.c,v 1.67 2000/05/23 20:10:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -722,6 +722,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; + ctx->Const.NumCompressedTextureFormats = 0; /* Modelview matrix */ gl_matrix_ctr( &ctx->ModelView ); @@ -900,11 +901,12 @@ init_attrib_groups( GLcontext *ctx ) ctx->Hint.LineSmooth = GL_DONT_CARE; ctx->Hint.PolygonSmooth = GL_DONT_CARE; ctx->Hint.Fog = GL_DONT_CARE; - ctx->Hint.AllowDrawWin = GL_TRUE; ctx->Hint.AllowDrawFrg = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; ctx->Hint.StrictLighting = GL_TRUE; + ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; + ctx->Hint.TextureCompression = GL_DONT_CARE; /* Histogram group */ ctx->Histogram.Width = 0; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 2ada02ea06..9d80cb5004 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.39 2000/05/19 13:12:29 brianp Exp $ */ +/* $Id: dlist.c,v 1.40 2000/05/23 20:10:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -3559,6 +3559,8 @@ static void save_ClientActiveTextureARB( GLenum target ) +/* GL_ARB_transpose_matrix */ + static void save_LoadTransposeMatrixdARB( const GLdouble m[16] ) { GLdouble tm[16]; @@ -3606,6 +3608,62 @@ static void save_PixelTexGenSGIX(GLenum mode) } +/* GL_ARB_texture_compression */ +static void +save_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data) +{ +} + + +static void +save_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data) +{ +} + + +static void +save_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data) +{ +} + + +static void +save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ +} + + +static void +save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ +} + + +static void +save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ +} + + +/* GL_SGIS_pixel_texture */ + static void save_PixelTexGenParameteriSGIS(GLenum target, GLint value) { GET_CURRENT_CONTEXT(ctx); @@ -5181,6 +5239,14 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB; table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB; + /* ARB 12. GL_ARB_texture_compression */ + table->CompressedTexImage3DARB = save_CompressedTexImage3DARB; + table->CompressedTexImage2DARB = save_CompressedTexImage2DARB; + table->CompressedTexImage1DARB = save_CompressedTexImage1DARB; + table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB; + table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB; + table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB; + table->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index bcb9e0c426..897a973baf 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.27 2000/05/22 18:46:52 brianp Exp $ */ +/* $Id: extensions.c,v 1.28 2000/05/23 20:10:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -51,6 +51,7 @@ struct extension { static struct { int enabled; const char *name; } default_extensions[] = { { DEFAULT_OFF, "GL_ARB_imaging" }, /* in progress */ { DEFAULT_ON, "GL_ARB_multitexture" }, + { DEFAULT_OFF, "GL_ARB_texture_compression" }, /* in progress */ { DEFAULT_OFF, "GL_ARB_texture_cube_map" }, /* in progress */ { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, { ALWAYS_ENABLED, "GL_EXT_abgr" }, @@ -101,6 +102,7 @@ update_extension_flags( GLcontext *ctx ) ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias"); ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test"); ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map"); + ctx->Extensions.HaveTextureCompression = gl_extension_is_enabled(ctx, "GL_ARB_texture_compression"); } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index a7d3d5658a..2c349c7719 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.28 2000/05/23 17:14:49 brianp Exp $ */ +/* $Id: get.c,v 1.29 2000/05/23 20:10:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -974,6 +974,31 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); break; + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = INT_TO_BOOL(ctx->Hint.TextureCompression); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = INT_TO_BOOL(ctx->Const.CompressedTextureFormats[i]); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = ENUM_TO_BOOL(GL_NICEST); @@ -2092,6 +2117,31 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); return; + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLdouble) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLdouble) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLdouble) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = ENUM_TO_DOUBLE(GL_NICEST); @@ -3209,6 +3259,31 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); return; + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLfloat) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLfloat) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLfloat) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = ENUM_TO_FLOAT(GL_NICEST); @@ -4300,6 +4375,31 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); return; + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLint) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = (GL_NICEST); diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 3621176b37..7fb0e743b0 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -1,4 +1,4 @@ -/* $Id: hint.c,v 1.3 2000/04/10 15:52:26 brianp Exp $ */ +/* $Id: hint.c,v 1.4 2000/05/23 20:10:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -121,13 +121,23 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) case GL_NATIVE_GRAPHICS_HANDLE_PGI: break; - /* GL_EXT_clip_volume_hint */ + /* GL_EXT_clip_volume_hint */ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: ctx->Hint.ClipVolumeClipping = mode; break; + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + ctx->Hint.TextureCompression = mode; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + } + break; + default: - gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" ); + gl_error(ctx, GL_INVALID_ENUM, "glHint(target)"); return GL_FALSE; } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index ead81566c8..9eb8aafb67 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.12 2000/05/10 22:36:05 brianp Exp $ */ +/* $Id: state.c,v 1.13 2000/05/23 20:10:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -641,9 +641,20 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB; exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB; exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB; + + /* ARB 12. GL_ARB_texture_compression */ + exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB; + exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB; + exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB; + exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB; + exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB; + exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB; + exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; + } + /**********************************************************************/ /***** State update logic *****/ /**********************************************************************/ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index d3d8bd75c2..30677e3216 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2369,3 +2369,63 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, } } } + + + +void +_mesa_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data) +{ +} + + +void +_mesa_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data) +{ +} + + +void +_mesa_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data) +{ +} + + +void +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ +} + + +void +_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ +} + + +void +_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ +} + + +void +_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img) +{ +} diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 433bdc34e6..bbf1836eab 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -1,4 +1,4 @@ -/* $Id: teximage.h,v 1.8 2000/05/23 17:14:49 brianp Exp $ */ +/* $Id: teximage.h,v 1.9 2000/05/23 20:10:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -145,5 +145,47 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + + +extern void +_mesa_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data); + + +extern void +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data); + +extern void +_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data); + +extern void +_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); + + #endif diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 0e55fc9b1f..32ce600563 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.12 2000/05/23 17:14:49 brianp Exp $ */ +/* $Id: texstate.c,v 1.13 2000/05/23 20:10:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -463,6 +463,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; const struct gl_texture_image *img = NULL; GLuint dimensions; + GLboolean isProxy; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexLevelParameter"); @@ -486,6 +487,11 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, return; } + isProxy = (target == GL_PROXY_TEXTURE_1D) || + (target == GL_PROXY_TEXTURE_2D) || + (target == GL_PROXY_TEXTURE_3D) || + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB); + switch (pname) { case GL_TEXTURE_WIDTH: *params = img->Width; @@ -535,9 +541,31 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_TEXTURE_INDEX_SIZE_EXT: *params = img->IndexBits; return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCompression) { + if (img->IsCompressed && !isProxy) + *params = img->CompressedSize; + else + gl_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameter[if]v(pname)"); + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_COMPRESSED_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) img->IsCompressed; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + } + return; + default: - gl_error( ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)" ); + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } } |