[Piglit] [PATCH 1/4] Add a new comprehensive test for textureSize().
Kenneth Graunke
kenneth at whitecape.org
Mon Dec 5 14:17:23 PST 2011
On 11/30/2011 05:24 AM, Eric Anholt wrote:
> On Tue, 29 Nov 2011 23:32:27 -0800, Kenneth Graunke <kenneth at whitecape.org> wrote:
>> This exhaustively tests all of GLSL 1.30's textureSize variants, both in
>> the vertex and fragment shaders. It covers:
>> - Sampler data type (floating point, signed integer, unsigned integer)
>> - Dimensionality (1D, 2D, 3D, Cube, 1DArray, 2DArray)
>> - Color and shadow samplers
>> - Mipmapped textures
>> - Non-power-of-two textures
>>
>> It doesn't cover texture format variations. In fact, the test never
>> actually provides any content for the textures, because it should be
>> irrelevant for textureSize(), is easier to program, and also extra mean.
>>
>> The new "textureSize" binary takes two arguments: shader stage and
>> sampler type. For example:
>>
>> ./bin/textureSize fs sampler1DArrayShadow
>> ./bin/textureSize vs usamplerCube
>>
>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>> ---
>
>> +#define BS 500
>
> Heh. Workaround for Windows developers always replacing nice asprintfs
> with snprintf instead of just defining asprintf on their platform
> produces #define BS :)
Heh! :D I'll convert it to use asprintf.
>> + int is_array = sampler->gl_target == GL_TEXTURE_1D_ARRAY ||
>> + sampler->gl_target == GL_TEXTURE_2D_ARRAY;
>
> is_array should probably imply a check for GL_EXT_texture_array.
Will do, thanks.
>> + /* Draw consecutive squares for each mipmap level */
>> + for (l = 0; l < miplevels; l++) {
>> + const int x = 10 + l * 20;
>> + float expected_color[4] = { 0.0, 0.0, 0.0, 1.0 };
>> + for (i = 0; i < sampler->size; i++)
>> + expected_color[i] = 0.01 * level_size[i];
>> +
>> + piglit_Uniform1i(lod_location, l);
>> + glViewport(x, 10, 10, 10);
>> + piglit_draw_rect(-1, -1, 2, 2);
>> +
>> + pass &= piglit_probe_rect_rgba(x, 10, 10, 10, expected_color);
>> +
>> + /* For arrays, the # of slices never changes; don't divide */
>> + for (i = 0; i < sampler->size - is_array; i++)
>> + level_size[i] = max2(level_size[i] / 2, 1);
>> + }
>
> I'd be curious what the result is supposed to be for lod > maxlevel and
> seeing that tested (also for single-level textures).
More information about the Piglit
mailing list