nv50/ir: make use of auxCBSlot instead of magic numbers
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 15 Mar 2016 12:06:44 +0000 (13:06 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 19 Mar 2016 17:01:04 +0000 (18:01 +0100)
This avoids using magic numbers for the driver constbuf slot which
is always 15 except for compute shaders on gk104+ where the slot 0
is used.

For gk104+, some special compute-related values like the thread
index are uploaded to screen->parm which is currently bound on c0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp

index d284446f5d90cc9fa86aaf906687f94c84461b5b..4bebfdc0a7b31c3465ba0dc37d2a750aabb6f9ab 100644 (file)
@@ -2178,7 +2178,8 @@ Converter::getResourceBase(const int r)
 
    switch (r) {
    case TGSI_RESOURCE_GLOBAL:
-      sym = new_Symbol(prog, nv50_ir::FILE_MEMORY_GLOBAL, 15);
+      sym = new_Symbol(prog, nv50_ir::FILE_MEMORY_GLOBAL,
+                       info->io.auxCBSlot);
       break;
    case TGSI_RESOURCE_LOCAL:
       assert(prog->getType() == Program::TYPE_COMPUTE);
index 8d3cf5ac2ce449d2c7a4e0a3b7f22dc497399a3f..6f1ebef74fb552cde04cfe413016677fd2e49596 100644 (file)
@@ -1699,7 +1699,8 @@ NVC0LoweringPass::handleRDSV(Instruction *i)
       }
       addr += prog->driver->prop.cp.gridInfoBase;
       bld.mkLoad(TYPE_U32, i->getDef(0),
-                 bld.mkSymbol(FILE_MEMORY_CONST, 0, TYPE_U32, addr), NULL);
+                 bld.mkSymbol(FILE_MEMORY_CONST, prog->driver->io.auxCBSlot,
+                              TYPE_U32, addr), NULL);
       break;
    case SV_SAMPLE_INDEX:
       // TODO: Properly pass source as an address in the PIX address space