[Piglit] [PATCH] ext_texture_array: add simple API errors test
Brian Paul
brianp at vmware.com
Wed Dec 3 07:21:02 PST 2014
On 12/03/2014 12:47 AM, Tapani Pälli wrote:
>
>
> On 12/02/2014 06:43 PM, Brian Paul wrote:
>> ---
>> tests/all.py | 1 +
>> tests/spec/ext_texture_array/CMakeLists.gl.txt | 1 +
>> tests/spec/ext_texture_array/errors.c | 170
>> +++++++++++++++++++++++++
>> 3 files changed, 172 insertions(+)
>> create mode 100644 tests/spec/ext_texture_array/errors.c
>
> 8<
>
>> +static bool
>> +test_2d_dimensions(void)
>> +{
>> + bool pass = true;
>> + GLuint tex;
>> +
>> + glGenTextures(1, &tex);
>> + glBindTexture(GL_TEXTURE_1D_ARRAY, tex);
>> +
>> + /*
>> + * zero dimensions should be OK
>> + */
>> + glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA,
>
>
> You are binding texture as GL_TEXTURE_1D_ARRAY but then setting target
> for glTexImage3D as GL_TEXTURE_2D_ARRAY.
Copy and paste fail.
> Should this fail?
No, because the glTexImage3D call at that point will address the default
texture object for the GL_TEXTURE_2D_ARRAY target.
> Why is the
> last case invalid if texture is bound as GL_TEXTURE_1D_ARRAY?
Because GL_TEXTURE_1D_ARRAY is not a legal target for glTexImage3D().
I'll fix the copy&paste mistake before pushing.
-Brian
>
>
>> + 0, 0, 0, /* w, h, d */
>> + 0, /* border */
>> + GL_RGBA, GL_FLOAT, NULL);
>> + if (!piglit_check_gl_error(GL_NO_ERROR))
>> + pass = false;
>> +
>> + glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA,
>> + 1, 0, 0, /* w, h, d */
>> + 0, /* border */
>> + GL_RGBA, GL_FLOAT, NULL);
>> + if (!piglit_check_gl_error(GL_NO_ERROR))
>> + pass = false;
>> +
>> + glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA,
>> + 1, 1, 0, /* w, h, d */
>> + 0, /* border */
>> + GL_RGBA, GL_FLOAT, NULL);
>> + if (!piglit_check_gl_error(GL_NO_ERROR))
>> + pass = false;
>> +
>> + glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA,
>> + 1, 0, 1, /* w, h, d */
>> + 0, /* border */
>> + GL_RGBA, GL_FLOAT, NULL);
>> + if (!piglit_check_gl_error(GL_NO_ERROR))
>> + pass = false;
>> +
>> + /* Test too many layers */
>> + glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA,
>> + 32, 32, MaxLayers + 1, /* w, h, d */
>> + 0, /* border */
>> + GL_RGBA, GL_FLOAT, NULL);
>> + if (!piglit_check_gl_error(GL_INVALID_VALUE))
>> + pass = false;
>> +
>> + /* Test invalid target */
>> + glTexImage3D(GL_TEXTURE_1D_ARRAY, 0, GL_RGBA,
>> + 32, 32, 2, /* w, h, d */
>> + 0, /* border */
>> + GL_RGBA, GL_FLOAT, NULL);
>> + if (!piglit_check_gl_error(GL_INVALID_ENUM))
>> + pass = false;
>> +
>> + return pass;
>> +}
>> +
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> + bool pass;
>> +
>> + pass = test_1d_dimensions();
>> + pass = test_2d_dimensions() && pass;
>> +
>> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>> +}
>> +
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> + piglit_require_extension("GL_EXT_texture_array");
>> +
>> + glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, &MaxLayers);
>> +}
>>
More information about the Piglit
mailing list