<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p><br>
</p>
<meta content="text/html; charset=UTF-8">
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;">
<p><br>
</p>
<p><span style="font-size: 11pt;">Tests is setting GL_SWIZZLE_TEXTURE_RGBA to [GL_RED, GL_ZERO, GL_ZERO, GL_ZERO]. When
</span><span style="font-size: 11pt;">GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_AR</span><span style="font-size: 11pt;">B = 4 then all the 4 components are affected by textureGather on the other
</span><span style="font-size: 11pt;">GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_AR</span><span style="font-size: 11pt;">B=1, then only red component is getting affected, i</span><span style="font-size: 11pt;">f I understood</span><span style="font-size: 11pt;">
 notion of </span><span style="font-size: 11pt;">GL_SWIZZLE_TEXTURE_RGBA</span><span style="font-size: 11pt;"> correctly.</span><br>
<span style="font-size: 11pt;"></span></p>
<span style="font-size: 11pt;"></span>
<p><br>
<span style="font-size: 11pt;"></span></p>
<span style="font-size: 11pt;"></span>
<div id="x_Signature"><span style="font-size: 11pt;"></span>
<div id="x_divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri,Arial,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;">
<span style="font-size: 11pt;"></span>
<p><span style="font-size: 11pt;">Regards,</span></p>
<span style="font-size: 11pt;"></span>
<p><span style="font-size: 11pt;">Neha</span><br>
</p>
</div>
</div>
</div>
<hr style="display:inline-block; width:98%" tabindex="-1">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> ibmirkin@gmail.com <ibmirkin@gmail.com> on behalf of Ilia Mirkin <imirkin@alum.mit.edu><br>
<b>Sent:</b> Thursday, August 3, 2017 11:44:34 AM<br>
<b>To:</b> Neha Bhende<br>
<b>Cc:</b> piglit@lists.freedesktop.org<br>
<b>Subject:</b> Re: [Piglit] [Review Request (master branch)] textureGather: correct expected result for GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB = 1</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">The GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB is in reference to<br>
the number of components the texture being gathered may have (with<br>
always the red component being gathered, at least with<br>
ARB_texture_gather):<br>
<br>
     MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB determines what formats<br>
     are supported. If the value is one, only RED, ALPHA, LUMINANCE,<br>
     INTENSITY, DEPTH, and DEPTH_STENCIL are supported. If the value is<br>
<br>
It shouldn't affect the expected outcomes of the gathered textures...<br>
i.e. the textureGather result still returns 4 values. But perhaps I'm<br>
not understanding the broken scenario?<br>
<br>
On Thu, Aug 3, 2017 at 7:04 AM, Neha Bhende <bhenden@vmware.com> wrote:<br>
> Expected results were with respect to GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB = 4.<br>
> This patch is fixing it for GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB =1 as well.<br>
> ---<br>
>  tests/texturing/shaders/textureGather.c | 50 ++++++++++++++++++++-------------<br>
>  1 file changed, 31 insertions(+), 19 deletions(-)<br>
><br>
> diff --git a/tests/texturing/shaders/textureGather.c b/tests/texturing/shaders/textureGather.c<br>
> index f8dbe0f..f364c5c 100644<br>
> --- a/tests/texturing/shaders/textureGather.c<br>
> +++ b/tests/texturing/shaders/textureGather.c<br>
> @@ -25,6 +25,7 @@ int max_offset = 0;<br>
><br>
>  int texture_width = 32;<br>
>  int texture_height = 32;<br>
> +int max_components;<br>
><br>
>  GLenum internalformat_for_components[][4] = {<br>
>         { GL_R16, GL_RG16, GL_RGB16, GL_RGBA16, },<br>
> @@ -144,6 +145,15 @@ norm_value(int x)<br>
>         return (float)x / 255.0f;<br>
>  }<br>
><br>
> +static float<br>
> +normalized_value(int component, int x)<br>
> +{<br>
> +       if (swizzle >= 0 && max_components < 4 && component > 0)<br>
> +               return 0;<br>
> +       else<br>
> +               return (float)x / 255.0f;<br>
> +}<br>
> +<br>
>  static void<br>
>  make_image(int num_channels, int use_channel)<br>
>  {<br>
> @@ -156,9 +166,12 @@ make_image(int num_channels, int use_channel)<br>
>                                 *pp++ = (ch == use_channel) ? (i+j*texture_width) : 128;<br>
>  }<br>
><br>
> -static float shadow_compare(float x)<br>
> +static float shadow_compare(int component, float x)<br>
>  {<br>
> -       return x > 0.5f ? 1.0f : 0.0f;<br>
> +       if (swizzle >= 0 && max_components < 4 && component > 0)<br>
> +               return 0;<br>
> +        else<br>
> +               return x > 0.5f ? 1.0f : 0.0f;<br>
>  }<br>
><br>
>  static void<br>
> @@ -171,28 +184,28 @@ make_expected(void)<br>
>                 for (i = 0; i < texture_width; i++) {<br>
>                         if (comptype == SHADOW_T) {<br>
>                                 if (use_offsets) {<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i, j, 0)));<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i, j, 1)));<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i, j, 2)));<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i, j, 3)));<br>
> +                                       *pe++ = shadow_compare(0, norm_value(pixel_value(i, j, 0)));<br>
> +                                       *pe++ = shadow_compare(1, norm_value(pixel_value(i, j, 1)));<br>
> +                                       *pe++ = shadow_compare(2, norm_value(pixel_value(i, j, 2)));<br>
> +                                       *pe++ = shadow_compare(3, norm_value(pixel_value(i, j, 3)));<br>
>                                 } else {<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i, j + 1, 0)));<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i + 1, j + 1, 0)));<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i + 1, j, 0)));<br>
> -                                       *pe++ = shadow_compare(norm_value(pixel_value(i, j, 0)));<br>
> +                                       *pe++ = shadow_compare(0, norm_value(pixel_value(i, j + 1, 0)));<br>
> +                                       *pe++ = shadow_compare(1, norm_value(pixel_value(i + 1, j + 1, 0)));<br>
> +                                       *pe++ = shadow_compare(2, norm_value(pixel_value(i + 1, j, 0)));<br>
> +                                       *pe++ = shadow_compare(3, norm_value(pixel_value(i, j, 0)));<br>
>                                 }<br>
>                         }<br>
>                         else {<br>
>                                 if (use_offsets) {<br>
> -                                       *pe++ = norm_value(pixel_value(i, j, 0));<br>
> -                                       *pe++ = norm_value(pixel_value(i, j, 1));<br>
> -                                       *pe++ = norm_value(pixel_value(i, j, 2));<br>
> -                                       *pe++ = norm_value(pixel_value(i, j, 3));<br>
> +                                       *pe++ = normalized_value(0, pixel_value(i, j, 0));<br>
> +                                       *pe++ = normalized_value(1, pixel_value(i, j, 1));<br>
> +                                       *pe++ = normalized_value(2, pixel_value(i, j, 2));<br>
> +                                       *pe++ = normalized_value(3, pixel_value(i, j, 3));<br>
>                                 } else {<br>
> -                                       *pe++ = norm_value(pixel_value(i, j + 1, 0));<br>
> -                                       *pe++ = norm_value(pixel_value(i + 1, j + 1, 0));<br>
> -                                       *pe++ = norm_value(pixel_value(i + 1, j, 0));<br>
> -                                       *pe++ = norm_value(pixel_value(i, j, 0));<br>
> +                                       *pe++ = normalized_value(0, pixel_value(i, j + 1, 0));<br>
> +                                       *pe++ = normalized_value(1, pixel_value(i + 1, j + 1, 0));<br>
> +                                       *pe++ = normalized_value(2, pixel_value(i + 1, j, 0));<br>
> +                                       *pe++ = normalized_value(3, pixel_value(i, j, 0));<br>
>                                 }<br>
>                         }<br>
>                 }<br>
> @@ -232,7 +245,6 @@ upload_verts(void)<br>
>  void<br>
>  do_requires(void)<br>
>  {<br>
> -       int max_components;<br>
>         piglit_require_GLSL_version(130);<br>
>         piglit_require_extension("GL_ARB_texture_gather");<br>
><br>
> --<br>
> 2.7.4<br>
><br>
> _______________________________________________<br>
> Piglit mailing list<br>
> Piglit@lists.freedesktop.org<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_piglit&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=U9C05uEFArICiTQ6FqFIgVCB-YGE5G2JTThVEccv_Ec&m=h9LKgRq9jEOtMHpLLluIIg2149_N8Wh3KYYQQqCBK6o&s=w4h06fst6D1LkDqAFVPw48cpo7oAJzetPQir7IN-vDM&e=" id="LPlnk194510" previewremoved="true">
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_piglit&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=U9C05uEFArICiTQ6FqFIgVCB-YGE5G2JTThVEccv_Ec&m=h9LKgRq9jEOtMHpLLluIIg2149_N8Wh3KYYQQqCBK6o&s=w4h06fst6D1LkDqAFVPw48cpo7oAJzetPQir7IN-vDM&e=</a>
<br>
</div>
</span></font></div>
</body>
</html>