mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
mesa: extension flags and version testing for GL 3.x features
This commit is contained in:
parent
120a9f46cd
commit
44732103b2
3 changed files with 102 additions and 3 deletions
|
|
@ -44,6 +44,7 @@ static const struct {
|
|||
const char *name;
|
||||
int flag_offset;
|
||||
} 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_clamp", F(ARB_depth_clamp) },
|
||||
|
|
@ -55,18 +56,22 @@ static const struct {
|
|||
{ OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) },
|
||||
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
|
||||
{ OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) },
|
||||
{ OFF, "GL_ARB_explicit_attrib_location", F(ARB_explicit_attrib_location) },
|
||||
{ OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) },
|
||||
{ OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) },
|
||||
{ OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) },
|
||||
{ OFF, "GL_ARB_imaging", F(ARB_imaging) },
|
||||
{ OFF, "GL_ARB_instanced_arrays", F(ARB_instanced_arrays) },
|
||||
{ OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) },
|
||||
{ ON, "GL_ARB_multisample", F(ARB_multisample) },
|
||||
{ OFF, "GL_ARB_multitexture", F(ARB_multitexture) },
|
||||
{ OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) },
|
||||
{ OFF, "GL_ARB_occlusion_query2", F(ARB_occlusion_query2) },
|
||||
{ OFF, "GL_ARB_pixel_buffer_object", F(EXT_pixel_buffer_object) },
|
||||
{ OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) },
|
||||
{ OFF, "GL_ARB_point_sprite", F(ARB_point_sprite) },
|
||||
{ OFF, "GL_ARB_provoking_vertex", F(EXT_provoking_vertex) },
|
||||
{ OFF, "GL_ARB_sampler_objects", F(ARB_sampler_objects) },
|
||||
{ OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) },
|
||||
{ OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) },
|
||||
{ OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) },
|
||||
|
|
@ -75,6 +80,7 @@ static const struct {
|
|||
{ OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) },
|
||||
{ OFF, "GL_ARB_sync", F(ARB_sync) },
|
||||
{ OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) },
|
||||
{ OFF, "GL_ARB_texture_buffer_object", F(ARB_texture_buffer_object) },
|
||||
{ ON, "GL_ARB_texture_compression", F(ARB_texture_compression) },
|
||||
{ OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) },
|
||||
{ OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) },
|
||||
|
|
@ -83,16 +89,20 @@ static const struct {
|
|||
{ 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_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_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) },
|
||||
{ OFF, "GL_ARB_transform_feedback2", F(ARB_transform_feedback2) },
|
||||
{ OFF, "GL_ARB_uniform_buffer_object", F(ARB_uniform_buffer_object) },
|
||||
{ OFF, "GL_ARB_vertex_array_bgra", F(EXT_vertex_array_bgra) },
|
||||
{ OFF, "GL_ARB_vertex_array_object", F(ARB_vertex_array_object) },
|
||||
{ ON, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) },
|
||||
{ OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) },
|
||||
{ OFF, "GL_ARB_vertex_shader", F(ARB_vertex_shader) },
|
||||
{ OFF, "GL_ARB_vertex_type_2_10_10_10_rev", F(ARB_vertex_type_2_10_10_10_rev) },
|
||||
{ ON, "GL_ARB_window_pos", F(ARB_window_pos) },
|
||||
{ ON, "GL_EXT_abgr", F(EXT_abgr) },
|
||||
{ ON, "GL_EXT_bgra", F(EXT_bgra) },
|
||||
|
|
@ -114,11 +124,13 @@ static const struct {
|
|||
{ OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) },
|
||||
{ OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) },
|
||||
{ OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) },
|
||||
{ OFF, "GL_EXT_framebuffer_sRGB", F(EXT_framebuffer_sRGB) },
|
||||
{ OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) },
|
||||
{ OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) },
|
||||
{ OFF, "GL_EXT_histogram", F(EXT_histogram) },
|
||||
{ ON, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) },
|
||||
{ OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) },
|
||||
{ OFF, "GL_EXT_packed_float", F(EXT_packed_float) },
|
||||
{ ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) },
|
||||
{ OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) },
|
||||
{ OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) },
|
||||
|
|
@ -129,6 +141,7 @@ 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) },
|
||||
|
|
@ -137,12 +150,14 @@ static const struct {
|
|||
{ ON, "GL_EXT_texture3D", F(EXT_texture3D) },
|
||||
{ OFF, "GL_EXT_texture_array", F(EXT_texture_array) },
|
||||
{ OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) },
|
||||
{ OFF, "GL_EXT_texture_compression_rgtc", F(EXT_texture_compression_rgtc) },
|
||||
{ OFF, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map) },
|
||||
{ ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
|
||||
{ OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) },
|
||||
{ OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) },
|
||||
{ OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) },
|
||||
{ OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) },
|
||||
{ OFF, "GL_EXT_texture_integer", F(EXT_texture_integer) },
|
||||
{ OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) },
|
||||
{ OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) },
|
||||
{ ON, "GL_EXT_texture_object", F(EXT_texture_object) },
|
||||
|
|
@ -184,9 +199,10 @@ static const struct {
|
|||
{ ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) },
|
||||
{ OFF, "GL_NV_packed_depth_stencil", F(EXT_packed_depth_stencil) },
|
||||
{ OFF, "GL_NV_point_sprite", F(NV_point_sprite) },
|
||||
{ OFF, "GL_NV_primitive_restart", F(NV_primitive_restart) },
|
||||
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
|
||||
{ OFF, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4) },
|
||||
{ OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) },
|
||||
{ ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
|
||||
{ OFF, "GL_NV_vertex_program", F(NV_vertex_program) },
|
||||
{ OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
|
||||
{ ON, "GL_OES_read_format", F(OES_read_format) },
|
||||
|
|
|
|||
|
|
@ -2032,6 +2032,9 @@ struct gl_query_state
|
|||
struct gl_query_object *PrimitivesGenerated;
|
||||
struct gl_query_object *PrimitivesWritten;
|
||||
|
||||
/** GL_ARB_timer_query */
|
||||
struct gl_query_object *TimeElapsed;
|
||||
|
||||
GLenum CondRenderMode;
|
||||
};
|
||||
|
||||
|
|
@ -2592,6 +2595,7 @@ struct gl_constants
|
|||
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_clamp;
|
||||
|
|
@ -2603,23 +2607,28 @@ struct gl_extensions
|
|||
GLboolean ARB_fragment_program_shadow;
|
||||
GLboolean ARB_fragment_shader;
|
||||
GLboolean ARB_framebuffer_object;
|
||||
GLboolean ARB_explicit_attrib_location;
|
||||
GLboolean ARB_geometry_shader4;
|
||||
GLboolean ARB_half_float_pixel;
|
||||
GLboolean ARB_half_float_vertex;
|
||||
GLboolean ARB_imaging;
|
||||
GLboolean ARB_instanced_arrays;
|
||||
GLboolean ARB_map_buffer_range;
|
||||
GLboolean ARB_multisample;
|
||||
GLboolean ARB_multitexture;
|
||||
GLboolean ARB_occlusion_query;
|
||||
GLboolean ARB_occlusion_query2;
|
||||
GLboolean ARB_point_sprite;
|
||||
GLboolean ARB_sampler_objects;
|
||||
GLboolean ARB_seamless_cube_map;
|
||||
GLboolean ARB_shader_objects;
|
||||
GLboolean ARB_shading_language_100;
|
||||
GLboolean ARB_shading_language_120;
|
||||
GLboolean ARB_shadow;
|
||||
GLboolean ARB_shadow_ambient; /* or GL_ARB_shadow_ambient */
|
||||
GLboolean ARB_shadow_ambient;
|
||||
GLboolean ARB_sync;
|
||||
GLboolean ARB_texture_border_clamp;
|
||||
GLboolean ARB_texture_buffer_object;
|
||||
GLboolean ARB_texture_compression;
|
||||
GLboolean ARB_texture_cube_map;
|
||||
GLboolean ARB_texture_env_combine;
|
||||
|
|
@ -2627,13 +2636,18 @@ struct gl_extensions
|
|||
GLboolean ARB_texture_env_dot3;
|
||||
GLboolean ARB_texture_float;
|
||||
GLboolean ARB_texture_mirrored_repeat;
|
||||
GLboolean ARB_texture_multisample;
|
||||
GLboolean ARB_texture_non_power_of_two;
|
||||
GLboolean ARB_texture_rgb10_a2ui;
|
||||
GLboolean ARB_timer_query;
|
||||
GLboolean ARB_transform_feedback2;
|
||||
GLboolean ARB_transpose_matrix;
|
||||
GLboolean ARB_uniform_buffer_object;
|
||||
GLboolean ARB_vertex_array_object;
|
||||
GLboolean ARB_vertex_buffer_object;
|
||||
GLboolean ARB_vertex_program;
|
||||
GLboolean ARB_vertex_shader;
|
||||
GLboolean ARB_vertex_type_2_10_10_10_rev;
|
||||
GLboolean ARB_window_pos;
|
||||
GLboolean EXT_abgr;
|
||||
GLboolean EXT_bgra;
|
||||
|
|
@ -2655,11 +2669,13 @@ struct gl_extensions
|
|||
GLboolean EXT_framebuffer_blit;
|
||||
GLboolean EXT_framebuffer_multisample;
|
||||
GLboolean EXT_framebuffer_object;
|
||||
GLboolean EXT_framebuffer_sRGB;
|
||||
GLboolean EXT_gpu_program_parameters;
|
||||
GLboolean EXT_histogram;
|
||||
GLboolean EXT_multi_draw_arrays;
|
||||
GLboolean EXT_paletted_texture;
|
||||
GLboolean EXT_packed_depth_stencil;
|
||||
GLboolean EXT_packed_float;
|
||||
GLboolean EXT_packed_pixels;
|
||||
GLboolean EXT_pixel_buffer_object;
|
||||
GLboolean EXT_point_parameters;
|
||||
|
|
@ -2669,6 +2685,7 @@ 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;
|
||||
|
|
@ -2678,10 +2695,12 @@ struct gl_extensions
|
|||
GLboolean EXT_texture3D;
|
||||
GLboolean EXT_texture_array;
|
||||
GLboolean EXT_texture_compression_s3tc;
|
||||
GLboolean EXT_texture_compression_rgtc;
|
||||
GLboolean EXT_texture_env_add;
|
||||
GLboolean EXT_texture_env_combine;
|
||||
GLboolean EXT_texture_env_dot3;
|
||||
GLboolean EXT_texture_filter_anisotropic;
|
||||
GLboolean EXT_texture_integer;
|
||||
GLboolean EXT_texture_lod_bias;
|
||||
GLboolean EXT_texture_mirror_clamp;
|
||||
GLboolean EXT_texture_sRGB;
|
||||
|
|
@ -2715,6 +2734,7 @@ struct gl_extensions
|
|||
GLboolean NV_fragment_program_option;
|
||||
GLboolean NV_light_max_exponent;
|
||||
GLboolean NV_point_sprite;
|
||||
GLboolean NV_primitive_restart;
|
||||
GLboolean NV_texgen_reflection;
|
||||
GLboolean NV_texture_env_combine4;
|
||||
GLboolean NV_texture_rectangle;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,70 @@ compute_version(GLcontext *ctx)
|
|||
ctx->Extensions.ARB_shading_language_120 &&
|
||||
ctx->Extensions.EXT_pixel_buffer_object &&
|
||||
ctx->Extensions.EXT_texture_sRGB);
|
||||
if (ver_2_1) {
|
||||
const GLboolean ver_3_0 = (ver_2_1 &&
|
||||
ctx->Extensions.ARB_half_float_pixel &&
|
||||
ctx->Extensions.ARB_map_buffer_range &&
|
||||
ctx->Extensions.ARB_texture_float &&
|
||||
ctx->Extensions.APPLE_vertex_array_object &&
|
||||
ctx->Extensions.EXT_draw_buffers2 &&
|
||||
ctx->Extensions.EXT_framebuffer_blit &&
|
||||
ctx->Extensions.EXT_framebuffer_multisample &&
|
||||
ctx->Extensions.EXT_framebuffer_object &&
|
||||
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_transform_feedback &&
|
||||
ctx->Extensions.NV_conditional_render);
|
||||
const GLboolean ver_3_1 = (ver_3_0 &&
|
||||
ctx->Extensions.ARB_copy_buffer &&
|
||||
ctx->Extensions.ARB_draw_instanced &&
|
||||
ctx->Extensions.ARB_texture_buffer_object &&
|
||||
ctx->Extensions.ARB_uniform_buffer_object &&
|
||||
ctx->Extensions.NV_primitive_restart &&
|
||||
ctx->Extensions.NV_texture_rectangle &&
|
||||
ctx->Const.MaxVertexTextureImageUnits >= 16);
|
||||
const GLboolean ver_3_2 = (ver_3_1 &&
|
||||
ctx->Extensions.ARB_depth_clamp &&
|
||||
ctx->Extensions.ARB_draw_elements_base_vertex &&
|
||||
ctx->Extensions.ARB_fragment_coord_conventions &&
|
||||
ctx->Extensions.ARB_geometry_shader4 &&
|
||||
ctx->Extensions.EXT_provoking_vertex &&
|
||||
ctx->Extensions.ARB_seamless_cube_map &&
|
||||
ctx->Extensions.ARB_sync &&
|
||||
ctx->Extensions.ARB_texture_multisample &&
|
||||
ctx->Extensions.EXT_vertex_array_bgra);
|
||||
const GLboolean ver_3_3 = (ver_3_2 &&
|
||||
ctx->Extensions.ARB_blend_func_extended &&
|
||||
ctx->Extensions.ARB_explicit_attrib_location &&
|
||||
ctx->Extensions.ARB_instanced_arrays &&
|
||||
ctx->Extensions.ARB_occlusion_query2 &&
|
||||
ctx->Extensions.ARB_sampler_objects &&
|
||||
ctx->Extensions.ARB_texture_rgb10_a2ui &&
|
||||
ctx->Extensions.ARB_timer_query &&
|
||||
ctx->Extensions.ARB_vertex_type_2_10_10_10_rev &&
|
||||
ctx->Extensions.EXT_texture_swizzle);
|
||||
|
||||
if (ver_3_3) {
|
||||
major = 3;
|
||||
minor = 3;
|
||||
}
|
||||
else if (ver_3_2) {
|
||||
major = 3;
|
||||
minor = 2;
|
||||
}
|
||||
else if (ver_3_1) {
|
||||
major = 3;
|
||||
minor = 1;
|
||||
}
|
||||
else if (ver_3_0) {
|
||||
major = 3;
|
||||
minor = 0;
|
||||
}
|
||||
else if (ver_2_1) {
|
||||
major = 2;
|
||||
minor = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue