diff options
author | Jason Ekstrand <[email protected]> | 2018-05-17 23:17:17 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-28 13:19:38 -0700 |
commit | 9d78abbef80ae79c9f81056d19eaee9a4e81aeb3 (patch) | |
tree | c4c7e0e7d4f0bb1f3722648c588bcdae1aeb65fc /src/mesa | |
parent | 85750348bcd9da55c252126845445a210a79a8f9 (diff) |
intel/compiler: Add and use helpers for working with KSP indices
The pixel shader dispatch table is kind-of a confusing mess. This adds
some helpers for dealing with it and for easily extracting the correct
data from wm_prog_data.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen4_blorp_exec.h | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/genX_state_upload.c | 54 |
2 files changed, 47 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/i965/gen4_blorp_exec.h b/src/mesa/drivers/dri/i965/gen4_blorp_exec.h index e59bc9f2c2c..e3b90f12d96 100644 --- a/src/mesa/drivers/dri/i965/gen4_blorp_exec.h +++ b/src/mesa/drivers/dri/i965/gen4_blorp_exec.h @@ -136,13 +136,17 @@ blorp_emit_wm_state(struct blorp_batch *batch, #if GEN_GEN == 4 wm.KernelStartPointer0 = instruction_state_address(batch, params->wm_prog_kernel); - wm.GRFRegisterCount0 = prog_data->reg_blocks_0; + wm.GRFRegisterCount0 = brw_wm_prog_data_reg_blocks(prog_data, wm, 0); #else - wm.KernelStartPointer0 = params->wm_prog_kernel; - wm.GRFRegisterCount0 = prog_data->reg_blocks_0; - wm.KernelStartPointer2 = - params->wm_prog_kernel + prog_data->prog_offset_2; - wm.GRFRegisterCount2 = prog_data->reg_blocks_2; + wm.KernelStartPointer0 = params->wm_prog_kernel + + brw_wm_prog_data_prog_offset(prog_data, wm, 0); + wm.KernelStartPointer1 = params->wm_prog_kernel + + brw_wm_prog_data_prog_offset(prog_data, wm, 1); + wm.KernelStartPointer2 = params->wm_prog_kernel + + brw_wm_prog_data_prog_offset(prog_data, wm, 2); + wm.GRFRegisterCount0 = brw_wm_prog_data_reg_blocks(prog_data, wm, 0); + wm.GRFRegisterCount1 = brw_wm_prog_data_reg_blocks(prog_data, wm, 1); + wm.GRFRegisterCount2 = brw_wm_prog_data_reg_blocks(prog_data, wm, 2); #endif } diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index b9803d349fe..189245d91f9 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -1899,43 +1899,57 @@ genX(upload_wm)(struct brw_context *brw) #if GEN_GEN == 4 /* On gen4, we only have one shader kernel */ - if (wm_prog_data->dispatch_8 || wm_prog_data->dispatch_16) { + if (brw_wm_state_has_ksp(wm, 0)) { + assert(brw_wm_prog_data_prog_offset(wm_prog_data, wm, 0) == 0); wm.KernelStartPointer0 = KSP(brw, stage_state->prog_offset); - wm.GRFRegisterCount0 = wm_prog_data->reg_blocks_0; + wm.GRFRegisterCount0 = brw_wm_prog_data_reg_blocks(wm_prog_data, wm, 0); wm.DispatchGRFStartRegisterForConstantSetupData0 = - wm_prog_data->base.dispatch_grf_start_reg; + brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, wm, 0); } #elif GEN_GEN == 5 /* On gen5, we have multiple shader kernels but only one GRF start * register for all kernels */ - wm.KernelStartPointer0 = stage_state->prog_offset; + wm.KernelStartPointer0 = stage_state->prog_offset + + brw_wm_prog_data_prog_offset(wm_prog_data, wm, 0); + wm.KernelStartPointer1 = stage_state->prog_offset + + brw_wm_prog_data_prog_offset(wm_prog_data, wm, 1); wm.KernelStartPointer2 = stage_state->prog_offset + - wm_prog_data->prog_offset_2; + brw_wm_prog_data_prog_offset(wm_prog_data, wm, 2); - wm.GRFRegisterCount0 = wm_prog_data->reg_blocks_0; - wm.GRFRegisterCount2 = wm_prog_data->reg_blocks_2; + wm.GRFRegisterCount0 = brw_wm_prog_data_reg_blocks(wm_prog_data, wm, 0); + wm.GRFRegisterCount1 = brw_wm_prog_data_reg_blocks(wm_prog_data, wm, 1); + wm.GRFRegisterCount2 = brw_wm_prog_data_reg_blocks(wm_prog_data, wm, 2); wm.DispatchGRFStartRegisterForConstantSetupData0 = wm_prog_data->base.dispatch_grf_start_reg; /* Dispatch GRF Start should be the same for all shaders on gen5 */ - if (wm_prog_data->dispatch_8 && wm_prog_data->dispatch_16) { + if (brw_wm_state_has_ksp(wm, 1)) { assert(wm_prog_data->base.dispatch_grf_start_reg == - wm_prog_data->dispatch_grf_start_reg_2); + brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, wm, 1)); + } + if (brw_wm_state_has_ksp(wm, 2)) { + assert(wm_prog_data->base.dispatch_grf_start_reg == + brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, wm, 2)); } #elif GEN_GEN == 6 /* On gen5, we have multiple shader kernels and we no longer specify a * register count for each one. */ - wm.KernelStartPointer0 = stage_state->prog_offset; + wm.KernelStartPointer0 = stage_state->prog_offset + + brw_wm_prog_data_prog_offset(wm_prog_data, wm, 0); + wm.KernelStartPointer1 = stage_state->prog_offset + + brw_wm_prog_data_prog_offset(wm_prog_data, wm, 1); wm.KernelStartPointer2 = stage_state->prog_offset + - wm_prog_data->prog_offset_2; + brw_wm_prog_data_prog_offset(wm_prog_data, wm, 2); wm.DispatchGRFStartRegisterForConstantSetupData0 = - wm_prog_data->base.dispatch_grf_start_reg; + brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, wm, 0); + wm.DispatchGRFStartRegisterForConstantSetupData1 = + brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, wm, 1); wm.DispatchGRFStartRegisterForConstantSetupData2 = - wm_prog_data->dispatch_grf_start_reg_2; + brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data, wm, 2); #endif #if GEN_GEN <= 5 @@ -4015,14 +4029,20 @@ genX(upload_ps)(struct brw_context *brw) ps._8PixelDispatchEnable = prog_data->dispatch_8; ps._16PixelDispatchEnable = prog_data->dispatch_16; + ps.DispatchGRFStartRegisterForConstantSetupData0 = - prog_data->base.dispatch_grf_start_reg; + brw_wm_prog_data_dispatch_grf_start_reg(prog_data, ps, 0); + ps.DispatchGRFStartRegisterForConstantSetupData1 = + brw_wm_prog_data_dispatch_grf_start_reg(prog_data, ps, 1); ps.DispatchGRFStartRegisterForConstantSetupData2 = - prog_data->dispatch_grf_start_reg_2; + brw_wm_prog_data_dispatch_grf_start_reg(prog_data, ps, 2); - ps.KernelStartPointer0 = stage_state->prog_offset; + ps.KernelStartPointer0 = stage_state->prog_offset + + brw_wm_prog_data_prog_offset(prog_data, ps, 0); + ps.KernelStartPointer1 = stage_state->prog_offset + + brw_wm_prog_data_prog_offset(prog_data, ps, 1); ps.KernelStartPointer2 = stage_state->prog_offset + - prog_data->prog_offset_2; + brw_wm_prog_data_prog_offset(prog_data, ps, 2); if (prog_data->base.total_scratch) { ps.ScratchSpaceBasePointer = |