struct nir_shader *nir,
const struct brw_wm_prog_key *wm_key,
bool use_repclear,
- struct brw_blorp_prog_data *prog_data,
+ struct brw_wm_prog_data *wm_prog_data,
unsigned *program_size)
{
const struct brw_compiler *compiler = blorp->compiler;
nir->options =
compiler->glsl_compiler_options[MESA_SHADER_FRAGMENT].NirOptions;
- struct brw_wm_prog_data wm_prog_data;
- memset(&wm_prog_data, 0, sizeof(wm_prog_data));
+ memset(wm_prog_data, 0, sizeof(*wm_prog_data));
- wm_prog_data.base.nr_params = 0;
- wm_prog_data.base.param = NULL;
+ wm_prog_data->base.nr_params = 0;
+ wm_prog_data->base.param = NULL;
/* BLORP always just uses the first two binding table entries */
- wm_prog_data.binding_table.render_target_start = BLORP_RENDERBUFFER_BT_INDEX;
- wm_prog_data.base.binding_table.texture_start = BLORP_TEXTURE_BT_INDEX;
+ wm_prog_data->binding_table.render_target_start = BLORP_RENDERBUFFER_BT_INDEX;
+ wm_prog_data->base.binding_table.texture_start = BLORP_TEXTURE_BT_INDEX;
nir = brw_preprocess_nir(compiler, nir);
nir_remove_dead_variables(nir, nir_var_shader_in);
const unsigned *program =
brw_compile_fs(compiler, blorp->driver_ctx, mem_ctx, wm_key,
- &wm_prog_data, nir, NULL, -1, -1, false, use_repclear,
+ wm_prog_data, nir, NULL, -1, -1, false, use_repclear,
NULL, program_size, NULL);
- /* Copy the relavent bits of wm_prog_data over into the blorp prog data */
- prog_data->dispatch_8 = wm_prog_data.dispatch_8;
- prog_data->dispatch_16 = wm_prog_data.dispatch_16;
- prog_data->first_curbe_grf_0 = wm_prog_data.base.dispatch_grf_start_reg;
- prog_data->first_curbe_grf_2 = wm_prog_data.dispatch_grf_start_reg_2;
- prog_data->ksp_offset_2 = wm_prog_data.prog_offset_2;
- prog_data->persample_msaa_dispatch = wm_prog_data.persample_dispatch;
- prog_data->flat_inputs = wm_prog_data.flat_inputs;
- prog_data->num_varying_inputs = wm_prog_data.num_varying_inputs;
- prog_data->inputs_read = nir->info->inputs_read;
-
- assert(wm_prog_data.base.nr_params == 0);
-
return program;
}
const unsigned *program;
unsigned program_size;
- struct brw_blorp_prog_data prog_data;
+ struct brw_wm_prog_data prog_data;
nir_shader *nir = brw_blorp_build_nir_shader(blorp, mem_ctx, prog_key);
struct brw_wm_prog_key wm_key;
struct brw_wm_prog_key wm_key;
brw_blorp_init_wm_prog_key(&wm_key);
- struct brw_blorp_prog_data prog_data;
+ struct brw_wm_prog_data prog_data;
unsigned program_size;
const unsigned *program =
blorp_compile_fs(blorp, mem_ctx, b.shader, &wm_key, use_replicated_data,
for (unsigned i = 0; i < max_num_varyings; i++) {
const gl_varying_slot attr = VARYING_SLOT_VAR0 + i;
- if (!(params->wm_prog_data->inputs_read & (1ull << attr)))
+ const int input_index = params->wm_prog_data->urb_setup[attr];
+ if (input_index < 0)
continue;
memcpy(inputs, inputs_src + i * 4, vec4_size_in_bytes);
blorp_emit_sf_config(struct blorp_batch *batch,
const struct blorp_params *params)
{
- const struct brw_blorp_prog_data *prog_data = params->wm_prog_data;
+ const struct brw_wm_prog_data *prog_data = params->wm_prog_data;
/* 3DSTATE_SF
*
blorp_emit_ps_config(struct blorp_batch *batch,
const struct blorp_params *params)
{
- const struct brw_blorp_prog_data *prog_data = params->wm_prog_data;
+ const struct brw_wm_prog_data *prog_data = params->wm_prog_data;
/* Even when thread dispatch is disabled, max threads (dw5.25:31) must be
* nonzero to prevent the GPU from hanging. While the documentation doesn't
if (prog_data) {
ps.DispatchGRFStartRegisterForConstantSetupData0 =
- prog_data->first_curbe_grf_0;
+ prog_data->base.dispatch_grf_start_reg;
ps.DispatchGRFStartRegisterForConstantSetupData2 =
- prog_data->first_curbe_grf_2;
+ prog_data->dispatch_grf_start_reg_2;
ps._8PixelDispatchEnable = prog_data->dispatch_8;
ps._16PixelDispatchEnable = prog_data->dispatch_16;
ps.KernelStartPointer0 = params->wm_prog_kernel;
ps.KernelStartPointer2 =
- params->wm_prog_kernel + prog_data->ksp_offset_2;
+ params->wm_prog_kernel + prog_data->prog_offset_2;
}
/* 3DSTATE_PS expects the number of threads per PSD, which is always 64;
if (prog_data) {
psx.PixelShaderValid = true;
psx.AttributeEnable = prog_data->num_varying_inputs > 0;
- psx.PixelShaderIsPerSample = prog_data->persample_msaa_dispatch;
+ psx.PixelShaderIsPerSample = prog_data->persample_dispatch;
}
if (params->src.enabled)
if (params->dst.surf.samples > 1) {
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
wm.MultisampleDispatchMode =
- (prog_data && prog_data->persample_msaa_dispatch) ?
+ (prog_data && prog_data->persample_dispatch) ?
MSDISPMODE_PERSAMPLE : MSDISPMODE_PERPIXEL;
} else {
wm.MultisampleRasterizationMode = MSRASTMODE_OFF_PIXEL;
if (prog_data) {
ps.DispatchGRFStartRegisterforConstantSetupData0 =
- prog_data->first_curbe_grf_0;
+ prog_data->base.dispatch_grf_start_reg;
ps.DispatchGRFStartRegisterforConstantSetupData2 =
- prog_data->first_curbe_grf_2;
+ prog_data->dispatch_grf_start_reg_2;
ps.KernelStartPointer0 = params->wm_prog_kernel;
ps.KernelStartPointer2 =
- params->wm_prog_kernel + prog_data->ksp_offset_2;
+ params->wm_prog_kernel + prog_data->prog_offset_2;
ps._8PixelDispatchEnable = prog_data->dispatch_8;
ps._16PixelDispatchEnable = prog_data->dispatch_16;
wm.ThreadDispatchEnable = true;
wm.DispatchGRFStartRegisterforConstantSetupData0 =
- prog_data->first_curbe_grf_0;
+ prog_data->base.dispatch_grf_start_reg;
wm.DispatchGRFStartRegisterforConstantSetupData2 =
- prog_data->first_curbe_grf_2;
+ prog_data->dispatch_grf_start_reg_2;
wm.KernelStartPointer0 = params->wm_prog_kernel;
wm.KernelStartPointer2 =
- params->wm_prog_kernel + prog_data->ksp_offset_2;
+ params->wm_prog_kernel + prog_data->prog_offset_2;
wm._8PixelDispatchEnable = prog_data->dispatch_8;
wm._16PixelDispatchEnable = prog_data->dispatch_16;
if (params->dst.surf.samples > 1) {
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
wm.MultisampleDispatchMode =
- (prog_data && prog_data->persample_msaa_dispatch) ?
+ (prog_data && prog_data->persample_dispatch) ?
MSDISPMODE_PERSAMPLE : MSDISPMODE_PERPIXEL;
} else {
wm.MultisampleRasterizationMode = MSRASTMODE_OFF_PIXEL;
uint32_t pad[1];
};
-struct brw_blorp_prog_data
-{
- bool dispatch_8;
- bool dispatch_16;
-
- uint8_t first_curbe_grf_0;
- uint8_t first_curbe_grf_2;
-
- uint32_t ksp_offset_2;
-
- /**
- * True if the WM program should be run in MSDISPMODE_PERSAMPLE with more
- * than one sample per pixel.
- */
- bool persample_msaa_dispatch;
-
- /**
- * Mask of which FS inputs are marked flat by the shader source. This is
- * needed for setting up 3DSTATE_SF/SBE.
- */
- uint32_t flat_inputs;
- unsigned num_varying_inputs;
- uint64_t inputs_read;
-};
-
static inline unsigned
-brw_blorp_get_urb_length(const struct brw_blorp_prog_data *prog_data)
+brw_blorp_get_urb_length(const struct brw_wm_prog_data *prog_data)
{
if (prog_data == NULL)
return 1;
unsigned num_draw_buffers;
unsigned num_layers;
uint32_t wm_prog_kernel;
- struct brw_blorp_prog_data *wm_prog_data;
+ struct brw_wm_prog_data *wm_prog_data;
};
void blorp_params_init(struct blorp_params *params);
struct nir_shader *nir,
const struct brw_wm_prog_key *wm_key,
bool use_repclear,
- struct brw_blorp_prog_data *prog_data,
+ struct brw_wm_prog_data *wm_prog_data,
unsigned *program_size);
/** \} */