From: Jason Ekstrand Date: Tue, 23 Jun 2015 00:30:23 +0000 (-0700) Subject: i965/vec4_vs: Add an explicit use_legacy_snorm_formula flag X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bcaf4a3f077e3e3fbc66f264fe9124fa920ee70c;p=mesa.git i965/vec4_vs: Add an explicit use_legacy_snorm_formula flag This way we can stop doing is_gles3 checks inside of the compiler. Reviewed-by: Kenneth Graunke Reviewed-by: Chris Forbes --- diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 9c450347ba2..f51aa1a3a54 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -35,6 +35,7 @@ extern "C" { #include "program/prog_print.h" #include "program/prog_parameter.h" } +#include "main/context.h" #define MAX_INSTRUCTION (1 << 30) @@ -1938,7 +1939,8 @@ brw_vs_emit(struct brw_context *brw, if (!assembly) { prog_data->base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT; - vec4_vs_visitor v(brw, c, prog_data, prog, mem_ctx, st_index); + vec4_vs_visitor v(brw, c, prog_data, prog, mem_ctx, st_index, + !_mesa_is_gles3(&brw->ctx)); if (!v.run(brw_select_clip_planes(&brw->ctx))) { if (prog) { prog->LinkStatus = false; 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 dc1775527be..26e3057ac78 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp @@ -23,7 +23,6 @@ #include "brw_vs.h" -#include "main/context.h" namespace brw { @@ -78,7 +77,7 @@ vec4_vs_visitor::emit_prolog() /* ES 3.0 has different rules for converting signed normalized * fixed-point numbers than desktop GL. */ - if (_mesa_is_gles3(ctx) && (wa_flags & BRW_ATTRIB_WA_SIGN)) { + if ((wa_flags & BRW_ATTRIB_WA_SIGN) && !use_legacy_snorm_formula) { /* According to equation 2.2 of the ES 3.0 specification, * signed normalization conversion is done by: * @@ -217,14 +216,16 @@ vec4_vs_visitor::vec4_vs_visitor(struct brw_context *brw, struct brw_vs_prog_data *vs_prog_data, struct gl_shader_program *prog, void *mem_ctx, - int shader_time_index) + int shader_time_index, + bool use_legacy_snorm_formula) : vec4_visitor(brw, &vs_compile->base, &vs_compile->vp->program.Base, &vs_compile->key.base, &vs_prog_data->base, prog, MESA_SHADER_VERTEX, mem_ctx, false /* no_spills */, shader_time_index), vs_compile(vs_compile), - vs_prog_data(vs_prog_data) + vs_prog_data(vs_prog_data), + use_legacy_snorm_formula(use_legacy_snorm_formula) { } diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 6f84179c694..0511ab50528 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -95,7 +95,8 @@ public: struct brw_vs_prog_data *vs_prog_data, struct gl_shader_program *prog, void *mem_ctx, - int shader_time_index); + int shader_time_index, + bool use_legacy_snorm_formula); protected: virtual dst_reg *make_reg_for_system_value(ir_variable *ir); @@ -116,6 +117,8 @@ private: struct brw_vs_prog_data * const vs_prog_data; src_reg *vp_temp_regs; src_reg vp_addr_reg; + + bool use_legacy_snorm_formula; }; } /* namespace brw */