[Mesa-dev] [PATCH 7/8] i965/vs: Enable SPF when the shader contains no control flow.
Chia-I Wu
olvaffe at gmail.com
Tue May 6 19:14:11 PDT 2014
On Wed, May 7, 2014 at 9:38 AM, Matt Turner <mattst88 at gmail.com> wrote:
> ---
> src/mesa/drivers/dri/i965/gen6_vs_state.c | 3 ++-
> src/mesa/drivers/dri/i965/gen7_vs_state.c | 3 ++-
> src/mesa/drivers/dri/i965/gen8_vs_state.c | 3 ++-
> 3 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> index 0af87d1..bdfb9b5 100644
> --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
> @@ -167,7 +167,8 @@ upload_vs_state(struct brw_context *brw)
> OUT_BATCH(floating_point_mode |
> ((ALIGN(stage_state->sampler_count, 4)/4) << GEN6_VS_SAMPLER_COUNT_SHIFT) |
> ((brw->vs.prog_data->base.base.binding_table.size_bytes / 4) <<
> - GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
> + GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT) |
> + (!brw->vs.prog_data->base.has_control_flow ? GEN6_VS_SPF_MODE : 0));
The doc says bit 31 is "Single Vertex Dispatch". When this bit is
set, I vaguely remember VS_INVOCATION_COUNT does get doubled for the
same workload, and the performance is hurt.
>
> if (brw->vs.prog_data->base.total_scratch) {
> OUT_RELOC(stage_state->scratch_bo,
> diff --git a/src/mesa/drivers/dri/i965/gen7_vs_state.c b/src/mesa/drivers/dri/i965/gen7_vs_state.c
> index b5fc871..f9c9abc 100644
> --- a/src/mesa/drivers/dri/i965/gen7_vs_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_vs_state.c
> @@ -97,7 +97,8 @@ upload_vs_state(struct brw_context *brw)
> ((ALIGN(stage_state->sampler_count, 4)/4) <<
> GEN6_VS_SAMPLER_COUNT_SHIFT) |
> ((brw->vs.prog_data->base.base.binding_table.size_bytes / 4) <<
> - GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
> + GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT) |
> + (!brw->vs.prog_data->base.has_control_flow ? GEN6_VS_SPF_MODE : 0));
>
> if (brw->vs.prog_data->base.total_scratch) {
> OUT_RELOC(stage_state->scratch_bo,
> diff --git a/src/mesa/drivers/dri/i965/gen8_vs_state.c b/src/mesa/drivers/dri/i965/gen8_vs_state.c
> index 373cfe4..a83d78b 100644
> --- a/src/mesa/drivers/dri/i965/gen8_vs_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_vs_state.c
> @@ -85,7 +85,8 @@ upload_vs_state(struct brw_context *brw)
> ((ALIGN(stage_state->sampler_count, 4) / 4) <<
> GEN6_VS_SAMPLER_COUNT_SHIFT) |
> ((prog_data->base.binding_table.size_bytes / 4) <<
> - GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
> + GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT) |
> + (!brw->vs.prog_data->base.has_control_flow ? GEN6_VS_SPF_MODE : 0));
>
> if (prog_data->total_scratch) {
> OUT_RELOC64(stage_state->scratch_bo,
> --
> 1.8.3.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
olv at LunarG.com
More information about the mesa-dev
mailing list