[Glamor] [PATCH] glamor_trapezoid: workaround a glsl like problem.

He Junyan junyan.he at linux.intel.com
Wed Aug 1 19:35:45 PDT 2012


I have test it and it works well.
This problem seems weird,
On my IVB platform no such thing happens.
The shader may have different behave because of GLSL on SNB.


> It seems that the following statement cann't run as expected on SNB.
> bool trap_left_vertical = (abs(trap_left_vertical_f - 1.0) <= 0.0001);
>
> Have to rewrite it to another style to let the vertical edge trapezoid
> to be rendered correctly.
>
> Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
> ---
>   src/glamor_trapezoid.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/glamor_trapezoid.c b/src/glamor_trapezoid.c
> index fd63062..7813d82 100644
> --- a/src/glamor_trapezoid.c
> +++ b/src/glamor_trapezoid.c
> @@ -1068,8 +1068,6 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
>   	    "varying float trap_right_vertical_f;  \n"
>   	    "float x_per_pix = 1.0;"
>   	    "float y_per_pix = 1.0;"
> -	    "bool trap_left_vertical = (abs(trap_left_vertical_f - 1.0) <= 0.0001);\n"
> -	    "bool trap_right_vertical = (abs(trap_right_vertical_f - 1.0) <= 0.0001);\n"
>   	    "\n"
>   	    "float get_alpha_val() \n"
>   	    "{  \n"
> @@ -1077,6 +1075,16 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
>   	    "    float x_bottom_cut_left;  \n"
>   	    "    float x_up_cut_right;  \n"
>   	    "    float x_bottom_cut_right;  \n"
> +	    "    bool trap_left_vertical;\n"
> +	    "    bool trap_right_vertical;\n"
> +	    "	 if (abs(trap_left_vertical_f - 1.0) <= 0.0001)\n"
> +	    "		trap_left_vertical = true;\n"
> +	    "	 else\n"
> +	    "		trap_left_vertical = false;\n"
> +	    "	 if (abs(trap_right_vertical_f - 1.0) <= 0.0001)\n"
> +	    "		trap_right_vertical = true;\n"
> +	    "	 else\n"
> +	    "		trap_right_vertical = false;\n"
>   	    "    \n"
>   	    "    if(trap_left_vertical == true) {  \n"
>   	    "        x_up_cut_left = trap_left_x;  \n"
>


More information about the Glamor mailing list