glsl: add GL_OES_geometry_point_size and conditionalize gl_PointSize
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 22 Jan 2016 18:07:10 +0000 (13:07 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 26 Jan 2016 17:36:15 +0000 (12:36 -0500)
For now this will be enabled in tandem with GL_OES_geometry_shader.
Should a driver come along that wants to separate them out, another
enable can be added.

Also adds the missed GL_OES_geometry_shader define in glcpp.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
src/compiler/glsl/builtin_variables.cpp
src/compiler/glsl/glcpp/glcpp-parse.y
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h
src/mesa/main/extensions_table.h

index ccc04c00ceae830ce001bdac7e9e1934d16116e1..25d92cc691b759b04b29d511911c4d14dc252d2b 100644 (file)
@@ -1201,7 +1201,12 @@ builtin_variable_generator::generate_varyings()
    /* gl_Position and gl_PointSize are not visible from fragment shaders. */
    if (state->stage != MESA_SHADER_FRAGMENT) {
       add_varying(VARYING_SLOT_POS, vec4_t, "gl_Position");
-      add_varying(VARYING_SLOT_PSIZ, float_t, "gl_PointSize");
+      if (!state->es_shader ||
+          state->stage == MESA_SHADER_VERTEX ||
+          (state->stage == MESA_SHADER_GEOMETRY &&
+           state->OES_geometry_point_size_enable)) {
+         add_varying(VARYING_SLOT_PSIZ, float_t, "gl_PointSize");
+      }
    }
 
    if (state->is_version(130, 0)) {
index ef1a6575aaa359a1a6bc0c3b334dbeb615bd3e4e..43a1aa94aff6b9cfb8c3c57d6ea6b05a3b1c9477 100644 (file)
@@ -2386,6 +2386,13 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
                  add_builtin_define(parser, "GL_OES_texture_storage_multisample_2d_array", 1);
               if (extensions->ARB_blend_func_extended)
                  add_builtin_define(parser, "GL_EXT_blend_func_extended", 1);
+
+              if (version >= 310) {
+                 if (extensions->OES_geometry_shader) {
+                    add_builtin_define(parser, "GL_OES_geometry_point_size", 1);
+                    add_builtin_define(parser, "GL_OES_geometry_shader", 1);
+                 }
+              }
           }
        } else {
           add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
index 603895497d12e645a380fc5822f2d791b2b999a0..7dad46661b36cab2275acee252e7e76ea298acc1 100644 (file)
@@ -598,6 +598,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    /* OES extensions go here, sorted alphabetically.
     */
    EXT(OES_EGL_image_external,         false, true,      OES_EGL_image_external),
+   EXT(OES_geometry_point_size,        false, true,      OES_geometry_shader),
    EXT(OES_geometry_shader,            false, true,      OES_geometry_shader),
    EXT(OES_standard_derivatives,       false, true,      OES_standard_derivatives),
    EXT(OES_texture_3D,                 false, true,      dummy_true),
index 3f88e01d5999f3d93af50281b27cadcaae0c8dbb..a905b5647878e082bd9661da5ed7c812d872767e 100644 (file)
@@ -591,6 +591,8 @@ struct _mesa_glsl_parse_state {
     */
    bool OES_EGL_image_external_enable;
    bool OES_EGL_image_external_warn;
+   bool OES_geometry_point_size_enable;
+   bool OES_geometry_point_size_warn;
    bool OES_geometry_shader_enable;
    bool OES_geometry_shader_warn;
    bool OES_standard_derivatives_enable;
index 11f4482f8d25a755bf96073da763e82732fd2cb3..ad5dc6099934ea4ef8f55da4ad27bfac0a2f76bd 100644 (file)
@@ -311,6 +311,7 @@ EXT(OES_element_index_uint                  , dummy_true
 EXT(OES_fbo_render_mipmap                   , dummy_true                             ,  x ,  x , ES1, ES2, 2005)
 EXT(OES_fixed_point                         , dummy_true                             ,  x ,  x , ES1,  x , 2002)
 EXT(OES_framebuffer_object                  , dummy_true                             ,  x ,  x , ES1,  x , 2005)
+EXT(OES_geometry_point_size                 , OES_geometry_shader                    ,  x ,  x ,  x ,  31, 2015)
 EXT(OES_geometry_shader                     , OES_geometry_shader                    ,  x ,  x ,  x ,  31, 2015)
 EXT(OES_get_program_binary                  , dummy_true                             ,  x ,  x ,  x , ES2, 2008)
 EXT(OES_mapbuffer                           , dummy_true                             ,  x ,  x , ES1, ES2, 2005)