gallium/ureg: Set the next shader stage from the shader info.
authorEric Anholt <eric@anholt.net>
Wed, 8 Jan 2020 20:59:16 +0000 (12:59 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 2 Sep 2020 16:58:44 +0000 (09:58 -0700)
Saves a loop over the linked shaders in glsl_to_tgsi which the GLSL linker
has already done for us.

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

src/gallium/auxiliary/tgsi/tgsi_ureg.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index d05dd248ce469c777c01e829ada22c7d1521bbf1..4a6b89a9af5486edaabd4355670c42d472eb309c 100644 (file)
@@ -31,6 +31,7 @@
 #include "pipe/p_state.h"
 #include "tgsi/tgsi_ureg.h"
 #include "tgsi/tgsi_build.h"
+#include "tgsi/tgsi_from_mesa.h"
 #include "tgsi/tgsi_info.h"
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_sanity.h"
@@ -2373,6 +2374,7 @@ ureg_setup_shader_info(struct ureg_program *ureg,
    switch (info->stage) {
    case MESA_SHADER_VERTEX:
       ureg_setup_clipdist_info(ureg, info);
+      ureg_set_next_shader_processor(ureg, pipe_shader_type_from_mesa(info->next_stage));
       break;
    case MESA_SHADER_TESS_CTRL:
       ureg_setup_tess_ctrl_shader(ureg, info);
index 3a72377f540abad5c895f4bb8a8c8ff18b03634b..3dc685e71f7ff617a190b5875223c39e52975280 100644 (file)
@@ -6986,25 +6986,6 @@ st_translate_program(
    foreach_in_list(glsl_to_tgsi_instruction, inst, &program->instructions)
       compile_tgsi_instruction(t, inst);
 
-   /* Set the next shader stage hint for VS and TES. */
-   switch (procType) {
-   case PIPE_SHADER_VERTEX:
-   case PIPE_SHADER_TESS_EVAL:
-      if (program->shader_program->SeparateShader)
-         break;
-
-      for (i = program->shader->Stage+1; i <= MESA_SHADER_FRAGMENT; i++) {
-         if (program->shader_program->_LinkedShaders[i]) {
-            ureg_set_next_shader_processor(
-                  ureg, pipe_shader_type_from_mesa((gl_shader_stage)i));
-            break;
-         }
-      }
-      break;
-   default:
-      ; /* nothing - silence compiler warning */
-   }
-
 out:
    if (t) {
       free(t->arrays);