[Mesa-dev] [PATCH 1/3] mesa: main: use _NEW_MULTISAMPLE for conservative rasterization state

Marek Olšák maraeo at gmail.com
Fri Dec 9 22:55:27 UTC 2016


Hi,

If the state change doesn't require any state validation in mesa/main,
it shouldn't flag _NEW_MULTISAMPLE. Instead, a new flag should be
added to gl_driver_flags and used here. The final code:

FLUSH_VERTICES(ctx, 0);
ctx->NewDriverState |= ctx->DriverFlags.NewIntelConservativeRasterization;

In your driver, you can set:
cts->DriverFlags.NewIntelConservativeRasterization = BRW_/*whatever
updates that state*/;

Marek

On Thu, Dec 8, 2016 at 11:59 AM, Lionel Landwerlin
<lionel.g.landwerlin at intel.com> wrote:
> Suggested by Ilia.
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> Cc: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/mesa/drivers/dri/i965/gen8_ps_state.c | 5 ++---
>  src/mesa/drivers/dri/i965/gen8_sf_state.c | 2 +-
>  src/mesa/main/enable.c                    | 2 +-
>  3 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c b/src/mesa/drivers/dri/i965/gen8_ps_state.c
> index e43192d..24a062e 100644
> --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c
> @@ -53,7 +53,7 @@ gen8_upload_ps_extra(struct brw_context *brw,
>     if (prog_data->persample_dispatch)
>        dw1 |= GEN8_PSX_SHADER_IS_PER_SAMPLE;
>
> -   /* _NEW_POLYGON */
> +   /* _NEW_MULTISAMPLE */
>     if (prog_data->uses_sample_mask) {
>        if (brw->gen >= 9) {
>           if (prog_data->post_depth_coverage)
> @@ -291,8 +291,7 @@ upload_ps_state(struct brw_context *brw)
>
>  const struct brw_tracked_state gen8_ps_state = {
>     .dirty = {
> -      .mesa  = _NEW_MULTISAMPLE |
> -               _NEW_POLYGON,
> +      .mesa  = _NEW_MULTISAMPLE,
>        .brw   = BRW_NEW_BATCH |
>                 BRW_NEW_BLORP |
>                 BRW_NEW_FS_PROG_DATA,
> diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c
> index afe7b52..f227f33 100644
> --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c
> @@ -319,7 +319,7 @@ upload_raster(struct brw_context *brw)
>        }
>     }
>
> -   /* _NEW_POLYGON */
> +   /* _NEW_MULTISAMPLE */
>     if (ctx->IntelConservativeRasterization) {
>        if (brw->gen >= 9)
>           dw1 |= GEN9_RASTER_CONSERVATIVE_RASTERIZATION_ENABLE;
> diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
> index c9f10ab..8440c62 100644
> --- a/src/mesa/main/enable.c
> +++ b/src/mesa/main/enable.c
> @@ -444,7 +444,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
>              goto invalid_enum_error;
>           if (ctx->IntelConservativeRasterization == state)
>              return;
> -         FLUSH_VERTICES(ctx, _NEW_POLYGON);
> +         FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
>           ctx->IntelConservativeRasterization = state;
>           break;
>        case GL_COLOR_LOGIC_OP:
> --
> 2.10.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list