Re: [Piglit] v3: ext_memory_object: Test sampling memory exported from Vulkan

2017-12-22 Thread Pohjolainen, Topi
On Thu, Dec 21, 2017 at 11:55:07AM -0500, Andres Rodriguez wrote:
> 
> I'm not familiar enough with the framework patches to give you a review
> there, hopefully someone else can chime in on those.
> 
> Patches 5, 7, 10 are:
> 
> Reviewed-by: Andres Rodriguez 
> 
> Other patches have replies inline.

Thanks for the review! I sent revisions for two patches. Those and
the more trivial updates can be also found in:

git://people.freedesktop.org/~tpohjola/piglit:external_objects

Next there are going to be holidays and then I need to continue on
other things meaning this might be on hold for a bit. All help is
anyway really welcome as there is a lot work remaining.

> 
> Thanks for the patches,
> Andres
> 
> On 2017-12-21 07:02 AM, Topi Pohjolainen wrote:
> > Here is a revision taking into account feedback from Andres and Fredrik.
> > Many thanks for both, I hope I didn't miss anything.
> > 
> > CC: Andres Rodriguez 
> > CC: Fredrik Hoeglund 
> > CC: Jason Ekstrand 
> > 
> > Topi Pohjolainen (11):
> >framework: Check for vulkan availability
> >framework: HACK: Read glslc path from env
> >ext_memory_object: Add script for turning glsl into spirv c-array
> >ext_memory_object: Support for setting up vulkan device
> >ext_memory_object: Support for drawing with vulkan
> >ext_memory_object: Support for setting up vulkan framebuffer
> >ext_memory_object: Add tex layout command line
> >ext_memory_object: Support for importing vulkan memory
> >ext_memory_object: Support for creating simple vulkan pipelines
> >ext_memory_object: Add helper for image type support
> >ext_memory_object: Test render with vulkan and sample with gl
> > 
> >   CMakeLists.txt |   3 +
> >   tests/spec/ext_memory_object/CMakeLists.gl.txt |  18 +
> >   tests/spec/ext_memory_object/common.c  | 167 +
> >   tests/spec/ext_memory_object/common.h  |  51 ++
> >   .../compile_and_dump_glsl_as_spirv.py  | 139 +
> >   tests/spec/ext_memory_object/vk_common.c   | 670 
> > +
> >   tests/spec/ext_memory_object/vk_common.h   | 176 ++
> >   .../ext_memory_object/vk_export_image_as_tex.c | 219 +++
> >   tests/spec/ext_memory_object/vk_fb.c   | 346 +++
> >   tests/spec/ext_memory_object/vk_fragcoord.fs   |   7 +
> >   tests/spec/ext_memory_object/vk_fragcoord.vs   |   8 +
> >   11 files changed, 1804 insertions(+)
> >   create mode 100644 tests/spec/ext_memory_object/common.c
> >   create mode 100644 tests/spec/ext_memory_object/common.h
> >   create mode 100644 
> > tests/spec/ext_memory_object/compile_and_dump_glsl_as_spirv.py
> >   create mode 100644 tests/spec/ext_memory_object/vk_common.c
> >   create mode 100644 tests/spec/ext_memory_object/vk_common.h
> >   create mode 100644 tests/spec/ext_memory_object/vk_export_image_as_tex.c
> >   create mode 100644 tests/spec/ext_memory_object/vk_fb.c
> >   create mode 100644 tests/spec/ext_memory_object/vk_fragcoord.fs
> >   create mode 100644 tests/spec/ext_memory_object/vk_fragcoord.vs
> > 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [v3 06/11] ext_memory_object: Support for setting up vulkan framebuffer

2017-12-21 Thread Pohjolainen, Topi
On Thu, Dec 21, 2017 at 11:25:04AM -0500, Andres Rodriguez wrote:
> 
> 
> On 2017-12-21 07:02 AM, Topi Pohjolainen wrote:
> > v2: Store image size in order to know how much memory to import,
> >  see glImportMemoryFdEXT().
> > 
> > v3:
> >  - use "goto fail" for all failure paths (Andres)
> >  - use VkExternalMemoryImageCreateInfoKHR (Fredrik)
> >  - check for dedicated using
> >vkGetImageMemoryRequirements2KHR() (Fredrik)
> > 
> > Signed-off-by: Topi Pohjolainen 
> > ---
> >   tests/spec/ext_memory_object/vk_common.c |  13 ++
> >   tests/spec/ext_memory_object/vk_common.h |  53 +
> >   tests/spec/ext_memory_object/vk_fb.c | 346 
> > +++
> >   3 files changed, 412 insertions(+)
> >   create mode 100644 tests/spec/ext_memory_object/vk_fb.c
> > 
> > diff --git a/tests/spec/ext_memory_object/vk_common.c 
> > b/tests/spec/ext_memory_object/vk_common.c
> > index 2c664742a..eaecdf8cd 100644
> > --- a/tests/spec/ext_memory_object/vk_common.c
> > +++ b/tests/spec/ext_memory_object/vk_common.c
> > @@ -570,3 +570,16 @@ vk_create_fence(VkDevice dev)
> >   return fence;
> >   }
> > +
> > +PFN_vkGetImageMemoryRequirements2KHR
> > +vk_get_proc_addr_for_image_mem_req(VkDevice dev)
> > +{
> > +   static PFN_vkGetImageMemoryRequirements2KHR get_mem_req = NULL;
> > +
> > +   if (get_mem_req == NULL)
> > +   get_mem_req = (PFN_vkGetImageMemoryRequirements2KHR)
> > +   vkGetDeviceProcAddr(
> > +   dev, "vkGetImageMemoryRequirements2KHR");
> > +
> > +return get_mem_req;
> > +}
> > diff --git a/tests/spec/ext_memory_object/vk_common.h 
> > b/tests/spec/ext_memory_object/vk_common.h
> > index b4c22575c..c9d920523 100644
> > --- a/tests/spec/ext_memory_object/vk_common.h
> > +++ b/tests/spec/ext_memory_object/vk_common.h
> > @@ -44,12 +44,62 @@ struct vk_vertex_buffer {
> > VkDeviceMemory mem;
> >   };
> > +struct vk_image {
> > +   VkImage image;
> > +   VkDeviceMemory mem;
> > +   VkDeviceSize size;
> > +};
> > +
> > +struct vk_attachment {
> > +   struct vk_image image;
> > +   VkImageView view;
> > +};
> > +
> > +struct vk_fb {
> > +   struct vk_attachment color;
> > +   struct vk_attachment depth;
> > +   VkRenderPass render_pass;
> > +   VkFramebuffer fb;
> > +};
> > +
> > +static inline VkImageType
> > +vk_get_image_type(unsigned h, unsigned z)
> > +{
> > +   if (h == 1)
> > +   return VK_IMAGE_TYPE_1D;
> > +
> > +   if (z > 1)
> > +   return VK_IMAGE_TYPE_3D;
> > +
> > +   return VK_IMAGE_TYPE_2D;
> > +}
> > +
> >   void
> >   vk_core_init(struct vk_core *core);
> >   void
> >   vk_core_cleanup(struct vk_core *core);
> > +void
> > +vk_create_image(struct vk_core *core, VkFormat format,
> > +   unsigned w, unsigned h, unsigned z, unsigned num_samples,
> > +   unsigned num_levels, unsigned num_layers,
> > +   VkImageUsageFlagBits usage, VkImageTiling tiling,
> > +   struct vk_image *image);
> > +
> > +void
> > +vk_destroy_image(VkDevice dev, struct vk_image *image);
> > +
> > +void
> > +vk_setup_fb(struct vk_core *core,
> > +   unsigned w, unsigned h, unsigned num_samples,
> > +   VkFormat color_fmt, VkImageTiling color_tiling,
> > +   VkFormat depth_fmt, VkImageTiling depth_tiling,
> > +   unsigned layers, struct vk_fb *fb);
> > +
> > +void
> > +vk_fb_destroy(VkDevice dev, struct vk_fb *fb);
> > +
> >   VkRenderPass
> >   vk_create_render_pass(VkDevice dev,
> >   VkFormat format, unsigned num_samples,
> > @@ -88,4 +138,7 @@ vk_draw(struct vk_core *core, VkPipeline pipeline, 
> > VkBuffer vb, VkFence fence);
> >   VkFence
> >   vk_create_fence(VkDevice dev);
> > +PFN_vkGetImageMemoryRequirements2KHR
> > +vk_get_proc_addr_for_image_mem_req(VkDevice dev);
> > +
> >   #endif
> > diff --git a/tests/spec/ext_memory_object/vk_fb.c 
> > b/tests/spec/ext_memory_object/vk_fb.c
> > new file mode 100644
> > index 0..42609e900
> > --- /dev/null
> > +++ b/tests/spec/ext_memory_object/vk_fb.c
> > @@ -0,0 +1,346 @@
> > +/*
> > + * Copyright 2017 Intel Corporation
> > + *
> > + * 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 

Re: [Piglit] [v3 04/11] ext_memory_object: Support for setting up vulkan device

2017-12-21 Thread Pohjolainen, Topi
On Thu, Dec 21, 2017 at 11:03:15AM -0500, Andres Rodriguez wrote:
> 
> 
> On 2017-12-21 07:02 AM, Topi Pohjolainen wrote:
> > v2:
> > - drop magic number in allocator (Andres)
> > - fix indentation (Andres)
> > - allow more than one physical device (Andres)
> > - fix indentation (Andres)
> > - use better names for static variables (Andres). Here I
> >   simply shose to use structs and allocate them dynamically
> >   instead of using static variables at all. This was
> >   actually on my todo list, just forgot it.
> > 
> > CC: Andres Rodriguez 
> > Signed-off-by: Topi Pohjolainen 
> > ---
> >   tests/spec/ext_memory_object/vk_common.c | 236 
> > +++
> >   tests/spec/ext_memory_object/vk_common.h |  48 +++
> >   2 files changed, 284 insertions(+)
> >   create mode 100644 tests/spec/ext_memory_object/vk_common.c
> >   create mode 100644 tests/spec/ext_memory_object/vk_common.h
> > 
> > diff --git a/tests/spec/ext_memory_object/vk_common.c 
> > b/tests/spec/ext_memory_object/vk_common.c
> > new file mode 100644
> > index 0..2c3e8272e
> > --- /dev/null
> > +++ b/tests/spec/ext_memory_object/vk_common.c
> > @@ -0,0 +1,236 @@
> > +/*
> > + * Copyright 2017 Intel Corporation
> > + *
> > + * 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.
> > + */
> > +
> > +#include "vk_common.h"
> > +#include "piglit-util-gl.h"
> > +
> > +static void *
> > +test_vk_alloc(void *user_data, size_t size, size_t alignment,
> > +  VkSystemAllocationScope scope)
> > +{
> > +   assert(user_data == (void *)0xdeadbeef);
> > +   void *mem = malloc(size);
> > +   return mem;
> > +}
> > +
> > +static void *
> > +test_vk_realloc(void *user_data, void *orig, size_t size,
> > +size_t alignment, VkSystemAllocationScope scope)
> > +{
> > +   assert(user_data == (void *)0xdeadbeef);
> > +   return realloc(orig, size);
> > +}
> > +
> > +static void
> > +test_vk_free(void *user_data, void *mem)
> > +{
> > +   assert(user_data == (void *)0xdeadbeef);
> > +   free(mem);
> > +}
> > +
> > +static void
> > +test_vk_dummy_notify(void *user_ata, size_t size,
> > + VkInternalAllocationType allocation_type,
> > + VkSystemAllocationScope allocation_scope)
> > +{
> > +}
> > +
> > +static const VkAllocationCallbacks test_alloc_cb = {
> > +   .pUserData = (void *)0xdeadbeef,
> > +   .pfnAllocation = test_vk_alloc,
> > +   .pfnReallocation = test_vk_realloc,
> > +   .pfnFree = test_vk_free,
> > +   .pfnInternalAllocation = test_vk_dummy_notify,
> > +   .pfnInternalFree = test_vk_dummy_notify
> > +};
> > +
> > +static VkInstance
> > +create_vk_instance(void)
> > +{
> > +   const VkInstanceCreateInfo info = {
> > +   .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
> > +   .pApplicationInfo = &(VkApplicationInfo) {
> > +   .pApplicationName = "vk_core_renderer",
> > +   .apiVersion = VK_MAKE_VERSION(1, 0, 0),
> > +   },
> > +   };
> > +
> > +   VkInstance inst = VK_NULL_HANDLE;
> > +   if (vkCreateInstance(, _alloc_cb, ) != VK_SUCCESS)
> > +   inst = VK_NULL_HANDLE;
> > +
> > +   return inst;
> > +}
> > +
> > +static VkPhysicalDevice
> > +create_vk_phys_dev(VkInstance inst)
> > +{
> > +   unsigned count = 0;
> > +   VkPhysicalDevice first = VK_NULL_HANDLE;
> > +   VkPhysicalDevice *all;
> > +
> > +   if (vkEnumeratePhysicalDevices(inst, , NULL) != VK_SUCCESS ||
> > +   count == 0)
> > +   return VK_NULL_HANDLE;
> > +
> > +   all = malloc(count * sizeof(VkPhysicalDevice));
> > +
> > +   if (vkEnumeratePhysicalDevices(inst, , all) == VK_SUCCESS)
> > +   first = all[0];
> > +
> > +   free(all);
> > +
> > +   return first;
> > +}
> > +
> > +static 

Re: [Piglit] [PATCH v2 3/37] glean/tfragprog1: port ADD tests to shader_runner

2016-09-08 Thread Pohjolainen, Topi
On Tue, Sep 06, 2016 at 12:20:41PM -0700, Dylan Baker wrote:
> This ports the following tests:
> - ADD test
> - ADD with saturation
> - ADD an immediate
> - ADD negative immediate
> 
> It does not port ADD negative "immediate (2)", which adds MOV, MUL, and
> swizzling. It might be a useful test but it's not really testing ADD
> other than that it tests that ADD can be used with a swizzle.
> 
> Signed-off-by: Dylan Baker 
> 
> v2: - Cover more cases in the ADD_SAT test
> ---
>  tests/all.py 
>  |  5 +-
>  tests/glean/tfragprog1.cpp   
>  | 75 
> +
>  tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test 
>  | 16 +++-
>  
> tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test
>  | 16 +++-
>  tests/spec/arb_fragment_program/built-in-functions/add.shader_test   
>  | 18 +-
>  tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test   
>  | 22 +-
>  6 files changed, 72 insertions(+), 80 deletions(-)
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add.shader_test
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test
> 
> diff --git a/tests/all.py b/tests/all.py
> index 0f4a3c5..e655251 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -376,11 +376,6 @@ glean_glsl_tests = ['Primary plus secondary color',
>  'texcoord varying']
>  
>  glean_fp_tests = [
> -  'ADD test',
> -  'ADD with saturation',
> -  'ADD an immediate',
> -  'ADD negative immediate',
> -  'ADD negative immediate (2)',
>'CMP test',
>'COS test',
>'COS test 2',
> diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
> index bc340ed..1cbe243 100644
> --- a/tests/glean/tfragprog1.cpp
> +++ b/tests/glean/tfragprog1.cpp
> @@ -82,81 +82,6 @@ static GLfloat FogCoord = 50.0;  /* Between FogStart and 
> FogEnd */
>  // Alphabetical order, please
>  static const FragmentProgram Programs[] = {
>   {
> - "ADD test",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, fragment.color, p; \n"
> - "END \n",
> - { CLAMP01(FragColor[0] + Param1[0]),
> -   CLAMP01(FragColor[1] + Param1[1]),
> -   CLAMP01(FragColor[2] + Param1[2]),
> -   CLAMP01(FragColor[3] + Param1[3])
> - },
> - DONT_CARE_Z
> - },
> - {
> - "ADD with saturation",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> -"TEMP t; \n"
> -"ADD t, p, p; \n"
> - "ADD_SAT result.color, t, p; \n"
> - "END \n",
> - { CLAMP01(Param1[0] + Param1[0] + Param1[0]),
> -   CLAMP01(Param1[1] + Param1[1] + Param1[1]),
> -   CLAMP01(Param1[2] + Param1[2] + Param1[2]),
> -   CLAMP01(Param1[3] + Param1[3] + Param1[3]),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD an immediate",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, p, {0.25, 0.0, 0.5, 0.25}; \n"
> - "END \n",
> - { CLAMP01(Param1[0] + 0.25),
> -   CLAMP01(Param1[1] + 0.0),
> -   CLAMP01(Param1[2] + 0.5),
> -   CLAMP01(Param1[3] + 0.25),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD negative immediate",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, p, {-0.25, -0.2, 0.0, -0.25}; \n"
> - "END \n",
> - { CLAMP01(Param1[0] - 0.25),
> -   CLAMP01(Param1[1] - 0.2),
> -   CLAMP01(Param1[2] - 0.0),
> -   CLAMP01(Param1[3] - 0.25),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD negative immediate (2)",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "TEMP t; \n"
> - "MOV t, p; \n"
> - "MUL t.xyz, t, 2.0; \n"
> - "ADD t.xyz, t, -1.0; \n"
> - "MOV result.color, t; \n"
> - "END \n",
> - { CLAMP01(Param1[0] * 2.0 - 

Re: [Piglit] [PATCH v2 2/37] glean/tfragprog1: port ABS test to shader_runner

2016-09-08 Thread Pohjolainen, Topi
On Tue, Sep 06, 2016 at 12:20:40PM -0700, Dylan Baker wrote:
> Possible duplicate tests:
> shaders/fp-abs-01.c
> shaders/fp-abs-02.c
> 
> Signed-off-by: Dylan Baker 
> ---
>  tests/all.py   |  2 +-
>  tests/glean/tfragprog1.cpp | 13 
> -
>  tests/spec/arb_fragment_program/built-in-functions/abs.shader_test | 16 
> 
>  3 files changed, 17 insertions(+), 14 deletions(-)
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/abs.shader_test
> 
> diff --git a/tests/all.py b/tests/all.py
> index 3961656..0f4a3c5 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -375,7 +375,7 @@ glean_glsl_tests = ['Primary plus secondary color',
>  'varying read but not written',
>  'texcoord varying']
>  
> -glean_fp_tests = ['ABS test',
> +glean_fp_tests = [
>'ADD test',
>'ADD with saturation',
>'ADD an immediate',
> diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
> index 837382c..bc340ed 100644
> --- a/tests/glean/tfragprog1.cpp
> +++ b/tests/glean/tfragprog1.cpp
> @@ -82,19 +82,6 @@ static GLfloat FogCoord = 50.0;  /* Between FogStart and 
> FogEnd */
>  // Alphabetical order, please
>  static const FragmentProgram Programs[] = {
>   {
> - "ABS test",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[2]; \n"
> - "ABS result.color, p; \n"
> - "END \n",
> - { ABS(Param2[0]),
> -   ABS(Param2[1]),
> -   ABS(Param2[2]),
> -   ABS(Param2[3])
> - },
> - DONT_CARE_Z,
> - },
> - {
>   "ADD test",
>   "!!ARBfp1.0\n"
>   "PARAM p = program.local[1]; \n"
> diff --git 
> a/tests/spec/arb_fragment_program/built-in-functions/abs.shader_test 
> b/tests/spec/arb_fragment_program/built-in-functions/abs.shader_test
> new file mode 100644
> index 000..87949d1
> --- /dev/null
> +++ b/tests/spec/arb_fragment_program/built-in-functions/abs.shader_test
> @@ -0,0 +1,16 @@
> +[require]
> +GL_ARB_fragment_program
> +
> +[fragment program]
> +!!ARBfp1.0
> +PARAM p = program.local[0];
> +ABS result.color, p;
> +END
> +
> +[test]
> +clear color 0.5 0.5 0.5 0.5

Original uses clear color of "FRAGCOLOR { 0.25, 0.75, 0.5, 0.25 }". There is
not much difference expect in your case fourth component is cleared to 0.5
which is also the value expected in the end. I'd rather have that as something
else to make sure implementation didn't just fail to overwrite it.

Otherwise this looks to match the original test. Nice:

Reviewed-by: Topi Pohjolainen 

> +clear
> +
> +parameter local_fp 0 (0.0, -1.0, 0.25, -0.5)
> +draw rect -1 -1 2 2 
> +probe all rgba 0.0 1.0 0.25 0.5
> -- 
> git-series 0.8.10
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_shading_language_420pack: Make compatible with 4.30.

2016-06-06 Thread Pohjolainen, Topi
On Mon, Jun 06, 2016 at 02:40:15PM -0700, Matt Turner wrote:
> 4.30 removes gl_FragColor. In debugging bug 96320, I found it useful to
> replace gl_FragColor with a user-defined varying so that the tests could
> be run under GLSL 4.30.

Reviewed-by: Topi Pohjolainen 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 03/37] glean/tfragprog1: port ADD tests to shader_runner

2016-05-19 Thread Pohjolainen, Topi
On Fri, May 06, 2016 at 01:40:15PM -0700, Dylan Baker wrote:
> Quoting Pohjolainen, Topi (2016-05-04 10:25:31)
> [sni[
> > Okay, I don't how I mis-read the original tests so badly - CLAMP01 is the 
> > part
> > that defines the expected value. Anyway, if we want ADD_SAT to kick in, we 
> > need
> > to change the input so that the result > 1.
> > You have tried to define the inputs in such a way that yields all green in
> > succees case. This is how most tests are setup. However, there are also 
> > tests
> > that use other combinations and it might be justified here - otherwise we 
> > have
> > just easy values of zero in all other channels other than green. If we
> > wanted to keep strictly to the original, we would write:
> > 
> > fragment program]
> > ARBfp1.0
> > PARAM p = program.local[0];
> > TEMP s;
> > ADD s, p, p;
> > ADD_SAT result.color, p, s;
> > END
> > 
> > [test]
> > clear color 0.5 0.5 0.5 0.5
> > clear
> > 
> > parameter local_fp 0 (0.5, 0.25, 1.0, 0.5)
> > draw rect -1 -1 2 2
> > probe all rgba 1.0 0.75 1.0 1.0
> > 
> > 
> > 
> > Original had:
> > 
> > #define PARAM1 { 0.5, 0.25, 1.0, 0.5 }
> > static const GLfloat Param1[4] = PARAM1;
> 
> Right, but that's not strictly true either because the original defines
> a value for result.color. I have a v2 of this patch I'll send that
> covers the "x < -1", "-1 < x < 0", "1 > x > 0", and the "x > 1" case.

The original was:

   "ADD with saturation",
"!!ARBfp1.0\n"
"PARAM p = program.local[1]; \n"
"TEMP t; \n"
"ADD t, p, p; \n"
"ADD_SAT result.color, t, p; \n"
"END \n",
{ CLAMP01(Param1[0] + Param1[0] + Param1[0]),
  CLAMP01(Param1[1] + Param1[1] + Param1[1]),
  CLAMP01(Param1[2] + Param1[2] + Param1[2]),
  CLAMP01(Param1[3] + Param1[3] + Param1[3]),
},
DONT_CARE_Z

to me the one I defined looks pretty identical. What do you mean by
"the original defines a value for result.color"?
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 03/37] glean/tfragprog1: port ADD tests to shader_runner

2016-05-04 Thread Pohjolainen, Topi
On Tue, May 03, 2016 at 08:58:15AM -0700, Dylan Baker wrote:
> 
> 
> On May 3, 2016 4:11:43 AM PDT, "Pohjolainen, Topi" 
> <topi.pohjolai...@intel.com> wrote:
> >On Mon, May 02, 2016 at 02:59:05PM -0700, Dylan Baker wrote:
> >> This ports the following tests:
> >> - ADD test
> >> - ADD with saturation
> >> - ADD an immediate
> >> - ADD negative immediate
> >> 
> >> It does not port ADD negative "immediate (2)", which adds MOV, MUL,
> >and
> >> swizzling. It might be a useful test but it's not really testing ADD
> >> other than that it tests that ADD can be used with a swizzle.
> >> 
> >> Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> >> ---
> >>  tests/all.py   |  5 --
> >>  tests/glean/tfragprog1.cpp | 75
> >--
> >>  .../built-in-functions/add-immediate.shader_test   | 16 +
> >>  .../add-negative-immediate.shader_test | 16 +
> >>  .../built-in-functions/add.shader_test | 18 ++
> >>  .../built-in-functions/add_sat.shader_test | 22 +++
> >>  6 files changed, 72 insertions(+), 80 deletions(-)
> >>  create mode 100644
> >tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test
> >>  create mode 100644
> >tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test
> >>  create mode 100644
> >tests/spec/arb_fragment_program/built-in-functions/add.shader_test
> >>  create mode 100644
> >tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test
> >> 
> >> diff --git a/tests/all.py b/tests/all.py
> >> index 217216e..70be904 100644
> >> --- a/tests/all.py
> >> +++ b/tests/all.py
> >> @@ -376,11 +376,6 @@ glean_glsl_tests = ['Primary plus secondary
> >color',
> >>  'texcoord varying']
> >>  
> >>  glean_fp_tests = [
> >> -  'ADD test',
> >> -  'ADD with saturation',
> >> -  'ADD an immediate',
> >> -  'ADD negative immediate',
> >> -  'ADD negative immediate (2)',
> >>'CMP test',
> >>'COS test',
> >>'COS test 2',
> >> diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
> >> index bc340ed..1cbe243 100644
> >> --- a/tests/glean/tfragprog1.cpp
> >> +++ b/tests/glean/tfragprog1.cpp
> >> @@ -82,81 +82,6 @@ static GLfloat FogCoord = 50.0;  /* Between
> >FogStart and FogEnd */
> >>  // Alphabetical order, please
> >>  static const FragmentProgram Programs[] = {
> >>{
> >> -  "ADD test",
> >> -  "!!ARBfp1.0\n"
> >> -  "PARAM p = program.local[1]; \n"
> >> -  "ADD result.color, fragment.color, p; \n"
> >> -  "END \n",
> >> -  { CLAMP01(FragColor[0] + Param1[0]),
> >> -CLAMP01(FragColor[1] + Param1[1]),
> >> -CLAMP01(FragColor[2] + Param1[2]),
> >> -CLAMP01(FragColor[3] + Param1[3])
> >> -  },
> >> -  DONT_CARE_Z
> >> -  },
> >> -  {
> >> -  "ADD with saturation",
> >> -  "!!ARBfp1.0\n"
> >> -  "PARAM p = program.local[1]; \n"
> >> -"TEMP t; \n"
> >> -"ADD t, p, p; \n"
> >> -  "ADD_SAT result.color, t, p; \n"
> >> -  "END \n",
> >> -  { CLAMP01(Param1[0] + Param1[0] + Param1[0]),
> >> -CLAMP01(Param1[1] + Param1[1] + Param1[1]),
> >> -CLAMP01(Param1[2] + Param1[2] + Param1[2]),
> >> -CLAMP01(Param1[3] + Param1[3] + Param1[3]),
> >> -  },
> >> -  DONT_CARE_Z
> >> -  },
> >> -
> >> -  {
> >> -  "ADD an immediate",
> >> -  "!!ARBfp1.0\n"
> >> -  "PARAM p = program.local[1]; \n"
> >> -  "ADD result.color, p, {0.25, 0.0, 0.5, 0.25}; \n"
> >> -  "END \n",
> >> -  { CLAMP01(Param1[0] + 0.25),
> >> -CLAMP01(Param1[1] + 0.0),
> >> -CLAMP01(Param1[

Re: [Piglit] [PATCH 03/37] glean/tfragprog1: port ADD tests to shader_runner

2016-05-03 Thread Pohjolainen, Topi
On Mon, May 02, 2016 at 02:59:05PM -0700, Dylan Baker wrote:
> This ports the following tests:
> - ADD test
> - ADD with saturation
> - ADD an immediate
> - ADD negative immediate
> 
> It does not port ADD negative "immediate (2)", which adds MOV, MUL, and
> swizzling. It might be a useful test but it's not really testing ADD
> other than that it tests that ADD can be used with a swizzle.
> 
> Signed-off-by: Dylan Baker 
> ---
>  tests/all.py   |  5 --
>  tests/glean/tfragprog1.cpp | 75 
> --
>  .../built-in-functions/add-immediate.shader_test   | 16 +
>  .../add-negative-immediate.shader_test | 16 +
>  .../built-in-functions/add.shader_test | 18 ++
>  .../built-in-functions/add_sat.shader_test | 22 +++
>  6 files changed, 72 insertions(+), 80 deletions(-)
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add-immediate.shader_test
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add-negative-immediate.shader_test
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add.shader_test
>  create mode 100644 
> tests/spec/arb_fragment_program/built-in-functions/add_sat.shader_test
> 
> diff --git a/tests/all.py b/tests/all.py
> index 217216e..70be904 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -376,11 +376,6 @@ glean_glsl_tests = ['Primary plus secondary color',
>  'texcoord varying']
>  
>  glean_fp_tests = [
> -  'ADD test',
> -  'ADD with saturation',
> -  'ADD an immediate',
> -  'ADD negative immediate',
> -  'ADD negative immediate (2)',
>'CMP test',
>'COS test',
>'COS test 2',
> diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
> index bc340ed..1cbe243 100644
> --- a/tests/glean/tfragprog1.cpp
> +++ b/tests/glean/tfragprog1.cpp
> @@ -82,81 +82,6 @@ static GLfloat FogCoord = 50.0;  /* Between FogStart and 
> FogEnd */
>  // Alphabetical order, please
>  static const FragmentProgram Programs[] = {
>   {
> - "ADD test",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, fragment.color, p; \n"
> - "END \n",
> - { CLAMP01(FragColor[0] + Param1[0]),
> -   CLAMP01(FragColor[1] + Param1[1]),
> -   CLAMP01(FragColor[2] + Param1[2]),
> -   CLAMP01(FragColor[3] + Param1[3])
> - },
> - DONT_CARE_Z
> - },
> - {
> - "ADD with saturation",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> -"TEMP t; \n"
> -"ADD t, p, p; \n"
> - "ADD_SAT result.color, t, p; \n"
> - "END \n",
> - { CLAMP01(Param1[0] + Param1[0] + Param1[0]),
> -   CLAMP01(Param1[1] + Param1[1] + Param1[1]),
> -   CLAMP01(Param1[2] + Param1[2] + Param1[2]),
> -   CLAMP01(Param1[3] + Param1[3] + Param1[3]),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD an immediate",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, p, {0.25, 0.0, 0.5, 0.25}; \n"
> - "END \n",
> - { CLAMP01(Param1[0] + 0.25),
> -   CLAMP01(Param1[1] + 0.0),
> -   CLAMP01(Param1[2] + 0.5),
> -   CLAMP01(Param1[3] + 0.25),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD negative immediate",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "ADD result.color, p, {-0.25, -0.2, 0.0, -0.25}; \n"
> - "END \n",
> - { CLAMP01(Param1[0] - 0.25),
> -   CLAMP01(Param1[1] - 0.2),
> -   CLAMP01(Param1[2] - 0.0),
> -   CLAMP01(Param1[3] - 0.25),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
> - "ADD negative immediate (2)",
> - "!!ARBfp1.0\n"
> - "PARAM p = program.local[1]; \n"
> - "TEMP t; \n"
> - "MOV t, p; \n"
> - "MUL t.xyz, t, 2.0; \n"
> - "ADD t.xyz, t, -1.0; \n"
> - "MOV result.color, t; \n"
> - "END \n",
> - { CLAMP01(Param1[0] * 2.0 - 1.0),
> -   CLAMP01(Param1[1] * 2.0 - 1.0),
> -   CLAMP01(Param1[2] * 2.0 - 1.0),
> -   CLAMP01(Param1[3] ),
> - },
> - DONT_CARE_Z
> - },
> -
> - {
>   "CMP test",
>   "!!ARBfp1.0\n"
>   "PARAM zero = program.local[0]; \n"
> diff --git 
> 

Re: [Piglit] [PATCH 3/4] Add a fast clear test for non-MSRT surfaces

2015-12-01 Thread Pohjolainen, Topi
On Wed, Nov 25, 2015 at 06:11:52PM +0100, Neil Roberts wrote:
> ext_framebuffer_multisample-fast-clear can now take a parameter on the
> command line to make it test a single-sample buffer instead. This is
> worth testing at least on i965 because fast clears are handled
> differently when multisampling is not used.
> ---
>  tests/all.py   |  15 +++
>  .../spec/ext_framebuffer_multisample/fast-clear.c  | 138 
> +
>  2 files changed, 102 insertions(+), 51 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index fd07adb..ab9f181 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -135,6 +135,10 @@ def add_fbo_formats_tests(adder, extension, suffix=''):
>'fbo-alphatest-formats{}'.format(suffix))
>  adder(['fbo-colormask-formats', extension],
>'fbo-colormask-formats{}'.format(suffix))
> +adder(['ext_framebuffer_multisample-fast-clear',
> +   extension,
> +   'single-sample'],
> +  'fbo-fast-clear{}'.format(suffix))
>  
>  
>  def add_msaa_formats_tests(adder, extension):
> @@ -2043,6 +2047,11 @@ with profile.group_manager(
> 'GL_EXT_texture_sRGB',
> 'enable-fb-srgb'],
>'msaa-fast-clear')
> +g(['ext_framebuffer_multisample-fast-clear',
> +   'GL_EXT_texture_sRGB',
> +   'enable-fb-srgb',
> +   'single-sample'],
> +  'fbo-fast-clear')
>  
>  with profile.group_manager(
>  PiglitGLTest,
> @@ -2937,6 +2946,8 @@ with profile.group_manager(
>  g(['fbo-storage-completeness'])
>  g(['fbo-storage-formats'])
>  g(['getteximage-formats', 'init-by-rendering'])
> +g(['ext_framebuffer_multisample-fast-clear', 'single-sample'],
> +  'fbo-fast-clear')
>  add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX1')
>  add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX4')
>  add_fbo_stencil_tests(g, 'GL_STENCIL_INDEX8')
> @@ -3241,6 +3252,10 @@ with profile.group_manager(
>  #   'fbo-blending-formats')
>  g(['fbo-alphatest-formats', 'GL_EXT_texture_sRGB'],
>'fbo-alphatest-formats')
> +g(['ext_framebuffer_multisample-fast-clear',
> +   'GL_EXT_texture_sRGB',
> +   'single-sample'],
> +  'fbo-fast-clear')
>  add_msaa_formats_tests(g, 'GL_EXT_texture_sRGB')
>  add_texwrap_format_tests(g, 'GL_EXT_texture_sRGB')
>  add_texwrap_format_tests(g, 'GL_EXT_texture_sRGB-s3tc', '-s3tc')
> diff --git a/tests/spec/ext_framebuffer_multisample/fast-clear.c 
> b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> index 5935b2f..fc745da 100644
> --- a/tests/spec/ext_framebuffer_multisample/fast-clear.c
> +++ b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> @@ -40,6 +40,7 @@
>   *before clearing the buffer so that it can test that the color
>   *gets correctly converted to SRGB before being stored in the
>   *color buffer.
> + *  single-sample: A single sample texture will be created instead.
>   */
>  
>  #include "piglit-util-gl.h"
> @@ -64,9 +65,10 @@ vertex_source[] =
>  
>  static const char
>  fragment_source_float[] =
> - "#extension GL_ARB_texture_multisample : require\n"
> + "#version 130\n"
> + "%s\n"
>   "\n"
> - "uniform sampler2DMS tex;\n"
> + "uniform %s tex;\n"
>   "\n"
>   "void\n"
>   "main()\n"
> @@ -77,9 +79,9 @@ fragment_source_float[] =
>  static const char
>  fragment_source_int[] =
>   "#version 130\n"
> - "#extension GL_ARB_texture_multisample : require\n"
> + "%s\n"
>   "\n"
> - "uniform isampler2DMS tex;\n"
> + "uniform i%s tex;\n"
>   "\n"
>   "void\n"
>   "main()\n"
> @@ -90,9 +92,9 @@ fragment_source_int[] =
>  static const char
>  fragment_source_uint[] =
>   "#version 130\n"
> - "#extension GL_ARB_texture_multisample : require\n"
> + "%s\n"
>   "\n"
> - "uniform usampler2DMS tex;\n"
> + "uniform u%s tex;\n"
>   "\n"
>   "void\n"
>   "main()\n"
> @@ -129,6 +131,7 @@ struct component_sizes {
>  static GLuint prog_float, prog_int, prog_uint;
>  static GLuint result_fbo;
>  static bool enable_fb_srgb = false;
> +static bool single_sample = false;
>  
>  static void
>  convert_srgb_color(const struct format_desc *format,
> @@ -318,6 +321,7 @@ test_format(const struct format_desc *format)
>   enum piglit_result color_result;
>   struct component_sizes sizes;
>   GLenum type_param;
> + GLenum tex_target;
>   GLenum tex_error;
>   GLint type;
>   GLuint tex;
> @@ -333,47 +337,71 @@ test_format(const struct format_desc *format)
>  
>   printf("Testing %s\n", format->name);
>  
> - glGenTextures(1, );
> - glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
> -
> - piglit_reset_gl_error();
> -
> - glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
> - 1, /* samples */
> - format->internalformat,
> - 1, 1, /* width/height */

Re: [Piglit] [PATCH 4/4] Test blending a fast clear color with GL_FRAMEBUFFER_SRGB enabled

2015-12-01 Thread Pohjolainen, Topi
On Wed, Nov 25, 2015 at 06:11:53PM +0100, Neil Roberts wrote:
> On SKL in the i965 driver there is some special handling of the fast
> clear optimisation when GL_FRAMEBUFFER_SRGB is enabled because the
> hardware can't cope with the fast clear buffer in that case and the
> color buffer needs to be resolved. This test just tries varies
> different clear colors and enabling at GL_FRAMEBUFFER_SRGB at
> different points to make sure this resolving works correctly.
> ---
>  tests/all.py   |   1 +
>  tests/spec/arb_framebuffer_srgb/CMakeLists.gl.txt  |   1 +
>  tests/spec/arb_framebuffer_srgb/fast-clear-blend.c | 238 
> +
>  3 files changed, 240 insertions(+)
>  create mode 100644 tests/spec/arb_framebuffer_srgb/fast-clear-blend.c
> 
> diff --git a/tests/all.py b/tests/all.py
> index ab9f181..425f301 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2052,6 +2052,7 @@ with profile.group_manager(
> 'enable-fb-srgb',
> 'single-sample'],
>'fbo-fast-clear')
> +g(['arb_framebuffer_srgb-fast-clear-blend'])
>  
>  with profile.group_manager(
>  PiglitGLTest,
> diff --git a/tests/spec/arb_framebuffer_srgb/CMakeLists.gl.txt 
> b/tests/spec/arb_framebuffer_srgb/CMakeLists.gl.txt
> index 04609b8..fc1eb57 100644
> --- a/tests/spec/arb_framebuffer_srgb/CMakeLists.gl.txt
> +++ b/tests/spec/arb_framebuffer_srgb/CMakeLists.gl.txt
> @@ -12,4 +12,5 @@ piglit_add_executable (arb_framebuffer_srgb-pushpop 
> pushpop.c)
>  piglit_add_executable (arb_framebuffer_srgb-blit blit.c)
>  piglit_add_executable (arb_framebuffer_srgb-clear clear.c)
>  piglit_add_executable (arb_framebuffer_srgb-srgb_conformance 
> srgb_conformance.c)
> +piglit_add_executable (arb_framebuffer_srgb-fast-clear-blend 
> fast-clear-blend.c)
>  
> diff --git a/tests/spec/arb_framebuffer_srgb/fast-clear-blend.c 
> b/tests/spec/arb_framebuffer_srgb/fast-clear-blend.c
> new file mode 100644
> index 000..c8fe723
> --- /dev/null
> +++ b/tests/spec/arb_framebuffer_srgb/fast-clear-blend.c
> @@ -0,0 +1,238 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * 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 fast-clear-blend.c
> + *
> + * Enables GL_FRAMEBUFFER_SRGB, clears the buffer to a color and then
> + * blends it with a rectangle in another color before verifying the
> + * result. This is mainly to test fast clears on SKL in the i965
> + * driver because in that case fast clears can't be used with
> + * GL_FRAMEBUFFER_SRGB so it internally needs to resolve the color
> + * buffer.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 21;
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const char
> +vertex_source[] =
> + "attribute vec4 piglit_vertex;\n"
> + "\n"
> + "void\n"
> + "main()\n"
> + "{\n"
> + "gl_Position = piglit_vertex;\n"
> + "}\n";
> +
> +static const char
> +fragment_source[] =
> + "uniform vec4 color;\n"
> + "\n"
> + "void\n"
> + "main()\n"
> + "{\n"
> + "gl_FragColor = color;\n"
> + "}\n";
> +
> +static GLuint prog;
> +static GLuint fbo;
> +static GLint color_location;
> +
> +static const float
> +clear_colors[][4] = {
> + { 0.0f, 0.0f, 0.0f, 0.0f },
> + { 1.0f, 1.0f, 1.0f, 1.0f },
> + { 0.0f, 0.0f, 1.0f, 0.0f },
> + { 1.0f, 0.0f, 0.0f, 1.0f },
> +
> + { 0.25f, 0.5f, 0.75f, 1.0f },
> + { 0.75f, 0.5f, 0.25f, 0.0f },
> + { 0.5f, 0.25f, 0.75f, 0.5f },
> +};
> +
> +static bool
> +probe_srgb_color(int x, int y, int w, int h,
> +  const GLfloat *color)
> +{
> + GLfloat srgb_color[4];
> + int i;
> +
> + /* The value in the framebuffer is stored in SRGB space so we
> + 

Re: [Piglit] [PATCH 2/4] multisample-fast-clear: Test out-of-range values

2015-12-01 Thread Pohjolainen, Topi
On Wed, Nov 25, 2015 at 06:11:51PM +0100, Neil Roberts wrote:
> The test colors now include negative values and values greater than
> one. Instead of rendering the results into the window system buffer a
> floating point texture is now created so that it can store values that
> haven't been clamped to [0,1].
> ---
>  .../spec/ext_framebuffer_multisample/fast-clear.c  | 201 
> ++---
>  1 file changed, 135 insertions(+), 66 deletions(-)
> 
> diff --git a/tests/spec/ext_framebuffer_multisample/fast-clear.c 
> b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> index 9634eeb..5935b2f 100644
> --- a/tests/spec/ext_framebuffer_multisample/fast-clear.c
> +++ b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> @@ -84,7 +84,7 @@ fragment_source_int[] =
>   "void\n"
>   "main()\n"
>   "{\n"
> - "gl_FragColor = vec4(texelFetch(tex, ivec2(0), 0)) / 127.0;\n"
> + "gl_FragColor = vec4(texelFetch(tex, ivec2(0), 0));\n"
>   "}\n";
>  
>  static const char
> @@ -97,7 +97,7 @@ fragment_source_uint[] =
>   "void\n"
>   "main()\n"
>   "{\n"
> - "gl_FragColor = vec4(texelFetch(tex, ivec2(0), 0)) / 255.0;\n"
> + "gl_FragColor = vec4(texelFetch(tex, ivec2(0), 0));\n"
>   "}\n";
>  
>  static const struct test_desc *
> @@ -113,9 +113,21 @@ clear_colors[][4] = {
>   { 0.25f, 0.5f, 0.75f, 1.0f },
>   { 0.75f, 0.5f, 0.25f, 0.0f },
>   { 0.5f, 0.25f, 0.75f, 0.5f },
> +
> + { 2.0f, 3.0f, 0.5f, 1.0f },
> + { -2.0f, 0.0f, 0.25f, 1.0f },
> + { -0.5f, 0.0f, 0.25f, 1.0f },
> +};
> +
> +struct component_sizes {
> + int r, g, b;
> + int a;
> + int l;
> + int i;
>  };
>  
>  static GLuint prog_float, prog_int, prog_uint;
> +static GLuint result_fbo;
>  static bool enable_fb_srgb = false;
>  
>  static void
> @@ -147,52 +159,67 @@ convert_srgb_color(const struct format_desc *format,
>   color[i] = piglit_srgb_to_linear(color[i]);
>  }
>  
> +static int
> +clamp_signed(int value, int size)
> +{
> + return CLAMP(value,
> +  -1 << (size - 1),
> +  (int) (UINT32_MAX >> (33 - size)));
> +}
> +
> +static unsigned int
> +clamp_unsigned(int value, int size)
> +{
> + if (value < 0)
> + return 0;
> + return CLAMP((unsigned int) value, 0, UINT32_MAX >> (32 - size));
> +}
> +
>  static enum piglit_result
> -test_color(GLuint fbo,
> +test_color(GLuint test_fbo,
>  int offset,
>  const struct format_desc *format,
>  GLenum clear_type,
> +const struct component_sizes *sizes,
>  const float *clear_color)
>  {
>   float expected_color[4];
> - float alpha_override;
> + int i;
>  
> - glBindFramebuffer(GL_FRAMEBUFFER, fbo);
> + glBindFramebuffer(GL_FRAMEBUFFER, test_fbo);
>  
>   if (enable_fb_srgb)
>   glEnable(GL_FRAMEBUFFER_SRGB);
>  
> + memcpy(expected_color, clear_color, sizeof expected_color);
> +
>   switch (clear_type) {
>   case GL_INT: {
> - GLint clear_color_int[4] = {
> - clear_color[0] * 127,
> - clear_color[1] * 127,
> - clear_color[2] * 127,
> - clear_color[3] * 127
> - };
> + GLint clear_color_int[4];
> + for (i = 0; i < 4; i++) {
> + expected_color[i] *= 127;
> + clear_color_int[i] = expected_color[i];
> + }
>   if (prog_int == 0)
>   return PIGLIT_SKIP;
>   glUseProgram(prog_int);
>   glClearBufferiv(GL_COLOR,
>   0, /* draw buffer */
>   clear_color_int);
> - alpha_override = 1.0f / 127.0f;
>   break;
>   }
>   case GL_UNSIGNED_INT: {
> - GLint clear_color_uint[4] = {
> - clear_color[0] * 255,
> - clear_color[1] * 255,
> - clear_color[2] * 255,
> - clear_color[3] * 255
> - };
> + GLuint clear_color_uint[4];
> + for (i = 0; i < 4; i++) {
> + expected_color[i] *= 255;
> + clear_color_uint[i] = MAX2(expected_color[i], 0);
> + }
>   if (prog_uint == 0)
>   return PIGLIT_SKIP;
>   glUseProgram(prog_uint);
> - glClearBufferiv(GL_COLOR,
> - 0, /* draw buffer */
> - clear_color_uint);
> - alpha_override = 1.0f / 255.0f;
> + glClearBufferuiv(GL_COLOR,
> +  0, /* draw buffer */
> +  clear_color_uint);
>   break;
>   }
>   default:
> @@ -202,15 +229,12 @@ test_color(GLuint fbo,
>clear_color[2],
>

Re: [Piglit] [PATCH 1/4] mulitsample-fast-clear: Test enabling GL_FRAMEBUFFER_SRGB

2015-11-27 Thread Pohjolainen, Topi
On Wed, Nov 25, 2015 at 06:11:50PM +0100, Neil Roberts wrote:

There is a typo in the subject: "mulitsample-fast-clear"
^

> If ???enable-fb-srgb??? is given on the command line to the fast clear
> test it will now enable GL_FRAMEBUFFER_SRGB before clearing the
> buffer. This should cause the clear color to be converted from SRGB to
> linear before being written to the framebuffer. The expected color is
> therefore converted to match. This exposes a bug on SKL in the i965
> driver when clearing SRGB MSRTs.
> ---
>  tests/all.py   |  4 ++
>  .../spec/ext_framebuffer_multisample/fast-clear.c  | 63 
> ++
>  2 files changed, 57 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index 07e3599..fd07adb 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2039,6 +2039,10 @@ with profile.group_manager(
>  g(['framebuffer-srgb'], run_concurrent=False)
>  g(['arb_framebuffer_srgb-clear'])
>  g(['arb_framebuffer_srgb-pushpop'])
> +g(['ext_framebuffer_multisample-fast-clear',
> +   'GL_EXT_texture_sRGB',
> +   'enable-fb-srgb'],
> +  'msaa-fast-clear')
>  
>  with profile.group_manager(
>  PiglitGLTest,
> diff --git a/tests/spec/ext_framebuffer_multisample/fast-clear.c 
> b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> index b3b57bf..9634eeb 100644
> --- a/tests/spec/ext_framebuffer_multisample/fast-clear.c
> +++ b/tests/spec/ext_framebuffer_multisample/fast-clear.c
> @@ -33,6 +33,13 @@
>   * various different code paths to implement a fast clear optimisation
>   * and the path taken depends on the color chosen to a certain
>   * degree.
> + *
> + * The test can take the following additional arguments:
> + *
> + *  enable-fb-srgb: This will cause it to enable GL_FRAMEBUFFER_SRGB
> + *before clearing the buffer so that it can test that the color
> + *gets correctly converted to SRGB before being stored in the
> + *color buffer.
>   */
>  
>  #include "piglit-util-gl.h"
> @@ -109,6 +116,36 @@ clear_colors[][4] = {
>  };
>  
>  static GLuint prog_float, prog_int, prog_uint;
> +static bool enable_fb_srgb = false;
> +
> +static void
> +convert_srgb_color(const struct format_desc *format,
> +float *color)
> +{
> + int i;
> +
> + /* If the texture is not an sRGB format then no conversion is
> +  * needed regardless of the sRGB settings.
> +  */
> + if (strstr(format->name, "SRGB") == NULL &&
> + strstr(format->name, "SLUMINANCE") == NULL)
> + return;
> +
> + /* If GL_FRAMEBUFFER_SRGB was enabled when we did the clear
> +  * then the clear color would have been converted to SRGB
> +  * before being written. When it is sampled it will be
> +  * converted back to linear. The two conversions cancel each
> +  * other out so we don't need to do anything.
> +  */
> + if (enable_fb_srgb)
> + return;
> +
> + /* Otherwise we need to compensate for the color being
> +  * converted to linear when sampled.
> +  */
> + for (i = 0; i < 3; i++)
> + color[i] = piglit_srgb_to_linear(color[i]);
> +}
>  
>  static enum piglit_result
>  test_color(GLuint fbo,
> @@ -119,10 +156,12 @@ test_color(GLuint fbo,
>  {
>   float expected_color[4];
>   float alpha_override;
> - int i;
>  
>   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
>  
> + if (enable_fb_srgb)
> + glEnable(GL_FRAMEBUFFER_SRGB);
> +
>   switch (clear_type) {
>   case GL_INT: {
>   GLint clear_color_int[4] = {
> @@ -167,6 +206,9 @@ test_color(GLuint fbo,
>   break;
>   }
>  
> + if (enable_fb_srgb)
> + glDisable(GL_FRAMEBUFFER_SRGB);
> +
>   memcpy(expected_color, clear_color, sizeof expected_color);
>  
>   switch (format->base_internal_format) {
> @@ -204,13 +246,7 @@ test_color(GLuint fbo,
>   break;
>   }
>  
> - if (strstr(format->name, "SRGB") ||
> - strstr(format->name, "SLUMINANCE")) {
> - for (i = 0; i < 3; i++) {
> - expected_color[i] =
> - piglit_srgb_to_linear(expected_color[i]);
> - }
> - }
> + convert_srgb_color(format, expected_color);
>  
>   glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
>   piglit_draw_rect(offset * 16 * 2.0f / piglit_width - 1.0f,

This is a question regarding the existing logic. Earlier the test calls
"glBindFramebuffer(GL_FRAMEBUFFER, fbo)" and clears the framebuffer
desigbated by "fbo". Then just above the test sets the target framebuffer
to "piglit_winsys_fbo", and blits into "piglit_winsys_fbo" using
piglit_draw_rect().
Please bare with me, but I understand the idea being that the cleared values
from "fbo" are blit to "piglit_winsys_fbo". But
"glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo)" sets "piglit_winsys_fbo"
both as source and 

Re: [Piglit] [PATCH 1/4] mulitsample-fast-clear: Test enabling GL_FRAMEBUFFER_SRGB

2015-11-27 Thread Pohjolainen, Topi
On Fri, Nov 27, 2015 at 11:03:05AM +0100, Neil Roberts wrote:
> "Pohjolainen, Topi" <topi.pohjolai...@intel.com> writes:
> 
> >>glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
> >>piglit_draw_rect(offset * 16 * 2.0f / piglit_width - 1.0f,
> >
> > This is a question regarding the existing logic. Earlier the test
> > calls "glBindFramebuffer(GL_FRAMEBUFFER, fbo)" and clears the
> > framebuffer desigbated by "fbo". Then just above the test sets the
> > target framebuffer to "piglit_winsys_fbo", and blits into
> > "piglit_winsys_fbo" using piglit_draw_rect(). Please bare with me, but
> > I understand the idea being that the cleared values from "fbo" are
> > blit to "piglit_winsys_fbo". But "glBindFramebuffer(GL_FRAMEBUFFER,
> > piglit_winsys_fbo)" sets "piglit_winsys_fbo" both as source and
> > destination, doesn't it?
> 
> That is correct, but the read buffer is only used for a blit, ie when
> calling glBlitFramebuffer. This is not actually doing a blit but is
> instead drawing a regular rectangle while using the texture from the
> test framebuffer as a texture source. That means only the draw
> framebuffer is actually used. The idea of the test is to test sampling
> from the surface so that we can be sure the clear color programmed in
> the texture surface state works correctly, so I think it makes sense
> here to explicitly use the surface as a texture source rather than a
> blit.

Thanks for the explanation, it makes sense now. The patch is:

Reviewed-by: Topi Pohjolainen <topi.pohjolai...@intel.com>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 06/25] arb_direct_state_access: Use piglit_reset_gl_error in texunits

2015-05-20 Thread Pohjolainen, Topi
On Mon, May 18, 2015 at 01:49:59PM -0700, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com

This is also:

Reviewed-by: Topi Pohjolainen topi.pohjolai...@intel.com

Unfortunately I don't have much input for the rest of the patches
in the series.

 ---
  tests/spec/arb_direct_state_access/texunits.c | 16 
  1 file changed, 4 insertions(+), 12 deletions(-)
 
 diff --git a/tests/spec/arb_direct_state_access/texunits.c 
 b/tests/spec/arb_direct_state_access/texunits.c
 index 54bd886..d4710e3 100644
 --- a/tests/spec/arb_direct_state_access/texunits.c
 +++ b/tests/spec/arb_direct_state_access/texunits.c
 @@ -91,20 +91,12 @@ report4v(const GLfloat exp[4], const GLfloat act[4])
  }
  
  
 -static void
 -clear_errors()
 -{
 -   while (glGetError())
 -  ;
 -}
 -
 -
  static bool
  test_rasterpos(void)
  {
 int i;
  
 -   clear_errors();
 +   piglit_reset_gl_error();
  
 /* set current texcoords */
 for (i = 0; i  MaxTextureCoordUnits; i++) {
 @@ -169,7 +161,7 @@ test_texture_matrix(void)
  {
 int i;
  
 -   clear_errors();
 +   piglit_reset_gl_error();
  
 /* set tex matrices */
 for (i = 0; i  MaxTextureCoordUnits; i++) {
 @@ -221,7 +213,7 @@ test_texture_params(void)
 int i;
 int maxUnit;
  
 -   clear_errors();
 +   piglit_reset_gl_error();
  
 glCreateTextures(GL_TEXTURE_2D, MaxTextureCombinedUnits, tex);
  
 @@ -269,7 +261,7 @@ test_texture_env(void)
 /* Texture Environment state is fixed-function; not used by shaders */
 int i;
  
 -   clear_errors();
 +   piglit_reset_gl_error();
  
 /* set per-unit state */
 for (i = 0; i  MaxTextureCombinedUnits; i++) {
 -- 
 2.1.0
 
 ___
 Piglit mailing list
 Piglit@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/5] arb_uniform_buffer_object: Random test generation infrastructure

2014-11-03 Thread Pohjolainen, Topi
On Mon, Nov 03, 2014 at 11:10:25AM +0200, Tapani wrote:
 On 09/24/2014 07:47 PM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 This is the core of the random test generation infrastructure.  This
 Python script can be used stand-alone to generate fully random tests, or
 it can be called from other Python code to generate tests in a more
 directed manner.  Examples of both uses are coming in future patches.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 
 8
 
 +
 +def scalar_derp(type, name, offset, data):
 +if type == bool:
 +if int(data) == 0:
 +return name
 +else:
 +return ! + name
 +elif type == uint:
 +return {} != {}u.format(name, data)
 +elif type == int:
 +return {} != {}.format(name, data)
 +elif type == float:
 +bits = fudge_data_for_setter(data, float)
 +return !float_match({}, {}, {}u).format(name, data, bits)
 +elif type == double:
 +bits = fudge_data_for_setter(data, double)
 +
 +# 0x
 +# 012345678901234567
 +
 +hi = 0x + bits[2:9]
 +lo = 0x + bits[10:17]
 
 I noticed  that the tests had wrong values for hi and lo when testing uvec2
 against double. We had a look at this with Topi and believe that here
 generator should use 2:10 and 10:18 to get correct values. Maybe 'bits'
 could be renamed as 'hex_digits'?

There were only seven digits per hi/lo in the generated tests and we were
guessing the indexing here is probably open ended?
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] Tests for GL_OES_EGL_image_external

2014-09-15 Thread Pohjolainen, Topi
On Sun, Sep 14, 2014 at 04:35:38AM +, Sundareson, Prabindh wrote:
 Hello Eric,  Topi,
 
 I was looking for compliance tests for GL_OES_EGL_image_external, and saw a 
 discussion [1] in the archives last year. I could not see any follow ups to 
 this, and it appears unmerged as it is not in the latest tree.
 
 Before I start on this patch, can anyone please confirm if the need for this 
 test is perhaps subsumed in any other module that I am unaware of ? If not, 
 what do we need to do to mainline this patch ?
 
 [1] - http://lists.freedesktop.org/archives/piglit/2013-March/005175.html
 

They are not merged, and I dropped the ball on the test cases as we didn't
add the support for YUV sampling (or for image external in general for that
matter) in Mesa afterall.

-Topi
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] ext_image_dma_buf_import: update ownership_transfer test

2014-08-13 Thread Pohjolainen, Topi
On Fri, Aug 08, 2014 at 02:50:26PM +0300, Pekka Paalanen wrote:
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 The EGL_EXT_image_dma_buf_import specification was revised (according to
 its revision history) on Dec 5th, 2013, for EGL to not take ownership of the
 file descriptors.
 
 Update the ownership_transfer test to have the correct quote from the
 latest specification (version 6), and invert the final test on close().
 
 Now the test verifies, that after a successful import into EGL, followed
 by guaranteed destruction of the EGLImage and the buffer reference
 inside EGL, the dma_buf file descriptor still stays valid in the caller.
 
 Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 ---
 
 I do not have commit access to piglit, and this is my first submission,
 IIRC.
 
 This change causes Mesa to regress on this particular Piglit test. I am
 planning to fix Mesa, too.
 
 I also didn't really understand the comment below the spec quote, so I
 left it as is. It seems this test does not test at all that the buffer
 stays valid in EGL after the creator side has been destroyed. This is
 only about (not) keeping the dmabuf file descriptor open.

This is correct, and your change is the right thing to do.

Reviewed-by: Topi Pohjolainen topi.pohjolai...@intel.com

Same as in case of the mesa patch, lets wait for other people to comment
as well.

 
 Thanks,
 pq
 ---
  tests/spec/ext_image_dma_buf_import/ownership_transfer.c | 13 +
  1 file changed, 9 insertions(+), 4 deletions(-)
 
 diff --git a/tests/spec/ext_image_dma_buf_import/ownership_transfer.c 
 b/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
 index ff51810..e3e34b6 100644
 --- a/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
 +++ b/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
 @@ -32,8 +32,9 @@
   *
   * 3. Does ownership of the file descriptor pass to the EGL library?
   *
 - *   ANSWER: If eglCreateImageKHR is successful, EGL assumes ownership of the
 - *   file descriptors and is responsible for closing them.
 + *   ANSWER: No, EGL does not take ownership of the file descriptors. It is 
 the
 + *   responsibility of the application to close the file descriptors on 
 success
 + *   and failure.
   *
   *
   * Here one checks that the creator of the buffer can drop its reference once
 @@ -99,8 +100,12 @@ test_create_and_destroy(unsigned w, unsigned h, void 
 *buf, int fd,
   return PIGLIT_FAIL;
   }
  
 - /* EGL stack should have closed the importing file descriptor by now */
 - return close(fd)  errno == EBADF ? PIGLIT_PASS : PIGLIT_FAIL;
 + /*
 +  * EGL stack should have closed the importing file descriptor by now,

Just drop this line here - importing file descriptor meant the very same
fd we gave to the EGL stack (and the one we are about to close here).

 +  * but our own file descriptor must still be valid, and therefore
 +  * closing it must succeed.
 +  */
 + return close(fd) == 0 ? PIGLIT_PASS : PIGLIT_FAIL;
  }
  
  enum piglit_result
 -- 
 1.8.5.5
 
 ___
 Piglit mailing list
 Piglit@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/7] ARB_explicit_uniform_location: test for uniform location boundary values

2014-03-14 Thread Pohjolainen, Topi
On Thu, Mar 13, 2014 at 11:24:46AM -0700, Anuj Phogat wrote:
 On Thu, Mar 13, 2014 at 5:41 AM, Tapani Pälli tapani.pa...@intel.com wrote:
  Signed-off-by: Tapani Pälli tapani.pa...@intel.com
  ---
   tests/all.py   |   1 +
   .../CMakeLists.gl.txt  |   1 +
   .../arb_explicit_uniform_location/loc-minmax.c | 107 
  +
   3 files changed, 109 insertions(+)
   create mode 100644 tests/spec/arb_explicit_uniform_location/loc-minmax.c
 
  diff --git a/tests/all.py b/tests/all.py
  index 6642019..25ec0ea 100644
  --- a/tests/all.py
  +++ b/tests/all.py
  @@ -1925,6 +1925,7 @@ 
  import_glsl_parser_tests(arb_explicit_uniform_location,
os.path.join(testsDir, 'spec', 
  'arb_explicit_uniform_location'),
[''])
   add_plain_test(arb_explicit_uniform_location, 
  'arb_explicit_uniform_location-minmax')
  +add_plain_test(arb_explicit_uniform_location, 
  'arb_explicit_uniform_location-boundaries')
 
   arb_texture_buffer_object = Group()
   spec['ARB_texture_buffer_object'] = arb_texture_buffer_object
  diff --git a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt 
  b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
  index 2bac595..57e90f0 100644
  --- a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
  +++ b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
  @@ -10,3 +10,4 @@ link_libraries (
   )
 
   piglit_add_executable (arb_explicit_uniform_location-minmax minmax.c)
  +piglit_add_executable (arb_explicit_uniform_location-boundaries 
  loc-minmax.c)
  diff --git a/tests/spec/arb_explicit_uniform_location/loc-minmax.c 
  b/tests/spec/arb_explicit_uniform_location/loc-minmax.c
  new file mode 100644
  index 000..d72422d
  --- /dev/null
  +++ b/tests/spec/arb_explicit_uniform_location/loc-minmax.c
  @@ -0,0 +1,107 @@
  +/*
  + * Copyright © 2014 Intel Corporation
  + *
  + * 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 loc-minmax.c
  + *
  + *  Tests the boundary values for uniform locations, this is a positive 
  test
  + *  for the locations, every check here is expected to pass.
  + *
  + *  https://www.opengl.org/registry/specs/ARB/explicit_uniform_location.txt
  + *
  + *  Specification states : The explicitly defined locations and the 
  generated
  + *  locations must be in the range of 0 to MAX_UNIFORM_LOCATIONS minus 
  one.
  + *
  + *  This test tests 0, MAX - 1 and a random value in between, shader 
  contains
  + *  also uniform without explicit location to see that it does not affect
  + *  getting the wanted locations.
  + */
  +#include piglit-util-gl-common.h
  +
  +PIGLIT_GL_TEST_CONFIG_BEGIN
  +
  +   config.supports_gl_compat_version = 20;
  +   config.window_visual = PIGLIT_GL_VISUAL_RGB;
  +
  +PIGLIT_GL_TEST_CONFIG_END
  +
  +enum piglit_result
  +piglit_display(void)
  +{
  +   return PIGLIT_FAIL;
  +}
  +
  +const char v_sha[] =
  +vec4 vertex;\n
  +void main() {\n
  +gl_Position = vertex;\n
  +};

Piglit style indents these by tab also.

  +
  +const char fshader_main[] =
  +#extension GL_ARB_explicit_uniform_location: require\n
  +uniform float a;\n
  +layout(location = %d) uniform float r;\n
  +layout(location = %d) uniform float g;\n
  +layout(location = %d) uniform float b;\n
  +void main() {\n
  +gl_FragColor = vec4(r, g, b, a);\n
  +};
 Using indentation in shader programs will make them more
 readable.
  +
  +#define VERIFY_LOC(uni, loc)\
  +   if (glGetUniformLocation(prog, uni) != loc)\
  +   piglit_report_result(PIGLIT_FAIL);
  +
  +void
  +piglit_init(int argc, char **argv)
  +{
  +   int maxloc, randloc;
  +   GLuint prog;
  +
  +   piglit_require_extension(GL_ARB_explicit_uniform_location);
  +
  +   

Re: [Piglit] [PATCH 2/7] ARB_explicit_uniform_location: test sequential array elements

2014-03-14 Thread Pohjolainen, Topi
On Thu, Mar 13, 2014 at 02:41:44PM +0200, Tapani P?lli wrote:
 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  tests/all.py   |   1 +
  .../CMakeLists.gl.txt  |   1 +
  .../arb_explicit_uniform_location/array-elements.c | 107 
 +
  3 files changed, 109 insertions(+)
  create mode 100644 tests/spec/arb_explicit_uniform_location/array-elements.c
 
 diff --git a/tests/all.py b/tests/all.py
 index 25ec0ea..03202cd 100644
 --- a/tests/all.py
 +++ b/tests/all.py
 @@ -1926,6 +1926,7 @@ import_glsl_parser_tests(arb_explicit_uniform_location,
   [''])
  add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-minmax')
  add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-boundaries')
 +add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-array-elements')
  
  arb_texture_buffer_object = Group()
  spec['ARB_texture_buffer_object'] = arb_texture_buffer_object
 diff --git a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt 
 b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 index 57e90f0..481922e 100644
 --- a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 +++ b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 @@ -11,3 +11,4 @@ link_libraries (
  
  piglit_add_executable (arb_explicit_uniform_location-minmax minmax.c)
  piglit_add_executable (arb_explicit_uniform_location-boundaries loc-minmax.c)
 +piglit_add_executable (arb_explicit_uniform_location-array-elements 
 array-elements.c)
 diff --git a/tests/spec/arb_explicit_uniform_location/array-elements.c 
 b/tests/spec/arb_explicit_uniform_location/array-elements.c
 new file mode 100644
 index 000..a82dc46
 --- /dev/null
 +++ b/tests/spec/arb_explicit_uniform_location/array-elements.c
 @@ -0,0 +1,107 @@
 +/*
 + * Copyright © 2014 Intel Corporation
 + *
 + * 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 array-elements.c
 + *
 + *  Tests that array elements get sequential locations.
 + *
 + *  https://www.opengl.org/registry/specs/ARB/explicit_uniform_location.txt
 + *
 + *  Specification states : Individual elements of a uniform array are 
 assigned
 + *  consecutive locations with the first element 
 taking
 + *  location location.
 + */
 +#include piglit-util-gl-common.h
 +
 +PIGLIT_GL_TEST_CONFIG_BEGIN
 +
 + config.supports_gl_compat_version = 20;
 + config.window_visual = PIGLIT_GL_VISUAL_RGB;
 +
 +PIGLIT_GL_TEST_CONFIG_END
 +
 +enum piglit_result
 +piglit_display(void)
 +{
 + return PIGLIT_FAIL;
 +}
 +
 +const char v_sha[] =
 +vec4 vertex;\n
 +void main() {\n
 +gl_Position = vertex;\n
 +};
 +
 +const char fshader_main[] =
 +#extension GL_ARB_explicit_uniform_location: require\n
 +layout(location = %d) uniform float r;\n
 +layout(location = %d) uniform float g;\n
 +layout(location = %d) uniform float a[%d];\n
 +layout(location = %d) uniform float b;\n
 +void main() {\n
 +gl_FragColor = vec4(r, g, b, a[%d]);\n
 +};
 +
 +#define VERIFY_LOC(uni, loc)\
 + if (glGetUniformLocation(prog, uni) != loc)\
 + piglit_report_result(PIGLIT_FAIL);
 +
 +static bool
 +test()
 +{
 + GLuint prog;
 +
 +char f_sha[512];
 + int array_size = 16;
 + unsigned i, array_loc = 3;
 +
 + snprintf(f_sha, 512, fshader_main,
 + 1, /* r */
 + 2, /* g */
 + array_loc, /* a */
 + array_size, /* array len */
 + 42, /* b */
 +array_size - 1); /* array access */
 +
 + prog = piglit_build_simple_program(v_sha, f_sha);
 +
 +/* loop through array elements and verify that
 + * locations are sequential
 + */
 + for (i = 0; i  array_size; i++) {
 + char 

Re: [Piglit] [V2 2/8] ARB_explicit_uniform_location: test sequential array elements

2014-03-14 Thread Pohjolainen, Topi
On Fri, Mar 14, 2014 at 01:23:23PM +0200, Tapani P?lli wrote:
 v2: set values directly to shader, simplify overall (Topi)
 fix style issues, use asprintf (Anuj)
 
 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  tests/all.py   |  1 +
  .../CMakeLists.gl.txt  |  1 +
  .../arb_explicit_uniform_location/array-elements.c | 90 
 ++
  3 files changed, 92 insertions(+)
  create mode 100644 tests/spec/arb_explicit_uniform_location/array-elements.c
 
 diff --git a/tests/all.py b/tests/all.py
 index 25ec0ea..03202cd 100644
 --- a/tests/all.py
 +++ b/tests/all.py
 @@ -1926,6 +1926,7 @@ import_glsl_parser_tests(arb_explicit_uniform_location,
   [''])
  add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-minmax')
  add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-boundaries')
 +add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-array-elements')
  
  arb_texture_buffer_object = Group()
  spec['ARB_texture_buffer_object'] = arb_texture_buffer_object
 diff --git a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt 
 b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 index e871ca1..945c80d 100644
 --- a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 +++ b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 @@ -11,3 +11,4 @@ link_libraries (
  
  piglit_add_executable (arb_explicit_uniform_location-minmax minmax.c)
  piglit_add_executable (arb_explicit_uniform_location-boundaries 
 loc-boundaries.c)
 +piglit_add_executable (arb_explicit_uniform_location-array-elements 
 array-elements.c)
 diff --git a/tests/spec/arb_explicit_uniform_location/array-elements.c 
 b/tests/spec/arb_explicit_uniform_location/array-elements.c
 new file mode 100644
 index 000..f4e3cb2
 --- /dev/null
 +++ b/tests/spec/arb_explicit_uniform_location/array-elements.c
 @@ -0,0 +1,90 @@
 +/*
 + * Copyright © 2014 Intel Corporation
 + *
 + * 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 array-elements.c
 + *
 + * Tests that array elements get sequential locations.
 + *
 + * https://www.opengl.org/registry/specs/ARB/explicit_uniform_location.txt
 + *
 + * Specification states : Individual elements of a uniform array are 
 assigned
 + * consecutive locations with the first element 
 taking
 + * location location.
 + */
 +#include piglit-util-gl-common.h
 +
 +PIGLIT_GL_TEST_CONFIG_BEGIN
 +
 + config.supports_gl_compat_version = 20;
 + config.window_visual = PIGLIT_GL_VISUAL_RGB;
 +
 +PIGLIT_GL_TEST_CONFIG_END
 +
 +enum piglit_result
 +piglit_display(void)
 +{
 + return PIGLIT_FAIL;
 +}
 +
 +const char v_sha[] =

This could be static.

 + vec4 vertex;\n
 + void main() {\n
 + gl_Position = vertex;\n
 + };
 +
 +const char f_sha[] =

Same here.

 + #extension GL_ARB_explicit_uniform_location: require\n
 + #define ARRAY_SIZE 16\n
 + layout(location = 1) uniform float r;\n
 + layout(location = 2) uniform float g;\n
 + layout(location = 3) uniform float a[ARRAY_SIZE];\n
 + layout(location = 19) uniform float b;\n
 + void main() {\n
 + gl_FragColor = vec4(r, g, b, a[ARRAY_SIZE - 1]);\n
 + };
 +
 +void
 +piglit_init(int argc, char **argv)
 +{
 + GLuint prog, i;
 +
 + piglit_require_extension(GL_ARB_explicit_uniform_location);
 +
 + prog = piglit_build_simple_program(v_sha, f_sha);
 +
 + /* verify that locations are sequential */
 + for (i = 0; i  16; i++) {
 + char *element;
 + if (asprintf(element, a[%d], i) == -1)
 + piglit_report_result(PIGLIT_FAIL);
 +
 + if (glGetUniformLocation(prog, element) != 3 + i)
 +

Re: [Piglit] [PATCH 1/7] ARB_explicit_uniform_location: test for uniform location boundary values

2014-03-13 Thread Pohjolainen, Topi
On Thu, Mar 13, 2014 at 02:41:43PM +0200, Tapani P?lli wrote:
 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  tests/all.py   |   1 +
  .../CMakeLists.gl.txt  |   1 +
  .../arb_explicit_uniform_location/loc-minmax.c | 107 
 +
  3 files changed, 109 insertions(+)
  create mode 100644 tests/spec/arb_explicit_uniform_location/loc-minmax.c
 
 diff --git a/tests/all.py b/tests/all.py
 index 6642019..25ec0ea 100644
 --- a/tests/all.py
 +++ b/tests/all.py
 @@ -1925,6 +1925,7 @@ import_glsl_parser_tests(arb_explicit_uniform_location,
   os.path.join(testsDir, 'spec', 
 'arb_explicit_uniform_location'),
   [''])
  add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-minmax')
 +add_plain_test(arb_explicit_uniform_location, 
 'arb_explicit_uniform_location-boundaries')
  
  arb_texture_buffer_object = Group()
  spec['ARB_texture_buffer_object'] = arb_texture_buffer_object
 diff --git a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt 
 b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 index 2bac595..57e90f0 100644
 --- a/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 +++ b/tests/spec/arb_explicit_uniform_location/CMakeLists.gl.txt
 @@ -10,3 +10,4 @@ link_libraries (
  )
  
  piglit_add_executable (arb_explicit_uniform_location-minmax minmax.c)
 +piglit_add_executable (arb_explicit_uniform_location-boundaries loc-minmax.c)
 diff --git a/tests/spec/arb_explicit_uniform_location/loc-minmax.c 
 b/tests/spec/arb_explicit_uniform_location/loc-minmax.c
 new file mode 100644
 index 000..d72422d
 --- /dev/null
 +++ b/tests/spec/arb_explicit_uniform_location/loc-minmax.c
 @@ -0,0 +1,107 @@
 +/*
 + * Copyright © 2014 Intel Corporation
 + *
 + * 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 loc-minmax.c
 + *
 + *  Tests the boundary values for uniform locations, this is a positive test
 + *  for the locations, every check here is expected to pass.
 + *
 + *  https://www.opengl.org/registry/specs/ARB/explicit_uniform_location.txt
 + *
 + *  Specification states : The explicitly defined locations and the 
 generated
 + *  locations must be in the range of 0 to MAX_UNIFORM_LOCATIONS minus one.
 + *
 + *  This test tests 0, MAX - 1 and a random value in between, shader contains

I'm always uncomfortable having tests based on random values - different runs
are possibly testing different behaviour. Could we just handpick a few from
now and there in the range. For example,

   0 * (max - 1) / 5
   1 * (max - 1) / 5
   2 * (max - 1) / 5
   3 * (max - 1) / 5
   4 * (max - 1) / 5

 + *  also uniform without explicit location to see that it does not affect
 + *  getting the wanted locations.
 + */
 +#include piglit-util-gl-common.h
 +
 +PIGLIT_GL_TEST_CONFIG_BEGIN
 +
 + config.supports_gl_compat_version = 20;
 + config.window_visual = PIGLIT_GL_VISUAL_RGB;
 +
 +PIGLIT_GL_TEST_CONFIG_END
 +
 +enum piglit_result
 +piglit_display(void)
 +{
 + return PIGLIT_FAIL;
 +}
 +
 +const char v_sha[] =
 +vec4 vertex;\n
 +void main() {\n
 +gl_Position = vertex;\n
 +};
 +
 +const char fshader_main[] =
 +#extension GL_ARB_explicit_uniform_location: require\n
 +uniform float a;\n
 +layout(location = %d) uniform float r;\n
 +layout(location = %d) uniform float g;\n
 +layout(location = %d) uniform float b;\n
 +void main() {\n
 +gl_FragColor = vec4(r, g, b, a);\n
 +};
 +
 +#define VERIFY_LOC(uni, loc)\
 + if (glGetUniformLocation(prog, uni) != loc)\
 + piglit_report_result(PIGLIT_FAIL);
 +
 +void
 +piglit_init(int argc, char **argv)
 +{
 + int maxloc, randloc;
 + GLuint prog;
 +
 + piglit_require_extension(GL_ARB_explicit_uniform_location);
 +
 + glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, maxloc);
 +
 + if 

Re: [Piglit] [PATCH 1/2] arb_gpu_shader5: Add shader tests to verify 'invocations' layout qualifier

2014-02-23 Thread Pohjolainen, Topi
On Wed, Feb 12, 2014 at 10:11:20AM -0800, Anuj Phogat wrote:
 Signed-off-by: Anuj Phogat anuj.pho...@gmail.com

Both are:

Reviewed-by: Topi Pohjolainen topi.pohjolai...@intel.com

 ---
  .../execution/invocations-conflicting.shader_test  | 47 
 ++
  .../execution/invocations-matching.shader_test | 46 +
  2 files changed, 93 insertions(+)
  create mode 100644 
 tests/spec/arb_gpu_shader5/execution/invocations-conflicting.shader_test
  create mode 100644 
 tests/spec/arb_gpu_shader5/execution/invocations-matching.shader_test
 
 diff --git 
 a/tests/spec/arb_gpu_shader5/execution/invocations-conflicting.shader_test 
 b/tests/spec/arb_gpu_shader5/execution/invocations-conflicting.shader_test
 new file mode 100644
 index 000..191d696
 --- /dev/null
 +++ b/tests/spec/arb_gpu_shader5/execution/invocations-conflicting.shader_test
 @@ -0,0 +1,47 @@
 +# ARB_gpu_shader5 spec says:
 +#   If an invocation count is declared, all such declarations
 +#must specify the same count.
 +#
 +# This test verifies that a link error occurs if two compilation units
 +# declare conflicting number of invocations.
 +
 +[require]
 +GLSL = 1.50
 +GL_ARB_gpu_shader5
 +
 +[vertex shader passthrough]
 +
 +[geometry shader]
 +
 +#extension GL_ARB_gpu_shader5 : enable
 +layout(lines, invocations=4) in;
 +layout(triangle_strip, max_vertices = 3) out;
 +
 +void do_vertex(int i);
 +
 +void main()
 +{
 +  for (int i = 0; i  2; i++)
 +do_vertex(i);
 +}
 +
 +[geometry shader]
 +
 +#extension GL_ARB_gpu_shader5 : enable
 +layout(invocations=3) in;
 +
 +void do_vertex(int i)
 +{
 +}
 +
 +[fragment shader]
 +
 +out vec4 color;
 +
 +void main()
 +{
 +  color = vec4(0.0, 1.0, 0.0, 1.0);
 +}
 +
 +[test]
 +link error
 diff --git 
 a/tests/spec/arb_gpu_shader5/execution/invocations-matching.shader_test 
 b/tests/spec/arb_gpu_shader5/execution/invocations-matching.shader_test
 new file mode 100644
 index 000..a893d07
 --- /dev/null
 +++ b/tests/spec/arb_gpu_shader5/execution/invocations-matching.shader_test
 @@ -0,0 +1,46 @@
 +# ARB_gpu_shader5 spec says:
 +#   If an invocation count is declared, all such declarations
 +#must specify the same count.
 +#
 +# This test verifies the link success if two compilation units
 +# declare the same number of invocations.
 +
 +[require]
 +GLSL = 1.50
 +GL_ARB_gpu_shader5
 +
 +[vertex shader passthrough]
 +
 +[geometry shader]
 +
 +#extension GL_ARB_gpu_shader5 : enable
 +layout(lines, invocations=4) in;
 +layout(triangle_strip, max_vertices = 3) out;
 +
 +void do_vertex(int i);
 +
 +void main()
 +{
 +  for (int i = 0; i  2; i++)
 +do_vertex(i);
 +}
 +
 +[geometry shader]
 +
 +#extension GL_ARB_gpu_shader5 : enable
 +layout(invocations=4) in;
 +void do_vertex(int i)
 +{
 +}
 +
 +[fragment shader]
 +
 +out vec4 color;
 +
 +void main()
 +{
 +  color = vec4(0.0, 1.0, 0.0, 1.0);
 +}
 +
 +[test]
 +link success
 -- 
 1.8.3.1
 
 ___
 Piglit mailing list
 Piglit@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Add a rendering test for GL_ARB_stencil_texturing.

2014-02-19 Thread Pohjolainen, Topi
On Tue, Feb 11, 2014 at 08:12:27PM -0800, Kenneth Graunke wrote:
 The GL_ARB_stencil_texturing extension allows sampling from either the
 depth or stencil components of combined GL_DEPTH_STENCIL textures.  To
 select which component to sample, applications can call TexParameter
 with a pname of GL_DEPTH_STENCIL_TEXTURE_MODE and value of either
 GL_DEPTH_COMPONENT or GL_STENCIL_INDEX.
 
 This test verifies that both depth and stencil texturing works as
 expected.  In particular, it verifies that the shader samples the
 correct locations.
 
 I chose a 256x256 texture since it's larger than i965's Y-tiling format
 (64) and W-tiling-interpreted-as-Y (128).

I've been playing quite a bit with this, and read it through a few
times. If you add this to tests/all it's:

Reviewed-by: Topi Pohjolainen topi.pohjolai...@intel.com

 
 Cc: Eric Anholt e...@anholt.net
 Cc: Topi Pohjolainen topi.pohjolai...@intel.com
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  tests/spec/CMakeLists.txt  |   1 +
  tests/spec/arb_stencil_texturing/CMakeLists.gl.txt |  12 +
  tests/spec/arb_stencil_texturing/CMakeLists.txt|   1 +
  tests/spec/arb_stencil_texturing/draw.c| 278 
 +
  4 files changed, 292 insertions(+)
  create mode 100644 tests/spec/arb_stencil_texturing/CMakeLists.gl.txt
  create mode 100644 tests/spec/arb_stencil_texturing/CMakeLists.txt
  create mode 100644 tests/spec/arb_stencil_texturing/draw.c
 
 We should also test that GetTexParameter works.
 
 diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
 index c83a64b..1c9e52f 100644
 --- a/tests/spec/CMakeLists.txt
 +++ b/tests/spec/CMakeLists.txt
 @@ -31,6 +31,7 @@ add_subdirectory (arb_separate_shader_objects)
  add_subdirectory (arb_shader_texture_lod/execution)
  add_subdirectory (arb_shader_objects)
  add_subdirectory (arb_shading_language_420pack/execution)
 +add_subdirectory (arb_stencil_texturing)
  add_subdirectory (arb_sync)
  add_subdirectory (arb_uniform_buffer_object)
  add_subdirectory (ati_draw_buffers)
 diff --git a/tests/spec/arb_stencil_texturing/CMakeLists.gl.txt 
 b/tests/spec/arb_stencil_texturing/CMakeLists.gl.txt
 new file mode 100644
 index 000..d49656a
 --- /dev/null
 +++ b/tests/spec/arb_stencil_texturing/CMakeLists.gl.txt
 @@ -0,0 +1,12 @@
 +include_directories(
 + ${GLEXT_INCLUDE_DIR}
 + ${OPENGL_INCLUDE_PATH}
 +)
 +
 +link_libraries (
 + piglitutil_${piglit_target_api}
 + ${OPENGL_gl_LIBRARY}
 + ${OPENGL_glu_LIBRARY}
 +)
 +
 +piglit_add_executable (arb_stencil_texturing-draw draw.c)
 diff --git a/tests/spec/arb_stencil_texturing/CMakeLists.txt 
 b/tests/spec/arb_stencil_texturing/CMakeLists.txt
 new file mode 100644
 index 000..144a306
 --- /dev/null
 +++ b/tests/spec/arb_stencil_texturing/CMakeLists.txt
 @@ -0,0 +1 @@
 +piglit_include_target_api()
 diff --git a/tests/spec/arb_stencil_texturing/draw.c 
 b/tests/spec/arb_stencil_texturing/draw.c
 new file mode 100644
 index 000..59c9e65
 --- /dev/null
 +++ b/tests/spec/arb_stencil_texturing/draw.c
 @@ -0,0 +1,278 @@
 +/*
 + * Copyright © 2014 Intel Corporation
 + *
 + * 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 draw.c
 + *
 + * A basic drawing test for GL_ARB_stencil_texturing which ensures that
 + * sampling occurs from the right position in the texture.
 + *
 + * It creates two packed depth/stencil textures.  The first has a horizontal
 + * gradient (0.0 - 1.0 for depth, 0 - 255 for stencil), and the second a
 + * vertical gradient.
 + *
 + * The expected output is four squares, separated by a blue border.
 + * The left half of the window is generated by stencil texturing, and drawn
 + * in red.  The right half is generated by depth texturing, and drawn in 
 green.
 + *
 + *   Stencil |   Depth
 + *(red)  |  (green)
 + *   |
 + *   0 -- 1 |  0 -- 1
 + *  

Re: [Piglit] [PATCH 1/2] Test that continue works properly inside a do-while loop.

2014-02-01 Thread Pohjolainen, Topi
On Fri, Jan 31, 2014 at 01:12:09PM -0800, Paul Berry wrote:
 ---
  .../glsl-fs-continue-inside-do-while.shader_test   | 51 +
  .../glsl-vs-continue-inside-do-while.shader_test   | 52 
 ++
  2 files changed, 103 insertions(+)
  create mode 100644 tests/shaders/glsl-fs-continue-inside-do-while.shader_test
  create mode 100644 tests/shaders/glsl-vs-continue-inside-do-while.shader_test
 
 diff --git a/tests/shaders/glsl-fs-continue-inside-do-while.shader_test 
 b/tests/shaders/glsl-fs-continue-inside-do-while.shader_test
 new file mode 100644
 index 000..9f5e491
 --- /dev/null
 +++ b/tests/shaders/glsl-fs-continue-inside-do-while.shader_test
 @@ -0,0 +1,51 @@
 +# From the GLSL 4.40 spec, section 6.4 (Jumps):
 +#
 +# The continue jump is used only in loops. It skips the remainder
 +# of the body of the inner most loop of which it is inside. For
 +# while and do-while loops, this jump is to the next evaluation of
 +# the loop condition-expression from which the loop continues as
 +# previously defined.
 +#
 +# As of 1/31/2014 (commit db8b6fb), Mesa handles continue inside a
 +# do-while loop incorrectly; instead of jumping to the loop
 +# condition-expression, it jumps to the top of the loop.  This is
 +# particularly problematic because it can lead to infinite loops.
 +#
 +# This test verifies correct behaviour of continue inside do-while
 +# loops without risking an infinite loop.
 +
 +[require]
 +GLSL = 1.10
 +
 +[vertex shader]
 +void main()
 +{
 +  gl_Position = gl_Vertex;
 +}
 +
 +[fragment shader]
 +void main()
 +{
 +  int x = 0;
 +  int y = 0;
 +  do { // 1st iteration  2nd iteration  3rd iteration
 +++x;   // x - 1 x - 2 x - 3
 +if (x = 4)// false  false  false
 +  break;

This guarding is for the infinite looping case of the broken mesa to terminate
after finite amount of iterations, right? Without this extra check the following
continue would always jump to the top of the loop (as you explained) causing the
final guarding while (x  3) to be infinitely skipped.
If this is the case, would it make sense to add a small comment for the future
when the problem in mesa not present anymore and somebody might wonder why the
extra guarding is needed?

Still need to add that this is one the best documented tests that I've seen.
Thanks Paul, makes really nice reading!

 +if (x = 2)// false  true   true
 +  continue;
 +++y;   // y=1skippedskipped
 +  } while (x  3); // true   true   false
 +
 +  // The continue should skip ++y on all iterations but the first,
 +  // so y should now be 1.  The continue should not skip (x  3)
 +  // ever, so the loop should terminate when x == 3 (not 4).
 +  if (x == 3  y == 1)
 +gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
 +  else
 +gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
 +}
 +
 +[test]
 +draw rect -1 -1 2 2
 +probe all rgba 0.0 1.0 0.0 1.0
 diff --git a/tests/shaders/glsl-vs-continue-inside-do-while.shader_test 
 b/tests/shaders/glsl-vs-continue-inside-do-while.shader_test
 new file mode 100644
 index 000..aa6d3e6
 --- /dev/null
 +++ b/tests/shaders/glsl-vs-continue-inside-do-while.shader_test
 @@ -0,0 +1,52 @@
 +# From the GLSL 4.40 spec, section 6.4 (Jumps):
 +#
 +# The continue jump is used only in loops. It skips the remainder
 +# of the body of the inner most loop of which it is inside. For
 +# while and do-while loops, this jump is to the next evaluation of
 +# the loop condition-expression from which the loop continues as
 +# previously defined.
 +#
 +# As of 1/31/2014 (commit db8b6fb), Mesa handles continue inside a
 +# do-while loop incorrectly; instead of jumping to the loop
 +# condition-expression, it jumps to the top of the loop.  This is
 +# particularly problematic because it can lead to infinite loops.
 +#
 +# This test verifies correct behaviour of continue inside do-while
 +# loops without risking an infinite loop.
 +
 +[require]
 +GLSL = 1.10
 +
 +[vertex shader]
 +void main()
 +{
 +  gl_Position = gl_Vertex;
 +  int x = 0;
 +  int y = 0;
 +  do { // 1st iteration  2nd iteration  3rd iteration
 +++x;   // x - 1 x - 2 x - 3
 +if (x = 4)// false  false  false
 +  break;
 +if (x = 2)// false  true   true
 +  continue;
 +++y;   // y=1skippedskipped
 +  } while (x  3); // true   true   false
 +
 +  // The continue should skip ++y on all iterations but the first,
 +  // so y should now be 1.  The continue should not skip (x  3)
 +  // ever, so the loop should terminate when x == 3 (not 4).
 +  if (x == 3  y == 1)
 +gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
 +  else
 +gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
 +}
 +
 +[fragment shader]
 +void main()
 +{
 +  gl_FragColor = gl_Color;
 

Re: [Piglit] [PATCH 1/8] layered-rendering/blit: use color other than the default red

2014-01-27 Thread Pohjolainen, Topi
On Sun, Jan 26, 2014 at 11:29:45PM -0800, Kenneth Graunke wrote:
 On 01/26/2014 01:34 AM, Topi Pohjolainen wrote:
  Passes on nvidia and on IVB using blt-engine and mesa fallback
  path but fails on IVB using blorp (both before and after the
  recent refactoring):
  
  Probe color at (32,0)
Expected: 0.50 0.40 0.30
Observed: 0.250980 0.160784 0.090196
  Probe color at (96,0)
Expected: 0.50 0.40 0.30
Observed: 0.250980 0.160784 0.090196
  Probe color at (32,64)
Expected: 0.50 0.40 0.30
Observed: 0.250980 0.160784 0.090196
  Probe color at (96,64)
Expected: 0.50 0.40 0.30
Observed: 0.250980 0.160784 0.090196
 
 This looks a lot like botched SRGB handling.  I saw BlitFramebuffers
 with a source format of XRGB and a destination format of SRGB8.

This is odd, I tried the latest mesa-master and for me the destination
is either MESA_FORMAT_XRGB (RGB-texture) or MESA_FORMAT_ARGB
(the framebuffer).

 Commenting out the A - 1.0 override in gen6_blorp_emit_blend_state
 makes the test pass, so something's probably broken around there...

As we discussed offline, I'll try a patch which effectively reverts:

commit c0554141a9b831b4e614747104dcbbe0fe489b9d
Author: Kenneth Graunke kenn...@whitecape.org
Date:   Mon Jan 28 22:03:18 2013 -0800

i965/blorp: Support overriding destination alpha to 1.0.

Currently, Blorp requires the source and destination formats to be
equal.  However, we'd really like to be able to blit between XRGB and
ARGB formats; our BLT engine paths have supported this for a long time.

For ARGB - XRGB, nothing needs to occur: the missing alpha is already
interpreted as 1.0.  For XRGB - ARGB, we need to smash the alpha
channel to 1.0 when writing the destination colors.  This is fairly
straightforward with blending.

For now, this code is never used, as the source and destination formats
still must be equal.  The next patch will relax that restriction.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Tested-by: Martin Steigerwald mar...@lichtvoll.de

diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i96
index eb61898..3834ae2 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -283,6 +283,25 @@ gen6_blorp_emit_blend_state(struct brw_context *brw,
blend-blend1.write_disable_b = false;
blend-blend1.write_disable_a = false;
 
+   /* When blitting from an XRGB source to a ARGB destination, we need to
+* interpret the missing channel as 1.0.  Blending can do that for us:
+* we simply use the RGB values from the fragment shader (source RGB),
+* but smash the alpha channel to 1.
+*/
+   if (_mesa_get_format_bits(params-dst.mt-format, GL_ALPHA_BITS)  0 
+   _mesa_get_format_bits(params-src.mt-format, GL_ALPHA_BITS) == 0) {
+  blend-blend0.blend_enable = 1;
+  blend-blend0.ia_blend_enable = 1;
+
+  blend-blend0.blend_func = BRW_BLENDFUNCTION_ADD;
+  blend-blend0.ia_blend_func = BRW_BLENDFUNCTION_ADD;
+
+  blend-blend0.source_blend_factor = BRW_BLENDFACTOR_SRC_COLOR;
+  blend-blend0.dest_blend_factor = BRW_BLENDFACTOR_ZERO;
+  blend-blend0.ia_source_blend_factor = BRW_BLENDFACTOR_ONE;
+  blend-blend0.ia_dest_blend_factor = BRW_BLENDFACTOR_ZERO;
+   }
+
return cc_blend_state_offset;
 }


--
Our blorp logic samples the XRGB normally and gets alpha channel set
to 1.0 automatically by the sampler engine. This is simply copied in the
blorp blit program directly to the payload of the render target write
message and hence we shouldn't need any additional blending support from
the pixel processing pipeline.

 
 Good luck!
 


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 5/7] pack_depth_stencil: Create textures with GL_DEPTH_STENCIL base format

2014-01-17 Thread Pohjolainen, Topi
On Tue, Jan 14, 2014 at 01:23:10PM -0800, Ian Romanick wrote:
 On 12/21/2013 03:24 AM, Pohjolainen, Topi wrote:
  On Thu, Dec 19, 2013 at 11:37:33AM -0800, Ian Romanick wrote:
  From: Ian Romanick ian.d.roman...@intel.com
 
  Depending on the GL version and extensions supported, this should either
  work (not generate a GL error) or generate a variety of GL errors.
 
  This test passes on NVIDIA (304.64 on GTX 260).  This driver exposes
  OpenGL 3.3 and GL_ARB_texture_storage.
 
  This test fails on current Mesa on drivers that support depth textures.
  the glTexImage3D(GL_TEXTURE_3D) tests generate GL_INVALID_ENUM instead
  of GL_INVALID_OPERATION.  The glTexStorage3D(GL_TEXTURE_3D) test
  doesn't generate an error, but it should generate GL_INVALID_OPERATION.
 
  Signed-off-by: Ian Romanick ian.d.roman...@intel.com
  ---
   tests/all.tests|   1 +
   .../ext_packed_depth_stencil/CMakeLists.gl.txt |   1 +
   .../depth-stencil-texture.c| 245 
  +
   3 files changed, 247 insertions(+)
   create mode 100644 
  tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
 
  diff --git a/tests/all.tests b/tests/all.tests
  index 091a2e5..fa25c6c 100644
  --- a/tests/all.tests
  +++ b/tests/all.tests
  @@ -2136,6 +2136,7 @@ add_depthstencil_render_miplevels_tests(
's=z24_s8_d=z24_s8', 's=z24_s8_d=z24', 'd=s=z24_s8', 
  's=d=z24_s8',
'ds=z24_s8'))
   ext_packed_depth_stencil['fbo-clear-formats stencil'] = 
  concurrent_test('fbo-clear-formats GL_EXT_packed_depth_stencil stencil')
  +ext_packed_depth_stencil['DEPTH_STENCIL texture'] = 
  concurrent_test('ext_packed_depth_stencil-depth-stencil-texture')
   
   ext_texture_array = Group()
   spec['EXT_texture_array'] = ext_texture_array
  diff --git a/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt 
  b/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt
  index 22d6f34..2f47328 100644
  --- a/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt
  +++ b/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt
  @@ -9,6 +9,7 @@ link_libraries (
 ${OPENGL_glu_LIBRARY}
   )
   
  +piglit_add_executable (ext_packed_depth_stencil-depth-stencil-texture 
  depth-stencil-texture.c)
   piglit_add_executable (ext_packed_depth_stencil-readpixels-24_8 
  readpixels-24_8.c)
   
   # vim: ft=cmake:
  diff --git a/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c 
  b/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
  new file mode 100644
  index 000..c641772
  --- /dev/null
  +++ b/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
  @@ -0,0 +1,245 @@
  +/*
  + * Copyright © 2011 Intel Corporation
  + *
  + * 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-texture
  
  Would this need to be 'depth-stencil-texture.c' instead?
 
 With that fixed, can I add your Reviewed-by?

Yes, it looks good to me. I spent some time thinking if there is anything that
would make it clearer that while 'has_depth_texture_cube_map' and
'has_depth_texture' control expected error values, 'has_texture_cube_map' in
turn tells if cube map textures should be even considered.
I couldn't think of anything and by reading the test case thoroughly it is clear
in the end anyway. Scope of the constant 'expected_cube_error' could be reduced
to the conditional testing block but I don't think it really improves the
readability.

 
  + * Create a depth-stencil texture when ARB_depth_texture is not supported.
  + *
  + * The EXT_packed_depth_stencil spec neglects to mention an interaction
  + * (though the header of the spec says ARB_depth_texture affects the
  + * definition of this extension.), but ARB_framebuffer_object, which 
  includes
  + * EXT_packed_depth_stencil functionality says

Re: [Piglit] [PATCH 5/7] pack_depth_stencil: Create textures with GL_DEPTH_STENCIL base format

2013-12-21 Thread Pohjolainen, Topi
On Thu, Dec 19, 2013 at 11:37:33AM -0800, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Depending on the GL version and extensions supported, this should either
 work (not generate a GL error) or generate a variety of GL errors.
 
 This test passes on NVIDIA (304.64 on GTX 260).  This driver exposes
 OpenGL 3.3 and GL_ARB_texture_storage.
 
 This test fails on current Mesa on drivers that support depth textures.
 the glTexImage3D(GL_TEXTURE_3D) tests generate GL_INVALID_ENUM instead
 of GL_INVALID_OPERATION.  The glTexStorage3D(GL_TEXTURE_3D) test
 doesn't generate an error, but it should generate GL_INVALID_OPERATION.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  tests/all.tests|   1 +
  .../ext_packed_depth_stencil/CMakeLists.gl.txt |   1 +
  .../depth-stencil-texture.c| 245 
 +
  3 files changed, 247 insertions(+)
  create mode 100644 
 tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
 
 diff --git a/tests/all.tests b/tests/all.tests
 index 091a2e5..fa25c6c 100644
 --- a/tests/all.tests
 +++ b/tests/all.tests
 @@ -2136,6 +2136,7 @@ add_depthstencil_render_miplevels_tests(
   's=z24_s8_d=z24_s8', 's=z24_s8_d=z24', 'd=s=z24_s8', 's=d=z24_s8',
   'ds=z24_s8'))
  ext_packed_depth_stencil['fbo-clear-formats stencil'] = 
 concurrent_test('fbo-clear-formats GL_EXT_packed_depth_stencil stencil')
 +ext_packed_depth_stencil['DEPTH_STENCIL texture'] = 
 concurrent_test('ext_packed_depth_stencil-depth-stencil-texture')
  
  ext_texture_array = Group()
  spec['EXT_texture_array'] = ext_texture_array
 diff --git a/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt 
 b/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt
 index 22d6f34..2f47328 100644
 --- a/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt
 +++ b/tests/spec/ext_packed_depth_stencil/CMakeLists.gl.txt
 @@ -9,6 +9,7 @@ link_libraries (
   ${OPENGL_glu_LIBRARY}
  )
  
 +piglit_add_executable (ext_packed_depth_stencil-depth-stencil-texture 
 depth-stencil-texture.c)
  piglit_add_executable (ext_packed_depth_stencil-readpixels-24_8 
 readpixels-24_8.c)
  
  # vim: ft=cmake:
 diff --git a/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c 
 b/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
 new file mode 100644
 index 000..c641772
 --- /dev/null
 +++ b/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
 @@ -0,0 +1,245 @@
 +/*
 + * Copyright © 2011 Intel Corporation
 + *
 + * 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-texture

Would this need to be 'depth-stencil-texture.c' instead?

 + * Create a depth-stencil texture when ARB_depth_texture is not supported.
 + *
 + * The EXT_packed_depth_stencil spec neglects to mention an interaction
 + * (though the header of the spec says ARB_depth_texture affects the
 + * definition of this extension.), but ARB_framebuffer_object, which 
 includes
 + * EXT_packed_depth_stencil functionality says:
 + *
 + * If ARB_depth_texture or SGIX_depth_texture is supported,
 + * GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8 data can also be used for
 + * textures;
 + *
 + * In cases where neither ARB_depth_texture nor SGIX_depth_texture is
 + * supported, trying to create a texture with a depth-stencil format should
 + * generate an error.
 + */
 +
 +#include piglit-util-gl-common.h
 +
 +PIGLIT_GL_TEST_CONFIG_BEGIN
 +
 + config.supports_gl_compat_version = 12;
 + config.supports_gl_core_version = 31;
 +
 + config.window_visual = PIGLIT_GL_VISUAL_RGBA;
 +
 +PIGLIT_GL_TEST_CONFIG_END
 +
 +static bool has_texture_cube_map = false;
 +static bool has_depth_texture_cube_map = false;
 +static bool has_depth_texture = false;
 +
 +static bool
 +try_TexImage(GLenum internalFormat)
 +{
 + bool pass = true;
 + GLuint 

Re: [Piglit] [v4 08/11] arb_transform_feedback3: add test for interleaved in max buffers

2013-11-25 Thread Pohjolainen, Topi
On Fri, Nov 22, 2013 at 01:47:23PM -0800, Ian Romanick wrote:
 On 11/14/2013 04:20 AM, Topi Pohjolainen wrote:
  Passes on NVIDIA (304.88 on GTX 660) and on Ivy Bridge.
  
  v2:
 - fixed indentation: spaces - tabs (Ian)
 - require core/compatibility version 3.2 instead of
   ARB_geometry_shader4 which is not going to be supported by
   mesa (Ian)
 - drop _EXT, use core names instead (Ian)
 - now using piglit_build_simple_program_multiple_shaders()
  
  v3:
 - drop unnecessary doxygen markers in comments
 - switched to hex-numbered variable names to simplify the
   name generation and space allocation
 - such as Ian suggested for another test, generate the
   names of the varyings using 'asprintf()'
 - renamed into 'ext_interleaved_max_buffers_and_varyings'
 - dropped unnecessary requirements for 1.50 glsl and
   arb_gpu_shader5 - former is already covered by the
   GL version 3.2 and latter is simply not needed
 - split varying setup logic into common source file for
   other tests to use
  
  Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
  ---
   tests/all.tests|   2 +
   .../spec/arb_transform_feedback3/CMakeLists.gl.txt |   1 +
   .../ext_interleaved_max_buffers_and_varyings.c | 306 
  +
   tests/spec/arb_transform_feedback3/xfb3_common.c   |  60 
   tests/spec/arb_transform_feedback3/xfb3_common.h   |  55 
   5 files changed, 424 insertions(+)
   create mode 100644 
  tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c
   create mode 100644 tests/spec/arb_transform_feedback3/xfb3_common.c
   create mode 100644 tests/spec/arb_transform_feedback3/xfb3_common.h
  
  diff --git a/tests/all.tests b/tests/all.tests
  index 3ae92d2..2769877 100644
  --- a/tests/all.tests
  +++ b/tests/all.tests
  @@ -2490,6 +2490,8 @@ 
  arb_transform_feedback3['arb_transform_feedback3-end_query_with_name_zero'] 
  = Pl
   
  arb_transform_feedback3['arb_transform_feedback3-draw_using_invalid_stream_index']
   = 
  PlainExecTest(['arb_transform_feedback3-draw_using_invalid_stream_index', 
  '-auto'])
   
  arb_transform_feedback3['arb_transform_feedback3-set_varyings_with_invalid_args']
   = PlainExecTest(['arb_transform_feedback3-set_varyings_with_invalid_args', 
  '-auto'])
   arb_transform_feedback3['arb_transform_feedback3-set_invalid_varyings'] = 
  PlainExecTest(['arb_transform_feedback3-set_invalid_varyings', '-auto'])
  +arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings_vs']
   = 
  PlainExecTest(['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings',
   '-auto', 'vs'])
  +arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings_gs']
   = 
  PlainExecTest(['arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings',
   '-auto', 'gs'])
   
   arb_uniform_buffer_object = Group()
   spec['ARB_uniform_buffer_object'] = arb_uniform_buffer_object
  diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
  b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
  index 1205a07..2f1515b 100644
  --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
  +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
  @@ -14,5 +14,6 @@ piglit_add_executable 
  (arb_transform_feedback3-end_query_with_name_zero end_quer
   piglit_add_executable 
  (arb_transform_feedback3-draw_using_invalid_stream_index 
  draw_using_invalid_stream_index.c)
   piglit_add_executable 
  (arb_transform_feedback3-set_varyings_with_invalid_args 
  set_varyings_with_invalid_args.c)
   piglit_add_executable (arb_transform_feedback3-set_invalid_varyings 
  set_invalid_varyings.c)
  +piglit_add_executable 
  (arb_transform_feedback3-ext_interleaved_max_buffers_and_varyings 
  ext_interleaved_max_buffers_and_varyings.c xfb3_common.c)
   
   # vim: ft=cmake:
  diff --git 
  a/tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c
   
  b/tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c
  new file mode 100644
  index 000..7612c3c
  --- /dev/null
  +++ 
  b/tests/spec/arb_transform_feedback3/ext_interleaved_max_buffers_and_varyings.c
  @@ -0,0 +1,306 @@
  +/*
  + * Copyright © 2013 Intel Corporation
  + *
  + * 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 

Re: [Piglit] [RFC 1/3] hack: enable shader runner on 4.2.0 NVIDIA 304.88

2013-10-17 Thread Pohjolainen, Topi
On Wed, Oct 16, 2013 at 10:25:00AM -0500, Ken Phillis Jr wrote:
On Wed, Oct 16, 2013 at 12:43 AM, Pohjolainen, Topi
topi.pohjolai...@intel.com wrote:
 
  I don't know why it fixes it, I just tried it without the visual
  settings and
  found out that I could run the shader_runner by relaxing the settings.
  I'm
  running 7.1 debian and I thought that the gl-driver and X-server I get
  via the
  distribution should be just fine - shader_runner is quite central test
  in
  piglit after all. That's why I wrote in the cover letter that:
 
   First patch I included just to ask if there something amiss in
   my system. I have
 
   X.Org X Server 1.12.4
   Release Date: 2012-08-27
 
   running on NVIDIA (304.88 on GTX 660). Without the patch I just
   wasn't able to run the shader_runner at all:
 
   piglit: info: Failed to create GL 3.2 core context
   piglit: info: Falling back to GL 3.2 compatibility context
   piglit: info: Failed to create GL 3.2 compatibility context
   piglit: info: Failed to create any GL context
   PIGLIT: {'result': 'skip' }
  -Topi
 
I Think this is a bug to a specific nvidia driver release. So is it
possible to retry this test against the Nvidia 325.08 driver and Nvidia
331.13 drivers?

I'm looking into this but I really wanted to avoid removing the distribution
packages and installing the driver directly (even debian unstable provides only
304.108 which isn't any different w.r.t. the problem in hand).

 
Also, what is the exact test that gives this result?

It is the shader_runner binary that won't get passed the configuration phase.
The exact *.shader_test file being used doesn't really make any difference as
it's contents are considered only after the configuration succeeds.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [RFC 1/3] hack: enable shader runner on 4.2.0 NVIDIA 304.88

2013-10-17 Thread Pohjolainen, Topi
On Thu, Oct 17, 2013 at 12:13:06PM +0300, Pohjolainen, Topi wrote:
 On Wed, Oct 16, 2013 at 10:25:00AM -0500, Ken Phillis Jr wrote:
 On Wed, Oct 16, 2013 at 12:43 AM, Pohjolainen, Topi
 topi.pohjolai...@intel.com wrote:
  
   I don't know why it fixes it, I just tried it without the visual
   settings and
   found out that I could run the shader_runner by relaxing the settings.
   I'm
   running 7.1 debian and I thought that the gl-driver and X-server I get
   via the
   distribution should be just fine - shader_runner is quite central test
   in
   piglit after all. That's why I wrote in the cover letter that:
  
First patch I included just to ask if there something amiss in
my system. I have
  
X.Org X Server 1.12.4
Release Date: 2012-08-27
  
running on NVIDIA (304.88 on GTX 660). Without the patch I just
wasn't able to run the shader_runner at all:
  
piglit: info: Failed to create GL 3.2 core context
piglit: info: Falling back to GL 3.2 compatibility context
piglit: info: Failed to create GL 3.2 compatibility context
piglit: info: Failed to create any GL context
PIGLIT: {'result': 'skip' }
   -Topi
  
 I Think this is a bug to a specific nvidia driver release. So is it
 possible to retry this test against the Nvidia 325.08 driver and Nvidia
 331.13 drivers?
 
 I'm looking into this but I really wanted to avoid removing the distribution
 packages and installing the driver directly (even debian unstable provides 
 only
 304.108 which isn't any different w.r.t. the problem in hand).

For some reason the system I was using had X11 server configured for 16-bit
depth. Nothing wrong with driver as I was suspecting. Sorry for the noise.

 
  
 Also, what is the exact test that gives this result?
 
 It is the shader_runner binary that won't get passed the configuration phase.
 The exact *.shader_test file being used doesn't really make any difference as
 it's contents are considered only after the configuration succeeds.
 ___
 Piglit mailing list
 Piglit@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [RFC 1/3] hack: enable shader runner on 4.2.0 NVIDIA 304.88

2013-10-15 Thread Pohjolainen, Topi
On Tue, Oct 15, 2013 at 09:15:52AM -0600, Brian Paul wrote:
 On 10/15/2013 05:49 AM, Topi Pohjolainen wrote:
 Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
 ---
   tests/shaders/shader_runner.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
 index ba76cd0..5731985 100644
 --- a/tests/shaders/shader_runner.c
 +++ b/tests/shaders/shader_runner.c
 @@ -52,7 +52,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
  config.window_width = 250;
  config.window_height = 250;
 -config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
 +config.window_visual = PIGLIT_GL_VISUAL_DOUBLE;
 
   PIGLIT_GL_TEST_CONFIG_END
 
 
 
 Can you please give more detail about what the problem is and why
 this fixes it?

I don't know why it fixes it, I just tried it without the visual settings and
found out that I could run the shader_runner by relaxing the settings. I'm
running 7.1 debian and I thought that the gl-driver and X-server I get via the
distribution should be just fine - shader_runner is quite central test in
piglit after all. That's why I wrote in the cover letter that:

 First patch I included just to ask if there something amiss in
 my system. I have

 X.Org X Server 1.12.4
 Release Date: 2012-08-27

 running on NVIDIA (304.88 on GTX 660). Without the patch I just
 wasn't able to run the shader_runner at all:

 piglit: info: Failed to create GL 3.2 core context
 piglit: info: Falling back to GL 3.2 compatibility context
 piglit: info: Failed to create GL 3.2 compatibility context
 piglit: info: Failed to create any GL context
 PIGLIT: {'result': 'skip' }

-Topi
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 0/4] Fix build on systems with Mesa 9.2 or without libdrm

2013-09-11 Thread Pohjolainen, Topi
On Tue, Sep 10, 2013 at 11:07:50AM -0700, Chad Versace wrote:
 Ian recently discovered that Topi's new dma_buf tests break the build on Linux
 systems with libdrm2.4.28. And I discovered that they broke the build on
 systems with Mesa  9.2. No surprise, really, since these tests do some wacky
 things and introduce new dependencies for which Piglit has no precedent. It's
 never possible to test patches on every imaginable configuration.

Thanks a lot for cleaning up the mess!

 
 This series *should* fix the build in these circumstances, but, again, I 
 wasn't
 able to test the patches in all desired system configurations.

I cannot think of any other cases either but then again I left quite a few
holes there in the first place.

 
 In fixing the build, I added a new CMake option, PIGLIT_BUILD_DMA_BUF_TESTS.
 During CMake configuration, this option is automatically enabled if your
 systems has the requisites.
 
 I tested the patches as follows in an Archlinux chroot:
 
   - System has libdrm=2.4.38, xcb-dri2-1.9.1, old eglext.h without
 EGL_EXT_image_dma_buf_import. Run cmake. Verify that Piglit builds
 successfully, and that the dma_buf tests do get built and all pass.
 
   - System has libdrm=2.4.37, xcb-dri2=1.9.1, and old eglext.h. Run cmake.
 Verify that Piglit builds successfully, and that no dma_buf tests get
 built.
 
   - System has libdrm=2.4.38, no xcb-dri2, and old eglext.h. Run cmake.  
 Verify
 that Piglit builds successfully, and that no dma_buf tests get built.
 
   - System is missing at least one dma_buf requirement. Run cmake. Then,
 manually enable the dma_buf tests by setting
 CMakeCache:PIGLIT_BUILD_DMA_BUF_TESTS=ON. Verify that the next invocation 
 of
 `make` emits a fatal CMake error with message:
 PIGLIT_BUILD_DMA_BUF_TESTS require libdrm,
 libdrm_intel=2.4.38, and xcb-dri2
 
 The series lives on my branch 'fix-build-dma-buf'.
 
 Chad Versace (4):
   cmake,dma_buf: Refactor decisions to build dma_buf tests
   cmake,dma_buf: Require xcb-dri2 for dma_buf tests
   cmake,dma_buf: Require libdrm_intel=2.4.38 to build dma_buf tests
   ext_image_dma_buf_import: Fix build with mesa  9.2
 
  CMakeLists.txt | 34 
 ++
  .../ext_image_dma_buf_import/CMakeLists.gles1.txt  |  4 +--
  .../ext_image_dma_buf_import/CMakeLists.gles2.txt  |  5 ++--
  tests/spec/ext_image_dma_buf_import/image_common.h | 30 +++
  tests/util/CMakeLists.txt  | 22 +++---
  .../util/piglit-framework-gl/piglit_drm_dma_buf.c  |  6 
  6 files changed, 72 insertions(+), 29 deletions(-)
 
 -- 
 1.8.3.1
 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/4] ext_image_dma_buf_import: Fix build with mesa 9.2

2013-09-11 Thread Pohjolainen, Topi
On Tue, Sep 10, 2013 at 11:07:54AM -0700, Chad Versace wrote:
 The extension EGL_EXT_image_dma_buf_import is a recent extension,
 published 2013-02-09, and therefore the eglext.h on many systems do not
 define it.  The first Mesa version in which eglext.h defined the
 extension was was Mesa 9.2.
 
 To fix the build on such systems, define the extension's enums in
 image_common.h.

Is there any way we could use the 'EGL_EGLEXT_VERSION' found in the eglext.h?
I'm just thinking that if the header is too old than the EGL stack is too old
to support the tests anyway.

 
 Signed-off-by: Chad Versace chad.vers...@linux.intel.com
 ---
  tests/spec/ext_image_dma_buf_import/image_common.h | 30 
 ++
  .../spec/ext_image_dma_buf_import/sample_common.c  |  4 +--
  2 files changed, 31 insertions(+), 3 deletions(-)
 
 diff --git a/tests/spec/ext_image_dma_buf_import/image_common.h 
 b/tests/spec/ext_image_dma_buf_import/image_common.h
 index 29338c0..a9a1715 100644
 --- a/tests/spec/ext_image_dma_buf_import/image_common.h
 +++ b/tests/spec/ext_image_dma_buf_import/image_common.h
 @@ -35,6 +35,36 @@
  #define EGL_EGLEXT_PROTOTYPES 1
  #include EGL/eglext.h
  
 +/* We define here the enums for EGL_EXT_image_dma_buf_import because, as of
 + * today (2013-09-10), the eglext.h on many systems lack them.  The first 
 Mesa
 + * version in which eglext.h defined the enums was Mesa 9.2 (2013-08-27).
 + */
 +#ifndef EGL_EXT_image_dma_buf_import
 +#define EGL_EXT_image_dma_buf_import 1
 +#define EGL_LINUX_DMA_BUF_EXT0x3270
 +#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
 +#define EGL_DMA_BUF_PLANE0_FD_EXT0x3272
 +#define EGL_DMA_BUF_PLANE0_OFFSET_EXT0x3273
 +#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
 +#define EGL_DMA_BUF_PLANE1_FD_EXT0x3275
 +#define EGL_DMA_BUF_PLANE1_OFFSET_EXT0x3276
 +#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
 +#define EGL_DMA_BUF_PLANE2_FD_EXT0x3278
 +#define EGL_DMA_BUF_PLANE2_OFFSET_EXT0x3279
 +#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
 +#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
 +#define EGL_SAMPLE_RANGE_HINT_EXT0x327C
 +#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
 +#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
 +#define EGL_ITU_REC601_EXT   0x327F
 +#define EGL_ITU_REC709_EXT   0x3280
 +#define EGL_ITU_REC2020_EXT  0x3281
 +#define EGL_YUV_FULL_RANGE_EXT   0x3282
 +#define EGL_YUV_NARROW_RANGE_EXT 0x3283
 +#define EGL_YUV_CHROMA_SITING_0_EXT  0x3284
 +#define EGL_YUV_CHROMA_SITING_0_5_EXT0x3285
 +#endif
 +
  extern PFNEGLCREATEIMAGEKHRPROC image_common_dispatch_eglCreateImageKHR;
  #define eglCreateImageKHR image_common_dispatch_eglCreateImageKHR
  
 diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c 
 b/tests/spec/ext_image_dma_buf_import/sample_common.c
 index 29877be..44dec39 100644
 --- a/tests/spec/ext_image_dma_buf_import/sample_common.c
 +++ b/tests/spec/ext_image_dma_buf_import/sample_common.c
 @@ -22,9 +22,7 @@
   */
  
  #include sample_common.h
 -#include piglit-util-egl.h
 -#define EGL_EGLEXT_PROTOTYPES 1
 -#include EGL/eglext.h
 +#include image_common.h
  #include unistd.h
  
  static const char fs_src[] =
 -- 
 1.8.3.1
 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/4] cmake, dma_buf: Require xcb-dri2 for dma_buf tests

2013-09-11 Thread Pohjolainen, Topi
On Tue, Sep 10, 2013 at 11:07:52AM -0700, Chad Versace wrote:
 xcb-dri2 is an optional build dependency for the dma_buf tests.  If
 xcb-dri2 is present, then the tests use it to gain DRM authentication.
 Otherwise, the tests must be ran as root.
 
 No one likes running tests as root, so require xcb-dri2 for these tests.
 
 Signed-off-by: Chad Versace chad.vers...@linux.intel.com
 ---
  CMakeLists.txt  |  7 +--
  tests/util/CMakeLists.txt   | 17 +++--
  tests/util/piglit-framework-gl/piglit_drm_dma_buf.c |  6 --
  3 files changed, 8 insertions(+), 22 deletions(-)
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
 index 2aba844..955516b 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -99,10 +99,12 @@ ENDIF()
  
  # Choose to build tests that use dma_buf.
  #
 +# Piglit's dma_buf utilities require xcb-dri2 to gain DRM authentication.
 +#
  # The presence of libdrm is not sufficient. At least one libdrm_${hardware}
  # library is also needed.
  #
 -if(LIBDRM_FOUND AND LIBDRM_INTEL_FOUND)
 +if(LIBDRM_FOUND AND LIBDRM_INTEL_FOUND AND XCB_DRI2_FOUND)
   set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID true)
  else()
   set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID false)
 @@ -118,7 +120,8 @@ endif()
  # we need to validate it.
  if(PIGLIT_BUILD_DMA_BUF_TESTS AND NOT PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID)
   message(FATAL_ERROR
 - PIGLIT_BUILD_DMA_BUF_TESTS require libdrm and libdrm_intel)
 + PIGLIT_BUILD_DMA_BUF_TESTS require libdrm and libdrm_intel, 
 + and xcb-dri2)
  endif()
  
  IF(PIGLIT_BUILD_GLX_TESTS)
 diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
 index 6bfe451..fb6dd3e 100644
 --- a/tests/util/CMakeLists.txt
 +++ b/tests/util/CMakeLists.txt
 @@ -62,10 +62,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
  
   list(APPEND UTIL_GL_LIBS
   ${LIBDRM_LDFLAGS}
 + ${XCB_DRI2_LDFLAGS}
 +

Is this extra line intentional?

   )
  
   list(APPEND UTIL_GL_INCLUDES
   ${LIBDRM_INCLUDE_DIRS}
 + ${XCB_DRI2_INCLUDE_DIRS}
   )
  
   if(LIBDRM_INTEL_FOUND)
 @@ -75,20 +78,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
   ${LIBDRM_INTEL_LDFLAGS}
   )
   endif()
 -
 - # xcb-dri2 is used to gain DRM authentication.
 - if(XCB_DRI2_FOUND)
 - add_definitions(-DHAVE_XCB_DRI2)
 -
 - list(APPEND UTIL_GL_LIBS
 - ${XCB_DRI2_LDFLAGS}
 - )
 -
 - list(APPEND UTIL_GL_INCLUDES
 - ${XCB_DRI2_INCLUDE_DIRS}
 - )
 - endif()
 -
   endif()
  
   set(UTIL_GL_LIBS
 diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c 
 b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
 index 9a7ff3b..cc6c366 100644
 --- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
 +++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
 @@ -32,10 +32,8 @@
  #include string.h
  #include xf86drm.h
  #include stdbool.h
 -#ifdef HAVE_XCB_DRI2
  #include xcb/dri2.h
  #include drm.h
 -#endif
  
  static const char *drm_device_filename = /dev/dri/card0;
  
 @@ -77,7 +75,6 @@ piglit_drm_device_get(void)
   return fd;
  }
  
 -#ifdef HAVE_XCB_DRI2
  static bool
  piglit_drm_x11_authenticate(void)
  {
 @@ -116,7 +113,6 @@ piglit_drm_x11_authenticate(void)
  
   return true;
  }
 -#endif /* HAVE_XCB_DRI2 */
  
  #ifdef HAVE_LIBDRM_INTEL
  static drm_intel_bufmgr *
 @@ -131,10 +127,8 @@ piglit_intel_bufmgr_get(void)
   if (!piglit_drm_device_get())
   return NULL;
  
 -#ifdef HAVE_XCB_DRI2
   if (!piglit_drm_x11_authenticate())
   return NULL;
 -#endif /* HAVE_XCB_DRI2 */
  
   mgr = intel_bufmgr_gem_init(piglit_drm_device_get(), batch_sz);
  
 -- 
 1.8.3.1
 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] gs: Test corner case for triangle strip ordering with primitive restart.

2013-08-30 Thread Pohjolainen, Topi
On Wed, Aug 28, 2013 at 12:12:40PM -0700, Paul Berry wrote:
 Verified using the NVIDIA proprietary driver for linux.
 ---
  tests/all.tests|   6 +
  .../glsl-1.50/execution/geometry/CMakeLists.gl.txt |   1 +
  .../tri-strip-ordering-with-prim-restart.c | 311 
 +
  3 files changed, 318 insertions(+)
  create mode 100644 
 tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c
 
 diff --git a/tests/all.tests b/tests/all.tests
 index 7ab841e..3ee7cd2 100644
 --- a/tests/all.tests
 +++ b/tests/all.tests
 @@ -955,6 +955,12 @@ for prim_type in ['GL_POINTS', 'GL_LINE_LOOP', 
 'GL_LINE_STRIP', 'GL_LINES',
  'glsl-1.50-geometry-primitive-types {0}'.format(
  prim_type))
  
 +for prim_type in ['GL_TRIANGLE_STRIP', 'GL_TRIANGLE_STRIP_ADJACENCY']:
 +for restart_index in ['ffs', 'other']:
 +add_concurrent_test(spec['glsl-1.50'],
 +
 'glsl-1.50-geometry-tri-strip-ordering-with-prim-restart {0} {1}'.format(
 +prim_type, restart_index))
 +
  spec['glsl-3.30'] = Group()
  import_glsl_parser_tests(spec['glsl-3.30'],
os.path.join(testsDir, 'spec', 'glsl-3.30'),
 diff --git a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt 
 b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt
 index 202fcd2..a504412 100644
 --- a/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt
 +++ b/tests/spec/glsl-1.50/execution/geometry/CMakeLists.gl.txt
 @@ -12,3 +12,4 @@ ${OPENGL_glu_LIBRARY}
  
  piglit_add_executable (glsl-1.50-geometry-end-primitive end-primitive.c)
  piglit_add_executable (glsl-1.50-geometry-primitive-types primitive-types.c)
 +piglit_add_executable 
 (glsl-1.50-geometry-tri-strip-ordering-with-prim-restart 
 tri-strip-ordering-with-prim-restart.c)
 diff --git 
 a/tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c
  
 b/tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c
 new file mode 100644
 index 000..90f6860
 --- /dev/null
 +++ 
 b/tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c
 @@ -0,0 +1,311 @@
 +/*
 + * Copyright © 2013 Intel Corporation
 + *
 + * 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 tri-strip-ordering-with-prim-restart.c
 + *
 + * Check a subtle corner case that affects the i965/gen7 mesa driver:
 + * when the primitive type is either GL_TRIANGLE_STRIP or
 + * GL_TRIANGLE_STRIP_ADJACENCY, the hardware delivers the vertices of
 + * odd numbered triangles to the geometry shader in the wrong order,
 + * so the driver must emit workaround code to re-order them.  This
 + * test verifies that the workaround code functions correctly in the
 + * presence of primitive restart, since the presence of primitive
 + * restart can make a triangle odd numbered in relation to the
 + * current strip even if it is even numbered as measured by
 + * gl_PrimitiveIDIn.
 + *
 + * This test works by issuing a single draw call and using primitive
 + * restart to split it into a pair of 3-triangle strips (this ensures
 + * that triangles in the first strip have the same parity in relation
 + * to the strip as they have when measured by gl_PrimitiveIDIn;
 + * triangles in the second strip hav opposite parity in relation to
 + * the strip from what they have when measured by gl_PrimitiveIDIn).
 + * The vertex IDs of all vertices are collected using transform
 + * feedback, and checked it C to make sure it matches the expected
 ^
Just checking if this was supposed to be checked in C instead?

 + * sequence of vertices.
 + *
 + * Note: some generations of Intel hardware require primitive restart
 + * to be emulated in software when either:
 + *
 + * - certain primitive types are 

Re: [Piglit] [PATCH 12/13 v2] glsl: Enhance built-in-constants to test extensions too

2013-08-28 Thread Pohjolainen, Topi
On Mon, Aug 26, 2013 at 07:15:27PM -0700, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 v2: Use an array of pointers to char for required_extensions (using
 strndup) instead of the previous static buffer cleverness.  Also replace
 the previous cleverness for generating the GLSL extension enables with
 something less clever and easier to understand.  Both suggested by Eric.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  tests/shaders/built-in-constants.c | 78 
 +-
  1 file changed, 77 insertions(+), 1 deletion(-)
 
 diff --git a/tests/shaders/built-in-constants.c 
 b/tests/shaders/built-in-constants.c
 index af87107..54af859 100644
 --- a/tests/shaders/built-in-constants.c
 +++ b/tests/shaders/built-in-constants.c
 @@ -39,6 +39,22 @@ unsigned num_tests = 0;
  int required_glsl_version = 0;
  char *required_glsl_version_string = NULL;
  
 +/**
 + * List of extensions required by the current test set.
 + */
 +char *required_extensions[32];
 +unsigned num_required_extensions = 0;
 +
 +/**
 + * Array of extension enables for the shader code
 + *
 + * For each used entry in \c required_extensions, there is text in
 + * this string of the form #extension ...: require\n.
 + */
 +#define MAX_EXTENSION_ENABLE_LINE_LEN 80
 +char extension_enables[ARRAY_SIZE(required_extensions)
 +* MAX_EXTENSION_ENABLE_LINE_LEN];
 +unsigned extension_enables_len = 0;
  
  static const char *const uniform_template =
   uniform float f[%s %s %d ? 1 : -1];\n
 @@ -131,6 +147,7 @@ parse_file(const char *filename)
   /* The format of the test file is:
*
* major.minor
 +  * GL_ARB_some_extension
* gl_MaxFoo 8
* gl_MaxBar 16
* gl_MinAsdf -2
 @@ -152,6 +169,32 @@ parse_file(const char *filename)
   if (line[0] != '\0')
   line++;
  
 + /* Process the list of required extensions.
 +  */
 + while (strncmp(GL_, line, 3) == 0) {
 + char *end_of_line = strchrnul(line, '\n');
 + const ptrdiff_t len = end_of_line - line;
 +
 + assert(end_of_line[0] == '\n' || end_of_line[0] == '\0');
 +
 + if (num_required_extensions = ARRAY_SIZE(required_extensions)) 
 {
 + fprintf(stderr, Too many required extensions!\n);
 + piglit_report_result(PIGLIT_FAIL);
 + }
 +
 + /* Copy the new extension to the list.
 +  */
 + required_extensions[num_required_extensions] =
 + strndup(line, len);

Isn't this version now missing the corresponding 'free()'?

 + num_required_extensions++;
 +
 + /* Advance to the next input line.
 +  */
 + line = end_of_line;
 + if (line[0] == '\n')
 + line++;
 + }
 +
   while (line[0] != '\0') {
   char *endptr;
  
 @@ -254,16 +297,49 @@ piglit_init(int argc, char **argv)
   if (glsl_version  required_glsl_version)
   piglit_report_result(PIGLIT_SKIP);
  
 + /* Process the list of required extensions.  While doing this,
 +  * generate the GLSL code that will enable those extensions in the
 +  * shaders.
 +  */
 + for (i = 0; i  num_required_extensions; i++) {
 + int len;
 +
 + if (!piglit_is_extension_supported(required_extensions[i])) {
 + printf(%s not supported\n, required_extensions[i]);
 + piglit_report_result(PIGLIT_SKIP);
 + }
 +
 + if ((extension_enables_len + MAX_EXTENSION_ENABLE_LINE_LEN)
 + = sizeof(extension_enables)) {
 + printf(Extension enables too long.\n);
 + piglit_report_result(PIGLIT_FAIL);
 + }
 +
 + len = snprintf(extension_enables[extension_enables_len],
 +MAX_EXTENSION_ENABLE_LINE_LEN,
 +#extension %s: require\n,
 +required_extensions[i]);
 +
 + if (len = 0) {
 + printf(Extension enable snprintf failed.\n);
 + piglit_report_result(PIGLIT_FAIL);
 + }
 +
 + extension_enables_len += len;
 + }
 +
   /* Generate the version declaration that will be used by all of the
* shaders in the test run.
*/
   asprintf(version_string,
#version %d %s\n
 +  %s
#ifdef GL_ES\n
precision mediump float;\n
#endif\n,
required_glsl_version,
 -  required_glsl_version == 300 ? es : );
 +  required_glsl_version == 300 ? es : ,
 +  extension_enables);
  
   /* Create the shaders that will be used for the real part of the test.
*/
 -- 
 1.8.1.4
 
 ___
 Piglit 

Re: [Piglit] [v7 07/12] tests: spec: EXT_image_dma_buf_import fd ownership transfer

2013-05-30 Thread Pohjolainen, Topi
On Tue, May 28, 2013 at 12:17:37PM -0700, Eric Anholt wrote:
 Topi Pohjolainen topi.pohjolai...@intel.com writes:
 
  Simple test checking that EGL closes the export file handle and
  the creator can in turn drop its reference.
 
  v2:
 - compile only on platforms that have drm (Eric)
 - use standard drm definitions for fourcc instead of duplicated
   local (Daniel, Eric)
 - use helper variables for width, height and cpp instead of
   repeating the magic numbers over and over again (Eric)
 - try to close the export file descriptor and check that it is
   already closed by the EGL stack (Eric, Chad)
 - fix typo in the description (and commit) (Chad)
 - renamed from close_buffer to ownership_transfer
 - removed irrelevant quote of the spec (Eric)
 
  v3:
 - use properly linked egl-extension calls (Eric)
 - check for EBADF and not just for close()-failure (Daniel)
 
 I think for this one we want to actually do some rendering with the
 image after having destroyed the drm_intel_bo, to make sure the kernel
 and driver's refcounting is actually working as intended.

The sampling tests in the series in fact do that already. I suppose I could
extend those tests with this checking for the file descriptor closing and
simply drop this test case?

 
 Also, by my reading, I don't think you get to assert that it's closed
 after the image is freed, only after the display is freed:
 
 If eglCreateImageKHR is successful for a EGL_LINUX_DMA_BUF_EXT target, the
 EGL takes ownership of the file descriptor and is responsible for closing
 it, which it may do at any time while the EGLDisplay is initialized.

I remember thinking about this but originally thought that the tests cannot
severe the connection themselves. And then I forgot that among other things.

Now after checking the piglit infra I realize that nothing really prevents this.
Tests could call 'eglTerminate()' and check for the file descriptor after. I'll
fix that.

-Topi
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [v6] Tests for EXT_image_dma_buf_import

2013-05-21 Thread Pohjolainen, Topi
On Tue, May 21, 2013 at 12:09:31AM +0200, Daniel Vetter wrote:
 On Thu, May 16, 2013 at 12:51:13PM +0300, Topi Pohjolainen wrote:
  Here are some tests for the dma buffer importing. These are mostly
  things specifically listed down in the spec itself regarding
  attributes and their values. This version two adds three additional
  tests for sampling packed RGB, but testing of more complex planar
  (YUV) formats is left until one has the sampling support in place
  provided by the image external extension.
  
  I augmented the framework to provide platform independent interface
  for creating and releasing the target buffers. I hope to re-use the
  logic for the external image testing later on.
  
  v2-v4:
 - clarifications on closing the buffers
 - added tests sampling RGB formatted buffers
 - check for EGL extensions, not for GL (added a utility for this)
  
  v5:
 - split tests into individual commits
 - introduced common header for drm fourcc formats
  
  v6:
 - various fixes according to review comments from Eric, Chad,
   Daniel and Ken
 - refactored dri2-authentication from Chad's revision of dma
   buffer support into its own patch. I had fixes for other
   review comments already in my version of the base patch.
  
  
  Chad: Please check if you agree into conditionally including the
authentication support. I'm fine having it as you proposed
originally. I just couldn't get it working on my Ubuntu
laptop, and not being too familiar with the mechanism in
general I thought better getting stuff for review as I have
revisioned the series heavily.
  
  Eric,Chad,Daniel: In my system subsequent call of 'close()'
against the same file descriptor returns -1
instead of EBADF. Hence I just check that the
return value differs from zero.
 
 libc convention is to set the return value to an unconditional -1 and set
 errno to the right (positive) error code. So you need to check for
 
   ret = close(fd);
   assert(ret == -1  errno == EBADF);

Thanks, I'll wait for feedback from others and fix it accordingly.

-Topi
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [v5 01/12] util: egl: support for skipping unsupported extension tests

2013-05-15 Thread Pohjolainen, Topi
On Tue, May 14, 2013 at 11:23:30AM -0700, Eric Anholt wrote:
 Chad Versace chad.vers...@linux.intel.com writes:
 
  On 05/03/2013 04:26 AM, Topi Pohjolainen wrote:
  Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
  ---
tests/util/piglit-util-egl.c | 9 +
tests/util/piglit-util-egl.h | 5 +
2 files changed, 14 insertions(+)
 
  diff --git a/tests/util/piglit-util-egl.c b/tests/util/piglit-util-egl.c
  index 1087429..5a9f0a9 100644
  --- a/tests/util/piglit-util-egl.c
  +++ b/tests/util/piglit-util-egl.c
  @@ -84,3 +84,12 @@ piglit_is_egl_extension_supported(EGLDisplay egl_dpy, 
  const char *name)
 
 return piglit_is_extension_in_string(egl_extension_list, name);
}
  +
  +void piglit_require_egl_extension(const char *name)
  +{
  +  if (!piglit_is_egl_extension_supported(eglGetCurrentDisplay(), name)) {
  +  printf(Test requires %s\n, name);
  +  piglit_report_result(PIGLIT_SKIP);
  +  exit(1);
  +  }
  +}
 
  piglit_report_result() already calls exit(). Remove the call to exit(1) 
  here and it's
  Reviewed-by: Chad Versace chad.vers...@linux.intel.com

And by the way for future cleanup, the same 'exit()' can be found in
'piglit_require_extension()'. I used it as example.

 
 I also needed this patch for my recent EGL image tests, so I've made the
 little change and pushed it.

Thanks Eric, I can drop it then.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [v4 4/4] tests: spec: tests for EXT_image_dma_buf_import

2013-05-03 Thread Pohjolainen, Topi
On Fri, May 03, 2013 at 10:54:12AM +0200, Daniel Vetter wrote:
 On Thu, May 02, 2013 at 04:57:49PM -0700, Eric Anholt wrote:
   +#define fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b)  8) | \
   + ((uint32_t)(c)  16) | ((uint32_t)(d)  24))
   +#define DRM_FORMAT_ARGB fourcc_code('A', 'R', '2', '4')
  
  This is in many subtests, and should pretty clearly be in a header.
 
 That thing is in the drm_fourcc.h kernel userspace header. Do we just need
 a check to make sure the linux-headers are recent enough?

I tried to keep the tests platform independent, and this was to avoid any need
for libdrm inclusions there. (One checks for particular driver and platform
in the framework and uses their settings for inclusions and libraries).

I could add a common header if you like. But then again there are a quite a bit
of other things in all the tests that one could start refactoring, and these
one-liners weren't on top of my list.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] framework: support for creating dma buffers through libdrm

2013-04-25 Thread Pohjolainen, Topi
On Wed, Apr 24, 2013 at 03:35:08PM +0200, Chad Versace wrote:
 On 04/16/2013 12:45 PM, Topi Pohjolainen wrote:
 In order to test EXT_image_dma_buf_import one needs the capability
 of creating driver specific buffers. By probing the environment for
 drm libraries one can decide for which drivers the support is to
 be built.
 
 Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
 ---
   tests/util/CMakeLists.txt  |  47 +
   .../util/piglit-framework-gl/piglit_drm_dma_buf.c  | 228 
  +
   .../util/piglit-framework-gl/piglit_drm_dma_buf.h  |  35 
   .../piglit-framework-gl/piglit_x11_framework.c |   5 +
   4 files changed, 315 insertions(+)
   create mode 100644 tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
   create mode 100644 tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
 
 diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
 index cbcf050..6a41c24 100644
 --- a/tests/util/CMakeLists.txt
 +++ b/tests/util/CMakeLists.txt
 @@ -51,6 +51,53 @@ set(UTIL_GL_LIBS
  )
 
   if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
 +find_library(DRM_LIBRARY
 +NAMES drm
 +PATHS /usr/lib
 +)
 +
 +find_path(DRM_INCLUDE_BASE_DIR
 +NAMES libdrm/drm.h
 +PATHS /opt/include
 
 Why /opt/include? I expected /usr/include.

Good catch, my mistake.

 
 +)
 +
 +find_library(DRM_LIBRARY
 +NAMES drm
 +PATHS /usr/lib
 +)
 +
 +find_library(DRM_INTEL_LIBRARY
 +NAMES drm_intel
 +PATHS /usr/lib
 +)
 
 The searching above needs to respect pkg-config by using pkg_check_modules().
 Otherwise
   1. As written, the above search will fail on 64-bit rpm distros,
  which use /usr/lib64.
   2. If someone is doing development on libdrm installed into a
  custom prefix, then the search as-written will not to use the custom 
 libdrm
  as defined by PKG_CONFIG_PATH.
 
 pkg_check_modules() is documented in cmake's manpage. For example usage, just
 grep piglit.

Many thanks, it's not only cleaner, but it becomes a lot simpler, too.

 
 +
 +# One needs to have at least one hardware driver present, otherwise
 +# there is no point compiling just the dispatcher.
 
 Yeah, that makes sense.
 
 +if(DRM_LIBRARY AND DRM_INCLUDE_BASE_DIR AND DRM_INTEL_LIBRARY)
 +add_definitions(-DHAVE_LIBDRM)
 +
 +list(APPEND UTIL_GL_SOURCES
 +piglit-framework-gl/piglit_drm_dma_buf.c
 +)
 +
 +list(APPEND UTIL_GL_LIBS
 +${DRM_LIBRARY}
 +)
 +
 +# This is needed for the direct drm.h inclusion by xh86drm.h
 +list(APPEND UTIL_GL_INCLUDES
 +${DRM_INCLUDE_BASE_DIR}/libdrm
 +)
 
 If you use pkg_check_modules(), then the above append is unneeded. libdrm.pc
 lists $PREFIX/include/drm in the include flags.

Indeed.

 
 +
 +if(DRM_INTEL_LIBRARY)
 +add_definitions(-DHAVE_LIBDRM_INTEL)
 +
 +list(APPEND UTIL_GL_LIBS
 +${DRM_INTEL_LIBRARY}
 +)
 +endif()
 +endif()
 +
  set(UTIL_GL_LIBS
  ${UTIL_GL_LIBS}
  ${X11_X11_LIB}
 diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c 
 b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
 new file mode 100644
 index 000..1bebf14
 --- /dev/null
 +++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
 @@ -0,0 +1,228 @@
 +/*
 + * Copyright © 2013 Intel Corporation
 + *
 + * 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.
 + */
 +
 +#include piglit-util-gl-common.h
 +#include piglit_drm_dma_buf.h
 +#ifdef HAVE_LIBDRM_INTEL
 +#include libdrm/intel_bufmgr.h
 +#endif
 +#include sys/types.h
 +#include sys/stat.h
 +#include fcntl.h
 

Re: [Piglit] [v2 1/3] framework: introduce interface for external buffers

2013-03-11 Thread Pohjolainen, Topi
On Mon, Mar 11, 2013 at 10:31:33AM -0700, Eric Anholt wrote:
 Topi Pohjolainen topi.pohjolai...@intel.com writes:
 
  In order to test the OES_EGL_image_external with planar formats such
  as YUV420 or NV12, one needs a way for creating buffers that can be
  passed to EGL and filling them with YUV-data for the GL-stack to
  sample.
  By the nature the extension in question deals with platform specific
  buffers and hence the idea here is to push the details down into the
  platform specific logic leaving the tests themselves platform
  independent.
 
  v2:
- clarify _ext as referring to external instead of extension
- if platform does not support external buffers, report PIGLIT_SKIP
 
  Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
  ---
   tests/util/piglit-framework-gl.c   |   42 
  
   tests/util/piglit-framework-gl.h   |   29 ++
   .../util/piglit-framework-gl/piglit_gl_framework.h |   23 +++
   3 files changed, 94 insertions(+)
 
  diff --git a/tests/util/piglit-framework-gl.c 
  b/tests/util/piglit-framework-gl.c
  index 441e271..36bf210 100644
  --- a/tests/util/piglit-framework-gl.c
  +++ b/tests/util/piglit-framework-gl.c
  @@ -162,3 +162,45 @@ piglit_set_reshape_func(void (*func)(int w, int h))
  if (!gl_fw-set_reshape_func)
  gl_fw-set_reshape_func(gl_fw, func);
   }
  +
  +void
  +piglit_create_ext_420_buf(unsigned w, unsigned h, bool swap_vu,
  +   const void *y, const void *u, const void *v,
  +   enum piglit_result *result, void **buf)
 
 I think either the result or the buf should be the return value instead
 of being an outvalue here.  I'd say the result.
 

I can do this, I'm just used to having all the outgoing stuff returned using one
mechanism.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit