Re: [Piglit] [PATCH] getteximage-formats: Add option to clear texture before rendering

2016-02-29 Thread Matt Turner
On Thu, Feb 11, 2016 at 9:11 AM, Topi Pohjolainen
 wrote:
> Demonstrates a bug in Intel color resolve logic. If rendering to
> texture is preceded by fast clear subsequent reads from the
> texture require the underlying color buffer to be resolved. In
> case of mipmap generation Intel driver needs to reallocate the
> underlying buffer to fit the subsequent levels. However, copy of
> the original level zero to newly allocated buffer is delayed until
> the driver is about to generate level one using level zero as
> source. This causes a color resolve of the original level zero.
> Both the generation of level one and the resolve are meta
> operations, and the latter will interfere with the sampler
> settings of the former.
>
> Signed-off-by: Topi Pohjolainen 
> CC: Ian Romanick 
> ---
>  tests/all.py  |  1 +
>  tests/texturing/getteximage-formats.c | 16 +---
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 2912d1f..8938bfc 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2987,6 +2987,7 @@ with profile.group_manager(
>  g(['fbo-storage-completeness'])
>  g(['fbo-storage-formats'])
>  g(['getteximage-formats', 'init-by-rendering'])
> +g(['getteximage-formats', 'init-by-clear-and-render'])
>  g(['ext_framebuffer_multisample-fast-clear', 'single-sample'],
>'fbo-fast-clear')
>  add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX1')
> diff --git a/tests/texturing/getteximage-formats.c 
> b/tests/texturing/getteximage-formats.c
> index 715d5df..320683f 100644
> --- a/tests/texturing/getteximage-formats.c
> +++ b/tests/texturing/getteximage-formats.c
> @@ -50,6 +50,7 @@ static const char *TestName = "getteximage-formats";
>  static const GLfloat clearColor[4] = { 0.4, 0.4, 0.4, 0.0 };
>  static GLuint texture_id;
>  static GLboolean init_by_rendering;
> +static GLboolean init_by_clearing_first;
>
>  #define TEX_SIZE 128
>
> @@ -83,7 +84,7 @@ make_texture_image(GLenum intFormat, GLubyte 
> upperRightTexel[4])
>
> memcpy(upperRightTexel, tex[TEX_SIZE-1][TEX_SIZE-1], 4);
>
> -   if (init_by_rendering) {
> +   if (init_by_rendering || init_by_clearing_first) {
> /* Initialize the mipmap levels. */
> for (i = TEX_SIZE, j = 0; i; i >>= 1, j++) {
> glTexImage2D(GL_TEXTURE_2D, j, intFormat, i, i, 0,
> @@ -102,6 +103,11 @@ make_texture_image(GLenum intFormat, GLubyte 
> upperRightTexel[4])
> return GL_FALSE;
> }
>
> +   if (init_by_clearing_first) {
> +   glClearColor(1, 0, 0, 1);
> +   glClear(GL_COLOR_BUFFER_BIT);
> +   }
> +
> glViewport(0, 0, TEX_SIZE, TEX_SIZE);
>
> glWindowPos2iARB(0, 0);
> @@ -365,6 +371,7 @@ test_format(const struct test_desc *test,
> GLfloat expected[4], pix[4], tolerance[4];
> GLboolean pass = GL_TRUE;
>
> +   glClearColor(clearColor[0], clearColor[1], clearColor[2], 
> clearColor[3]);
> glClear(GL_COLOR_BUFFER_BIT);
>
> /* The RGBA_DXT1 formats seem to expose a Mesa/libtxc_dxtn bug.
> @@ -536,6 +543,11 @@ piglit_init(int argc, char **argv)
> puts("The textures will be initialized by rendering "
>  "to them using glDrawPixels.");
> break;
> +   } else if (strcmp(argv[i], "init-by-clear-and-render") == 0) {
> +   init_by_clearing_first = GL_TRUE;
> +   puts("The textures will be initialized by rendering "
> +"to them using glCear and glDrawPixels.");

Just noticed the typo in some test output: glCear. Oops.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] getteximage-formats: Add option to clear texture before rendering

2016-02-12 Thread Brian Paul

On 02/11/2016 10:11 AM, Topi Pohjolainen wrote:

Demonstrates a bug in Intel color resolve logic. If rendering to
texture is preceded by fast clear subsequent reads from the
texture require the underlying color buffer to be resolved. In
case of mipmap generation Intel driver needs to reallocate the
underlying buffer to fit the subsequent levels. However, copy of
the original level zero to newly allocated buffer is delayed until
the driver is about to generate level one using level zero as
source. This causes a color resolve of the original level zero.
Both the generation of level one and the resolve are meta
operations, and the latter will interfere with the sampler
settings of the former.

Signed-off-by: Topi Pohjolainen 
CC: Ian Romanick 
---
  tests/all.py  |  1 +
  tests/texturing/getteximage-formats.c | 16 +---
  2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 2912d1f..8938bfc 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2987,6 +2987,7 @@ with profile.group_manager(
  g(['fbo-storage-completeness'])
  g(['fbo-storage-formats'])
  g(['getteximage-formats', 'init-by-rendering'])
+g(['getteximage-formats', 'init-by-clear-and-render'])
  g(['ext_framebuffer_multisample-fast-clear', 'single-sample'],
'fbo-fast-clear')
  add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX1')
diff --git a/tests/texturing/getteximage-formats.c 
b/tests/texturing/getteximage-formats.c
index 715d5df..320683f 100644
--- a/tests/texturing/getteximage-formats.c
+++ b/tests/texturing/getteximage-formats.c
@@ -50,6 +50,7 @@ static const char *TestName = "getteximage-formats";
  static const GLfloat clearColor[4] = { 0.4, 0.4, 0.4, 0.0 };
  static GLuint texture_id;
  static GLboolean init_by_rendering;
+static GLboolean init_by_clearing_first;

  #define TEX_SIZE 128

@@ -83,7 +84,7 @@ make_texture_image(GLenum intFormat, GLubyte 
upperRightTexel[4])

memcpy(upperRightTexel, tex[TEX_SIZE-1][TEX_SIZE-1], 4);

-   if (init_by_rendering) {
+   if (init_by_rendering || init_by_clearing_first) {
/* Initialize the mipmap levels. */
for (i = TEX_SIZE, j = 0; i; i >>= 1, j++) {
glTexImage2D(GL_TEXTURE_2D, j, intFormat, i, i, 0,
@@ -102,6 +103,11 @@ make_texture_image(GLenum intFormat, GLubyte 
upperRightTexel[4])
return GL_FALSE;
}

+   if (init_by_clearing_first) {
+   glClearColor(1, 0, 0, 1);
+   glClear(GL_COLOR_BUFFER_BIT);
+   }
+
glViewport(0, 0, TEX_SIZE, TEX_SIZE);

glWindowPos2iARB(0, 0);
@@ -365,6 +371,7 @@ test_format(const struct test_desc *test,
GLfloat expected[4], pix[4], tolerance[4];
GLboolean pass = GL_TRUE;

+   glClearColor(clearColor[0], clearColor[1], clearColor[2], 
clearColor[3]);
glClear(GL_COLOR_BUFFER_BIT);

/* The RGBA_DXT1 formats seem to expose a Mesa/libtxc_dxtn bug.
@@ -536,6 +543,11 @@ piglit_init(int argc, char **argv)
puts("The textures will be initialized by rendering "
 "to them using glDrawPixels.");
break;
+   } else if (strcmp(argv[i], "init-by-clear-and-render") == 0) {
+   init_by_clearing_first = GL_TRUE;
+   puts("The textures will be initialized by rendering "
+"to them using glCear and glDrawPixels.");
+   break;
}
}

@@ -547,6 +559,4 @@ piglit_init(int argc, char **argv)
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-   glClearColor(clearColor[0], clearColor[1], clearColor[2], 
clearColor[3]);
  }



Reviewed-by: Brian Paul 

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] getteximage-formats: Add option to clear texture before rendering

2016-02-11 Thread Topi Pohjolainen
Demonstrates a bug in Intel color resolve logic. If rendering to
texture is preceded by fast clear subsequent reads from the
texture require the underlying color buffer to be resolved. In
case of mipmap generation Intel driver needs to reallocate the
underlying buffer to fit the subsequent levels. However, copy of
the original level zero to newly allocated buffer is delayed until
the driver is about to generate level one using level zero as
source. This causes a color resolve of the original level zero.
Both the generation of level one and the resolve are meta
operations, and the latter will interfere with the sampler
settings of the former.

Signed-off-by: Topi Pohjolainen 
CC: Ian Romanick 
---
 tests/all.py  |  1 +
 tests/texturing/getteximage-formats.c | 16 +---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 2912d1f..8938bfc 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2987,6 +2987,7 @@ with profile.group_manager(
 g(['fbo-storage-completeness'])
 g(['fbo-storage-formats'])
 g(['getteximage-formats', 'init-by-rendering'])
+g(['getteximage-formats', 'init-by-clear-and-render'])
 g(['ext_framebuffer_multisample-fast-clear', 'single-sample'],
   'fbo-fast-clear')
 add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX1')
diff --git a/tests/texturing/getteximage-formats.c 
b/tests/texturing/getteximage-formats.c
index 715d5df..320683f 100644
--- a/tests/texturing/getteximage-formats.c
+++ b/tests/texturing/getteximage-formats.c
@@ -50,6 +50,7 @@ static const char *TestName = "getteximage-formats";
 static const GLfloat clearColor[4] = { 0.4, 0.4, 0.4, 0.0 };
 static GLuint texture_id;
 static GLboolean init_by_rendering;
+static GLboolean init_by_clearing_first;
 
 #define TEX_SIZE 128
 
@@ -83,7 +84,7 @@ make_texture_image(GLenum intFormat, GLubyte 
upperRightTexel[4])
 
memcpy(upperRightTexel, tex[TEX_SIZE-1][TEX_SIZE-1], 4);
 
-   if (init_by_rendering) {
+   if (init_by_rendering || init_by_clearing_first) {
/* Initialize the mipmap levels. */
for (i = TEX_SIZE, j = 0; i; i >>= 1, j++) {
glTexImage2D(GL_TEXTURE_2D, j, intFormat, i, i, 0,
@@ -102,6 +103,11 @@ make_texture_image(GLenum intFormat, GLubyte 
upperRightTexel[4])
return GL_FALSE;
}
 
+   if (init_by_clearing_first) {
+   glClearColor(1, 0, 0, 1);
+   glClear(GL_COLOR_BUFFER_BIT);
+   }
+
glViewport(0, 0, TEX_SIZE, TEX_SIZE);
 
glWindowPos2iARB(0, 0);
@@ -365,6 +371,7 @@ test_format(const struct test_desc *test,
GLfloat expected[4], pix[4], tolerance[4];
GLboolean pass = GL_TRUE;
 
+   glClearColor(clearColor[0], clearColor[1], clearColor[2], 
clearColor[3]);
glClear(GL_COLOR_BUFFER_BIT);
 
/* The RGBA_DXT1 formats seem to expose a Mesa/libtxc_dxtn bug.
@@ -536,6 +543,11 @@ piglit_init(int argc, char **argv)
puts("The textures will be initialized by rendering "
 "to them using glDrawPixels.");
break;
+   } else if (strcmp(argv[i], "init-by-clear-and-render") == 0) {
+   init_by_clearing_first = GL_TRUE;
+   puts("The textures will be initialized by rendering "
+"to them using glCear and glDrawPixels.");
+   break;
}
}
 
@@ -547,6 +559,4 @@ piglit_init(int argc, char **argv)
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-   glClearColor(clearColor[0], clearColor[1], clearColor[2], 
clearColor[3]);
 }
-- 
2.5.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit