From: Kristian Høgsberg Date: Mon, 7 Jul 2014 22:00:46 +0000 (-0700) Subject: i965: Add context flag to disable the viewport transform X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff7a2fc322a0ae0a36a976444b7506e9313ac630;p=mesa.git i965: Add context flag to disable the viewport transform This lets us disable the viewport transform, which will be useful for emitting 3DPRIM_RECTLIST. Signed-off-by: Kristian Høgsberg Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6f621e0db42..97790a2aa4b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -757,6 +757,7 @@ brwCreateContext(gl_api api, brw->prim_restart.in_progress = false; brw->prim_restart.enable_cut_index = false; brw->gs.enabled = false; + brw->sf.viewport_transform_enable = true; ctx->VertexProgram._MaintainTnlProgram = true; ctx->FragmentProgram._MaintainTexEnvProgram = true; diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index f84ced9f9d0..48494082831 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1238,6 +1238,7 @@ struct brw_context uint32_t prog_offset; uint32_t state_offset; uint32_t vp_offset; + bool viewport_transform_enable; } sf; struct { diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index 20c00a61057..843507eb32e 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -241,9 +241,10 @@ upload_sf_state(struct brw_context *brw) uint32_t point_sprite_origin; dw1 = GEN6_SF_SWIZZLE_ENABLE | num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT; + dw2 = GEN6_SF_STATISTICS_ENABLE; - dw2 = GEN6_SF_STATISTICS_ENABLE | - GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; + if (brw->sf.viewport_transform_enable) + dw2 |= GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; dw3 = 0; dw4 = 0; diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c index 6135b275425..4badc82b9be 100644 --- a/src/mesa/drivers/dri/i965/gen7_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c @@ -109,8 +109,10 @@ upload_sf_state(struct brw_context *brw) bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); bool multisampled_fbo = ctx->DrawBuffer->Visual.samples > 1; - dw1 = GEN6_SF_STATISTICS_ENABLE | - GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; + dw1 = GEN6_SF_STATISTICS_ENABLE; + + if (brw->sf.viewport_transform_enable) + dw1 |= GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; /* _NEW_BUFFERS */ dw1 |= (brw_depthbuffer_format(brw) << GEN7_SF_DEPTH_BUFFER_SURFACE_FORMAT_SHIFT); diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c index 8d8b00dd3ea..4263eaf829a 100644 --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c @@ -117,7 +117,10 @@ upload_sf(struct brw_context *brw) uint32_t dw1 = 0, dw2 = 0, dw3 = 0; float point_size; - dw1 = GEN6_SF_STATISTICS_ENABLE | GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; + dw1 = GEN6_SF_STATISTICS_ENABLE; + + if (brw->sf.viewport_transform_enable) + dw1 |= GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; /* _NEW_LINE */ uint32_t line_width_u3_7 = U_FIXED(CLAMP(ctx->Line.Width, 0.0, 7.99), 7);