reg->type = brw_type_for_base_type(ir->type->get_scalar_type());
fs_reg attr = *reg;
+ assert(stage == MESA_SHADER_FRAGMENT);
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
+
unsigned int array_elements;
const glsl_type *type;
fs_visitor::assign_curb_setup()
{
if (dispatch_width == 8) {
- prog_data->base.dispatch_grf_start_reg = payload.num_regs;
+ prog_data->dispatch_grf_start_reg = payload.num_regs;
} else {
+ assert(stage == MESA_SHADER_FRAGMENT);
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
prog_data->dispatch_grf_start_reg_16 = payload.num_regs;
}
- prog_data->base.curb_read_length = ALIGN(stage_prog_data->nr_params, 8) / 8;
+ prog_data->curb_read_length = ALIGN(stage_prog_data->nr_params, 8) / 8;
/* Map the offsets in the UNIFORM file to fixed HW regs. */
foreach_in_list(fs_inst, inst, &instructions) {
void
fs_visitor::calculate_urb_setup()
{
+ assert(stage == MESA_SHADER_FRAGMENT);
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
+
for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) {
prog_data->urb_setup[i] = -1;
}
void
fs_visitor::assign_urb_setup()
{
+ assert(stage == MESA_SHADER_FRAGMENT);
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
+
int urb_start = payload.num_regs + prog_data->base.curb_read_length;
/* Offset all the urb_setup[] index by the actual position of the
{
bool uses_depth =
(prog->InputsRead & (1 << VARYING_SLOT_POS)) != 0;
- unsigned barycentric_interp_modes = prog_data->barycentric_interp_modes;
+ unsigned barycentric_interp_modes =
+ (stage == MESA_SHADER_FRAGMENT) ?
+ ((brw_wm_prog_data*) this->prog_data)->barycentric_interp_modes : 0;
assert(brw->gen >= 6);
}
}
- prog_data->uses_pos_offset = key->compute_pos_offset;
- /* R31: MSAA position offsets. */
- if (prog_data->uses_pos_offset) {
- payload.sample_pos_reg = payload.num_regs;
- payload.num_regs++;
+ if (stage == MESA_SHADER_FRAGMENT) {
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
+ prog_data->uses_pos_offset = key->compute_pos_offset;
+ /* R31: MSAA position offsets. */
+ if (prog_data->uses_pos_offset) {
+ payload.sample_pos_reg = payload.num_regs;
+ payload.num_regs++;
+ }
}
/* R32: MSAA input coverage mask */
void
fs_visitor::assign_binding_table_offsets()
{
+ assert(stage == MESA_SHADER_FRAGMENT);
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
uint32_t next_binding_table_offset = 0;
/* If there are no color regions, we still perform an FB write to a null
/* We handle discards by keeping track of the still-live pixels in f0.1.
* Initialize it with the dispatched pixels.
*/
- if (prog_data->uses_kill || key->alpha_test_func) {
+ bool uses_kill =
+ (stage == MESA_SHADER_FRAGMENT) &&
+ ((brw_wm_prog_data*) this->prog_data)->uses_kill;
+ if (uses_kill || key->alpha_test_func) {
fs_inst *discard_init = emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS);
discard_init->flag_subreg = 1;
}
schedule_instructions(SCHEDULE_POST);
if (last_scratch > 0) {
- prog_data->base.total_scratch = brw_get_scratch_size(last_scratch);
+ prog_data->total_scratch = brw_get_scratch_size(last_scratch);
}
if (brw->use_rep_send)
try_rep_send();
- if (dispatch_width == 8)
- prog_data->reg_blocks = brw_register_blocks(grf_used);
- else
- prog_data->reg_blocks_16 = brw_register_blocks(grf_used);
+ if (stage == MESA_SHADER_FRAGMENT) {
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
+ if (dispatch_width == 8)
+ prog_data->reg_blocks = brw_register_blocks(grf_used);
+ else
+ prog_data->reg_blocks_16 = brw_register_blocks(grf_used);
+ }
/* If any state parameters were appended, then ParameterValues could have
* been realloced, in which case the driver uniform storage set up by
/* Assume this may touch any UBO. It would be nice to provide
* a tighter bound, but the array information is already lowered away.
*/
- brw_mark_surface_used(&prog_data->base,
+ brw_mark_surface_used(prog_data,
stage_prog_data->binding_table.ubo_start +
shader_prog->NumUniformBlocks - 1);
}
max_used += stage_prog_data->binding_table.texture_start;
}
- brw_mark_surface_used(&prog_data->base, max_used);
+ brw_mark_surface_used(prog_data, max_used);
/* Emit code to evaluate the actual indexing expression */
nonconst_sampler_index->accept(this);
fs_reg dst, fs_reg offset, fs_reg src0,
fs_reg src1)
{
+ bool uses_kill =
+ (stage == MESA_SHADER_FRAGMENT) &&
+ ((brw_wm_prog_data*) this->prog_data)->uses_kill;
const unsigned operand_len = dispatch_width / 8;
unsigned mlen = 0;
fs_inst *inst;
emit(MOV(brw_uvec_mrf(8, mlen, 0), fs_reg(0u)))
->force_writemask_all = true;
- if (prog_data->uses_kill) {
+ if (uses_kill) {
emit(MOV(brw_uvec_mrf(1, mlen, 7), brw_flag_reg(0, 1)))
->force_writemask_all = true;
} else {
fs_visitor::emit_untyped_surface_read(unsigned surf_index, fs_reg dst,
fs_reg offset)
{
+ bool uses_kill =
+ (stage == MESA_SHADER_FRAGMENT) &&
+ ((brw_wm_prog_data*) this->prog_data)->uses_kill;
const unsigned operand_len = dispatch_width / 8;
unsigned mlen = 0;
fs_inst *inst;
emit(MOV(brw_uvec_mrf(8, mlen, 0), fs_reg(0u)))
->force_writemask_all = true;
- if (prog_data->uses_kill) {
+ if (uses_kill) {
emit(MOV(brw_uvec_mrf(1, mlen, 7), brw_flag_reg(0, 1)))
->force_writemask_all = true;
} else {
struct brw_reg
fs_visitor::interp_reg(int location, int channel)
{
+ assert(stage == MESA_SHADER_FRAGMENT);
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
int regnr = prog_data->urb_setup[location] * 2 + channel / 2;
int stride = (channel & 1) * 4;
void
fs_visitor::emit_fb_writes()
{
+ assert(stage == MESA_SHADER_FRAGMENT);
+ brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
+
this->current_annotation = "FB write header";
bool header_present = true;
/* We can potentially have a message length of up to 15, so we have to set
* thread message and on all dual-source messages."
*/
if (brw->gen >= 6 &&
- (brw->is_haswell || brw->gen >= 8 || !this->prog_data->uses_kill) &&
+ (brw->is_haswell || brw->gen >= 8 || !prog_data->uses_kill) &&
!do_dual_src &&
key->nr_color_regions == 1) {
header_present = false;
unsigned dispatch_width)
: backend_visitor(brw, shader_prog, &fp->Base, &prog_data->base,
MESA_SHADER_FRAGMENT),
- key(key), prog_data(prog_data),
+ key(key), prog_data(&prog_data->base),
dispatch_width(dispatch_width)
{
this->mem_ctx = mem_ctx;