<div dir="auto">The check is against what the driver max is, not what the application requested.<div dir="auto"><br></div><div dir="auto">Using overrides messes up this logic, it seems.</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 18, 2018, 06:14 Benedikt Schemmer <<a href="mailto:ben@besd.de">ben@besd.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes its backwards and it seems it doesn't work anymore ;)<br>
Seems the loophole I was using got removed.<br>
<br>
Problem remains that applications that could use an legacy extension<br>
are not aware of it and will simply/usually not request it:<br>
<br>
MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=150 glxinfo | grep shader5<br>
-nothing-<br>
<br>
MESA_GL_VERSION_OVERRIDE=3.2 MESA_GLSL_VERSION_OVERRIDE=400 glxinfo | grep shader5<br>
GL_ARB_gpu_shader5, GL_ARB_gpu_shader_fp64, GL_ARB_gpu_shader_int64,<br>
GL_ARB_gpu_shader5, GL_ARB_half_float_pixel, GL_ARB_half_float_vertex,<br>
GL_EXT_gpu_shader5, GL_EXT_map_buffer_range, GL_EXT_memory_object,<br>
GL_OES_get_program_binary, GL_OES_gpu_shader5, GL_OES_mapbuffer,<br>
<br>
<br>
If an application knows about GLSL 400 it doesn't need GL_ARB_gpu_shader5 anymore.<br>
<br>
<br>
<br>
Am 18.05.2018 um 11:25 schrieb Timothy Arceri:<br>
> Hi Benedikt,<br>
> <br>
> I think you have this backwards. compute_version() computes the version of OpenGL supported by the driver by checking what extensions it advertises. See version 2 of my patch to see where the<br>
> extensions are enabled. I don't think this is something that can be automated, it really depends on the driver, just because an extension can be advertised at a certain level doesn't mean you must (or<br>
> can) do it.<br>
> <br>
> Tim<br>
> <br>
> On 18/05/18 19:13, Benedikt Schemmer wrote:<br>
>> Hi Timothy,<br>
>><br>
>> I was looking into something similar myself.<br>
>> Great to see someone working on getting legacy extensions available<br>
>> to the applications that can actually use them!<br>
>><br>
>> Another thing I noticed is that extensions aren't advertised at the<br>
>> correct feature level.<br>
>> The code below works and does a better job at it, but its probably also<br>
>> the wrong way to go about it.<br>
>><br>
>> Cheers,<br>
>> Benedikt<br>
>><br>
>> P.S. I grepped and sed together a file which describes the requirements<br>
>> for every extension better, unfortunately the files on khronos<br>
>> arent exactly machine readable<br>
>> will send in next reply<br>
>><br>
>> ---<br>
>><br>
>> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c<br>
>> --- a/src/mesa/main/version.c<br>
>> +++ b/src/mesa/main/version.c<br>
>> @@ -233,8 +233,15 @@ _mesa_override_glsl_version(struct gl_constants *consts)<br>
>> }<br>
>><br>
>> /**<br>
>> - * Examine enabled GL extensions to determine GL version.<br>
>> + * Enable GL Extensions according to the minimum version requirements as per spec.<br>
>> + * Careful: some extensions are implemented for the express purpose of being<br>
>> + * used in a lower version context (legacy extensions).<br>
>> + * Example:<br>
>> + * ARB_gpu_shader5: first implementation in OpenGL 4.0 (GLSL 400) but<br>
>> + * supposed to be advertised from OpenGL 3.2 (GLSL 150) upwards,<br>
>> + * however early Nvidia FXAA could use it from GLSL 120 so advertise it there<br>
>> */<br>
>> +<br>
>> static GLuint<br>
>> compute_version(const struct gl_extensions *extensions,<br>
>> const struct gl_constants *consts, gl_api api)<br>
>> @@ -242,25 +249,43 @@ compute_version(const struct gl_extensions *extensions,<br>
>> GLuint major, minor, version;<br>
>><br>
>> const bool ver_1_3 = (extensions->ARB_texture_border_clamp &&<br>
>> + extensions->ARB_instanced_arrays &&<br>
>> + extensions->ARB_shadow &&<br>
>> + extensions->ARB_vertex_shader &&<br>
>> + extensions->ARB_fragment_shader &&<br>
>> + extensions->ARB_depth_texture &&<br>
>> + extensions->ARB_occlusion_query2 &&<br>
>> extensions->ARB_texture_cube_map &&<br>
>> + extensions->ARB_seamless_cube_map &&<br>
>> extensions->ARB_texture_env_combine &&<br>
>> + extensions->ARB_texture_rg &&<br>
>> + extensions->ARB_texture_compression_rgtc &&<br>
>> + extensions->ARB_texture_compression_bptc &&<br>
>> + extensions->ARB_texture_float &&<br>
>> + extensions->ARB_framebuffer_object &&<br>
>> + extensions->ARB_framebuffer_no_attachments &&<br>
>> extensions->ARB_texture_env_dot3);<br>
>> const bool ver_1_4 = (ver_1_3 &&<br>
>> - extensions->ARB_depth_texture &&<br>
>> - extensions->ARB_shadow &&<br>
>> + extensions->ARB_stencil_texturing &&<br>
>> extensions->ARB_texture_env_crossbar &&<br>
>> + extensions->ARB_texture_mirror_clamp_to_edge &&<br>
>> extensions->EXT_blend_color &&<br>
>> extensions->EXT_blend_func_separate &&<br>
>> extensions->EXT_blend_minmax &&<br>
>> extensions->EXT_point_parameters);<br>
>> const bool ver_1_5 = (ver_1_4 &&<br>
>> + extensions->ARB_query_buffer_object &&<br>
>> extensions->ARB_occlusion_query);<br>
>> const bool ver_2_0 = (ver_1_5 &&<br>
>> extensions->ARB_point_sprite &&<br>
>> - extensions->ARB_vertex_shader &&<br>
>> - extensions->ARB_fragment_shader &&<br>
>> + extensions->ARB_blend_func_extended &&<br>
>> extensions->ARB_texture_non_power_of_two &&<br>
>> extensions->EXT_blend_equation_separate &&<br>
>> + extensions->ARB_shader_texture_lod &&<br>
>> + extensions->ARB_transform_feedback2 &&<br>
>> + extensions->ARB_uniform_buffer_object &&<br>
>> + extensions->ARB_texture_buffer_object &&<br>
>> + extensions->ARB_texture_buffer_range &&<br>
>><br>
>> /* Technically, 2.0 requires the functionality of the<br>
>> * EXT version. Enable 2.0 if either extension is<br>
>> @@ -272,33 +297,44 @@ compute_version(const struct gl_extensions *extensions,<br>
>> || extensions->ATI_separate_stencil));<br>
>> const bool ver_2_1 = (ver_2_0 &&<br>
>> extensions->EXT_pixel_buffer_object &&<br>
>> + extensions->ARB_map_buffer_range &&<br>
>> + extensions->ARB_draw_instanced &&<br>
>> + extensions->ARB_shader_bit_encoding &&<br>
>> + extensions->ARB_gpu_shader5 &&<br>
>> extensions->EXT_texture_sRGB);<br>
>> const bool ver_3_0 = (ver_2_1 &&<br>
>> consts->GLSLVersion >= 130 &&<br>
>> (consts->MaxSamples >= 4 || consts->FakeSWMSAA) &&<br>
>> (api == API_OPENGL_CORE ||<br>
>> extensions->ARB_color_buffer_float) &&<br>
>> + extensions->ARB_conservative_depth &&<br>
>> extensions->ARB_depth_buffer_float &&<br>
>> extensions->ARB_half_float_vertex &&<br>
>> - extensions->ARB_map_buffer_range &&<br>
>> - extensions->ARB_shader_texture_lod &&<br>
>> - extensions->ARB_texture_float &&<br>
>> - extensions->ARB_texture_rg &&<br>
>> - extensions->ARB_texture_compression_rgtc &&<br>
>> + extensions->ARB_pipeline_statistics_query &&<br>
>> + extensions->ARB_shader_image_load_store &&<br>
>> + extensions->ARB_texture_rgb10_a2ui &&<br>
>> + extensions->ARB_vertex_type_10f_11f_11f_rev &&<br>
>> extensions->EXT_draw_buffers2 &&<br>
>> - extensions->ARB_framebuffer_object &&<br>
>> + extensions->ARB_transform_feedback_instanced &&<br>
>> + extensions->ARB_internalformat_query &&<br>
>> + extensions->ARB_internalformat_query2 &&<br>
>> extensions->EXT_framebuffer_sRGB &&<br>
>> extensions->EXT_packed_float &&<br>
>> + extensions->ARB_sample_shading &&<br>
>> + extensions->ARB_shader_atomic_counters &&<br>
>> extensions->EXT_texture_array &&<br>
>> + extensions->ARB_texture_query_lod &&<br>
>> extensions->EXT_texture_shared_exponent &&<br>
>> extensions->EXT_transform_feedback &&<br>
>> - extensions->NV_conditional_render);<br>
>> + extensions->NV_conditional_render &&<br>
>> + extensions->ARB_texture_cube_map_array &&<br>
>> + extensions->ARB_transform_feedback_overflow_query);<br>
>> const bool ver_3_1 = (ver_3_0 &&<br>
>> consts->GLSLVersion >= 140 &&<br>
>> - extensions->ARB_draw_instanced &&<br>
>> - extensions->ARB_texture_buffer_object &&<br>
>> - extensions->ARB_uniform_buffer_object &&<br>
>> extensions->EXT_texture_snorm &&<br>
>> + extensions->ARB_shading_language_420pack &&<br>
>> + extensions->ARB_sync &&<br>
>> + extensions->ARB_draw_indirect &&<br>
>> extensions->NV_primitive_restart &&<br>
>> extensions->NV_texture_rectangle &&<br>
>> consts->Program[MESA_SHADER_VERTEX].MaxTextureImageUnits >= 16);<br>
>> @@ -308,18 +344,17 @@ compute_version(const struct gl_extensions *extensions,<br>
>> extensions->ARB_draw_elements_base_vertex &&<br>
>> extensions->ARB_fragment_coord_conventions &&<br>
>> extensions->EXT_provoking_vertex &&<br>
>> - extensions->ARB_seamless_cube_map &&<br>
>> - extensions->ARB_sync &&<br>
>> + extensions->ARB_gpu_shader_fp64 &&<br>
>> + extensions->ARB_vertex_attrib_64bit &&<br>
>> extensions->ARB_texture_multisample &&<br>
>> - extensions->EXT_vertex_array_bgra);<br>
>> + extensions->ARB_tessellation_shader &&<br>
>> + extensions->EXT_vertex_array_bgra &&<br>
>> + extensions->ARB_fragment_layer_viewport &&<br>
>> + extensions->ARB_viewport_array);<br>
>> const bool ver_3_3 = (ver_3_2 &&<br>
>> consts->GLSLVersion >= 330 &&<br>
>> - extensions->ARB_blend_func_extended &&<br>
>> extensions->ARB_explicit_attrib_location &&<br>
>> - extensions->ARB_instanced_arrays &&<br>
>> - extensions->ARB_occlusion_query2 &&<br>
>> - extensions->ARB_shader_bit_encoding &&<br>
>> - extensions->ARB_texture_rgb10_a2ui &&<br>
>> + extensions->ARB_explicit_uniform_location &&<br>
>> extensions->ARB_timer_query &&<br>
>> extensions->ARB_vertex_type_2_10_10_10_rev &&<br>
>> extensions->EXT_texture_swizzle);<br>
>> @@ -328,67 +363,42 @@ compute_version(const struct gl_extensions *extensions,<br>
>> const bool ver_4_0 = (ver_3_3 &&<br>
>> consts->GLSLVersion >= 400 &&<br>
>> extensions->ARB_draw_buffers_blend &&<br>
>> - extensions->ARB_draw_indirect &&<br>
>> - extensions->ARB_gpu_shader5 &&<br>
>> - extensions->ARB_gpu_shader_fp64 &&<br>
>> - extensions->ARB_sample_shading &&<br>
>> - extensions->ARB_tessellation_shader &&<br>
>> + extensions->ARB_derivative_control &&<br>
>> extensions->ARB_texture_buffer_object_rgb32 &&<br>
>> - extensions->ARB_texture_cube_map_array &&<br>
>> - extensions->ARB_texture_query_lod &&<br>
>> - extensions->ARB_transform_feedback2 &&<br>
>> extensions->ARB_transform_feedback3);<br>
>> const bool ver_4_1 = (ver_4_0 &&<br>
>> consts->GLSLVersion >= 410 &&<br>
>> extensions->ARB_ES2_compatibility &&<br>
>> - extensions->ARB_shader_precision &&<br>
>> - extensions->ARB_vertex_attrib_64bit &&<br>
>> - extensions->ARB_viewport_array);<br>
>> + extensions->ARB_shading_language_packing &&<br>
>> + extensions->ARB_shader_precision);<br>
>> const bool ver_4_2 = (ver_4_1 &&<br>
>> consts->GLSLVersion >= 420 &&<br>
>> extensions->ARB_base_instance &&<br>
>> - extensions->ARB_conservative_depth &&<br>
>> - extensions->ARB_internalformat_query &&<br>
>> - extensions->ARB_shader_atomic_counters &&<br>
>> - extensions->ARB_shader_image_load_store &&<br>
>> - extensions->ARB_shading_language_420pack &&<br>
>> - extensions->ARB_shading_language_packing &&<br>
>> - extensions->ARB_texture_compression_bptc &&<br>
>> - extensions->ARB_transform_feedback_instanced);<br>
>> + extensions->ARB_compute_shader &&<br>
>> + extensions->ARB_shader_atomic_counter_ops);<br>
>> const bool ver_4_3 = (ver_4_2 &&<br>
>> consts->GLSLVersion >= 430 &&<br>
>> consts->Program[MESA_SHADER_VERTEX].MaxUniformBlocks >= 14 &&<br>
>> extensions->ARB_ES3_compatibility &&<br>
>> extensions->ARB_arrays_of_arrays &&<br>
>> - extensions->ARB_compute_shader &&<br>
>> + extensions->ARB_buffer_storage &&<br>
>> extensions->ARB_copy_image &&<br>
>> - extensions->ARB_explicit_uniform_location &&<br>
>> - extensions->ARB_fragment_layer_viewport &&<br>
>> - extensions->ARB_framebuffer_no_attachments &&<br>
>> - extensions->ARB_internalformat_query2 &&<br>
>> extensions->ARB_robust_buffer_access_behavior &&<br>
>> extensions->ARB_shader_image_size &&<br>
>> extensions->ARB_shader_storage_buffer_object &&<br>
>> - extensions->ARB_stencil_texturing &&<br>
>> - extensions->ARB_texture_buffer_range &&<br>
>> extensions->ARB_texture_query_levels &&<br>
>> extensions->ARB_texture_view);<br>
>> const bool ver_4_4 = (ver_4_3 &&<br>
>> consts->GLSLVersion >= 440 &&<br>
>> - extensions->ARB_buffer_storage &&<br>
>> extensions->ARB_clear_texture &&<br>
>> extensions->ARB_enhanced_layouts &&<br>
>> - extensions->ARB_query_buffer_object &&<br>
>> - extensions->ARB_texture_mirror_clamp_to_edge &&<br>
>> - extensions->ARB_texture_stencil8 &&<br>
>> - extensions->ARB_vertex_type_10f_11f_11f_rev);<br>
>> + extensions->ARB_texture_stencil8);<br>
>> const bool ver_4_5 = (ver_4_4 &&<br>
>> consts->GLSLVersion >= 450 &&<br>
>> extensions->ARB_ES3_1_compatibility &&<br>
>> extensions->ARB_clip_control &&<br>
>> extensions->ARB_conditional_render_inverted &&<br>
>> extensions->ARB_cull_distance &&<br>
>> - extensions->ARB_derivative_control &&<br>
>> extensions->ARB_shader_texture_image_samples &&<br>
>> extensions->NV_texture_barrier);<br>
>> const bool ver_4_6 = (ver_4_5 &&<br>
>> @@ -396,13 +406,10 @@ compute_version(const struct gl_extensions *extensions,<br>
>> /* extensions->ARB_gl_spirv */ 0 &&<br>
>> /* extensions->ARB_spirv_extensions */ 0 &&<br>
>> extensions->ARB_indirect_parameters &&<br>
>> - extensions->ARB_pipeline_statistics_query &&<br>
>> extensions->ARB_polygon_offset_clamp &&<br>
>> - extensions->ARB_shader_atomic_counter_ops &&<br>
>> extensions->ARB_shader_draw_parameters &&<br>
>> extensions->ARB_shader_group_vote &&<br>
>> - extensions->ARB_texture_filter_anisotropic &&<br>
>> - extensions->ARB_transform_feedback_overflow_query);<br>
>> + extensions->ARB_texture_filter_anisotropic);<br>
>><br>
>> if (ver_4_6) {<br>
>> major = 4;<br>
>><br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>