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,
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)
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:
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;
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,
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)
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
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,
*/
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);
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);
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),
st_written(st_written),
st_reset(st_reset)
{
- this->shader = shader;
-
this->mem_ctx = mem_ctx;
this->failed = false;
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),
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:
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)
{