summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2014-02-18 22:50:13 +0200
committerTopi Pohjolainen <[email protected]>2014-03-05 10:31:44 +0200
commita290cd039cc07330598a101e74d25289ce70bcee (patch)
tree4a5443c6f39cda161bb84970bc242793d507e5cd
parent81494ec6137d133f999a98474d1660b8c87d2276 (diff)
i965: Merge resolving of shader program source
Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp8
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp5
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp14
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.h1
-rw-r--r--src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp3
11 files changed, 23 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 424763bd6cb..90272eb68f5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2942,17 +2942,13 @@ fs_visitor::fs_visitor(struct brw_context *brw,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
unsigned dispatch_width)
- : backend_visitor(brw, shader_prog, &fp->Base, &c->prog_data.base),
+ : backend_visitor(brw, shader_prog, &fp->Base, &c->prog_data.base,
+ MESA_SHADER_FRAGMENT),
dispatch_width(dispatch_width)
{
this->c = c;
this->fp = fp;
this->mem_ctx = ralloc_context(NULL);
- if (shader_prog)
- shader = (struct brw_shader *)
- shader_prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
- else
- shader = NULL;
this->failed = false;
this->variable_ht = hash_table_ctor(0,
hash_table_pointer_hash,
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 747137e4a43..407319b4d8d 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -539,9 +539,12 @@ brw_instruction_name(enum opcode op)
backend_visitor::backend_visitor(struct brw_context *brw,
struct gl_shader_program *shader_prog,
struct gl_program *prog,
- struct brw_stage_prog_data *stage_prog_data)
+ struct brw_stage_prog_data *stage_prog_data,
+ gl_shader_stage stage)
: brw(brw),
ctx(&brw->ctx),
+ shader(shader_prog ?
+ (struct brw_shader *)shader_prog->_LinkedShaders[stage] : NULL),
shader_prog(shader_prog),
prog(prog),
stage_prog_data(stage_prog_data)
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 0163414cecc..33295549b7a 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -74,7 +74,8 @@ protected:
backend_visitor(struct brw_context *brw,
struct gl_shader_program *shader_prog,
struct gl_program *prog,
- struct brw_stage_prog_data *stage_prog_data);
+ struct brw_stage_prog_data *stage_prog_data,
+ gl_shader_stage stage);
public:
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index c30afaecda6..87825f13497 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1668,7 +1668,7 @@ brw_vs_emit(struct brw_context *brw,
if (unlikely(INTEL_DEBUG & DEBUG_VS))
brw_dump_ir(brw, "vertex", prog, &shader->base, &c->vp->program.Base);
- vec4_vs_visitor v(brw, c, prog_data, prog, shader, mem_ctx);
+ vec4_vs_visitor v(brw, c, prog_data, prog, mem_ctx);
if (!v.run()) {
if (prog) {
prog->LinkStatus = false;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index cb0586fdcbc..eb375e2fc68 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -287,7 +287,7 @@ public:
const struct brw_vec4_prog_key *key,
struct brw_vec4_prog_data *prog_data,
struct gl_shader_program *shader_prog,
- struct brw_shader *shader,
+ gl_shader_stage stage,
void *mem_ctx,
bool debug_flag,
bool no_spills,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 92b2e8d6f08..13d6d385a2f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -36,11 +36,10 @@ namespace brw {
vec4_gs_visitor::vec4_gs_visitor(struct brw_context *brw,
struct brw_gs_compile *c,
struct gl_shader_program *prog,
- struct brw_shader *shader,
void *mem_ctx,
bool no_spills)
: vec4_visitor(brw, &c->base, &c->gp->program.Base, &c->key.base,
- &c->prog_data.base, prog, shader, mem_ctx,
+ &c->prog_data.base, prog, MESA_SHADER_GEOMETRY, mem_ctx,
INTEL_DEBUG & DEBUG_GS, no_spills,
ST_GS, ST_GS_WRITTEN, ST_GS_RESET),
c(c)
@@ -585,11 +584,12 @@ brw_gs_emit(struct brw_context *brw,
void *mem_ctx,
unsigned *final_assembly_size)
{
- struct brw_shader *shader =
- (brw_shader *) prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
+ if (unlikely(INTEL_DEBUG & DEBUG_GS)) {
+ struct brw_shader *shader =
+ (brw_shader *) prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
- if (unlikely(INTEL_DEBUG & DEBUG_GS))
brw_dump_ir(brw, "geometry", prog, &shader->base, NULL);
+ }
/* Compile the geometry shader in DUAL_OBJECT dispatch mode, if we can do
* so without spilling. If the GS invocations count > 1, then we can't use
@@ -599,7 +599,7 @@ brw_gs_emit(struct brw_context *brw,
likely(!(INTEL_DEBUG & DEBUG_NO_DUAL_OBJECT_GS))) {
c->prog_data.dual_instanced_dispatch = false;
- vec4_gs_visitor v(brw, c, prog, shader, mem_ctx, true /* no_spills */);
+ vec4_gs_visitor v(brw, c, prog, mem_ctx, true /* no_spills */);
if (v.run()) {
return generate_assembly(brw, prog, &c->gp->program.Base,
&c->prog_data.base, mem_ctx, &v.instructions,
@@ -619,7 +619,7 @@ brw_gs_emit(struct brw_context *brw,
*/
c->prog_data.dual_instanced_dispatch = true;
- vec4_gs_visitor v(brw, c, prog, shader, mem_ctx, false /* no_spills */);
+ vec4_gs_visitor v(brw, c, prog, mem_ctx, false /* no_spills */);
if (!v.run()) {
prog->LinkStatus = false;
ralloc_strcat(&prog->InfoLog, v.fail_msg);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index 68756f74904..25415ea3df1 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -80,7 +80,6 @@ public:
vec4_gs_visitor(struct brw_context *brw,
struct brw_gs_compile *c,
struct gl_shader_program *prog,
- struct brw_shader *shader,
void *mem_ctx,
bool no_spills);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 87b13614186..921e9099e08 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3356,14 +3356,14 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
const struct brw_vec4_prog_key *key,
struct brw_vec4_prog_data *prog_data,
struct gl_shader_program *shader_prog,
- struct brw_shader *shader,
+ gl_shader_stage stage,
void *mem_ctx,
bool debug_flag,
bool no_spills,
shader_time_shader_type st_base,
shader_time_shader_type st_written,
shader_time_shader_type st_reset)
- : backend_visitor(brw, shader_prog, prog, &prog_data->base),
+ : backend_visitor(brw, shader_prog, prog, &prog_data->base, stage),
c(c),
key(key),
prog_data(prog_data),
@@ -3377,8 +3377,6 @@ vec4_visitor::vec4_visitor(struct brw_context *brw,
st_written(st_written),
st_reset(st_reset)
{
- this->shader = shader;
-
this->mem_ctx = mem_ctx;
this->failed = false;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
index c739e41d1d4..79cb40f2977 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -211,10 +211,10 @@ vec4_vs_visitor::vec4_vs_visitor(struct brw_context *brw,
struct brw_vs_compile *vs_compile,
struct brw_vs_prog_data *vs_prog_data,
struct gl_shader_program *prog,
- struct brw_shader *shader,
void *mem_ctx)
: vec4_visitor(brw, &vs_compile->base, &vs_compile->vp->program.Base,
- &vs_compile->key.base, &vs_prog_data->base, prog, shader,
+ &vs_compile->key.base, &vs_prog_data->base, prog,
+ MESA_SHADER_VERTEX,
mem_ctx, INTEL_DEBUG & DEBUG_VS, false /* no_spills */,
ST_VS, ST_VS_WRITTEN, ST_VS_RESET),
vs_compile(vs_compile),
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index 207cd5c94d0..97308a78a3c 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -108,7 +108,6 @@ public:
struct brw_vs_compile *vs_compile,
struct brw_vs_prog_data *vs_prog_data,
struct gl_shader_program *prog,
- struct brw_shader *shader,
void *mem_ctx);
protected:
diff --git a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
index 4e971b54d02..7563aef8bf2 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
@@ -48,7 +48,8 @@ class register_coalesce_vec4_visitor : public vec4_visitor
public:
register_coalesce_vec4_visitor(struct brw_context *brw,
struct gl_shader_program *shader_prog)
- : vec4_visitor(brw, NULL, NULL, NULL, NULL, shader_prog, NULL, NULL,
+ : vec4_visitor(brw, NULL, NULL, NULL, NULL, shader_prog,
+ MESA_SHADER_VERTEX, NULL,
false, false /* no_spills */,
ST_NONE, ST_NONE, ST_NONE)
{