Tests is setting GL_SWIZZLE_TEXTURE_RGBA to [GL_RED, GL_ZERO, GL_ZERO, GL_ZERO]. When GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB = 4 then all the 4 components are affected by textureGather on the other GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB=1, then only red component is getting affected, if I understood notion of GL_SWIZZLE_TEXTURE_RGBA correctly.
Regards, Neha ________________________________ From: ibmir...@gmail.com <ibmir...@gmail.com> on behalf of Ilia Mirkin <imir...@alum.mit.edu> Sent: Thursday, August 3, 2017 11:44:34 AM To: Neha Bhende Cc: piglit@lists.freedesktop.org Subject: Re: [Piglit] [Review Request (master branch)] textureGather: correct expected result for GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB = 1 The GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB is in reference to the number of components the texture being gathered may have (with always the red component being gathered, at least with ARB_texture_gather): MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB determines what formats are supported. If the value is one, only RED, ALPHA, LUMINANCE, INTENSITY, DEPTH, and DEPTH_STENCIL are supported. If the value is It shouldn't affect the expected outcomes of the gathered textures... i.e. the textureGather result still returns 4 values. But perhaps I'm not understanding the broken scenario? On Thu, Aug 3, 2017 at 7:04 AM, Neha Bhende <bhen...@vmware.com> wrote: > Expected results were with respect to > GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB = 4. > This patch is fixing it for GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB =1 > as well. > --- > tests/texturing/shaders/textureGather.c | 50 > ++++++++++++++++++++------------- > 1 file changed, 31 insertions(+), 19 deletions(-) > > diff --git a/tests/texturing/shaders/textureGather.c > b/tests/texturing/shaders/textureGather.c > index f8dbe0f..f364c5c 100644 > --- a/tests/texturing/shaders/textureGather.c > +++ b/tests/texturing/shaders/textureGather.c > @@ -25,6 +25,7 @@ int max_offset = 0; > > int texture_width = 32; > int texture_height = 32; > +int max_components; > > GLenum internalformat_for_components[][4] = { > { GL_R16, GL_RG16, GL_RGB16, GL_RGBA16, }, > @@ -144,6 +145,15 @@ norm_value(int x) > return (float)x / 255.0f; > } > > +static float > +normalized_value(int component, int x) > +{ > + if (swizzle >= 0 && max_components < 4 && component > 0) > + return 0; > + else > + return (float)x / 255.0f; > +} > + > static void > make_image(int num_channels, int use_channel) > { > @@ -156,9 +166,12 @@ make_image(int num_channels, int use_channel) > *pp++ = (ch == use_channel) ? > (i+j*texture_width) : 128; > } > > -static float shadow_compare(float x) > +static float shadow_compare(int component, float x) > { > - return x > 0.5f ? 1.0f : 0.0f; > + if (swizzle >= 0 && max_components < 4 && component > 0) > + return 0; > + else > + return x > 0.5f ? 1.0f : 0.0f; > } > > static void > @@ -171,28 +184,28 @@ make_expected(void) > for (i = 0; i < texture_width; i++) { > if (comptype == SHADOW_T) { > if (use_offsets) { > - *pe++ = > shadow_compare(norm_value(pixel_value(i, j, 0))); > - *pe++ = > shadow_compare(norm_value(pixel_value(i, j, 1))); > - *pe++ = > shadow_compare(norm_value(pixel_value(i, j, 2))); > - *pe++ = > shadow_compare(norm_value(pixel_value(i, j, 3))); > + *pe++ = shadow_compare(0, > norm_value(pixel_value(i, j, 0))); > + *pe++ = shadow_compare(1, > norm_value(pixel_value(i, j, 1))); > + *pe++ = shadow_compare(2, > norm_value(pixel_value(i, j, 2))); > + *pe++ = shadow_compare(3, > norm_value(pixel_value(i, j, 3))); > } else { > - *pe++ = > shadow_compare(norm_value(pixel_value(i, j + 1, 0))); > - *pe++ = > shadow_compare(norm_value(pixel_value(i + 1, j + 1, 0))); > - *pe++ = > shadow_compare(norm_value(pixel_value(i + 1, j, 0))); > - *pe++ = > shadow_compare(norm_value(pixel_value(i, j, 0))); > + *pe++ = shadow_compare(0, > norm_value(pixel_value(i, j + 1, 0))); > + *pe++ = shadow_compare(1, > norm_value(pixel_value(i + 1, j + 1, 0))); > + *pe++ = shadow_compare(2, > norm_value(pixel_value(i + 1, j, 0))); > + *pe++ = shadow_compare(3, > norm_value(pixel_value(i, j, 0))); > } > } > else { > if (use_offsets) { > - *pe++ = norm_value(pixel_value(i, j, > 0)); > - *pe++ = norm_value(pixel_value(i, j, > 1)); > - *pe++ = norm_value(pixel_value(i, j, > 2)); > - *pe++ = norm_value(pixel_value(i, j, > 3)); > + *pe++ = normalized_value(0, > pixel_value(i, j, 0)); > + *pe++ = normalized_value(1, > pixel_value(i, j, 1)); > + *pe++ = normalized_value(2, > pixel_value(i, j, 2)); > + *pe++ = normalized_value(3, > pixel_value(i, j, 3)); > } else { > - *pe++ = norm_value(pixel_value(i, j + > 1, 0)); > - *pe++ = norm_value(pixel_value(i + 1, > j + 1, 0)); > - *pe++ = norm_value(pixel_value(i + 1, > j, 0)); > - *pe++ = norm_value(pixel_value(i, j, > 0)); > + *pe++ = normalized_value(0, > pixel_value(i, j + 1, 0)); > + *pe++ = normalized_value(1, > pixel_value(i + 1, j + 1, 0)); > + *pe++ = normalized_value(2, > pixel_value(i + 1, j, 0)); > + *pe++ = normalized_value(3, > pixel_value(i, j, 0)); > } > } > } > @@ -232,7 +245,6 @@ upload_verts(void) > void > do_requires(void) > { > - int max_components; > piglit_require_GLSL_version(130); > piglit_require_extension("GL_ARB_texture_gather"); > > -- > 2.7.4 > > _______________________________________________ > Piglit mailing list > Piglit@lists.freedesktop.org > 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=
_______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit