diff options
author | Brian Paul <brianp@vmware.com> | 2010-07-07 20:26:33 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-07-07 20:26:33 -0600 |
commit | 6988f65e43297ae63bbce30bf882f870b370096c (patch) | |
tree | d3ed95a656903e818ec78271765b4cdafd2d8e93 | |
parent | d95b40759e82b11bd4b458ec9e44eb6234da1849 (diff) | |
download | mesa-6988f65e43297ae63bbce30bf882f870b370096c.tar.gz |
mesa: initial support for new GL 3.0 texture formats
-rw-r--r-- | src/mesa/main/extensions.c | 6 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 6 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 75 | ||||
-rw-r--r-- | src/mesa/main/version.c | 3 |
4 files changed, 85 insertions, 5 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 3d2de973bc5..19a1eebe6e9 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -46,8 +46,9 @@ static const struct { } default_extensions[] = { { OFF, "GL_ARB_blend_func_extended", F(ARB_blend_func_extended) }, { OFF, "GL_ARB_copy_buffer", F(ARB_copy_buffer) }, - { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, + { OFF, "GL_ARB_depth_buffer_float", F(ARB_depth_buffer_float) }, { OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) }, + { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, { ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) }, { OFF, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex) }, { OFF, "GL_ARB_draw_instanced", F(ARB_draw_instanced) }, @@ -92,6 +93,7 @@ static const struct { { OFF, "GL_ARB_texture_multisample", F(ARB_texture_multisample) }, { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)}, { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_ARB_texture_rg", F(ARB_texture_rg) }, { OFF, "GL_ARB_texture_rgb10_a2ui", F(ARB_texture_rgb10_a2ui) }, { OFF, "GL_ARB_texture_swizzle", F(EXT_texture_swizzle) }, { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) }, @@ -141,7 +143,6 @@ static const struct { { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) }, { ON, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color) }, { OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) }, - { OFF, "GL_EXT_shared_exponent", F(EXT_shared_exponent) }, { OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) }, { OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) }, { OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) }, @@ -162,6 +163,7 @@ static const struct { { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) }, { ON, "GL_EXT_texture_object", F(EXT_texture_object) }, { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_EXT_texture_shared_exponent", F(EXT_texture_shared_exponent) }, { OFF, "GL_EXT_texture_sRGB", F(EXT_texture_sRGB) }, { OFF, "GL_EXT_texture_swizzle", F(EXT_texture_swizzle) }, { OFF, "GL_EXT_timer_query", F(EXT_timer_query) }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0aeb130cb85..a3f89f2f9b9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2606,8 +2606,9 @@ struct gl_extensions GLboolean dummy; /* don't remove this! */ GLboolean ARB_blend_func_extended; GLboolean ARB_copy_buffer; - GLboolean ARB_depth_texture; + GLboolean ARB_depth_buffer_float; GLboolean ARB_depth_clamp; + GLboolean ARB_depth_texture; GLboolean ARB_draw_buffers; GLboolean ARB_draw_elements_base_vertex; GLboolean ARB_draw_instanced; @@ -2647,6 +2648,7 @@ struct gl_extensions GLboolean ARB_texture_mirrored_repeat; GLboolean ARB_texture_multisample; GLboolean ARB_texture_non_power_of_two; + GLboolean ARB_texture_rg; GLboolean ARB_texture_rgb10_a2ui; GLboolean ARB_timer_query; GLboolean ARB_transform_feedback2; @@ -2694,7 +2696,6 @@ struct gl_extensions GLboolean EXT_shadow_funcs; GLboolean EXT_secondary_color; GLboolean EXT_separate_specular_color; - GLboolean EXT_shared_exponent; GLboolean EXT_shared_texture_palette; GLboolean EXT_stencil_wrap; GLboolean EXT_stencil_two_side; @@ -2712,6 +2713,7 @@ struct gl_extensions GLboolean EXT_texture_integer; GLboolean EXT_texture_lod_bias; GLboolean EXT_texture_mirror_clamp; + GLboolean EXT_texture_shared_exponent; GLboolean EXT_texture_sRGB; GLboolean EXT_texture_swizzle; GLboolean EXT_transform_feedback; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index f3073220104..50890a3c1e3 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -402,6 +402,81 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) } } + if (ctx->Extensions.ARB_texture_rg) { + switch (internalFormat) { + case GL_R8: + case GL_R16: + case GL_R16F: + case GL_R32F: + case GL_R8I: + case GL_R8UI: + case GL_R16I: + case GL_R16UI: + case GL_R32I: + case GL_R32UI: + return GL_R; + case GL_RG: + case GL_RG_INTEGER: + case GL_RG8: + case GL_RG16: + case GL_RG16F: + case GL_RG32F: + case GL_RG8I: + case GL_RG8UI: + case GL_RG16I: + case GL_RG16UI: + case GL_RG32I: + case GL_RG32UI: + return GL_RG; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.EXT_texture_shared_exponent) { + switch (internalFormat) { + case GL_RGB9_E5_EXT: + return GL_RGB; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.EXT_packed_float) { + switch (internalFormat) { + case GL_R11F_G11F_B10F_EXT: + return GL_RGB; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.ARB_depth_buffer_float) { + switch (internalFormat) { + case GL_DEPTH_COMPONENT32F: + return GL_DEPTH_COMPONENT; + case GL_DEPTH32F_STENCIL8: + return GL_DEPTH_STENCIL; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.EXT_texture_compression_rgtc) { + switch (internalFormat) { + case GL_COMPRESSED_RED: + case GL_COMPRESSED_RED_RGTC1_EXT: + case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: + return GL_RED; + case GL_COMPRESSED_RG: + case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: + case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: + return GL_RG; + default: + ; /* fallthrough */ + } + } + return -1; /* error */ } diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 525d179621b..d833a160e9e 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -91,6 +91,7 @@ compute_version(GLcontext *ctx) ctx->Extensions.ARB_half_float_pixel && ctx->Extensions.ARB_map_buffer_range && ctx->Extensions.ARB_texture_float && + ctx->Extensions.ARB_texture_rg && ctx->Extensions.APPLE_vertex_array_object && ctx->Extensions.EXT_draw_buffers2 && ctx->Extensions.EXT_framebuffer_blit && @@ -99,10 +100,10 @@ compute_version(GLcontext *ctx) ctx->Extensions.EXT_framebuffer_sRGB && ctx->Extensions.EXT_packed_depth_stencil && ctx->Extensions.EXT_packed_float && - ctx->Extensions.EXT_shared_exponent && ctx->Extensions.EXT_texture_array && ctx->Extensions.EXT_texture_compression_rgtc && ctx->Extensions.EXT_texture_integer && + ctx->Extensions.EXT_texture_shared_exponent && ctx->Extensions.EXT_transform_feedback && ctx->Extensions.NV_conditional_render); const GLboolean ver_3_1 = (ver_3_0 && |