intel/blorp: Make the number of samples an explicit parameter
Previously, we always inferred it from params->dst which meant that references to params->dst were scattered all throughout the state upload code. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
parent
6614234fc9
commit
1acebeb191
|
@ -141,6 +141,7 @@ void
|
|||
blorp_params_init(struct blorp_params *params)
|
||||
{
|
||||
memset(params, 0, sizeof(*params));
|
||||
params->num_samples = 1;
|
||||
params->num_draw_buffers = 1;
|
||||
params->num_layers = 1;
|
||||
}
|
||||
|
@ -265,6 +266,7 @@ blorp_gen6_hiz_op(struct blorp_batch *batch,
|
|||
params.dst.surf.samples = params.depth.surf.samples;
|
||||
params.dst.surf.logical_level0_px = params.depth.surf.logical_level0_px;
|
||||
params.depth_format = isl_format_get_depth_format(surf->surf->format, false);
|
||||
params.num_samples = params.depth.surf.samples;
|
||||
|
||||
batch->blorp->exec(batch, ¶ms);
|
||||
}
|
||||
|
|
|
@ -1609,6 +1609,8 @@ do_blorp_blit(struct blorp_batch *batch,
|
|||
wm_prog_key->persample_msaa_dispatch = true;
|
||||
}
|
||||
|
||||
params->num_samples = params->dst.surf.samples;
|
||||
|
||||
if (params->src.tile_x_sa || params->src.tile_y_sa) {
|
||||
assert(wm_prog_key->need_src_offset);
|
||||
surf_get_intratile_offset_px(¶ms->src,
|
||||
|
|
|
@ -234,6 +234,7 @@ blorp_fast_clear(struct blorp_batch *batch,
|
|||
|
||||
brw_blorp_surface_info_init(batch->blorp, ¶ms.dst, surf, level,
|
||||
start_layer, format, true);
|
||||
params.num_samples = params.dst.surf.samples;
|
||||
|
||||
batch->blorp->exec(batch, ¶ms);
|
||||
}
|
||||
|
@ -293,6 +294,8 @@ blorp_clear(struct blorp_batch *batch,
|
|||
start_layer, format, true);
|
||||
params.dst.view.swizzle = swizzle;
|
||||
|
||||
params.num_samples = params.dst.surf.samples;
|
||||
|
||||
/* We may be restricted on the number of layers we can bind at any one
|
||||
* time. In particular, Sandy Bridge has a maximum number of layers of
|
||||
* 512 but a maximum 3D texture size is much larger.
|
||||
|
@ -338,6 +341,8 @@ blorp_clear_depth_stencil(struct blorp_batch *batch,
|
|||
params.stencil.surf.logical_level0_px;
|
||||
params.dst.view = params.depth.view;
|
||||
|
||||
params.num_samples = params.stencil.surf.samples;
|
||||
|
||||
/* We may be restricted on the number of layers we can bind at any
|
||||
* one time. In particular, Sandy Bridge has a maximum number of
|
||||
* layers of 512 but a maximum 3D texture size is much larger.
|
||||
|
@ -359,6 +364,8 @@ blorp_clear_depth_stencil(struct blorp_batch *batch,
|
|||
params.depth.surf.logical_level0_px;
|
||||
params.dst.view = params.depth.view;
|
||||
|
||||
params.num_samples = params.depth.surf.samples;
|
||||
|
||||
/* We may be restricted on the number of layers we can bind at any
|
||||
* one time. In particular, Sandy Bridge has a maximum number of
|
||||
* layers of 512 but a maximum 3D texture size is much larger.
|
||||
|
|
|
@ -456,7 +456,7 @@ blorp_emit_sf_config(struct blorp_batch *batch,
|
|||
sf.FrontFaceFillMode = FILL_MODE_SOLID;
|
||||
sf.BackFaceFillMode = FILL_MODE_SOLID;
|
||||
|
||||
sf.MultisampleRasterizationMode = params->dst.surf.samples > 1 ?
|
||||
sf.MultisampleRasterizationMode = params->num_samples > 1 ?
|
||||
MSRASTMODE_ON_PATTERN : MSRASTMODE_OFF_PIXEL;
|
||||
|
||||
#if GEN_GEN == 7
|
||||
|
@ -482,7 +482,7 @@ blorp_emit_sf_config(struct blorp_batch *batch,
|
|||
sf.FrontFaceFillMode = FILL_MODE_SOLID;
|
||||
sf.BackFaceFillMode = FILL_MODE_SOLID;
|
||||
|
||||
sf.MultisampleRasterizationMode = params->dst.surf.samples > 1 ?
|
||||
sf.MultisampleRasterizationMode = params->num_samples > 1 ?
|
||||
MSRASTMODE_ON_PATTERN : MSRASTMODE_OFF_PIXEL;
|
||||
|
||||
sf.VertexURBEntryReadOffset = 1;
|
||||
|
@ -610,7 +610,7 @@ blorp_emit_ps_config(struct blorp_batch *batch,
|
|||
if (params->src.enabled)
|
||||
wm.PixelShaderKillsPixel = true;
|
||||
|
||||
if (params->dst.surf.samples > 1) {
|
||||
if (params->num_samples > 1) {
|
||||
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
|
||||
wm.MultisampleDispatchMode =
|
||||
(prog_data && prog_data->persample_dispatch) ?
|
||||
|
@ -712,7 +712,7 @@ blorp_emit_ps_config(struct blorp_batch *batch,
|
|||
wm.PixelShaderKillsPixel = true; /* TODO: temporarily smash on */
|
||||
}
|
||||
|
||||
if (params->dst.surf.samples > 1) {
|
||||
if (params->num_samples > 1) {
|
||||
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
|
||||
wm.MultisampleDispatchMode =
|
||||
(prog_data && prog_data->persample_dispatch) ?
|
||||
|
@ -1165,10 +1165,8 @@ static void
|
|||
blorp_emit_3dstate_multisample(struct blorp_batch *batch,
|
||||
const struct blorp_params *params)
|
||||
{
|
||||
const unsigned samples = params->dst.surf.samples;
|
||||
|
||||
blorp_emit(batch, GENX(3DSTATE_MULTISAMPLE), ms) {
|
||||
ms.NumberofMultisamples = __builtin_ffs(samples) - 1;
|
||||
ms.NumberofMultisamples = __builtin_ffs(params->num_samples) - 1;
|
||||
|
||||
#if GEN_GEN >= 8
|
||||
/* The PRM says that this bit is valid only for DX9:
|
||||
|
@ -1181,7 +1179,7 @@ blorp_emit_3dstate_multisample(struct blorp_batch *batch,
|
|||
#elif GEN_GEN >= 7
|
||||
ms.PixelLocation = PIXLOC_CENTER;
|
||||
|
||||
switch (samples) {
|
||||
switch (params->num_samples) {
|
||||
case 1:
|
||||
GEN_SAMPLE_POS_1X(ms.Sample);
|
||||
break;
|
||||
|
@ -1303,7 +1301,7 @@ blorp_exec(struct blorp_batch *batch, const struct blorp_params *params)
|
|||
blorp_emit_3dstate_multisample(batch, params);
|
||||
|
||||
blorp_emit(batch, GENX(3DSTATE_SAMPLE_MASK), mask) {
|
||||
mask.SampleMask = (1 << params->dst.surf.samples) - 1;
|
||||
mask.SampleMask = (1 << params->num_samples) - 1;
|
||||
}
|
||||
|
||||
/* From the BSpec, 3D Pipeline > Geometry > Vertex Shader > State,
|
||||
|
|
|
@ -169,6 +169,7 @@ struct blorp_params
|
|||
enum blorp_fast_clear_op fast_clear_op;
|
||||
bool color_write_disable[4];
|
||||
struct brw_blorp_wm_inputs wm_inputs;
|
||||
unsigned num_samples;
|
||||
unsigned num_draw_buffers;
|
||||
unsigned num_layers;
|
||||
uint32_t wm_prog_kernel;
|
||||
|
|
Loading…
Reference in New Issue