[Piglit] [PATCH] glsl-1.30: add basic test for testing textureOffset functionality.

Roland Scheidegger sroland at vmware.com
Tue Mar 5 10:50:28 PST 2013


Am 05.03.2013 19:41, schrieb Brian Paul:
> On 03/05/2013 11:03 AM, Roland Scheidegger wrote:
>> Am 05.03.2013 17:05, schrieb Brian Paul:
>>> On 03/05/2013 08:37 AM, sroland at vmware.com wrote:
>>>> From: Roland Scheidegger<sroland at vmware.com>
>>>>
>>>> This is pretty rough and doesn't really test all that much (just
>>>> textureOffsetLod, but there's other texturing functions with offsets),
>>>> doesn't test different wrap modes, NPOT sizes etc., but there's no
>>>> other test using "ordinary" texture opcodes and texel offsets, so
>>>> it's a start (and in fact it exposed a bug in the mesa state tracker).
>>>> Tested with llvmpipe (pass) and softpipe (fail) which is as expected -
>>>> hopefully the math is ok...
>>>> Inspired from fs-texelFetchOffset.
>>>> ---
>>>>    tests/spec/glsl-1.30/execution/CMakeLists.gl.txt   |    1 +
>>>>    .../spec/glsl-1.30/execution/fs-textureOffset-2D.c |  158
>>>> ++++++++++++++++++++
>>>>    2 files changed, 159 insertions(+)
>>>>    create mode 100644
>>>> tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
>>>>
>>>> diff --git a/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
>>>> b/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
>>>> index 6737bb1..3c0b2d5 100644
>>>> --- a/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
>>>> +++ b/tests/spec/glsl-1.30/execution/CMakeLists.gl.txt
>>>> @@ -13,6 +13,7 @@ link_libraries (
>>>>    piglit_add_executable (fs-discard-exit-2 fs-discard-exit-2.c)
>>>>    piglit_add_executable (fs-texelFetch-2D fs-texelFetch-2D.c)
>>>>    piglit_add_executable (fs-texelFetchOffset-2D
>>>> fs-texelFetchOffset-2D.c)
>>>> +piglit_add_executable (fs-textureOffset-2D fs-textureOffset-2D.c)
>>>>    IF (NOT MSVC)
>>>>        piglit_add_executable (isinf-and-isnan isinf-and-isnan.c)
>>>>    ENDIF (NOT MSVC)
>>>> diff --git a/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
>>>> b/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
>>>> new file mode 100644
>>>> index 0000000..4c050fb
>>>> --- /dev/null
>>>> +++ b/tests/spec/glsl-1.30/execution/fs-textureOffset-2D.c
>>>> @@ -0,0 +1,158 @@
>>>> +/*
>>>> + * Copyright 2013 VMware, Inc.
>>>> + *
>>>> + * 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 fs-textureOffset-2D.c
>>>> + *
>>>> + * Tests the built-in function textureLodOffset() in the fragment
>>>> shader.
>>>> + *
>>>> + * Creates a mipmapped 64x32 2D texture and draws a series of squares
>>>> whose
>>>> + * color contains a texel fetched from each quadrant of the rgbw
>>>> texture.
>>>> + *
>>>> + * Author: Roland Scheidegger
>>>> + */
>>>> +#include "piglit-util-gl-common.h"
>>>> +
>>>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>>>> +
>>>> +    config.supports_gl_compat_version = 10;
>>>> +
>>>> +    config.window_width = 90;
>>>> +    config.window_height = 150;
>>>
>>> width=90 might cause trouble on Windows.  Windows will bump up the size
>>> to 120 pixels (IIRC).  This has caused other tests to fail in the past.
>> Ok, I'll bump it up to 120.
> 
> Or just omit them and use the defaults.
Oh yes sounds even better. I wasn't aware that you can omit it.

Roland


More information about the Piglit mailing list