fs_visitor::run_cs()
{
assert(stage == MESA_SHADER_COMPUTE);
- assert(shader);
setup_cs_payload();
/* Now the main event: Visit the shader IR and generate our FS IR for it.
*/
- fs_visitor v(brw->intelScreen->compiler, brw,
- mem_ctx, MESA_SHADER_FRAGMENT, key, &prog_data->base,
- prog, &fp->Base, 8, st_index8);
+ fs_visitor v(brw->intelScreen->compiler, brw, mem_ctx, key,
+ &prog_data->base, &fp->Base, fp->Base.nir, 8, st_index8);
if (!v.run_fs(false /* do_rep_send */)) {
if (prog) {
prog->LinkStatus = false;
}
cfg_t *simd16_cfg = NULL;
- fs_visitor v2(brw->intelScreen->compiler, brw,
- mem_ctx, MESA_SHADER_FRAGMENT, key, &prog_data->base,
- prog, &fp->Base, 16, st_index16);
+ fs_visitor v2(brw->intelScreen->compiler, brw, mem_ctx, key,
+ &prog_data->base, &fp->Base, fp->Base.nir, 16, st_index16);
if (likely(!(INTEL_DEBUG & DEBUG_NO16) || brw->use_rep_send)) {
if (!v.simd16_unsupported) {
/* Try a SIMD16 compile */
/* Now the main event: Visit the shader IR and generate our CS IR for it.
*/
- fs_visitor v8(brw->intelScreen->compiler, brw,
- mem_ctx, MESA_SHADER_COMPUTE, key, &prog_data->base, prog,
- &cp->Base, 8, st_index);
+ fs_visitor v8(brw->intelScreen->compiler, brw, mem_ctx, key,
+ &prog_data->base, &cp->Base, cp->Base.nir, 8, st_index);
if (!v8.run_cs()) {
fail_msg = v8.fail_msg;
} else if (local_workgroup_size <= 8 * brw->max_cs_threads) {
prog_data->simd_size = 8;
}
- fs_visitor v16(brw->intelScreen->compiler, brw,
- mem_ctx, MESA_SHADER_COMPUTE, key, &prog_data->base, prog,
- &cp->Base, 16, st_index);
+ fs_visitor v16(brw->intelScreen->compiler, brw, mem_ctx, key,
+ &prog_data->base, &cp->Base, cp->Base.nir, 16, st_index);
if (likely(!(INTEL_DEBUG & DEBUG_NO16)) &&
!fail_msg && !v8.simd16_unsupported &&
local_workgroup_size <= 16 * brw->max_cs_threads) {
public:
fs_visitor(const struct brw_compiler *compiler, void *log_data,
void *mem_ctx,
- gl_shader_stage stage,
const void *key,
struct brw_stage_prog_data *prog_data,
- struct gl_shader_program *shader_prog,
struct gl_program *prog,
+ nir_shader *shader,
unsigned dispatch_width,
int shader_time_index);
const struct brw_sampler_prog_key_data *key_tex;
struct brw_stage_prog_data *prog_data;
+ struct gl_program *prog;
int *param_size;
unsigned ubo_index = const_uniform_block ? const_uniform_block->u[0] : 0;
int reg_width = dispatch_width / 8;
- assert(shader->base.UniformBlocks[ubo_index].IsShaderStorage);
-
/* Set LOD = 0 */
fs_reg source = fs_reg(0);
fs_visitor::fs_visitor(const struct brw_compiler *compiler, void *log_data,
void *mem_ctx,
- gl_shader_stage stage,
const void *key,
struct brw_stage_prog_data *prog_data,
- struct gl_shader_program *shader_prog,
struct gl_program *prog,
+ nir_shader *shader,
unsigned dispatch_width,
int shader_time_index)
- : backend_shader(compiler, log_data, mem_ctx,
- shader_prog, prog, prog_data, stage),
- key(key), prog_data(prog_data),
+ : backend_shader(compiler, log_data, mem_ctx, shader, prog_data),
+ key(key), prog_data(prog_data), prog(prog),
dispatch_width(dispatch_width),
shader_time_index(shader_time_index),
promoted_constants(0),
backend_shader::backend_shader(const struct brw_compiler *compiler,
void *log_data,
void *mem_ctx,
- struct gl_shader_program *shader_prog,
- struct gl_program *prog,
- struct brw_stage_prog_data *stage_prog_data,
- gl_shader_stage stage)
+ nir_shader *shader,
+ struct brw_stage_prog_data *stage_prog_data)
: compiler(compiler),
log_data(log_data),
devinfo(compiler->devinfo),
- nir(prog->nir),
- shader(shader_prog ?
- (struct brw_shader *)shader_prog->_LinkedShaders[stage] : NULL),
- shader_prog(shader_prog),
- prog(prog),
+ nir(shader),
stage_prog_data(stage_prog_data),
mem_ctx(mem_ctx),
cfg(NULL),
- stage(stage)
+ stage(shader->stage)
{
debug_enabled = INTEL_DEBUG & intel_debug_flag_for_shader_stage(stage);
stage_name = _mesa_shader_stage_to_string(stage);
backend_shader(const struct brw_compiler *compiler,
void *log_data,
void *mem_ctx,
- struct gl_shader_program *shader_prog,
- struct gl_program *prog,
- struct brw_stage_prog_data *stage_prog_data,
- gl_shader_stage stage);
+ nir_shader *shader,
+ struct brw_stage_prog_data *stage_prog_data);
public:
const struct brw_device_info * const devinfo;
nir_shader *nir;
- struct brw_shader * const shader;
- struct gl_shader_program * const shader_prog;
- struct gl_program * const prog;
struct brw_stage_prog_data * const stage_prog_data;
/** ralloc context for temporary data used during compile */
emit_prolog();
- assert(prog->nir != NULL);
emit_nir_code();
if (failed)
return false;
prog_data->base.dispatch_mode = DISPATCH_MODE_SIMD8;
fs_visitor v(brw->intelScreen->compiler, brw,
- mem_ctx, MESA_SHADER_VERTEX, key,
- &prog_data->base.base, prog, &vp->Base,
- 8, st_index);
+ mem_ctx, key, &prog_data->base.base,
+ NULL, /* prog; Only used for TEXTURE_RECTANGLE on gen < 8 */
+ vp->Base.nir, 8, st_index);
if (!v.run_vs(brw_select_clip_planes(&brw->ctx))) {
if (prog) {
prog->LinkStatus = false;
prog_data->base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT;
vec4_vs_visitor v(brw->intelScreen->compiler, brw, key, prog_data,
- vp, prog, brw_select_clip_planes(&brw->ctx),
+ vp->Base.nir, brw_select_clip_planes(&brw->ctx),
mem_ctx, st_index,
!_mesa_is_gles3(&brw->ctx));
if (!v.run()) {
public:
vec4_visitor(const struct brw_compiler *compiler,
void *log_data,
- struct gl_program *prog,
const struct brw_sampler_prog_key_data *key,
struct brw_vue_prog_data *prog_data,
- struct gl_shader_program *shader_prog,
- gl_shader_stage stage,
+ nir_shader *shader,
void *mem_ctx,
bool no_spills,
int shader_time_index);
void *log_data,
struct brw_gs_compile *c,
struct gl_shader_program *prog,
+ nir_shader *shader,
void *mem_ctx,
bool no_spills,
int shader_time_index)
- : vec4_visitor(compiler, log_data,
- &c->gp->program.Base, &c->key.tex,
- &c->prog_data.base, prog, MESA_SHADER_GEOMETRY, mem_ctx,
+ : vec4_visitor(compiler, log_data, &c->key.tex,
+ &c->prog_data.base, shader, mem_ctx,
no_spills, shader_time_index),
+ shader_prog(prog),
c(c)
{
}
void *mem_ctx,
unsigned *final_assembly_size)
{
- if (unlikely(INTEL_DEBUG & DEBUG_GS)) {
- struct brw_shader *shader =
- (brw_shader *) prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
+ struct gl_shader *shader = prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
- brw_dump_ir("geometry", prog, &shader->base, NULL);
- }
+ if (unlikely(INTEL_DEBUG & DEBUG_GS))
+ brw_dump_ir("geometry", prog, shader, NULL);
int st_index = -1;
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
c->prog_data.base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT;
vec4_gs_visitor v(brw->intelScreen->compiler, brw,
- c, prog, mem_ctx, true /* no_spills */, st_index);
+ c, prog, shader->Program->nir,
+ mem_ctx, true /* no_spills */, st_index);
if (v.run()) {
return generate_assembly(brw, prog, &c->gp->program.Base,
&c->prog_data.base, mem_ctx, v.cfg,
if (brw->gen >= 7)
gs = new vec4_gs_visitor(brw->intelScreen->compiler, brw,
- c, prog, mem_ctx, false /* no_spills */,
+ c, prog, shader->Program->nir,
+ mem_ctx, false /* no_spills */,
st_index);
else
gs = new gen6_gs_visitor(brw->intelScreen->compiler, brw,
- c, prog, mem_ctx, false /* no_spills */,
+ c, prog, shader->Program->nir,
+ mem_ctx, false /* no_spills */,
st_index);
if (!gs->run()) {
void *log_data,
struct brw_gs_compile *c,
struct gl_shader_program *prog,
+ nir_shader *shader,
void *mem_ctx,
bool no_spills,
int shader_time_index);
void emit_control_data_bits();
void set_stream_control_data_bits(unsigned stream_id);
+ struct gl_shader_program *shader_prog;
+
src_reg vertex_count;
src_reg control_data_bits;
const struct brw_gs_compile * const c;
nir_const_value *const_uniform_block = nir_src_as_const_value(instr->src[0]);
unsigned ubo_index = const_uniform_block ? const_uniform_block->u[0] : 0;
- assert(shader->base.UniformBlocks[ubo_index].IsShaderStorage);
-
src_reg surf_index = src_reg(prog_data->base.binding_table.ubo_start +
ubo_index);
dst_reg result_dst = get_nir_dest(instr->dest);
vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
void *log_data,
- struct gl_program *prog,
const struct brw_sampler_prog_key_data *key_tex,
struct brw_vue_prog_data *prog_data,
- struct gl_shader_program *shader_prog,
- gl_shader_stage stage,
+ nir_shader *shader,
void *mem_ctx,
bool no_spills,
int shader_time_index)
- : backend_shader(compiler, log_data, mem_ctx,
- shader_prog, prog, &prog_data->base, stage),
+ : backend_shader(compiler, log_data, mem_ctx, shader, &prog_data->base),
key_tex(key_tex),
prog_data(prog_data),
fail_msg(NULL),
void *log_data,
const struct brw_vs_prog_key *key,
struct brw_vs_prog_data *vs_prog_data,
- struct gl_vertex_program *vp,
- struct gl_shader_program *prog,
+ nir_shader *shader,
gl_clip_plane *clip_planes,
void *mem_ctx,
int shader_time_index,
bool use_legacy_snorm_formula)
- : vec4_visitor(compiler, log_data,
- &vp->Base, &key->tex, &vs_prog_data->base, prog,
- MESA_SHADER_VERTEX,
- mem_ctx, false /* no_spills */,
- shader_time_index),
+ : vec4_visitor(compiler, log_data, &key->tex, &vs_prog_data->base, shader,
+ mem_ctx, false /* no_spills */, shader_time_index),
key(key),
vs_prog_data(vs_prog_data),
- vp(vp),
clip_planes(clip_planes),
use_legacy_snorm_formula(use_legacy_snorm_formula)
{
void *log_data,
const struct brw_vs_prog_key *key,
struct brw_vs_prog_data *vs_prog_data,
- struct gl_vertex_program *vp,
- struct gl_shader_program *prog,
+ nir_shader *shader,
gl_clip_plane *clip_planes,
void *mem_ctx,
int shader_time_index,
const struct brw_vs_prog_key *const key;
struct brw_vs_prog_data * const vs_prog_data;
- struct gl_vertex_program *const vp;
src_reg *vp_temp_regs;
src_reg vp_addr_reg;
void *log_data,
struct brw_gs_compile *c,
struct gl_shader_program *prog,
+ nir_shader *shader,
void *mem_ctx,
bool no_spills,
int shader_time_index) :
- vec4_gs_visitor(comp, log_data, c, prog, mem_ctx, no_spills,
+ vec4_gs_visitor(comp, log_data, c, prog, shader, mem_ctx, no_spills,
shader_time_index) {}
protected:
public:
cmod_propagation_fs_visitor(struct brw_compiler *compiler,
struct brw_wm_prog_data *prog_data,
- struct gl_shader_program *shader_prog)
- : fs_visitor(compiler, NULL, NULL, MESA_SHADER_FRAGMENT, NULL,
- &prog_data->base, shader_prog,
- (struct gl_program *) NULL, 8, -1) {}
+ nir_shader *shader)
+ : fs_visitor(compiler, NULL, NULL, NULL,
+ &prog_data->base, (struct gl_program *) NULL,
+ shader, 8, -1) {}
};
fp = ralloc(NULL, struct brw_fragment_program);
prog_data = ralloc(NULL, struct brw_wm_prog_data);
- shader_prog = ralloc(NULL, struct gl_shader_program);
+ nir_shader *shader = nir_shader_create(NULL, MESA_SHADER_FRAGMENT, NULL);
- v = new cmod_propagation_fs_visitor(compiler, prog_data, shader_prog);
+ v = new cmod_propagation_fs_visitor(compiler, prog_data, shader);
_mesa_init_fragment_program(ctx, &fp->program, GL_FRAGMENT_SHADER, 0);
public:
saturate_propagation_fs_visitor(struct brw_compiler *compiler,
struct brw_wm_prog_data *prog_data,
- struct gl_shader_program *shader_prog)
- : fs_visitor(compiler, NULL, NULL, MESA_SHADER_FRAGMENT, NULL,
- &prog_data->base, shader_prog,
- (struct gl_program *) NULL, 8, -1) {}
+ nir_shader *shader)
+ : fs_visitor(compiler, NULL, NULL, NULL,
+ &prog_data->base, (struct gl_program *) NULL,
+ shader, 8, -1) {}
};
fp = ralloc(NULL, struct brw_fragment_program);
prog_data = ralloc(NULL, struct brw_wm_prog_data);
- shader_prog = ralloc(NULL, struct gl_shader_program);
+ nir_shader *shader = nir_shader_create(NULL, MESA_SHADER_FRAGMENT, NULL);
- v = new saturate_propagation_fs_visitor(compiler, prog_data, shader_prog);
+ v = new saturate_propagation_fs_visitor(compiler, prog_data, shader);
_mesa_init_fragment_program(ctx, &fp->program, GL_FRAGMENT_SHADER, 0);
{
public:
copy_propagation_vec4_visitor(struct brw_compiler *compiler,
- struct gl_shader_program *shader_prog)
- : vec4_visitor(compiler, NULL, NULL, NULL, NULL, shader_prog,
- MESA_SHADER_VERTEX, NULL,
+ nir_shader *shader)
+ : vec4_visitor(compiler, NULL, NULL, NULL, shader, NULL,
false /* no_spills */, -1)
{
}
vp = ralloc(NULL, struct brw_vertex_program);
- shader_prog = ralloc(NULL, struct gl_shader_program);
+ nir_shader *shader = nir_shader_create(NULL, MESA_SHADER_VERTEX, NULL);
- v = new copy_propagation_vec4_visitor(compiler, shader_prog);
+ v = new copy_propagation_vec4_visitor(compiler, shader);
_mesa_init_vertex_program(ctx, &vp->program, GL_VERTEX_SHADER, 0);
{
public:
register_coalesce_vec4_visitor(struct brw_compiler *compiler,
- struct gl_shader_program *shader_prog)
- : vec4_visitor(compiler, NULL, NULL, NULL, NULL, shader_prog,
- MESA_SHADER_VERTEX, NULL,
+ nir_shader *shader)
+ : vec4_visitor(compiler, NULL, NULL, NULL, shader, NULL,
false /* no_spills */, -1)
{
}
vp = ralloc(NULL, struct brw_vertex_program);
- shader_prog = ralloc(NULL, struct gl_shader_program);
+ nir_shader *shader = nir_shader_create(NULL, MESA_SHADER_VERTEX, NULL);
- v = new register_coalesce_vec4_visitor(compiler, shader_prog);
+ v = new register_coalesce_vec4_visitor(compiler, shader);
_mesa_init_vertex_program(ctx, &vp->program, GL_VERTEX_SHADER, 0);