[2/2] texunits: don't test glTexEnv with unusable texture units

Submitted by Marek Olšák on Feb. 9, 2018, 12:59 a.m.

Details

Message ID 1518137959-10689-2-git-send-email-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák Feb. 9, 2018, 12:59 a.m.
From: Marek Olšák <marek.olsak@amd.com>

The GL limit is MaxTextureCombinedUnits, but the real usable limit is
MaxTextureCoordUnits. This is probably a spec bug.

Mesa will ignore glTexEnv calls where unit >= MaxTextureCoordUnits.
---
 tests/general/texunits.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/general/texunits.c b/tests/general/texunits.c
index b68dcf7..c6fbcb1 100644
--- a/tests/general/texunits.c
+++ b/tests/general/texunits.c
@@ -276,30 +276,30 @@  test_texture_params(void)
 
 static GLboolean
 test_texture_env(void)
 {
    /* Texture Environment state is fixed-function; not used by shaders */
    int i;
 
    clear_errors();
 
    /* set per-unit state */
-   for (i = 0; i < MaxTextureCombinedUnits; i++) {
+   for (i = 0; i < MaxTextureCoordUnits; i++) {
       glActiveTexture(GL_TEXTURE0 + i);
       glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, Random[i]);
       if (!piglit_check_gl_error(GL_NO_ERROR)) {
          return GL_FALSE;
       }
    }
 
    /* check per-unit state */
-   for (i = 0; i < MaxTextureCombinedUnits; i++) {
+   for (i = 0; i < MaxTextureCoordUnits; i++) {
       GLfloat v[4];
       glActiveTexture(GL_TEXTURE0 + i);
       glGetTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, v);
       if (!equal4v(v, Random[i])) {
          printf("Setting per-unit env state failed for unit %d\n", i);
          report4v(Random[i], v);
          return GL_FALSE;
       }
    }
 

Comments

Reviewed-by: Brian Paul <brianp@vmware.com>


On Thu, Feb 8, 2018 at 5:59 PM, Marek Olšák <maraeo@gmail.com> wrote:

> From: Marek Olšák <marek.olsak@amd.com>
>
> The GL limit is MaxTextureCombinedUnits, but the real usable limit is
> MaxTextureCoordUnits. This is probably a spec bug.
>
> Mesa will ignore glTexEnv calls where unit >= MaxTextureCoordUnits.
> ---
>  tests/general/texunits.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/general/texunits.c b/tests/general/texunits.c
> index b68dcf7..c6fbcb1 100644
> --- a/tests/general/texunits.c
> +++ b/tests/general/texunits.c
> @@ -276,30 +276,30 @@ test_texture_params(void)
>
>  static GLboolean
>  test_texture_env(void)
>  {
>     /* Texture Environment state is fixed-function; not used by shaders */
>     int i;
>
>     clear_errors();
>
>     /* set per-unit state */
> -   for (i = 0; i < MaxTextureCombinedUnits; i++) {
> +   for (i = 0; i < MaxTextureCoordUnits; i++) {
>        glActiveTexture(GL_TEXTURE0 + i);
>        glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, Random[i]);
>        if (!piglit_check_gl_error(GL_NO_ERROR)) {
>           return GL_FALSE;
>        }
>     }
>
>     /* check per-unit state */
> -   for (i = 0; i < MaxTextureCombinedUnits; i++) {
> +   for (i = 0; i < MaxTextureCoordUnits; i++) {
>        GLfloat v[4];
>        glActiveTexture(GL_TEXTURE0 + i);
>        glGetTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, v);
>        if (!equal4v(v, Random[i])) {
>           printf("Setting per-unit env state failed for unit %d\n", i);
>           report4v(Random[i], v);
>           return GL_FALSE;
>        }
>     }
>
> --
> 2.7.4
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>