Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / mesa / state_tracker / st_nir_builtins.c
index 7574ce306d5116069d49d17343e370530c19472e..1e295264e0bad4e904b0366d4eae1ee2303c05c8 100644 (file)
  */
 
 #include "tgsi/tgsi_from_mesa.h"
-#include "st_glsl_types.h"
 #include "st_nir.h"
 
 #include "compiler/nir/nir_builder.h"
+#include "compiler/glsl/gl_nir.h"
 
 struct pipe_shader_state *
 st_nir_finish_builtin_shader(struct st_context *st,
@@ -33,9 +33,6 @@ st_nir_finish_builtin_shader(struct st_context *st,
 {
    struct pipe_context *pipe = st->pipe;
    struct pipe_screen *screen = pipe->screen;
-   enum pipe_shader_type p_stage = pipe_shader_type_from_mesa(nir->info.stage);
-   bool is_scalar =
-      screen->get_shader_param(screen, p_stage, PIPE_SHADER_CAP_SCALAR_ISA);
 
    nir->info.name = ralloc_strdup(nir, name);
    nir->info.separate_shader = true;
@@ -46,8 +43,9 @@ st_nir_finish_builtin_shader(struct st_context *st,
    NIR_PASS_V(nir, nir_split_var_copies);
    NIR_PASS_V(nir, nir_lower_var_copies);
    NIR_PASS_V(nir, nir_lower_system_values);
+   NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
 
-   if (is_scalar) {
+   if (nir->options->lower_to_scalar) {
       nir_variable_mode mask =
          (nir->info.stage > MESA_SHADER_VERTEX ? nir_var_shader_in : 0) |
          (nir->info.stage < MESA_SHADER_FRAGMENT ? nir_var_shader_out : 0);
@@ -55,17 +53,20 @@ st_nir_finish_builtin_shader(struct st_context *st,
       NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask);
    }
 
-   st_nir_opts(nir, is_scalar);
-
    nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
 
+   st_nir_assign_vs_in_locations(nir);
    st_nir_assign_varying_locations(st, nir);
 
-   if (st->ctx->Const.PackedDriverUniformStorage) {
-      NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
-                 (nir_lower_io_options)0);
-      NIR_PASS_V(nir, st_nir_lower_uniforms_to_ubo);
-   }
+   st_nir_lower_samplers(screen, nir, NULL, NULL);
+   st_nir_lower_uniforms(st, nir);
+   if (!screen->get_param(screen, PIPE_CAP_NIR_IMAGES_AS_DEREF))
+      NIR_PASS_V(nir, gl_nir_lower_images, false);
+
+   if (screen->finalize_nir)
+      screen->finalize_nir(screen, nir, true);
+   else
+      st_nir_opts(nir);
 
    struct pipe_shader_state state = {
       .type = PIPE_SHADER_IR_NIR,