Re: [Mesa-dev] [PATCH] mesa: add AllowGLSLCrossStageInterpolationMismatch workaround

2017-11-23 Thread Tapani Pälli



On 11/23/2017 06:09 PM, Emil Velikov wrote:

On 23 November 2017 at 05:54, Tapani Pälli  wrote:

This fixes issues seen with certain versions of Unreal Engine 4 editor
and games built with that using GLSL 4.30.

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97852
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103801
---
  src/compiler/glsl/link_varyings.cpp | 51 +++--
  src/gallium/include/state_tracker/st_api.h  |  1 +
  src/gallium/state_trackers/dri/dri_screen.c |  2 ++
  src/mesa/drivers/dri/i965/brw_context.c |  3 ++
  src/mesa/drivers/dri/i965/intel_screen.c|  1 +
  src/mesa/main/mtypes.h  |  5 +++
  src/mesa/state_tracker/st_extensions.c  |  2 ++
  src/util/drirc  |  8 +
  src/util/xmlpool/t_options.h|  4 +++

Without updating driinfo_gallium.h (see below), the existing st/mesa
code will be a no-op.
Personally I'll either add the missing hunk or simply drop the st/mesa bits.


Thanks, will add that. This was tested on gallium though so surely it 
must be doing something even without. Will send v2 in a minute.



HTH
Emil

--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -23,6 +23,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_FORCE_GLSL_VERSION(0)
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false")
+   DRI_CONF_ALLOW_GLSL_CROSS_STAGE_INTERPOLATION_MISMATCH("false")
DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false")
DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false")


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: add AllowGLSLCrossStageInterpolationMismatch workaround

2017-11-23 Thread Emil Velikov
On 23 November 2017 at 05:54, Tapani Pälli  wrote:
> This fixes issues seen with certain versions of Unreal Engine 4 editor
> and games built with that using GLSL 4.30.
>
> Signed-off-by: Tapani Pälli 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97852
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103801
> ---
>  src/compiler/glsl/link_varyings.cpp | 51 
> +++--
>  src/gallium/include/state_tracker/st_api.h  |  1 +
>  src/gallium/state_trackers/dri/dri_screen.c |  2 ++
>  src/mesa/drivers/dri/i965/brw_context.c |  3 ++
>  src/mesa/drivers/dri/i965/intel_screen.c|  1 +
>  src/mesa/main/mtypes.h  |  5 +++
>  src/mesa/state_tracker/st_extensions.c  |  2 ++
>  src/util/drirc  |  8 +
>  src/util/xmlpool/t_options.h|  4 +++
Without updating driinfo_gallium.h (see below), the existing st/mesa
code will be a no-op.
Personally I'll either add the missing hunk or simply drop the st/mesa bits.

HTH
Emil

--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -23,6 +23,7 @@ DRI_CONF_SECTION_DEBUG
   DRI_CONF_FORCE_GLSL_VERSION(0)
   DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
   DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false")
+   DRI_CONF_ALLOW_GLSL_CROSS_STAGE_INTERPOLATION_MISMATCH("false")
   DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false")
   DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
   DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false")
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: add AllowGLSLCrossStageInterpolationMismatch workaround

2017-11-23 Thread Andres Gomez
Acked-by: Andres Gomez 

On Thu, 2017-11-23 at 07:54 +0200, Tapani Pälli wrote:
> This fixes issues seen with certain versions of Unreal Engine 4 editor
> and games built with that using GLSL 4.30.
> 
> Signed-off-by: Tapani Pälli 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97852
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103801
> ---
>  src/compiler/glsl/link_varyings.cpp | 51 
> +++--
>  src/gallium/include/state_tracker/st_api.h  |  1 +
>  src/gallium/state_trackers/dri/dri_screen.c |  2 ++
>  src/mesa/drivers/dri/i965/brw_context.c |  3 ++
>  src/mesa/drivers/dri/i965/intel_screen.c|  1 +
>  src/mesa/main/mtypes.h  |  5 +++
>  src/mesa/state_tracker/st_extensions.c  |  2 ++
>  src/util/drirc  |  8 +
>  src/util/xmlpool/t_options.h|  4 +++
>  9 files changed, 59 insertions(+), 18 deletions(-)
> 
> diff --git a/src/compiler/glsl/link_varyings.cpp 
> b/src/compiler/glsl/link_varyings.cpp
> index 72309365a0..0f53cd4aa9 100644
> --- a/src/compiler/glsl/link_varyings.cpp
> +++ b/src/compiler/glsl/link_varyings.cpp
> @@ -189,7 +189,8 @@ process_xfb_layout_qualifiers(void *mem_ctx, const 
> gl_linked_shader *sh,
>   * matching input to another stage.
>   */
>  static void
> -cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
> +cross_validate_types_and_qualifiers(struct gl_context *ctx,
> +struct gl_shader_program *prog,
>  const ir_variable *input,
>  const ir_variable *output,
>  gl_shader_stage consumer_stage,
> @@ -343,17 +344,30 @@ cross_validate_types_and_qualifiers(struct 
> gl_shader_program *prog,
> }
> if (input_interpolation != output_interpolation &&
> prog->data->Version < 440) {
> -  linker_error(prog,
> -   "%s shader output `%s' specifies %s "
> -   "interpolation qualifier, "
> -   "but %s shader input specifies %s "
> -   "interpolation qualifier\n",
> -   _mesa_shader_stage_to_string(producer_stage),
> -   output->name,
> -   interpolation_string(output->data.interpolation),
> -   _mesa_shader_stage_to_string(consumer_stage),
> -   interpolation_string(input->data.interpolation));
> -  return;
> +  if (!ctx->Const.AllowGLSLCrossStageInterpolationMismatch) {
> + linker_error(prog,
> +  "%s shader output `%s' specifies %s "
> +  "interpolation qualifier, "
> +  "but %s shader input specifies %s "
> +  "interpolation qualifier\n",
> +  _mesa_shader_stage_to_string(producer_stage),
> +  output->name,
> +  interpolation_string(output->data.interpolation),
> +  _mesa_shader_stage_to_string(consumer_stage),
> +  interpolation_string(input->data.interpolation));
> + return;
> +  } else {
> + linker_warning(prog,
> +"%s shader output `%s' specifies %s "
> +"interpolation qualifier, "
> +"but %s shader input specifies %s "
> +"interpolation qualifier\n",
> +_mesa_shader_stage_to_string(producer_stage),
> +output->name,
> +interpolation_string(output->data.interpolation),
> +_mesa_shader_stage_to_string(consumer_stage),
> +interpolation_string(input->data.interpolation));
> +  }
> }
>  }
>  
> @@ -361,7 +375,8 @@ cross_validate_types_and_qualifiers(struct 
> gl_shader_program *prog,
>   * Validate front and back color outputs against single color input
>   */
>  static void
> -cross_validate_front_and_back_color(struct gl_shader_program *prog,
> +cross_validate_front_and_back_color(struct gl_context *ctx,
> +struct gl_shader_program *prog,
>  const ir_variable *input,
>  const ir_variable *front_color,
>  const ir_variable *back_color,
> @@ -369,11 +384,11 @@ cross_validate_front_and_back_color(struct 
> gl_shader_program *prog,
>  gl_shader_stage producer_stage)
>  {
> if (front_color != NULL && front_color->data.assigned)
> -  cross_validate_types_and_qualifiers(prog, input, front_color,
> +  cross_validate_types_and_qualifiers(ctx, prog, input, front_color,
>consumer_stage, producer_stage);
>  
> if (back_color != NULL && 

[Mesa-dev] [PATCH] mesa: add AllowGLSLCrossStageInterpolationMismatch workaround

2017-11-22 Thread Tapani Pälli
This fixes issues seen with certain versions of Unreal Engine 4 editor
and games built with that using GLSL 4.30.

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97852
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103801
---
 src/compiler/glsl/link_varyings.cpp | 51 +++--
 src/gallium/include/state_tracker/st_api.h  |  1 +
 src/gallium/state_trackers/dri/dri_screen.c |  2 ++
 src/mesa/drivers/dri/i965/brw_context.c |  3 ++
 src/mesa/drivers/dri/i965/intel_screen.c|  1 +
 src/mesa/main/mtypes.h  |  5 +++
 src/mesa/state_tracker/st_extensions.c  |  2 ++
 src/util/drirc  |  8 +
 src/util/xmlpool/t_options.h|  4 +++
 9 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp 
b/src/compiler/glsl/link_varyings.cpp
index 72309365a0..0f53cd4aa9 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -189,7 +189,8 @@ process_xfb_layout_qualifiers(void *mem_ctx, const 
gl_linked_shader *sh,
  * matching input to another stage.
  */
 static void
-cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
+cross_validate_types_and_qualifiers(struct gl_context *ctx,
+struct gl_shader_program *prog,
 const ir_variable *input,
 const ir_variable *output,
 gl_shader_stage consumer_stage,
@@ -343,17 +344,30 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
}
if (input_interpolation != output_interpolation &&
prog->data->Version < 440) {
-  linker_error(prog,
-   "%s shader output `%s' specifies %s "
-   "interpolation qualifier, "
-   "but %s shader input specifies %s "
-   "interpolation qualifier\n",
-   _mesa_shader_stage_to_string(producer_stage),
-   output->name,
-   interpolation_string(output->data.interpolation),
-   _mesa_shader_stage_to_string(consumer_stage),
-   interpolation_string(input->data.interpolation));
-  return;
+  if (!ctx->Const.AllowGLSLCrossStageInterpolationMismatch) {
+ linker_error(prog,
+  "%s shader output `%s' specifies %s "
+  "interpolation qualifier, "
+  "but %s shader input specifies %s "
+  "interpolation qualifier\n",
+  _mesa_shader_stage_to_string(producer_stage),
+  output->name,
+  interpolation_string(output->data.interpolation),
+  _mesa_shader_stage_to_string(consumer_stage),
+  interpolation_string(input->data.interpolation));
+ return;
+  } else {
+ linker_warning(prog,
+"%s shader output `%s' specifies %s "
+"interpolation qualifier, "
+"but %s shader input specifies %s "
+"interpolation qualifier\n",
+_mesa_shader_stage_to_string(producer_stage),
+output->name,
+interpolation_string(output->data.interpolation),
+_mesa_shader_stage_to_string(consumer_stage),
+interpolation_string(input->data.interpolation));
+  }
}
 }
 
@@ -361,7 +375,8 @@ cross_validate_types_and_qualifiers(struct 
gl_shader_program *prog,
  * Validate front and back color outputs against single color input
  */
 static void
-cross_validate_front_and_back_color(struct gl_shader_program *prog,
+cross_validate_front_and_back_color(struct gl_context *ctx,
+struct gl_shader_program *prog,
 const ir_variable *input,
 const ir_variable *front_color,
 const ir_variable *back_color,
@@ -369,11 +384,11 @@ cross_validate_front_and_back_color(struct 
gl_shader_program *prog,
 gl_shader_stage producer_stage)
 {
if (front_color != NULL && front_color->data.assigned)
-  cross_validate_types_and_qualifiers(prog, input, front_color,
+  cross_validate_types_and_qualifiers(ctx, prog, input, front_color,
   consumer_stage, producer_stage);
 
if (back_color != NULL && back_color->data.assigned)
-  cross_validate_types_and_qualifiers(prog, input, back_color,
+  cross_validate_types_and_qualifiers(ctx, prog, input, back_color,
   consumer_stage, producer_stage);
 }
 
@@ -710,7 +725,7 @@ cross_validate_outputs_to_inputs(struct