Mesa (master): i965/vs: Move lazy NIR creation to codegen_vs_prog

Jason Ekstrand jekstrand at kemper.freedesktop.org
Fri Oct 2 21:20:52 UTC 2015


Module: Mesa
Branch: master
Commit: fc3f45234b4ff9545c84fbe8ec5261604d5ab611
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc3f45234b4ff9545c84fbe8ec5261604d5ab611

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Sep 30 16:06:43 2015 -0700

i965/vs: Move lazy NIR creation to codegen_vs_prog

The next commit will add code to codegen_vs_prog that requires the NIR
shader to be there in all cases.  It doesn't hurt anything to just move it
from brw_vs_emit to its only caller.

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

---

 src/mesa/drivers/dri/i965/brw_vec4.cpp |   12 ------------
 src/mesa/drivers/dri/i965/brw_vs.c     |   13 +++++++++++++
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 056ce39..407698f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1953,18 +1953,6 @@ brw_vs_emit(struct brw_context *brw,
    if (unlikely(INTEL_DEBUG & DEBUG_VS))
       brw_dump_ir("vertex", prog, &shader->base, &vp->Base);
 
-   if (!vp->Base.nir) {
-      /* Normally we generate NIR in LinkShader() or
-       * ProgramStringNotify(), but Mesa's fixed-function vertex program
-       * handling doesn't notify the driver at all.  Just do it here, at
-       * the last minute, even though it's lame.
-       */
-      assert(vp->Base.Id == 0 && prog == NULL);
-      vp->Base.nir =
-         brw_create_nir(brw, NULL, &vp->Base, MESA_SHADER_VERTEX,
-                        brw->intelScreen->compiler->scalar_vs);
-   }
-
    if (brw->intelScreen->compiler->scalar_vs) {
       prog_data->base.dispatch_mode = DISPATCH_MODE_SIMD8;
 
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 0a348a5..e1a0d9c 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -37,6 +37,7 @@
 #include "brw_state.h"
 #include "program/prog_print.h"
 #include "program/prog_parameter.h"
+#include "brw_nir.h"
 
 #include "util/ralloc.h"
 
@@ -81,6 +82,18 @@ brw_codegen_vs_prog(struct brw_context *brw,
    bool start_busy = false;
    double start_time = 0;
 
+   if (!vp->program.Base.nir) {
+      /* Normally we generate NIR in LinkShader() or
+       * ProgramStringNotify(), but Mesa's fixed-function vertex program
+       * handling doesn't notify the driver at all.  Just do it here, at
+       * the last minute, even though it's lame.
+       */
+      assert(vp->program.Base.Id == 0 && prog == NULL);
+      vp->program.Base.nir =
+         brw_create_nir(brw, NULL, &vp->program.Base, MESA_SHADER_VERTEX,
+                        brw->intelScreen->compiler->scalar_vs);
+   }
+
    if (prog)
       vs = (struct brw_shader *) prog->_LinkedShaders[MESA_SHADER_VERTEX];
 




More information about the mesa-commit mailing list