Add NV_fragment_shader_interlock support.
authorKevin Rogovin <kevin.rogovin@gmail.com>
Wed, 15 Aug 2018 11:29:28 +0000 (14:29 +0300)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 20 Aug 2018 20:32:43 +0000 (13:32 -0700)
The main purpose for having NV_fragment_shader_interlock
extension is because that extension is also for GLES31 while
the ARB extension is for GL only.

Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
src/compiler/glsl/builtin_functions.cpp
src/compiler/glsl/glsl_parser.yy
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h
src/mesa/main/extensions_table.h

index 7119903795f47dc8d628e9742040ff75b2bbb08e..e7b78c015877e62d5900549fcb830a3f196de587 100644 (file)
@@ -519,6 +519,12 @@ supports_arb_fragment_shader_interlock(const _mesa_glsl_parse_state *state)
    return state->ARB_fragment_shader_interlock_enable;
 }
 
+static bool
+supports_nv_fragment_shader_interlock(const _mesa_glsl_parse_state *state)
+{
+   return state->NV_fragment_shader_interlock_enable;
+}
+
 static bool
 shader_clock(const _mesa_glsl_parse_state *state)
 {
@@ -3331,6 +3337,18 @@ builtin_builder::create_builtins()
                    supports_arb_fragment_shader_interlock),
                 NULL);
 
+   add_function("beginInvocationInterlockNV",
+                _invocation_interlock(
+                   "__intrinsic_begin_invocation_interlock",
+                   supports_nv_fragment_shader_interlock),
+                NULL);
+
+   add_function("endInvocationInterlockNV",
+                _invocation_interlock(
+                   "__intrinsic_end_invocation_interlock",
+                   supports_nv_fragment_shader_interlock),
+                NULL);
+
    add_function("anyInvocationARB",
                 _vote("__intrinsic_vote_any", vote),
                 NULL);
index cb7376995d269768c2e22fa4bb10e922e1536d9f..bc2571b6844cde301b9d56a911e732a9c67ae8b5 100644 (file)
@@ -1450,10 +1450,12 @@ layout_qualifier_id:
                           "only valid in fragment shader input layout declaration.");
       } else if (pixel_interlock_ordered + pixel_interlock_unordered +
                  sample_interlock_ordered + sample_interlock_unordered > 0 &&
-                 !state->ARB_fragment_shader_interlock_enable) {
+                 !state->ARB_fragment_shader_interlock_enable &&
+                 !state->NV_fragment_shader_interlock_enable) {
          _mesa_glsl_error(& @1, state,
                           "interlock layout qualifier present, but the "
-                          "GL_ARB_fragment_shader_interlock extension is not "
+                          "GL_ARB_fragment_shader_interlock or "
+                          "GL_NV_fragment_shader_interlock extension is not "
                           "enabled.");
       } else {
          $$.flags.q.pixel_interlock_ordered = pixel_interlock_ordered;
index 6d92f24ea2264e69b790ef1c71a1a760bf647ee7..393942b62c3c63a7872026626754e2a0a036a91f 100644 (file)
@@ -724,6 +724,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT_AEP(EXT_texture_cube_map_array),
    EXT(INTEL_conservative_rasterization),
    EXT(MESA_shader_integer_functions),
+   EXT(NV_fragment_shader_interlock),
    EXT(NV_image_formats),
 };
 
index 59a173418b7110b8130e46353cc00db306a8e26a..3b17b54f0a23d4b6b26d5854933fc363d207a87c 100644 (file)
@@ -810,6 +810,8 @@ struct _mesa_glsl_parse_state {
    bool INTEL_conservative_rasterization_warn;
    bool MESA_shader_integer_functions_enable;
    bool MESA_shader_integer_functions_warn;
+   bool NV_fragment_shader_interlock_enable;
+   bool NV_fragment_shader_interlock_warn;
    bool NV_image_formats_enable;
    bool NV_image_formats_warn;
    /*@}*/
index af5ce118da400fb9e8c73363f4f930fcea1d1eba..746e821886edec262570e08f889941b2f751a54a 100644 (file)
@@ -346,6 +346,7 @@ EXT(NV_draw_buffers                         , dummy_true
 EXT(NV_fbo_color_attachments                , dummy_true                             ,  x ,  x ,  x , ES2, 2010)
 EXT(NV_fill_rectangle                       , NV_fill_rectangle                      , GLL, GLC,  x ,  x , 2015)
 EXT(NV_fog_distance                         , NV_fog_distance                        , GLL,  x ,  x ,  x , 2001)
+EXT(NV_fragment_shader_interlock            , ARB_fragment_shader_interlock          , GLL, GLC,  x ,  31, 2015)
 EXT(NV_image_formats                        , ARB_shader_image_load_store            ,  x ,  x ,  x ,  31, 2014)
 EXT(NV_light_max_exponent                   , dummy_true                             , GLL,  x ,  x ,  x , 1999)
 EXT(NV_packed_depth_stencil                 , dummy_true                             , GLL, GLC,  x ,  x , 2000)