iris: dummy constants
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Jan 2018 05:39:44 +0000 (21:39 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:05 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_state.c

index fc1b4c572dba3e5a5c74f381e4ab880b73031301..0c67535df82bf127878d96c0a420bd8081a0f744 100644 (file)
@@ -74,6 +74,11 @@ struct iris_batch;
 #define IRIS_DIRTY_FS                       (1ull << 32)
 #define IRIS_DIRTY_CS                       (1ull << 33)
 #define IRIS_DIRTY_URB                      (1ull << 34)
+#define IRIS_DIRTY_CONSTANTS_VS             (1ull << 35)
+#define IRIS_DIRTY_CONSTANTS_TCS            (1ull << 36)
+#define IRIS_DIRTY_CONSTANTS_TES            (1ull << 37)
+#define IRIS_DIRTY_CONSTANTS_GS             (1ull << 38)
+#define IRIS_DIRTY_CONSTANTS_FS             (1ull << 39)
 
 struct iris_depth_stencil_alpha_state;
 
index 289bc1c47118a980db0ae834829b583d2139fded..2e0dfd0ace9c15ce684f189ce4fa1d42b899609c 100644 (file)
@@ -1733,6 +1733,15 @@ iris_upload_urb_config(struct iris_context *ice, struct iris_batch *batch)
    }
 }
 
+static const uint32_t push_constant_opcodes[] = {
+   [MESA_SHADER_VERTEX]    = 21,
+   [MESA_SHADER_TESS_CTRL] = 25, /* HS */
+   [MESA_SHADER_TESS_EVAL] = 26, /* DS */
+   [MESA_SHADER_GEOMETRY]  = 22,
+   [MESA_SHADER_FRAGMENT]  = 23,
+   [MESA_SHADER_COMPUTE]   = 0,
+};
+
 static void
 iris_upload_render_state(struct iris_context *ice,
                          struct iris_batch *batch,
@@ -1793,7 +1802,18 @@ iris_upload_render_state(struct iris_context *ice,
       }
    }
 
-   // XXX: 3DSTATE_CONSTANT_XS
+   for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
+      if (!(dirty & (IRIS_DIRTY_CONSTANTS_VS << stage)))
+         continue;
+
+      iris_emit_cmd(batch, GENX(3DSTATE_CONSTANT_VS), pkt) {
+         pkt._3DCommandSubOpcode = push_constant_opcodes[stage];
+         if (ice->shaders.prog[stage]) {
+            // XXX: 3DSTATE_CONSTANT_XS
+         }
+      }
+   }
+
    // Surfaces:
    // - pull constants
    // - ubos/ssbos/abos