Module: Mesa
Branch: main
Commit: 762d3772923a542c8ef03e0bc5a65708171769eb
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=762d3772923a542c8ef03e0bc5a65708171769eb

Author: Gert Wollny <[email protected]>
Date:   Wed Sep  7 12:44:27 2022 +0200

mesa/glsl: Add support for NV_shader_noperspective_interpolation

With EXT_gpu_shader4 the support is already in place, we just
have to allow it in glsl and expose the extension name.

v2: Check whether the extension is enabled in the shader (Adam Jackson)
v3: Don't check GLES version in lexer (mareko)

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Adam Jackson <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18460>

---

 src/compiler/glsl/glsl_lexer.ll          | 2 +-
 src/compiler/glsl/glsl_parser_extras.cpp | 1 +
 src/compiler/glsl/glsl_parser_extras.h   | 2 ++
 src/mesa/main/extensions_table.h         | 1 +
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index 3a54660523c..ad109b3d112 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -448,7 +448,7 @@ centroid    KEYWORD_WITH_ALT(120, 300, 120, 300, 
yyextra->EXT_gpu_shader4_enable, C
 invariant      KEYWORD(120, 100, 120, 100, INVARIANT);
 flat           KEYWORD_WITH_ALT(130, 100, 130, 300, 
yyextra->EXT_gpu_shader4_enable, FLAT);
 smooth         KEYWORD(130, 300, 130, 300, SMOOTH);
-noperspective  KEYWORD_WITH_ALT(130, 300, 130, 0, 
yyextra->EXT_gpu_shader4_enable, NOPERSPECTIVE);
+noperspective  KEYWORD_WITH_ALT(130, 300, 130, 0, 
yyextra->EXT_gpu_shader4_enable || 
yyextra->NV_shader_noperspective_interpolation_enable, NOPERSPECTIVE);
 patch          KEYWORD_WITH_ALT(0, 300, 400, 320, 
yyextra->has_tessellation_shader(), PATCH);
 
 sampler1D      DEPRECATED_ES_TYPE(glsl_type::sampler1D_type);
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
b/src/compiler/glsl/glsl_parser_extras.cpp
index 57a397e4cc7..f6359dcd6bd 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -782,6 +782,7 @@ static const _mesa_glsl_extension 
_mesa_glsl_supported_extensions[] = {
    EXT(NV_image_formats),
    EXT(NV_shader_atomic_float),
    EXT(NV_shader_atomic_int64),
+   EXT(NV_shader_noperspective_interpolation),
    EXT(NV_viewport_array2),
 };
 
diff --git a/src/compiler/glsl/glsl_parser_extras.h 
b/src/compiler/glsl/glsl_parser_extras.h
index 45ed7ad87bd..a8fb7a5572c 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -908,6 +908,8 @@ struct _mesa_glsl_parse_state {
    bool NV_shader_atomic_float_warn;
    bool NV_shader_atomic_int64_enable;
    bool NV_shader_atomic_int64_warn;
+   bool NV_shader_noperspective_interpolation_enable;
+   bool NV_shader_noperspective_interpolation_warn;
    bool NV_viewport_array2_enable;
    bool NV_viewport_array2_warn;
    /*@}*/
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 68ac0917678..cd501439473 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -417,6 +417,7 @@ EXT(NV_read_stencil                         , dummy_true
 EXT(NV_sample_locations                     , ARB_sample_locations             
      , GLL, GLC,  x , ES2, 2015)
 EXT(NV_shader_atomic_float                  , NV_shader_atomic_float           
      , GLL, GLC,  x ,  x , 2012)
 EXT(NV_shader_atomic_int64                  , NV_shader_atomic_int64           
      , GLL, GLC,  x ,  x , 2014)
+EXT(NV_shader_noperspective_interpolation   , EXT_gpu_shader4                  
      ,  x ,  x ,  x ,  30, 2014)
 EXT(NV_texgen_reflection                    , dummy_true                       
      , GLL,  x ,  x ,  x , 1999)
 EXT(NV_texture_barrier                      , NV_texture_barrier               
      , GLL, GLC,  x ,  x , 2009)
 EXT(NV_texture_env_combine4                 , NV_texture_env_combine4          
      , GLL,  x ,  x ,  x , 1999)

Reply via email to