[Mesa-dev] [PATCH v2 18/17 (was 10/17)] i965/vs: Move use_legacy_snorm_formula into the shader key
Pohjolainen, Topi
topi.pohjolainen at intel.com
Wed Oct 14 02:29:25 PDT 2015
On Sat, Oct 10, 2015 at 08:05:59AM -0700, Jason Ekstrand wrote:
> This is really an input into the shader compiler so it kind of makes sense
> in the key. Also, given where it's placed into the key, it doesn't
> actually make it any bigger.
>
> v2 (Jason Ekstrand):
> - Rebase on top of the compiler clean-ups so the affects of this patch
> can better be studied without being in the middle of a series.
I guess you are planning to check the fixed hangs before pushing. The patch
itself looks good:
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
> src/mesa/drivers/dri/i965/brw_compiler.h | 3 ++-
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 4 +---
> src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 9 ++++-----
> src/mesa/drivers/dri/i965/brw_vs.c | 3 ++-
> src/mesa/drivers/dri/i965/brw_vs.h | 5 +----
> 5 files changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
> index 4bc1caa..153e381 100644
> --- a/src/mesa/drivers/dri/i965/brw_compiler.h
> +++ b/src/mesa/drivers/dri/i965/brw_compiler.h
> @@ -161,6 +161,8 @@ struct brw_vs_prog_key {
>
> bool clamp_vertex_color:1;
>
> + bool use_legacy_snorm_formula:1;
> +
> /**
> * How many user clipping planes are being uploaded to the vertex shader as
> * push constants.
> @@ -585,7 +587,6 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
> struct brw_vs_prog_data *prog_data,
> const struct nir_shader *shader,
> gl_clip_plane *clip_planes,
> - bool use_legacy_snorm_formula,
> int shader_time_index,
> unsigned *final_assembly_size,
> char **error_str);
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index 8636323..5336590 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -1943,7 +1943,6 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
> struct brw_vs_prog_data *prog_data,
> const nir_shader *shader,
> gl_clip_plane *clip_planes,
> - bool use_legacy_snorm_formula,
> int shader_time_index,
> unsigned *final_assembly_size,
> char **error_str)
> @@ -1982,8 +1981,7 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
> prog_data->base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT;
>
> vec4_vs_visitor v(compiler, log_data, key, prog_data,
> - shader, clip_planes, mem_ctx,
> - shader_time_index, use_legacy_snorm_formula);
> + shader, clip_planes, mem_ctx, shader_time_index);
> if (!v.run()) {
> if (error_str)
> *error_str = ralloc_strdup(mem_ctx, v.fail_msg);
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
> index 485a80e..9cf04cd 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
> @@ -77,7 +77,8 @@ vec4_vs_visitor::emit_prolog()
> /* ES 3.0 has different rules for converting signed normalized
> * fixed-point numbers than desktop GL.
> */
> - if ((wa_flags & BRW_ATTRIB_WA_SIGN) && !use_legacy_snorm_formula) {
> + if ((wa_flags & BRW_ATTRIB_WA_SIGN) &&
> + !key->use_legacy_snorm_formula) {
> /* According to equation 2.2 of the ES 3.0 specification,
> * signed normalization conversion is done by:
> *
> @@ -304,14 +305,12 @@ vec4_vs_visitor::vec4_vs_visitor(const struct brw_compiler *compiler,
> const nir_shader *shader,
> gl_clip_plane *clip_planes,
> void *mem_ctx,
> - int shader_time_index,
> - bool use_legacy_snorm_formula)
> + int shader_time_index)
> : vec4_visitor(compiler, log_data, &key->tex, &vs_prog_data->base, shader,
> mem_ctx, false /* no_spills */, shader_time_index),
> key(key),
> vs_prog_data(vs_prog_data),
> - clip_planes(clip_planes),
> - use_legacy_snorm_formula(use_legacy_snorm_formula)
> + clip_planes(clip_planes)
> {
> }
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
> index 9c9b83b..3b3eb8b 100644
> --- a/src/mesa/drivers/dri/i965/brw_vs.c
> +++ b/src/mesa/drivers/dri/i965/brw_vs.c
> @@ -184,7 +184,6 @@ brw_codegen_vs_prog(struct brw_context *brw,
> program = brw_compile_vs(brw->intelScreen->compiler, brw, mem_ctx, key,
> &prog_data, vp->program.Base.nir,
> brw_select_clip_planes(&brw->ctx),
> - !_mesa_is_gles3(&brw->ctx),
> st_index, &program_size, &error_str);
> if (program == NULL) {
> if (prog) {
> @@ -341,6 +340,8 @@ brw_vs_populate_key(struct brw_context *brw,
> key->clamp_vertex_color = ctx->Light._ClampVertexColor;
> }
>
> + key->use_legacy_snorm_formula = !_mesa_is_gles3(&brw->ctx);
> +
> /* _NEW_POINT */
> if (brw->gen < 6 && ctx->Point.PointSprite) {
> for (i = 0; i < 8; i++) {
> diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
> index bcb5e7b..e8be713 100644
> --- a/src/mesa/drivers/dri/i965/brw_vs.h
> +++ b/src/mesa/drivers/dri/i965/brw_vs.h
> @@ -83,8 +83,7 @@ public:
> const nir_shader *shader,
> gl_clip_plane *clip_planes,
> void *mem_ctx,
> - int shader_time_index,
> - bool use_legacy_snorm_formula);
> + int shader_time_index);
>
> protected:
> virtual dst_reg *make_reg_for_system_value(int location,
> @@ -105,8 +104,6 @@ private:
> struct brw_vs_prog_data * const vs_prog_data;
>
> gl_clip_plane *clip_planes;
> -
> - bool use_legacy_snorm_formula;
> };
>
> } /* namespace brw */
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list