[Mesa-dev] [PATCH v2 11/16] i965: Move more code into codegen-branch of the fs_visitor::run() if statement

Kristian Høgsberg krh at bitplanet.net
Thu Nov 13 16:28:17 PST 2014


These last few operations all only apply when we've actually generated code,
optimized and allocated registers.  The dummy and the repclear shaders don't
touch uncompressed_stack, don't need the gen4 send workaround, and don't
spill.  This means we can move these lines into the else-branch, which will
make the following refactoring easier.

Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 00156c7..0ffb4d8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3649,23 +3649,23 @@ fs_visitor::run()
                break;
          }
       }
-   }
-   assert(force_uncompressed_stack == 0);
 
-   /* This must come after all optimization and register allocation, since
-    * it inserts dead code that happens to have side effects, and it does
-    * so based on the actual physical registers in use.
-    */
-   insert_gen4_send_dependency_workarounds();
+      assert(force_uncompressed_stack == 0);
 
-   if (failed)
-      return false;
+      /* This must come after all optimization and register allocation, since
+       * it inserts dead code that happens to have side effects, and it does
+       * so based on the actual physical registers in use.
+       */
+      insert_gen4_send_dependency_workarounds();
+
+      if (failed)
+         return false;
 
-   if (!allocated_without_spills)
-      schedule_instructions(SCHEDULE_POST);
+      if (!allocated_without_spills)
+         schedule_instructions(SCHEDULE_POST);
 
-   if (last_scratch > 0) {
-      prog_data->total_scratch = brw_get_scratch_size(last_scratch);
+      if (last_scratch > 0)
+         prog_data->total_scratch = brw_get_scratch_size(last_scratch);
    }
 
    if (stage == MESA_SHADER_FRAGMENT) {
-- 
2.1.0



More information about the mesa-dev mailing list