From 4741dbcbbc2514de370a760f4b78a17491014555 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 1 Oct 2008 15:51:56 -0700 Subject: [PATCH] Unify ARB_depth_texture and SGIX_depth_texture The ARB extension is a superset of the older SGIX extension. Any hardware that can support the SGIX version can also support the ARB version. In Mesa, any driver that supports one also supports the other. This unification just simplifies some bits of code. --- src/mesa/drivers/dri/i915/i915_context.c | 2 -- src/mesa/drivers/dri/intel/intel_context.c | 2 -- src/mesa/drivers/dri/intel/intel_tex_copy.c | 2 +- src/mesa/drivers/dri/r300/r300_context.c | 1 - src/mesa/main/depthstencil.c | 4 ++-- src/mesa/main/extensions.c | 3 +-- src/mesa/main/mtypes.h | 1 - src/mesa/main/texformat.c | 9 ++++----- src/mesa/main/teximage.c | 18 ++++++++---------- src/mesa/main/texparam.c | 3 +-- src/mesa/swrast/s_texstore.c | 6 +++--- 11 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index efcac911aa6..e0ddc7fd613 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -56,8 +56,6 @@ static const struct dri_extension i915_extensions[] = { {"GL_ARB_shadow", NULL}, {"GL_ARB_texture_non_power_of_two", NULL}, {"GL_EXT_shadow_funcs", NULL}, - /* ARB extn won't work if not enabled */ - {"GL_SGIX_depth_texture", NULL}, {NULL, NULL} }; diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 1dd3ee7d0a6..e53972c46dd 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -404,8 +404,6 @@ static const struct dri_extension brw_extensions[] = { { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions }, { "GL_EXT_shadow_funcs", NULL }, { "GL_EXT_texture_sRGB", NULL }, - /* ARB extn won't work if not enabled */ - { "GL_SGIX_depth_texture", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index a7b88b39c04..f4cb4a781c6 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -60,7 +60,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat) switch (internalFormat) { case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT16_ARB: + case GL_DEPTH_COMPONENT16: irb = intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH); if (irb && irb->region && irb->region->cpp == 2) return irb->region; diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index ee4a69dce36..37436275e34 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -138,7 +138,6 @@ const struct dri_extension card_extensions[] = { {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, {"GL_SGIS_generate_mipmap", NULL}, - {"GL_SGIX_depth_texture", NULL}, {NULL, NULL} /* *INDENT-ON* */ }; diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index fb54d6184d9..9d208e2997d 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -282,8 +282,8 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, z24rb->RefCount = 1; z24rb->Width = dsrb->Width; z24rb->Height = dsrb->Height; - z24rb->InternalFormat = GL_DEPTH_COMPONENT24_ARB; - z24rb->_ActualFormat = GL_DEPTH_COMPONENT24_ARB; + z24rb->InternalFormat = GL_DEPTH_COMPONENT24; + z24rb->_ActualFormat = GL_DEPTH_COMPONENT24; z24rb->_BaseFormat = GL_DEPTH_COMPONENT; z24rb->DataType = GL_UNSIGNED_INT; z24rb->DepthBits = 24; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index ddcb44f06bf..de75325f152 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -165,7 +165,7 @@ static const struct { { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) }, { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, - { OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) }, + { OFF, "GL_SGIX_depth_texture", F(ARB_depth_texture) }, { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, @@ -292,7 +292,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.SGI_texture_color_table = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; - ctx->Extensions.SGIX_depth_texture = GL_TRUE; ctx->Extensions.SGIX_shadow = GL_TRUE; ctx->Extensions.SGIX_shadow_ambient = GL_TRUE; #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 19cf6f56d1a..62bc65cc72c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2626,7 +2626,6 @@ struct gl_extensions GLboolean SGIS_generate_mipmap; GLboolean SGIS_texture_edge_clamp; GLboolean SGIS_texture_lod; - GLboolean SGIX_depth_texture; GLboolean SGIX_shadow; GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean TDFX_texture_compression_FXT1; diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index d4ccdf9fa06..4442ce39a44 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1420,14 +1420,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ; /* fallthrough */ } - if (ctx->Extensions.SGIX_depth_texture || - ctx->Extensions.ARB_depth_texture) { + if (ctx->Extensions.ARB_depth_texture) { switch (internalFormat) { case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT24_SGIX: - case GL_DEPTH_COMPONENT32_SGIX: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: return &_mesa_texformat_z32; - case GL_DEPTH_COMPONENT16_SGIX: + case GL_DEPTH_COMPONENT16: return &_mesa_texformat_z16; default: ; /* fallthrough */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index b0a2d6ddb3d..4a419fde261 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -241,13 +241,12 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) } } - if (ctx->Extensions.SGIX_depth_texture || - ctx->Extensions.ARB_depth_texture) { + if (ctx->Extensions.ARB_depth_texture) { switch (internalFormat) { case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT16_SGIX: - case GL_DEPTH_COMPONENT24_SGIX: - case GL_DEPTH_COMPONENT32_SGIX: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: return GL_DEPTH_COMPONENT; default: ; /* fallthrough */ @@ -526,9 +525,9 @@ static GLboolean is_depth_format(GLenum format) { switch (format) { - case GL_DEPTH_COMPONENT16_ARB: - case GL_DEPTH_COMPONENT24_ARB: - case GL_DEPTH_COMPONENT32_ARB: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: case GL_DEPTH_COMPONENT: return GL_TRUE; default: @@ -2297,8 +2296,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (!ctx->Extensions.SGIX_depth_texture && - !ctx->Extensions.ARB_depth_texture && is_depth_format(format)) { + if (!ctx->Extensions.ARB_depth_texture && is_depth_format(format)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); return; } diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index acddb6663bb..a9e752a6371 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -642,8 +642,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = 0; break; case GL_TEXTURE_DEPTH_SIZE_ARB: - if (ctx->Extensions.SGIX_depth_texture || - ctx->Extensions.ARB_depth_texture) + if (ctx->Extensions.ARB_depth_texture) *params = img->TexFormat->DepthBits; else _mesa_error(ctx, GL_INVALID_ENUM, diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c index 15d52aa587c..16b00b9fa1c 100644 --- a/src/mesa/swrast/s_texstore.c +++ b/src/mesa/swrast/s_texstore.c @@ -216,9 +216,9 @@ is_depth_format(GLenum format) { switch (format) { case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT16_SGIX: - case GL_DEPTH_COMPONENT24_SGIX: - case GL_DEPTH_COMPONENT32_SGIX: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: return GL_TRUE; default: return GL_FALSE; -- 2.30.2