From bb3c0be7a8c390e9dc14d458c0ca63d44c769870 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 25 Jan 2018 21:39:44 -0800 Subject: [PATCH] iris: dummy constants --- src/gallium/drivers/iris/iris_context.h | 5 +++++ src/gallium/drivers/iris/iris_state.c | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index fc1b4c572db..0c67535df82 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -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; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 289bc1c4711..2e0dfd0ace9 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -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 -- 2.30.2