aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vec4.h
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2012-11-26 22:53:10 -0800
committerKenneth Graunke <[email protected]>2012-11-28 18:15:58 -0800
commiteda9726ef51dcfd3895924eb0f74df8e67aa9c3a (patch)
tree5114000f00254a07b7fe971028a463fa941cd6c6 /src/mesa/drivers/dri/i965/brw_vec4.h
parentdb6231fece32a0cec6050ca570a04362036f4f48 (diff)
i965/vs: Split final assembly code generation out of vec4_visitor.
Compiling shaders requires several main steps: 1. Generating VS IR from either GLSL IR or Mesa IR 2. Optimizing the IR 3. Register allocation 4. Generating assembly code This patch splits out step 4 into a separate class named "vec4_generator." There are several reasons for doing so: 1. Future hardware has a different instruction encoding. Splitting this out will allow us to replace vec4_generator (which relies heavily on the brw_eu_emit.c code and struct brw_instruction) with a new code generator that writes the new format. 2. It reduces the size of the vec4_visitor monolith. (Arguably, a lot more should be split out, but that's left for "future work.") 3. Separate namespaces allow us to make helper functions for generating instructions in both classes: ADD() can exist in vec4_visitor and create IR, while ADD() in vec4_generator() can create brw_instructions. (Patches for this upcoming.) Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 3d9d0dc504f..d0609414253 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -195,6 +195,12 @@ public:
bool is_math();
};
+/**
+ * The vertex shader front-end.
+ *
+ * Translates either GLSL IR or Mesa IR (for ARB_vertex_program and
+ * fixed-function) into VS IR.
+ */
class vec4_visitor : public backend_visitor
{
public:
@@ -218,7 +224,6 @@ public:
const struct gl_vertex_program *vp;
struct brw_vs_compile *c;
struct brw_vs_prog_data *prog_data;
- struct brw_compile *p;
char *fail_msg;
bool failed;
@@ -448,7 +453,28 @@ public:
bool process_move_condition(ir_rvalue *ir);
- void generate_code();
+ void dump_instruction(vec4_instruction *inst);
+ void dump_instructions();
+};
+
+/**
+ * The vertex shader code generator.
+ *
+ * Translates VS IR to actual i965 assembly code.
+ */
+class vec4_generator
+{
+public:
+ vec4_generator(struct brw_context *brw,
+ struct brw_vs_compile *c,
+ struct gl_shader_program *prog,
+ void *mem_ctx);
+ ~vec4_generator();
+
+ const unsigned *generate_assembly(exec_list *insts, unsigned *asm_size);
+
+private:
+ void generate_code(exec_list *instructions);
void generate_vs_instruction(vec4_instruction *inst,
struct brw_reg dst,
struct brw_reg *src);
@@ -491,8 +517,18 @@ public:
struct brw_reg index,
struct brw_reg offset);
- void dump_instruction(vec4_instruction *inst);
- void dump_instructions();
+ struct brw_context *brw;
+ struct intel_context *intel;
+ struct gl_context *ctx;
+
+ struct brw_compile *p;
+ struct brw_vs_compile *c;
+
+ struct gl_shader_program *prog;
+ struct gl_shader *shader;
+ const struct gl_vertex_program *vp;
+
+ void *mem_ctx;
};
} /* namespace brw */