[Mesa-dev] [PATCH] mesa: Add EXT_frag_depth bits and enable it on all drivers
Anuj Phogat
anuj.phogat at gmail.com
Fri Feb 10 21:39:45 UTC 2017
On Fri, Feb 10, 2017 at 1:38 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Fri, Feb 10, 2017 at 4:36 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>> On Fri, Feb 10, 2017 at 1:21 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>> On Fri, Feb 10, 2017 at 4:15 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>>>> Passes the newly added piglit test for this extension on i965.
>>>>
>>>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>>>> ---
>>>> A quick look at other drivers didn't show any issues with
>>>> this new extension. Let me know if you think it won't work
>>>> for any driver.
>>>
>>> Out of curiousity, why do you need this?
>>>
>> I'm not aware of any application using it. It's just another ES
>> extension which can be enabled on Mesa with almost zero
>> efforts.
>>>> ---
>>>> docs/features.txt | 3 +++
>>>> src/compiler/glsl/builtin_variables.cpp | 3 +++
>>>> src/compiler/glsl/glsl_parser_extras.cpp | 1 +
>>>> src/compiler/glsl/glsl_parser_extras.h | 2 ++
>>>> src/mesa/main/extensions_table.h | 1 +
>>>> src/mesa/main/mtypes.h | 1 +
>>>> 6 files changed, 11 insertions(+)
>>>>
>>>> diff --git a/docs/features.txt b/docs/features.txt
>>>> index 2f2d41d..aab35ac 100644
>>>> --- a/docs/features.txt
>>>> +++ b/docs/features.txt
>>>> @@ -221,6 +221,9 @@ GL 4.5, GLSL 4.50 -- all DONE: nvc0, radeonsi
>>>> GL_KHR_robustness DONE (i965)
>>>> GL_EXT_shader_integer_mix DONE (all drivers that support GLSL)
>>>>
>>>> +These are the extensions cherry-picked to make GLES 3.0
>>>> + GL_EXT_frag_depth DONE (all drivers that support GLSL ES 1.00)
>>>
>>> Not sure what such a partial list gets you...
>>>
>> Added to document the extension support. I'll drop it in favor of doing it
>> sometime later with rest of gles 3.0 extensions.
>>
>>>> +
>>>> These are the extensions cherry-picked to make GLES 3.1
>>>> GLES3.1, GLSL ES 3.1 -- all DONE: i965/hsw+, nvc0, radeonsi
>>>>
>>>> diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
>>>> index 4eb275e..8f054c7 100644
>>>> --- a/src/compiler/glsl/builtin_variables.cpp
>>>> +++ b/src/compiler/glsl/builtin_variables.cpp
>>>> @@ -1193,6 +1193,9 @@ builtin_variable_generator::generate_fs_special_vars()
>>>> if (state->is_version(110, 300))
>>>> add_output(FRAG_RESULT_DEPTH, float_t, "gl_FragDepth");
>>>>
>>>> + if (state->es_shader && state->language_version == 100 && state->EXT_frag_depth_enable)
>>>> + add_output(FRAG_RESULT_DEPTH, float_t, "gl_FragDepthEXT");
>>>
>>> So wait, if I have a #version 300 es shader, and #extension
>>> GL_EXT_frag_depth: enable, I can't use gl_FragDepthEXT? Where is that
>>> specified?
>>>
>> You're right. I'll modify the condition to use state->language_version >= 100
>
> I think you just want
>
> if (state->EXT_frag_depth_enable)
>
> and nothing else...
>
Yes. I realized it after replying you. Thanks.
>>>> +
>>>> if (state->ARB_shader_stencil_export_enable) {
>>>> ir_variable *const var =
>>>> add_output(FRAG_RESULT_STENCIL, int_t, "gl_FragStencilRefARB");
>>>> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
>>>> index e16d543..50b067d 100644
>>>> --- a/src/compiler/glsl/glsl_parser_extras.cpp
>>>> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
>>>> @@ -677,6 +677,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
>>>> EXT(AMD_vertex_shader_viewport_index),
>>>> EXT(ANDROID_extension_pack_es31a),
>>>> EXT(EXT_blend_func_extended),
>>>> + EXT(EXT_frag_depth),
>>>> EXT(EXT_draw_buffers),
>>>> EXT(EXT_clip_cull_distance),
>>>> EXT(EXT_geometry_point_size),
>>>> diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
>>>> index 424cab5..3f3adec 100644
>>>> --- a/src/compiler/glsl/glsl_parser_extras.h
>>>> +++ b/src/compiler/glsl/glsl_parser_extras.h
>>>> @@ -738,6 +738,8 @@ struct _mesa_glsl_parse_state {
>>>> bool EXT_blend_func_extended_warn;
>>>> bool EXT_clip_cull_distance_enable;
>>>> bool EXT_clip_cull_distance_warn;
>>>> + bool EXT_frag_depth_enable;
>>>> + bool EXT_frag_depth_warn;
>>>> bool EXT_draw_buffers_enable;
>>>> bool EXT_draw_buffers_warn;
>>>> bool EXT_geometry_point_size_enable;
>>>> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
>>>> index 75f432b..7ea56c8 100644
>>>> --- a/src/mesa/main/extensions_table.h
>>>> +++ b/src/mesa/main/extensions_table.h
>>>> @@ -211,6 +211,7 @@ EXT(EXT_draw_elements_base_vertex , ARB_draw_elements_base_vertex
>>>> EXT(EXT_draw_instanced , ARB_draw_instanced , GLL, GLC, x , x , 2006)
>>>> EXT(EXT_draw_range_elements , dummy_true , GLL, x , x , x , 1997)
>>>> EXT(EXT_fog_coord , dummy_true , GLL, x , x , x , 1999)
>>>> +EXT(EXT_frag_depth , dummy_true , x , x , x , ES2, 2010)
>>>> EXT(EXT_framebuffer_blit , dummy_true , GLL, GLC, x , x , 2005)
>>>> EXT(EXT_framebuffer_multisample , EXT_framebuffer_multisample , GLL, GLC, x , x , 2005)
>>>> EXT(EXT_framebuffer_multisample_blit_scaled , EXT_framebuffer_multisample_blit_scaled, GLL, GLC, x , x , 2011)
>>>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>>>> index a845a39..770bf72 100644
>>>> --- a/src/mesa/main/mtypes.h
>>>> +++ b/src/mesa/main/mtypes.h
>>>> @@ -3886,6 +3886,7 @@ struct gl_extensions
>>>> GLboolean EXT_blend_minmax;
>>>> GLboolean EXT_depth_bounds_test;
>>>> GLboolean EXT_draw_buffers2;
>>>> + GLboolean EXT_frag_depth;
>>>
>>> Is this used anywhere?
>>>
>> No, I initially added it to allow drivers to enable the extension.
>> But later switched it on for all. I'll remove it.
>>>> GLboolean EXT_framebuffer_multisample;
>>>> GLboolean EXT_framebuffer_multisample_blit_scaled;
>>>> GLboolean EXT_framebuffer_sRGB;
>>>> --
>>>> 2.9.3
>>>>
>>>> _______________________________________________
>>>> mesa-dev mailing list
>>>> mesa-dev at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list