mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 18:00:10 +01:00
ilo: convert pipe_rasterizer_state to ilo_rasterizer_wm
Add ilo_gpe_init_rasterizer_wm() to construct fixed-function part of 3DSTATE_WM once in create_rasterizer_state().
This commit is contained in:
parent
851202c319
commit
54ab03523b
7 changed files with 141 additions and 62 deletions
|
|
@ -676,7 +676,7 @@ gen6_pipeline_wm(struct ilo_3d_pipeline *p,
|
|||
gen6_wa_pipe_control_wm_max_threads_stall(p);
|
||||
|
||||
p->gen6_3DSTATE_WM(p->dev, fs, num_samplers,
|
||||
&ilo->rasterizer->state, dual_blend, cc_may_kill, p->cp);
|
||||
ilo->rasterizer, dual_blend, cc_may_kill, p->cp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -471,8 +471,7 @@ gen7_pipeline_wm(struct ilo_3d_pipeline *p,
|
|||
if (p->dev->gen == ILO_GEN(7) && session->hw_ctx_changed)
|
||||
gen7_wa_pipe_control_wm_max_threads_stall(p);
|
||||
|
||||
p->gen7_3DSTATE_WM(p->dev,
|
||||
fs, &ilo->rasterizer->state, cc_may_kill, p->cp);
|
||||
p->gen7_3DSTATE_WM(p->dev, fs, ilo->rasterizer, cc_may_kill, p->cp);
|
||||
}
|
||||
|
||||
/* 3DSTATE_BINDING_TABLE_POINTERS_PS */
|
||||
|
|
|
|||
|
|
@ -125,11 +125,19 @@ struct ilo_rasterizer_sf {
|
|||
uint32_t dw_msaa;
|
||||
};
|
||||
|
||||
struct ilo_rasterizer_wm {
|
||||
/* 3DSTATE_WM */
|
||||
uint32_t payload[2];
|
||||
uint32_t dw_msaa_rast;
|
||||
uint32_t dw_msaa_disp;
|
||||
};
|
||||
|
||||
struct ilo_rasterizer_state {
|
||||
struct pipe_rasterizer_state state;
|
||||
|
||||
struct ilo_rasterizer_clip clip;
|
||||
struct ilo_rasterizer_sf sf;
|
||||
struct ilo_rasterizer_wm wm;
|
||||
};
|
||||
|
||||
struct ilo_dsa_state {
|
||||
|
|
@ -291,6 +299,16 @@ ilo_gpe_init_rasterizer_sf(const struct ilo_dev_info *dev,
|
|||
const struct pipe_rasterizer_state *state,
|
||||
struct ilo_rasterizer_sf *sf);
|
||||
|
||||
void
|
||||
ilo_gpe_init_rasterizer_wm_gen6(const struct ilo_dev_info *dev,
|
||||
const struct pipe_rasterizer_state *state,
|
||||
struct ilo_rasterizer_wm *wm);
|
||||
|
||||
void
|
||||
ilo_gpe_init_rasterizer_wm_gen7(const struct ilo_dev_info *dev,
|
||||
const struct pipe_rasterizer_state *state,
|
||||
struct ilo_rasterizer_wm *wm);
|
||||
|
||||
static inline void
|
||||
ilo_gpe_init_rasterizer(const struct ilo_dev_info *dev,
|
||||
const struct pipe_rasterizer_state *state,
|
||||
|
|
@ -298,6 +316,11 @@ ilo_gpe_init_rasterizer(const struct ilo_dev_info *dev,
|
|||
{
|
||||
ilo_gpe_init_rasterizer_clip(dev, state, &rasterizer->clip);
|
||||
ilo_gpe_init_rasterizer_sf(dev, state, &rasterizer->sf);
|
||||
|
||||
if (dev->gen >= ILO_GEN(7))
|
||||
ilo_gpe_init_rasterizer_wm_gen7(dev, state, &rasterizer->wm);
|
||||
else
|
||||
ilo_gpe_init_rasterizer_wm_gen6(dev, state, &rasterizer->wm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -2030,11 +2030,59 @@ gen6_emit_3DSTATE_SF(const struct ilo_dev_info *dev,
|
|||
ilo_cp_end(cp);
|
||||
}
|
||||
|
||||
void
|
||||
ilo_gpe_init_rasterizer_wm_gen6(const struct ilo_dev_info *dev,
|
||||
const struct pipe_rasterizer_state *state,
|
||||
struct ilo_rasterizer_wm *wm)
|
||||
{
|
||||
uint32_t dw5, dw6;
|
||||
|
||||
ILO_GPE_VALID_GEN(dev, 6, 6);
|
||||
|
||||
/* only the FF unit states are set, as in GEN7 */
|
||||
|
||||
dw5 = GEN6_WM_LINE_AA_WIDTH_2_0;
|
||||
|
||||
/* same value as in 3DSTATE_SF */
|
||||
if (state->line_smooth)
|
||||
dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0;
|
||||
|
||||
if (state->poly_stipple_enable)
|
||||
dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE;
|
||||
if (state->line_stipple_enable)
|
||||
dw5 |= GEN6_WM_LINE_STIPPLE_ENABLE;
|
||||
|
||||
dw6 = GEN6_WM_POSITION_ZW_PIXEL |
|
||||
GEN6_WM_MSRAST_OFF_PIXEL |
|
||||
GEN6_WM_MSDISPMODE_PERSAMPLE;
|
||||
|
||||
if (state->bottom_edge_rule)
|
||||
dw6 |= GEN6_WM_POINT_RASTRULE_UPPER_RIGHT;
|
||||
|
||||
/*
|
||||
* assertion that makes sure
|
||||
*
|
||||
* dw6 |= wm->dw_msaa_rast | wm->dw_msaa_disp;
|
||||
*
|
||||
* is valid
|
||||
*/
|
||||
STATIC_ASSERT(GEN6_WM_MSRAST_OFF_PIXEL == 0 &&
|
||||
GEN6_WM_MSDISPMODE_PERSAMPLE == 0);
|
||||
|
||||
wm->dw_msaa_rast =
|
||||
(state->multisample) ? GEN6_WM_MSRAST_ON_PATTERN : 0;
|
||||
wm->dw_msaa_disp = GEN6_WM_MSDISPMODE_PERPIXEL;
|
||||
|
||||
STATIC_ASSERT(Elements(wm->payload) >= 2);
|
||||
wm->payload[0] = dw5;
|
||||
wm->payload[1] = dw6;
|
||||
}
|
||||
|
||||
static void
|
||||
gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev,
|
||||
const struct ilo_shader *fs,
|
||||
int num_samplers,
|
||||
const struct pipe_rasterizer_state *rasterizer,
|
||||
const struct ilo_rasterizer_state *rasterizer,
|
||||
bool dual_blend, bool cc_may_kill,
|
||||
struct ilo_cp *cp)
|
||||
{
|
||||
|
|
@ -2090,8 +2138,10 @@ gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev,
|
|||
dw4 |= GEN6_WM_HIERARCHICAL_DEPTH_RESOLVE;
|
||||
}
|
||||
|
||||
dw5 = (max_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT |
|
||||
GEN6_WM_LINE_AA_WIDTH_2_0;
|
||||
dw5 = rasterizer->wm.payload[0];
|
||||
dw6 = rasterizer->wm.payload[1];
|
||||
|
||||
dw5 |= (max_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT;
|
||||
|
||||
/*
|
||||
* From the Sandy Bridge PRM, volume 2 part 1, page 275:
|
||||
|
|
@ -2145,15 +2195,6 @@ gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev,
|
|||
if (true)
|
||||
dw5 |= GEN6_WM_DISPATCH_ENABLE;
|
||||
|
||||
/* same value as in 3DSTATE_SF */
|
||||
if (rasterizer->line_smooth)
|
||||
dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0;
|
||||
|
||||
if (rasterizer->poly_stipple_enable)
|
||||
dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE;
|
||||
if (rasterizer->line_stipple_enable)
|
||||
dw5 |= GEN6_WM_LINE_STIPPLE_ENABLE;
|
||||
|
||||
if (dual_blend)
|
||||
dw5 |= GEN6_WM_DUAL_SOURCE_BLEND_ENABLE;
|
||||
|
||||
|
|
@ -2162,25 +2203,14 @@ gen6_emit_3DSTATE_WM(const struct ilo_dev_info *dev,
|
|||
else
|
||||
dw5 |= GEN6_WM_8_DISPATCH_ENABLE;
|
||||
|
||||
dw6 = fs->in.count << GEN6_WM_NUM_SF_OUTPUTS_SHIFT |
|
||||
GEN6_WM_POSOFFSET_NONE |
|
||||
GEN6_WM_POSITION_ZW_PIXEL |
|
||||
fs->in.barycentric_interpolation_mode <<
|
||||
GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT;
|
||||
|
||||
if (rasterizer->bottom_edge_rule)
|
||||
dw6 |= GEN6_WM_POINT_RASTRULE_UPPER_RIGHT;
|
||||
dw6 |= fs->in.count << GEN6_WM_NUM_SF_OUTPUTS_SHIFT |
|
||||
GEN6_WM_POSOFFSET_NONE |
|
||||
fs->in.barycentric_interpolation_mode <<
|
||||
GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT;
|
||||
|
||||
if (num_samples > 1) {
|
||||
if (rasterizer->multisample)
|
||||
dw6 |= GEN6_WM_MSRAST_ON_PATTERN;
|
||||
else
|
||||
dw6 |= GEN6_WM_MSRAST_OFF_PIXEL;
|
||||
dw6 |= GEN6_WM_MSDISPMODE_PERPIXEL;
|
||||
}
|
||||
else {
|
||||
dw6 |= GEN6_WM_MSRAST_OFF_PIXEL |
|
||||
GEN6_WM_MSDISPMODE_PERSAMPLE;
|
||||
dw6 |= rasterizer->wm.dw_msaa_rast |
|
||||
rasterizer->wm.dw_msaa_disp;
|
||||
}
|
||||
|
||||
ilo_cp_begin(cp, cmd_len);
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ typedef void
|
|||
(*ilo_gpe_gen6_3DSTATE_WM)(const struct ilo_dev_info *dev,
|
||||
const struct ilo_shader *fs,
|
||||
int num_samplers,
|
||||
const struct pipe_rasterizer_state *rasterizer,
|
||||
const struct ilo_rasterizer_state *rasterizer,
|
||||
bool dual_blend, bool cc_may_kill,
|
||||
struct ilo_cp *cp);
|
||||
|
||||
|
|
|
|||
|
|
@ -194,10 +194,57 @@ gen7_emit_3DSTATE_SF(const struct ilo_dev_info *dev,
|
|||
ilo_cp_end(cp);
|
||||
}
|
||||
|
||||
void
|
||||
ilo_gpe_init_rasterizer_wm_gen7(const struct ilo_dev_info *dev,
|
||||
const struct pipe_rasterizer_state *state,
|
||||
struct ilo_rasterizer_wm *wm)
|
||||
{
|
||||
uint32_t dw1, dw2;
|
||||
|
||||
ILO_GPE_VALID_GEN(dev, 7, 7);
|
||||
|
||||
dw1 = GEN7_WM_POSITION_ZW_PIXEL |
|
||||
GEN7_WM_LINE_AA_WIDTH_2_0 |
|
||||
GEN7_WM_MSRAST_OFF_PIXEL;
|
||||
|
||||
/* same value as in 3DSTATE_SF */
|
||||
if (state->line_smooth)
|
||||
dw1 |= GEN7_WM_LINE_END_CAP_AA_WIDTH_1_0;
|
||||
|
||||
if (state->poly_stipple_enable)
|
||||
dw1 |= GEN7_WM_POLYGON_STIPPLE_ENABLE;
|
||||
if (state->line_stipple_enable)
|
||||
dw1 |= GEN7_WM_LINE_STIPPLE_ENABLE;
|
||||
|
||||
if (state->bottom_edge_rule)
|
||||
dw1 |= GEN7_WM_POINT_RASTRULE_UPPER_RIGHT;
|
||||
|
||||
dw2 = GEN7_WM_MSDISPMODE_PERSAMPLE;
|
||||
|
||||
/*
|
||||
* assertion that makes sure
|
||||
*
|
||||
* dw1 |= wm->dw_msaa_rast;
|
||||
* dw2 |= wm->dw_msaa_disp;
|
||||
*
|
||||
* is valid
|
||||
*/
|
||||
STATIC_ASSERT(GEN7_WM_MSRAST_OFF_PIXEL == 0 &&
|
||||
GEN7_WM_MSDISPMODE_PERSAMPLE == 0);
|
||||
|
||||
wm->dw_msaa_rast =
|
||||
(state->multisample) ? GEN7_WM_MSRAST_ON_PATTERN : 0;
|
||||
wm->dw_msaa_disp = GEN7_WM_MSDISPMODE_PERPIXEL;
|
||||
|
||||
STATIC_ASSERT(Elements(wm->payload) >= 2);
|
||||
wm->payload[0] = dw1;
|
||||
wm->payload[1] = dw2;
|
||||
}
|
||||
|
||||
static void
|
||||
gen7_emit_3DSTATE_WM(const struct ilo_dev_info *dev,
|
||||
const struct ilo_shader *fs,
|
||||
const struct pipe_rasterizer_state *rasterizer,
|
||||
const struct ilo_rasterizer_state *rasterizer,
|
||||
bool cc_may_kill,
|
||||
struct ilo_cp *cp)
|
||||
{
|
||||
|
|
@ -208,8 +255,11 @@ gen7_emit_3DSTATE_WM(const struct ilo_dev_info *dev,
|
|||
|
||||
ILO_GPE_VALID_GEN(dev, 7, 7);
|
||||
|
||||
dw1 = GEN7_WM_STATISTICS_ENABLE |
|
||||
GEN7_WM_LINE_AA_WIDTH_2_0;
|
||||
/* see ilo_gpe_init_rasterizer_wm() */
|
||||
dw1 = rasterizer->wm.payload[0];
|
||||
dw2 = rasterizer->wm.payload[1];
|
||||
|
||||
dw1 |= GEN7_WM_STATISTICS_ENABLE;
|
||||
|
||||
if (false) {
|
||||
dw1 |= GEN7_WM_DEPTH_CLEAR;
|
||||
|
|
@ -269,32 +319,9 @@ gen7_emit_3DSTATE_WM(const struct ilo_dev_info *dev,
|
|||
GEN7_WM_KILL_ENABLE;
|
||||
}
|
||||
|
||||
dw1 |= GEN7_WM_POSITION_ZW_PIXEL;
|
||||
|
||||
/* same value as in 3DSTATE_SF */
|
||||
if (rasterizer->line_smooth)
|
||||
dw1 |= GEN7_WM_LINE_END_CAP_AA_WIDTH_1_0;
|
||||
|
||||
if (rasterizer->poly_stipple_enable)
|
||||
dw1 |= GEN7_WM_POLYGON_STIPPLE_ENABLE;
|
||||
if (rasterizer->line_stipple_enable)
|
||||
dw1 |= GEN7_WM_LINE_STIPPLE_ENABLE;
|
||||
|
||||
if (rasterizer->bottom_edge_rule)
|
||||
dw1 |= GEN7_WM_POINT_RASTRULE_UPPER_RIGHT;
|
||||
|
||||
if (num_samples > 1) {
|
||||
if (rasterizer->multisample)
|
||||
dw1 |= GEN7_WM_MSRAST_ON_PATTERN;
|
||||
else
|
||||
dw1 |= GEN7_WM_MSRAST_OFF_PIXEL;
|
||||
|
||||
dw2 = GEN7_WM_MSDISPMODE_PERPIXEL;
|
||||
}
|
||||
else {
|
||||
dw1 |= GEN7_WM_MSRAST_OFF_PIXEL;
|
||||
|
||||
dw2 = GEN7_WM_MSDISPMODE_PERSAMPLE;
|
||||
dw1 |= rasterizer->wm.dw_msaa_rast;
|
||||
dw2 |= rasterizer->wm.dw_msaa_disp;
|
||||
}
|
||||
|
||||
ilo_cp_begin(cp, cmd_len);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ typedef void
|
|||
typedef void
|
||||
(*ilo_gpe_gen7_3DSTATE_WM)(const struct ilo_dev_info *dev,
|
||||
const struct ilo_shader *fs,
|
||||
const struct pipe_rasterizer_state *rasterizer,
|
||||
const struct ilo_rasterizer_state *rasterizer,
|
||||
bool cc_may_kill,
|
||||
struct ilo_cp *cp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue