nouveau: codegen: Add support for clover / OpenCL kernel input parameters
authorHans de Goede <hdegoede@redhat.com>
Thu, 10 Mar 2016 15:02:06 +0000 (16:02 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 21 Mar 2016 11:20:28 +0000 (12:20 +0100)
Add support for clover / OpenCL kernel input parameters.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp

index 5d744aff33841cefdef15ed7da7f05022a3c5fc8..2a1047fcfee313f4712985ee82dbbe99188f25fb 100644 (file)
@@ -1527,9 +1527,21 @@ Converter::makeSym(uint tgsiFile, int fileIdx, int idx, int c, uint32_t address)
 
    sym->reg.fileIndex = fileIdx;
 
-   if (tgsiFile == TGSI_FILE_MEMORY &&
-       code->memoryFiles[fileIdx].mem_type == TGSI_MEMORY_TYPE_SHARED)
-      sym->setFile(FILE_MEMORY_SHARED);
+   if (tgsiFile == TGSI_FILE_MEMORY) {
+      switch (code->memoryFiles[fileIdx].mem_type) {
+      case TGSI_MEMORY_TYPE_SHARED:
+         sym->setFile(FILE_MEMORY_SHARED);
+         break;
+      case TGSI_MEMORY_TYPE_INPUT:
+         assert(prog->getType() == Program::TYPE_COMPUTE);
+         assert(idx == -1);
+         sym->setFile(FILE_SHADER_INPUT);
+         address += info->prop.cp.inputOffset;
+         break;
+      default:
+         assert(0); /* TODO: Add support for global and private memory */
+      }
+   }
 
    if (idx >= 0) {
       if (sym->reg.file == FILE_SHADER_INPUT)