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:
@@ -141,6 +141,7 @@ void
|
|||||||
blorp_params_init(struct blorp_params *params)
|
blorp_params_init(struct blorp_params *params)
|
||||||
{
|
{
|
||||||
memset(params, 0, sizeof(*params));
|
memset(params, 0, sizeof(*params));
|
||||||
|
params->num_samples = 1;
|
||||||
params->num_draw_buffers = 1;
|
params->num_draw_buffers = 1;
|
||||||
params->num_layers = 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.samples = params.depth.surf.samples;
|
||||||
params.dst.surf.logical_level0_px = params.depth.surf.logical_level0_px;
|
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.depth_format = isl_format_get_depth_format(surf->surf->format, false);
|
||||||
|
params.num_samples = params.depth.surf.samples;
|
||||||
|
|
||||||
batch->blorp->exec(batch, ¶ms);
|
batch->blorp->exec(batch, ¶ms);
|
||||||
}
|
}
|
||||||
|
@@ -1609,6 +1609,8 @@ do_blorp_blit(struct blorp_batch *batch,
|
|||||||
wm_prog_key->persample_msaa_dispatch = true;
|
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) {
|
if (params->src.tile_x_sa || params->src.tile_y_sa) {
|
||||||
assert(wm_prog_key->need_src_offset);
|
assert(wm_prog_key->need_src_offset);
|
||||||
surf_get_intratile_offset_px(¶ms->src,
|
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,
|
brw_blorp_surface_info_init(batch->blorp, ¶ms.dst, surf, level,
|
||||||
start_layer, format, true);
|
start_layer, format, true);
|
||||||
|
params.num_samples = params.dst.surf.samples;
|
||||||
|
|
||||||
batch->blorp->exec(batch, ¶ms);
|
batch->blorp->exec(batch, ¶ms);
|
||||||
}
|
}
|
||||||
@@ -293,6 +294,8 @@ blorp_clear(struct blorp_batch *batch,
|
|||||||
start_layer, format, true);
|
start_layer, format, true);
|
||||||
params.dst.view.swizzle = swizzle;
|
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
|
/* 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
|
* time. In particular, Sandy Bridge has a maximum number of layers of
|
||||||
* 512 but a maximum 3D texture size is much larger.
|
* 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.stencil.surf.logical_level0_px;
|
||||||
params.dst.view = params.depth.view;
|
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
|
/* 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
|
* one time. In particular, Sandy Bridge has a maximum number of
|
||||||
* layers of 512 but a maximum 3D texture size is much larger.
|
* 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.depth.surf.logical_level0_px;
|
||||||
params.dst.view = params.depth.view;
|
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
|
/* 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
|
* one time. In particular, Sandy Bridge has a maximum number of
|
||||||
* layers of 512 but a maximum 3D texture size is much larger.
|
* 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.FrontFaceFillMode = FILL_MODE_SOLID;
|
||||||
sf.BackFaceFillMode = 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;
|
MSRASTMODE_ON_PATTERN : MSRASTMODE_OFF_PIXEL;
|
||||||
|
|
||||||
#if GEN_GEN == 7
|
#if GEN_GEN == 7
|
||||||
@@ -482,7 +482,7 @@ blorp_emit_sf_config(struct blorp_batch *batch,
|
|||||||
sf.FrontFaceFillMode = FILL_MODE_SOLID;
|
sf.FrontFaceFillMode = FILL_MODE_SOLID;
|
||||||
sf.BackFaceFillMode = 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;
|
MSRASTMODE_ON_PATTERN : MSRASTMODE_OFF_PIXEL;
|
||||||
|
|
||||||
sf.VertexURBEntryReadOffset = 1;
|
sf.VertexURBEntryReadOffset = 1;
|
||||||
@@ -610,7 +610,7 @@ blorp_emit_ps_config(struct blorp_batch *batch,
|
|||||||
if (params->src.enabled)
|
if (params->src.enabled)
|
||||||
wm.PixelShaderKillsPixel = true;
|
wm.PixelShaderKillsPixel = true;
|
||||||
|
|
||||||
if (params->dst.surf.samples > 1) {
|
if (params->num_samples > 1) {
|
||||||
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
|
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
|
||||||
wm.MultisampleDispatchMode =
|
wm.MultisampleDispatchMode =
|
||||||
(prog_data && prog_data->persample_dispatch) ?
|
(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 */
|
wm.PixelShaderKillsPixel = true; /* TODO: temporarily smash on */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params->dst.surf.samples > 1) {
|
if (params->num_samples > 1) {
|
||||||
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
|
wm.MultisampleRasterizationMode = MSRASTMODE_ON_PATTERN;
|
||||||
wm.MultisampleDispatchMode =
|
wm.MultisampleDispatchMode =
|
||||||
(prog_data && prog_data->persample_dispatch) ?
|
(prog_data && prog_data->persample_dispatch) ?
|
||||||
@@ -1165,10 +1165,8 @@ static void
|
|||||||
blorp_emit_3dstate_multisample(struct blorp_batch *batch,
|
blorp_emit_3dstate_multisample(struct blorp_batch *batch,
|
||||||
const struct blorp_params *params)
|
const struct blorp_params *params)
|
||||||
{
|
{
|
||||||
const unsigned samples = params->dst.surf.samples;
|
|
||||||
|
|
||||||
blorp_emit(batch, GENX(3DSTATE_MULTISAMPLE), ms) {
|
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
|
#if GEN_GEN >= 8
|
||||||
/* The PRM says that this bit is valid only for DX9:
|
/* 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
|
#elif GEN_GEN >= 7
|
||||||
ms.PixelLocation = PIXLOC_CENTER;
|
ms.PixelLocation = PIXLOC_CENTER;
|
||||||
|
|
||||||
switch (samples) {
|
switch (params->num_samples) {
|
||||||
case 1:
|
case 1:
|
||||||
GEN_SAMPLE_POS_1X(ms.Sample);
|
GEN_SAMPLE_POS_1X(ms.Sample);
|
||||||
break;
|
break;
|
||||||
@@ -1303,7 +1301,7 @@ blorp_exec(struct blorp_batch *batch, const struct blorp_params *params)
|
|||||||
blorp_emit_3dstate_multisample(batch, params);
|
blorp_emit_3dstate_multisample(batch, params);
|
||||||
|
|
||||||
blorp_emit(batch, GENX(3DSTATE_SAMPLE_MASK), mask) {
|
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,
|
/* From the BSpec, 3D Pipeline > Geometry > Vertex Shader > State,
|
||||||
|
@@ -169,6 +169,7 @@ struct blorp_params
|
|||||||
enum blorp_fast_clear_op fast_clear_op;
|
enum blorp_fast_clear_op fast_clear_op;
|
||||||
bool color_write_disable[4];
|
bool color_write_disable[4];
|
||||||
struct brw_blorp_wm_inputs wm_inputs;
|
struct brw_blorp_wm_inputs wm_inputs;
|
||||||
|
unsigned num_samples;
|
||||||
unsigned num_draw_buffers;
|
unsigned num_draw_buffers;
|
||||||
unsigned num_layers;
|
unsigned num_layers;
|
||||||
uint32_t wm_prog_kernel;
|
uint32_t wm_prog_kernel;
|
||||||
|
Reference in New Issue
Block a user