summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_context.h
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2011-08-31 15:04:23 -0700
committerPaul Berry <stereotype441@gmail.com>2011-09-06 11:03:49 -0700
commit45f1d7a66666d849031ffc2b8647149e17cc13bc (patch)
tree860631edab8c820adc87745517d02ba7a3a4a9c3 /src/mesa/drivers/dri/i965/brw_context.h
parent6489a1d5bab75589569658d374257bf23cb67a23 (diff)
downloadexternal_mesa3d-45f1d7a66666d849031ffc2b8647149e17cc13bc.zip
external_mesa3d-45f1d7a66666d849031ffc2b8647149e17cc13bc.tar.gz
external_mesa3d-45f1d7a66666d849031ffc2b8647149e17cc13bc.tar.bz2
i965: Write code to compute a VUE map.
Several places in the i965 code make implicit assumptions about the structure of data in the VUE (vertex URB entry). This patch adds a function, brw_compute_vue_map(), which computes the structure of the VUE explicitly. Future patches will modify the rest of the driver to use the explicitly computed map rather than rely on implicit assumptions about it. Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_context.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 69821d9..bf15fd6 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -281,6 +281,59 @@ struct brw_wm_prog_data {
enum param_conversion pull_param_convert[MAX_UNIFORMS * 4];
};
+/**
+ * Enum representing the i965-specific vertex results that don't correspond
+ * exactly to any element of gl_vert_result. The values of this enum are
+ * assigned such that they don't conflict with gl_vert_result.
+ */
+typedef enum
+{
+ BRW_VERT_RESULT_NDC = VERT_RESULT_MAX,
+ BRW_VERT_RESULT_HPOS_DUPLICATE,
+ BRW_VERT_RESULT_CLIP0,
+ BRW_VERT_RESULT_CLIP1,
+ BRW_VERT_RESULT_PAD,
+ BRW_VERT_RESULT_MAX
+} brw_vert_result;
+
+
+/**
+ * Data structure recording the relationship between the gl_vert_result enum
+ * and "slots" within the vertex URB entry (VUE). A "slot" is defined as a
+ * single octaword within the VUE (128 bits).
+ *
+ * Note that each BRW register contains 256 bits (2 octawords), so when
+ * accessing the VUE in URB_NOSWIZZLE mode, each register corresponds to two
+ * consecutive VUE slots. When accessing the VUE in URB_INTERLEAVED mode (as
+ * in a vertex shader), each register corresponds to a single VUE slot, since
+ * it contains data for two separate vertices.
+ */
+struct brw_vue_map {
+ /**
+ * Map from gl_vert_result value to VUE slot. For gl_vert_results that are
+ * not stored in a slot (because they are not written, or because
+ * additional processing is applied before storing them in the VUE), the
+ * value is -1.
+ */
+ int vert_result_to_slot[BRW_VERT_RESULT_MAX];
+
+ /**
+ * Map from VUE slot to gl_vert_result value. For slots that do not
+ * directly correspond to a gl_vert_result, the value comes from
+ * brw_vert_result.
+ *
+ * For slots that are not in use, the value is BRW_VERT_RESULT_MAX (this
+ * simplifies code that uses the value stored in slot_to_vert_result to
+ * create a bit mask).
+ */
+ int slot_to_vert_result[BRW_VERT_RESULT_MAX];
+
+ /**
+ * Total number of VUE slots in use
+ */
+ int num_slots;
+};
+
struct brw_sf_prog_data {
GLuint urb_read_length;
GLuint total_grf;
@@ -893,6 +946,11 @@ void brw_upload_cs_urb_state(struct brw_context *brw);
/* brw_disasm.c */
int brw_disasm (FILE *file, struct brw_instruction *inst, int gen);
+/* brw_vs.c */
+void brw_compute_vue_map(struct brw_vue_map *vue_map,
+ const struct intel_context *intel, int nr_userclip,
+ bool two_side_color, GLbitfield64 outputs_written);
+
/*======================================================================
* Inline conversion functions. These are better-typed than the
* macros used previously: