[v2] GL_ARB_texture_buffer_object: New test for error behavior.

Submitted by Illia Iorin on June 5, 2018, 11:58 a.m.

Details

Message ID 20180605115836.32730-1-illia.iorin@gloaballogic.com
State New
Headers show
Series "GL_ARB_texture_buffer_object: New test for error behavior." ( rev: 2 ) in Piglit

Not browsing as part of any series.

Commit Message

Illia Iorin June 5, 2018, 11:58 a.m.
This test checks that if we allocate more memory for the buffer
 than possible, we get GL_OUT_OF_MEMORY error.
V2:
  - check GL_ARB_texture_buffer_object extension
  - change storage format to GL_RGBA32I
  - check gl compat version 3.1 because
	function glTexBuffer() require that version
Signed-off-by: Illia Iorin <illia.iorin@globallogic.com>
---
 tests/opengl.py                               |  1 +
 .../CMakeLists.gl.txt                         |  1 +
 .../negative-bad-oom.c                        | 61 +++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 tests/spec/arb_texture_buffer_object/negative-bad-oom.c

Patch hide | download patch | download mbox

diff --git a/tests/opengl.py b/tests/opengl.py
index 9c43d32c9..56cf4f041 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2365,6 +2365,7 @@  with profile.test_list.group_manager(
     g(['arb_texture_buffer_object-max-size'], 'max-size')
     g(['arb_texture_buffer_object-minmax'], 'minmax')
     g(['arb_texture_buffer_object-negative-bad-bo'], 'negative-bad-bo')
+    g(['arb_texture_buffer_object-negative-bad-oom'], 'negative-bad-oom')
     g(['arb_texture_buffer_object-negative-bad-format'], 'negative-bad-format')
     g(['arb_texture_buffer_object-negative-bad-target'], 'negative-bad-target')
     g(['arb_texture_buffer_object-negative-unsupported'],
diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
index 959ca0c2f..98d1e16d8 100644
--- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
@@ -25,3 +25,4 @@  piglit_add_executable (arb_texture_buffer_object-subdata-sync subdata-sync.c)
 piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
 piglit_add_executable (arb_texture_buffer_object-fetch-outside-bounds fetch-outside-bounds.c)
 piglit_add_executable (arb_texture_buffer_object-indexed indexed.c)
+piglit_add_executable (arb_texture_buffer_object-negative-bad-oom negative-bad-oom.c)
\ No newline at end of file
diff --git a/tests/spec/arb_texture_buffer_object/negative-bad-oom.c b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
new file mode 100644
index 000000000..53d4ff3f8
--- /dev/null
+++ b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
@@ -0,0 +1,61 @@ 
+/* Copyright © 2018 Illia Iorin 
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**@file negative-bad-oom.c 
+* This test checks  allocat more memory than possible, 
+* the glGetError() will return  GL_OUT_OF_MEMORY error flag 
+*/
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 20;
+	config.supports_gl_core_version = 31;
+
+	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+	config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL; /* UNREACHED */
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+	GLuint tex, tbo;
+	glGenBuffers(1, &tbo);
+	glBindBuffer(GL_TEXTURE_BUFFER, tbo);
+
+	glGenTextures(1, &tex);
+	glBindTexture(GL_TEXTURE_BUFFER, tex);
+	glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32I, tbo);
+	glBufferData(GL_TEXTURE_BUFFER,
+		     INT_MAX , NULL, GL_STATIC_READ);
+	if (!piglit_check_gl_error(GL_OUT_OF_MEMORY))
+		piglit_report_result(PIGLIT_FAIL);
+	piglit_report_result(PIGLIT_PASS);
+}
\ No newline at end of file

Comments

On 06/05/2018 04:58 AM, Illia Iorin wrote:
> This test checks that if we allocate more memory for the buffer
>  than possible, we get GL_OUT_OF_MEMORY error.
> V2:
>   - check GL_ARB_texture_buffer_object extension
>   - change storage format to GL_RGBA32I
>   - check gl compat version 3.1 because
> 	function glTexBuffer() require that version

Uh... but you actually set it to 2.0.  Also, it's helpful if there's a
blank line between the body of the commit message an the first
Signed-off-by, Reviewed-by, etc.

One more nit below...

Assuming nobody else has comments, I can tidy these issues up and push
this patch Wednesday morning.

> Signed-off-by: Illia Iorin <illia.iorin@globallogic.com>
> ---
>  tests/opengl.py                               |  1 +
>  .../CMakeLists.gl.txt                         |  1 +
>  .../negative-bad-oom.c                        | 61 +++++++++++++++++++
>  3 files changed, 63 insertions(+)
>  create mode 100644 tests/spec/arb_texture_buffer_object/negative-bad-oom.c
> 
> diff --git a/tests/opengl.py b/tests/opengl.py
> index 9c43d32c9..56cf4f041 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -2365,6 +2365,7 @@ with profile.test_list.group_manager(
>      g(['arb_texture_buffer_object-max-size'], 'max-size')
>      g(['arb_texture_buffer_object-minmax'], 'minmax')
>      g(['arb_texture_buffer_object-negative-bad-bo'], 'negative-bad-bo')
> +    g(['arb_texture_buffer_object-negative-bad-oom'], 'negative-bad-oom')
>      g(['arb_texture_buffer_object-negative-bad-format'], 'negative-bad-format')
>      g(['arb_texture_buffer_object-negative-bad-target'], 'negative-bad-target')
>      g(['arb_texture_buffer_object-negative-unsupported'],
> diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> index 959ca0c2f..98d1e16d8 100644
> --- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> +++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> @@ -25,3 +25,4 @@ piglit_add_executable (arb_texture_buffer_object-subdata-sync subdata-sync.c)
>  piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
>  piglit_add_executable (arb_texture_buffer_object-fetch-outside-bounds fetch-outside-bounds.c)
>  piglit_add_executable (arb_texture_buffer_object-indexed indexed.c)
> +piglit_add_executable (arb_texture_buffer_object-negative-bad-oom negative-bad-oom.c)
> \ No newline at end of file
> diff --git a/tests/spec/arb_texture_buffer_object/negative-bad-oom.c b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
> new file mode 100644
> index 000000000..53d4ff3f8
> --- /dev/null
> +++ b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
> @@ -0,0 +1,61 @@
> +/* Copyright © 2018 Illia Iorin 
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +/**@file negative-bad-oom.c 
> +* This test checks  allocat more memory than possible, 
> +* the glGetError() will return  GL_OUT_OF_MEMORY error flag 
> +*/
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +	config.supports_gl_compat_version = 20;
> +	config.supports_gl_core_version = 31;
> +
> +	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
> +	config.khr_no_error_support = PIGLIT_HAS_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +	return PIGLIT_FAIL; /* UNREACHED */
> +}
> +

Only one blank line here.

> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +	GLuint tex, tbo;
> +	glGenBuffers(1, &tbo);
> +	glBindBuffer(GL_TEXTURE_BUFFER, tbo);
> +
> +	glGenTextures(1, &tex);
> +	glBindTexture(GL_TEXTURE_BUFFER, tex);
> +	glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32I, tbo);
> +	glBufferData(GL_TEXTURE_BUFFER,
> +		     INT_MAX , NULL, GL_STATIC_READ);
> +	if (!piglit_check_gl_error(GL_OUT_OF_MEMORY))
> +		piglit_report_result(PIGLIT_FAIL);
> +	piglit_report_result(PIGLIT_PASS);
> +}
> \ No newline at end of file
>
On Tue, Jun 5, 2018 at 2:32 PM, Ian Romanick <idr@freedesktop.org> wrote:
> On 06/05/2018 04:58 AM, Illia Iorin wrote:
>> This test checks that if we allocate more memory for the buffer
>>  than possible, we get GL_OUT_OF_MEMORY error.
>> V2:
>>   - check GL_ARB_texture_buffer_object extension

This bit didn't happen.

>>   - change storage format to GL_RGBA32I
>>   - check gl compat version 3.1 because
>>       function glTexBuffer() require that version
>
> Uh... but you actually set it to 2.0.  Also, it's helpful if there's a
> blank line between the body of the commit message an the first
> Signed-off-by, Reviewed-by, etc.

Having both core and compat is set causes just one of them to always
be picked, as I recall.

>
> One more nit below...
>
> Assuming nobody else has comments, I can tidy these issues up and push
> this patch Wednesday morning.
>
>> Signed-off-by: Illia Iorin <illia.iorin@globallogic.com>
>> ---
>>  tests/opengl.py                               |  1 +
>>  .../CMakeLists.gl.txt                         |  1 +
>>  .../negative-bad-oom.c                        | 61 +++++++++++++++++++
>>  3 files changed, 63 insertions(+)
>>  create mode 100644 tests/spec/arb_texture_buffer_object/negative-bad-oom.c
>>
>> diff --git a/tests/opengl.py b/tests/opengl.py
>> index 9c43d32c9..56cf4f041 100644
>> --- a/tests/opengl.py
>> +++ b/tests/opengl.py
>> @@ -2365,6 +2365,7 @@ with profile.test_list.group_manager(
>>      g(['arb_texture_buffer_object-max-size'], 'max-size')
>>      g(['arb_texture_buffer_object-minmax'], 'minmax')
>>      g(['arb_texture_buffer_object-negative-bad-bo'], 'negative-bad-bo')
>> +    g(['arb_texture_buffer_object-negative-bad-oom'], 'negative-bad-oom')
>>      g(['arb_texture_buffer_object-negative-bad-format'], 'negative-bad-format')
>>      g(['arb_texture_buffer_object-negative-bad-target'], 'negative-bad-target')
>>      g(['arb_texture_buffer_object-negative-unsupported'],
>> diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
>> index 959ca0c2f..98d1e16d8 100644
>> --- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
>> +++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
>> @@ -25,3 +25,4 @@ piglit_add_executable (arb_texture_buffer_object-subdata-sync subdata-sync.c)
>>  piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
>>  piglit_add_executable (arb_texture_buffer_object-fetch-outside-bounds fetch-outside-bounds.c)
>>  piglit_add_executable (arb_texture_buffer_object-indexed indexed.c)
>> +piglit_add_executable (arb_texture_buffer_object-negative-bad-oom negative-bad-oom.c)
>> \ No newline at end of file
>> diff --git a/tests/spec/arb_texture_buffer_object/negative-bad-oom.c b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
>> new file mode 100644
>> index 000000000..53d4ff3f8
>> --- /dev/null
>> +++ b/tests/spec/arb_texture_buffer_object/negative-bad-oom.c
>> @@ -0,0 +1,61 @@
>> +/* Copyright © 2018 Illia Iorin
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the next
>> + * paragraph) shall be included in all copies or substantial portions of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>> + * IN THE SOFTWARE.
>> + */
>> +
>> +/**@file negative-bad-oom.c
>> +* This test checks  allocat more memory than possible,
>> +* the glGetError() will return  GL_OUT_OF_MEMORY error flag
>> +*/
>> +#include "piglit-util-gl.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +     config.supports_gl_compat_version = 20;
>> +     config.supports_gl_core_version = 31;
>> +
>> +     config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
>> +     config.khr_no_error_support = PIGLIT_HAS_ERRORS;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +     return PIGLIT_FAIL; /* UNREACHED */
>> +}
>> +
>
> Only one blank line here.
>
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +     GLuint tex, tbo;
>> +     glGenBuffers(1, &tbo);
>> +     glBindBuffer(GL_TEXTURE_BUFFER, tbo);
>> +
>> +     glGenTextures(1, &tex);
>> +     glBindTexture(GL_TEXTURE_BUFFER, tex);
>> +     glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32I, tbo);
>> +     glBufferData(GL_TEXTURE_BUFFER,
>> +                  INT_MAX , NULL, GL_STATIC_READ);
>> +     if (!piglit_check_gl_error(GL_OUT_OF_MEMORY))
>> +             piglit_report_result(PIGLIT_FAIL);
>> +     piglit_report_result(PIGLIT_PASS);
>> +}
>> \ No newline at end of file
>>
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit