Currently, the GPU pipeline has one active VUE map in effect at any
given time--the one representing the layout of vertex data coming from
the vertex shader. However, when geometry shaders are added, they
will have their own independent VUE map. Later pipeline stages (clip,
sf, fs) will need to consult the geometry shader VUE map if a geometry
shader is in use, and the vertex shader VUE map otherwise.
This patch adds a new field to brw_context, vue_map_geom_out, which
contains the VUE map that should be used by later pipeline stages. It
also adds a new state flag, BRW_NEW_VUE_MAP_GEOM_OUT, which is
signalled whenever the contents of the VUE map changes.
Since we don't support geometry shaders yet, vue_map_geom_out is
currently set only by the brw_vs_prog state atom.
v2: Don't set vue_map_geom_out in do_vs_prog--that's redundant and
possibly problematic for precompiles. Only set it in
brw_upload_vs_prog. Also, make a copy instead of using a
pointer--this makes it possible to detect when the VUE map hasn't
changed, so we can avoid redundant state uploads.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
BRW_STATE_PROGRAM_CACHE,
BRW_STATE_STATE_BASE_ADDRESS,
BRW_STATE_SOL_INDICES,
+ BRW_STATE_VUE_MAP_GEOM_OUT,
};
#define BRW_NEW_URB_FENCE (1 << BRW_STATE_URB_FENCE)
#define BRW_NEW_PROGRAM_CACHE (1 << BRW_STATE_PROGRAM_CACHE)
#define BRW_NEW_STATE_BASE_ADDRESS (1 << BRW_STATE_STATE_BASE_ADDRESS)
#define BRW_NEW_SOL_INDICES (1 << BRW_STATE_SOL_INDICES)
+#define BRW_NEW_VUE_MAP_GEOM_OUT (1 << BRW_STATE_VUE_MAP_GEOM_OUT)
struct brw_state_flags {
/** State update flags signalled by mesa internals */
uint32_t offset;
} sampler;
+ /**
+ * Layout of vertex data exiting the geometry portion of the pipleine.
+ * This comes from the geometry shader if one exists, otherwise from the
+ * vertex shader.
+ *
+ * BRW_NEW_VUE_MAP_GEOM_OUT is flagged when the VUE map changes.
+ */
+ struct brw_vue_map vue_map_geom_out;
+
struct {
struct brw_vs_prog_data *prog_data;
DEFINE_BIT(BRW_NEW_PROGRAM_CACHE),
DEFINE_BIT(BRW_NEW_STATE_BASE_ADDRESS),
DEFINE_BIT(BRW_NEW_SOL_INDICES),
+ DEFINE_BIT(BRW_NEW_VUE_MAP_GEOM_OUT),
{0, 0, 0}
};
assert(success);
}
+ if (memcmp(&brw->vs.prog_data->vue_map, &brw->vue_map_geom_out,
+ sizeof(brw->vue_map_geom_out)) != 0) {
+ brw->vue_map_geom_out = brw->vs.prog_data->vue_map;
+ brw->state.dirty.brw |= BRW_NEW_VUE_MAP_GEOM_OUT;
+ }
}
/* See brw_vs.c: