bool
brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
+ struct gl_fragment_program *fp,
struct gl_shader_program *prog)
{
struct intel_context *intel = &brw->intel;
printf("\n\n");
} else {
printf("ARB_fragment_program %d ir for native fragment shader\n",
- c->fp->program.Base.Id);
- _mesa_print_program(&c->fp->program.Base);
+ fp->Base.Id);
+ _mesa_print_program(&fp->Base);
}
}
/* Now the main event: Visit the shader IR and generate our FS IR for it.
*/
- fs_visitor v(c, prog, 8);
+ fs_visitor v(c, prog, fp, 8);
if (!v.run()) {
prog->LinkStatus = false;
ralloc_strcat(&prog->InfoLog, v.fail_msg);
}
if (intel->gen >= 5 && c->prog_data.nr_pull_params == 0) {
- fs_visitor v2(c, prog, 16);
+ fs_visitor v2(c, prog, fp, 16);
v2.import_uniforms(&v);
if (!v2.run()) {
perf_debug("16-wide shader failed to compile, falling back to "
{
public:
- fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog,
+ fs_visitor(struct brw_wm_compile *c,
+ struct gl_shader_program *prog,
+ struct gl_fragment_program *fp,
unsigned dispatch_width);
~fs_visitor();
prog->Name, dispatch_width);
} else {
printf("Native code for fragment program %d (%d-wide dispatch):\n",
- c->fp->program.Base.Id, dispatch_width);
+ fp->Base.Id, dispatch_width);
}
}
/* PROGRAM_STATE_VAR etc. */
if (dispatch_width == 8) {
for (unsigned p = 0;
- p < c->fp->program.Base.Parameters->NumParameters; p++) {
+ p < fp->Base.Parameters->NumParameters; p++) {
for (unsigned int i = 0; i < 4; i++) {
this->param_index[c->prog_data.nr_params] = p;
this->param_offset[c->prog_data.nr_params] = i;
fs_reg
fs_visitor::get_fp_src_reg(const prog_src_register *src)
{
- struct gl_program_parameter_list *plist = c->fp->program.Base.Parameters;
+ struct gl_program_parameter_list *plist = fp->Base.Parameters;
fs_reg result;
(intel->gen < 6 ||
(intel->gen >= 6 && (c->key.tex.gl_clamp_mask[0] & (1 << sampler) ||
c->key.tex.gl_clamp_mask[1] & (1 << sampler))))) {
- struct gl_program_parameter_list *params = c->fp->program.Base.Parameters;
+ struct gl_program_parameter_list *params = fp->Base.Parameters;
int tokens[STATE_LENGTH] = {
STATE_INTERNAL,
STATE_TEXRECT_SCALE,
*reg = temp;
}
-fs_visitor::fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog,
+fs_visitor::fs_visitor(struct brw_wm_compile *c,
+ struct gl_shader_program *prog,
+ struct gl_fragment_program *fp,
unsigned dispatch_width)
: dispatch_width(dispatch_width)
{
this->c = c;
this->p = &c->func;
this->brw = p->brw;
- this->fp = &c->fp->program;
+ this->fp = fp;
this->prog = prog;
this->intel = &brw->intel;
this->ctx = &intel->ctx;
memcpy(&c->key, key, sizeof(*key));
- c->fp = fp;
-
brw_init_compile(brw, &c->func, c);
c->prog_data.barycentric_interp_modes =
brw_compute_barycentric_interp_modes(brw, c->key.flat_shade,
&fp->program);
- brw_wm_fs_emit(brw, c, prog);
+ brw_wm_fs_emit(brw, c, &fp->program, prog);
/* Scratch space is used for register spilling */
if (c->last_scratch) {
struct brw_wm_prog_key key;
struct brw_wm_prog_data prog_data;
- struct brw_fragment_program *fp;
-
uint8_t source_depth_reg;
uint8_t source_w_reg;
uint8_t aa_dest_stencil_reg;
};
bool brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
+ struct gl_fragment_program *fp,
struct gl_shader_program *prog);
GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
bool kill_stats_promoted_workaround = false;
int lookup = c->key.iz_lookup;
bool uses_depth =
- (c->fp->program.Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
+ (fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
assert(lookup < IZ_BIT_MAX);