[Piglit] [RFC 3/3] tests/spec: add tests for oes image external

Chad Versace chad.versace at linux.intel.com
Fri Mar 1 11:29:51 PST 2013


On 02/26/2013 05:15 AM, Topi Pohjolainen wrote:
> This consists of tests adapted from Khronos conformance suite and
> Android surface flinger. While the former deals with "getters/setters",
> enumrations and simple sampling of texture based images, the latter
> addresses bilinear sampling of non-GPU written subsampled UV-planes
> and conversion from YUV to RGB.
> 
> The original Android test consist of two YV12 formatted textures,
> one of size 64x64 and another of size 64x66. Both represent checker
> board pattern each YUV component having value 63 or 191. Here I have
> only the first but I'm planning to adopt the latter also if the approach
> I have taken is reasonable. Instead of filling in the entire pattern I
> have only written those YUV-components that are actually checked (a
> dozen odd pixels) while the rest are initialised to zero. In addition
> I used calculated floating point values instead of the hardcoded found
> in the original. There, however, I ended up in deviations and I would
> appreciate if people understanding the domain of YUV to RGB conversion
> better could take a good look.
> 
> In the implementation that I have written for mesa/i965 I have also
> support for NV12 format. Whereas YV12 (YVU420) has separate U- and
> V-planes, NV12 has them combined into one. Hence I would like to have
> the same tests for NV12 as for YV12 if acceptable.
> 
> The tests are written only for ES2 contexts, I haven't looked into
> how I would separate the tests not dealing with external sampler
> (samplerExternalOES is only defined for ES 2.x).
> 
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>  tests/spec/CMakeLists.txt                          |    1 +
>  .../oes_egl_image_external/CMakeLists.gles2.txt    |   16 +
>  tests/spec/oes_egl_image_external/CMakeLists.txt   |    3 +
>  .../oes_egl_image_external.c                       |  776 ++++++++++++++++++++
>  4 files changed, 796 insertions(+)
>  create mode 100644 tests/spec/oes_egl_image_external/CMakeLists.gles2.txt
>  create mode 100644 tests/spec/oes_egl_image_external/CMakeLists.txt
>  create mode 100644 tests/spec/oes_egl_image_external/oes_egl_image_external.c





> +static bool
> +test_64x64_yv12(void)
> +{
> +	bool pass;
> +	unsigned char y[64 * 64];
> +	unsigned char u[32 * 32];
> +	unsigned char v[32 * 32];
> +	EGLImageKHR img;
> +	void *buf;
> +
> +	write_64x64_420(y, u, v);
> +	/* Reversing the order of UV-planes gives YVU420 a.k.a. YV12 */
> +	buf = piglit_create_ext_420_buf(64, 64, true, y, u, v);
> +	if (!buf) {
> +		printf("failed to create external buffer\n");
> +		return false;

As I mentioned in patch 1, this is one of the places where the test
should skip if the platform is incapable of creating a yuv420 buffer.
If the the platform *is* capable of creating a yuv420, but fails to
do so, only then does it make sense to fail here.

> +	}



> +/**
> + * INVALID_ENUM should be generated for TexImage2D, TexSubImage2D,
> + * CompressedTexImager2D and CompressedTexSubImage2D with
> + * TEXTURE_EXTERNAL_OES.
> + */
> +static bool
> +test_disallow_image_2d(void)
> +{
> +	GLushort pixel_2x2_565[] = { 0, 0, 0, 0 };
> +	GLuint tex;
> +
> +	glGenTextures(1, &tex);
> +	glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);
> +
> +	glTexImage2D(GL_TEXTURE_EXTERNAL_OES, 0, GL_RGB, 2, 2, 0, GL_RGB,
> +		GL_UNSIGNED_SHORT_5_6_5, pixel_2x2_565);
> +	if (glGetError() != GL_INVALID_ENUM) {
> +		printf("TexImage2D() cannot be invoked for EXTERNAL_OES\n");
> +        	glDeleteTextures(1, &tex);
> +		return false;
> +	}

Piglit has a useful utility for checking GL errors: piglit_check_gl_error().
It prints good diagnostic information, so please use it here and in similar
places in your test. A quick grep should show you how to use it.

----

I tried reviewing the whole test, but quickly realized that I don't know
enough about color formats to do so.



More information about the Piglit mailing list