mesa/st: always inject a 1.0 pointsize for vertex stages
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 30 Mar 2022 13:24:03 +0000 (09:24 -0400)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 8 Apr 2022 01:56:09 +0000 (21:56 -0400)
since 1.0 is used in nearly every case, drivers requiring this exporting
can avoid potential shader variants by adding a 1.0 export to the base
shader variant and the only using the ubo upload when pointsize is explicitly
set for wide point functionality

drivers can then be responsible for removing unused pointsize exports
as needed (or desired)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>

src/mesa/state_tracker/st_glsl_to_nir.cpp

index 35a9c6b..4555718 100644 (file)
@@ -337,27 +337,10 @@ st_nir_preprocess(struct st_context *st, struct gl_program *prog,
    }
 
    prog->skip_pointsize_xfb = !(nir->info.outputs_written & VARYING_BIT_PSIZ);
-   if (st->lower_point_size && _mesa_is_gles(st->ctx) && prog->skip_pointsize_xfb &&
-       (stage == MESA_SHADER_TESS_EVAL || stage == MESA_SHADER_GEOMETRY) &&
+   if (st->lower_point_size && prog->skip_pointsize_xfb &&
+       stage < MESA_SHADER_FRAGMENT && stage != MESA_SHADER_TESS_CTRL &&
        st_can_add_pointsize_to_program(st, prog)) {
-      struct gl_shader *sh = NULL;
-      for (unsigned i = 0; i < shader_program->NumShaders; i++) {
-         if (shader_program->Shaders[i]->Stage == nir->info.stage) {
-            sh = shader_program->Shaders[i];
-            break;
-         }
-      }
-      assert(sh);
-      bool add_point_size = false;
-      if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
-         if (!sh->OES_tessellation_point_size_enable)
-            add_point_size = true;
-      } else {
-         if (!sh->OES_geometry_point_size_enable)
-            add_point_size = true;
-      }
-      if (add_point_size)
-         NIR_PASS_V(nir, st_nir_add_point_size);
+      NIR_PASS_V(nir, st_nir_add_point_size);
    }
 
    /* ES has strict SSO validation rules for shader IO matching so we can't