Re: [Piglit] [PATCH] arb_internalformat_query2: correct tessellation typo

2017-12-18 Thread Alejandro Piñeiro
Reviewed-by: Alejandro Piñeiro 

PS: in fact I have that fix as part of one of my patches, but I have
pending to answer one Ilia question (need some investigation). In any
case, I think that we can fix the typo now. Thanks!
On 18/12/17 17:46, Andres Gomez wrote:
> Cc: Alejandro Piñeiro 
> Signed-off-by: Andres Gomez 
> ---
>  tests/spec/arb_internalformat_query2/common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/arb_internalformat_query2/common.c 
> b/tests/spec/arb_internalformat_query2/common.c
> index a5686c0a5..9fa5fa9d1 100644
> --- a/tests/spec/arb_internalformat_query2/common.c
> +++ b/tests/spec/arb_internalformat_query2/common.c
> @@ -612,7 +612,7 @@ check_query2_pname_dependencies(const GLenum pname)
>  
>  case GL_TESS_CONTROL_TEXTURE:
>  case GL_TESS_EVALUATION_TEXTURE:
> -if 
> (!piglit_is_extension_supported("GL_ARB_tesselation_shader"))
> +if 
> (!piglit_is_extension_supported("GL_ARB_tessellation_shader"))
>  return false;
>  break;
>  

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


[Piglit] [PATCH] egl: API test for EGL_ANDROID_blob_cache extension

2017-12-18 Thread Tapani Pälli
Signed-off-by: Tapani Pälli 
---

I had here also shader compilation, and checks that get and set were
called when same same shader was compiled and linked again but I'm not
sure if that can be required from the driver, driver might just skip
cache if it wants. So, here's just the API tests for getting entrypoint
and different error cases when calling it.


 tests/all.py   |   1 +
 tests/egl/CMakeLists.gles2.txt |  18 +++
 tests/egl/egl-blob-cache.c | 109 +
 3 files changed, 128 insertions(+)
 create mode 100644 tests/egl/CMakeLists.gles2.txt
 create mode 100644 tests/egl/egl-blob-cache.c

diff --git a/tests/all.py b/tests/all.py
index 67e78c58c..3a769e6ab 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4456,6 +4456,7 @@ with profile.test_list.group_manager(
   run_concurrent=False)
 g(['egl-invalid-attr'])
 g(['egl-context-priority'])
+g(['egl-blob-cache'])
 
 with profile.test_list.group_manager(
 PiglitGLTest,
diff --git a/tests/egl/CMakeLists.gles2.txt b/tests/egl/CMakeLists.gles2.txt
new file mode 100644
index 0..f6e69d9b0
--- /dev/null
+++ b/tests/egl/CMakeLists.gles2.txt
@@ -0,0 +1,18 @@
+
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${EGL_LDFLAGS}
+   ${OPENGL_gl_LIBRARY}
+)
+
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+   piglit_add_executable (egl-blob-cache egl-blob-cache.c)
+   target_link_libraries(egl-blob-cache pthread)
+ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+# vim: ft=cmake:
diff --git a/tests/egl/egl-blob-cache.c b/tests/egl/egl-blob-cache.c
new file mode 100644
index 0..81af606fe
--- /dev/null
+++ b/tests/egl/egl-blob-cache.c
@@ -0,0 +1,109 @@
+/*
+ * 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 "piglit-util-egl.h"
+#include "piglit-util-gl.h"
+
+/**
+ * @file egl-blob-cache.c
+ *
+ * EGL API tests for EGL_ANDROID_blob_cache extension:
+ * 
https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_blob_cache.txt
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_es_version = 20;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/* dummy */
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+static void
+set_blob(const void* key, EGLsizeiANDROID keySize,
+const void* value, EGLsizeiANDROID valueSize)
+{
+}
+
+static EGLsizeiANDROID
+get_blob(const void* key, EGLsizeiANDROID keySize, void* value,
+EGLsizeiANDROID valueSize)
+{
+   return 0;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   EGLint major, minor;
+   EGLDisplay dpy;
+
+   /* Require EGL_MESA_platform_surfaceless extension. */
+   const char *exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+   if (!strstr(exts, "EGL_MESA_platform_surfaceless"))
+   piglit_report_result(PIGLIT_SKIP);
+
+   dpy = piglit_egl_get_default_display(EGL_PLATFORM_SURFACELESS_MESA);
+
+   if (!eglInitialize(dpy, , ))
+   piglit_report_result(PIGLIT_FAIL);
+
+   piglit_require_egl_extension(dpy, "EGL_MESA_configless_context");
+   piglit_require_egl_extension(dpy, "EGL_ANDROID_blob_cache");
+
+   PFNEGLSETBLOBCACHEFUNCSANDROIDPROC peglSetBlobCacheFuncs =
+   (PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)
+   eglGetProcAddress ("eglSetBlobCacheFuncsANDROID");
+
+   if (!peglSetBlobCacheFuncs)
+   piglit_report_result(PIGLIT_FAIL);
+
+#define EXPECT(x) if (!piglit_check_egl_error(x)) 
piglit_report_result(PIGLIT_FAIL);
+
+   /* Check error cases for passing NULL. */
+   peglSetBlobCacheFuncs(dpy, NULL, NULL);
+   EXPECT(EGL_BAD_PARAMETER);
+
+   peglSetBlobCacheFuncs(dpy, set_blob, NULL);
+   

Re: [Piglit] [PATCH] ext_transform_feedback-interleaved: disable unneeded printfs()

2017-12-18 Thread Timothy Arceri

Probably should just remove it but I don't really care either way so:

Reviewed-by: Timothy Arceri 

On 19/12/17 09:23, Brian Paul wrote:

No need to print passing cases.  Reduced log noise.
---
  tests/spec/ext_transform_feedback/interleaved.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/spec/ext_transform_feedback/interleaved.c 
b/tests/spec/ext_transform_feedback/interleaved.c
index a52474c..0d237d7 100644
--- a/tests/spec/ext_transform_feedback/interleaved.c
+++ b/tests/spec/ext_transform_feedback/interleaved.c
@@ -189,7 +189,8 @@ enum piglit_result piglit_display(void)
if (fabs(ptr[i] - expected[i]) > 0.01) {
printf("Buffer[%i]: %f,  Expected: %f\n", i, ptr[i], 
expected[i]);
pass = GL_FALSE;
-   } else {
+   } else if (0) {
+   /* debug */
printf("Buffer[%i]: %f,  Expected: %f -- OK\n", i, 
ptr[i], expected[i]);
}
}


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


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

2017-12-18 Thread Andres Rodriguez



On 2017-12-18 08:17 AM, Topi Pohjolainen wrote:

First draft only contained the Vulkan rendering part. This revision
adds the remaining bits: importing the memory to GL, creating a texture
for it and sampling it.

While there is now a fair bit of infrastructure that can be re-used, I
feel that a lot more work remains.


This is a pretty great start.


Along the way I needed GL support and drafted some initial support for
Intel Mesa driver:

git://people.freedesktop.org/~tpohjola/mesa:ext_memory_object

Jason: I was wondering how GL drivers are meant to deduce the tiling.
I suppose this is meant to happen outside the GL-api but I
couldn't think of anything else than trying to read that from
the buffer object (see the Intel driver hook).


I can't speak for igt, but on the radeonsi side these are passed as 
metadata associated with the kernel bo.




Piglit work can be found in:

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

CC: Jason Ekstrand 
CC: Andres Rodriguez 

Topi Pohjolainen (7):
   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: Test render with vulkan and sample with gl

  tests/spec/ext_memory_object/CMakeLists.gl.txt |  18 +
  tests/spec/ext_memory_object/common.c  | 142 +
  tests/spec/ext_memory_object/common.h  |  53 ++
  .../compile_and_dump_glsl_as_spirv.py  | 139 +
  tests/spec/ext_memory_object/vk_common.c   | 579 +


Can someone suggest a better location to place this file. Would 
tests/util work?


Interacting with vulkan would be useful even outside the 
ext_memory_object case.




  tests/spec/ext_memory_object/vk_common.h   | 113 
  .../ext_memory_object/vk_export_image_as_tex.c | 262 ++
  tests/spec/ext_memory_object/vk_fb.c   | 304 +++
  tests/spec/ext_memory_object/vk_fragcoord.fs   |   7 +
  tests/spec/ext_memory_object/vk_fragcoord.vs   |   8 +
  10 files changed, 1625 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] [v2 6/7] ext_memory_object: Support for importing vulkan memory

2017-12-18 Thread Andres Rodriguez



On 2017-12-18 08:17 AM, Topi Pohjolainen wrote:

Signed-off-by: Topi Pohjolainen 
---
  tests/spec/ext_memory_object/common.c| 71 
  tests/spec/ext_memory_object/common.h|  8 
  tests/spec/ext_memory_object/vk_common.c | 12 ++
  tests/spec/ext_memory_object/vk_common.h |  3 ++
  4 files changed, 94 insertions(+)

diff --git a/tests/spec/ext_memory_object/common.c 
b/tests/spec/ext_memory_object/common.c
index 4e629a787..b389b73ce 100644
--- a/tests/spec/ext_memory_object/common.c
+++ b/tests/spec/ext_memory_object/common.c
@@ -23,6 +23,7 @@
   */
  
  #include "common.h"

+#include "vk_common.h"
  
  static void

  print_usage_and_exit(const char *usage_prefix)
@@ -69,3 +70,73 @@ parse_tex_layout(const char **args, unsigned num_args,
layout->first_layer = read_unsigned(args[10], usage_prefix);
layout->num_layers = read_unsigned(args[11], usage_prefix);
  }
+
+bool
+create_mem_obj_for_vk_dev_mem(VkDevice dev, VkDeviceMemory mem,
+ uint64_t size, GLuint *mem_obj)
+{
+   PFN_vkGetMemoryFdKHR get_fd = vk_get_proc_addr_for_mem_fd(dev);


Would be nice to name this vkGetMemoryFd().


+   const VkMemoryGetFdInfoKHR info = {
+   .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR,
+   .memory = mem,
+   .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR
+   };
+   int fd;
+
+   assert(get_fd);
+   if (get_fd(dev, , ) != VK_SUCCESS)
+   return false;
+
+   glCreateMemoryObjectsEXT(1, mem_obj);
+
+   glImportMemoryFdEXT(*mem_obj, size, GL_HANDLE_TYPE_OPAQUE_FD_EXT, fd);


Check for gl errors here.


+
+   return true;
+}
+
+void
+create_tex_from_vk_dev_mem(const struct tex_layout *layout,
+  GLuint mem_obj, unsigned offset, GLuint *tex)
+{
+   assert(layout->num_samples == 1);
+
+   glGenTextures(1, tex);
+   glBindTexture(layout->target, *tex);
+
+   switch (layout->target) {
+   case GL_TEXTURE_1D:
+   assert(layout->z == 1);
+   assert(layout->h == 1);
+   glTexStorageMem1DEXT(layout->target, layout->num_levels,
+layout->format, layout->w,
+mem_obj, offset);
+   break;
+   case GL_TEXTURE_1D_ARRAY:
+   assert(layout->z == 1);
+   assert(layout->h == 1);
+   glTexStorageMem2DEXT(layout->target, layout->num_levels,
+layout->format, layout->w,
+layout->num_layers,
+mem_obj, offset);
+   case GL_TEXTURE_2D:
+   assert(layout->z == 1);
+   glTexStorageMem2DEXT(layout->target, layout->num_levels,
+layout->format, layout->w, layout->h,
+mem_obj, offset);
+   break;
+   case GL_TEXTURE_2D_ARRAY:
+   assert(layout->z == 1);
+   glTexStorageMem3DEXT(layout->target, layout->num_levels,
+layout->format,
+layout->w, layout->h, layout->num_layers,
+mem_obj, offset);
+   case GL_TEXTURE_3D:
+   glTexStorageMem3DEXT(layout->target, layout->num_levels,
+layout->format,
+layout->w, layout->h, layout->z,
+mem_obj, offset);
+   break;
+   default:
+   assert(!"Invalid target");
+   }
+}
diff --git a/tests/spec/ext_memory_object/common.h 
b/tests/spec/ext_memory_object/common.h
index 35e54c529..efd4528b5 100644
--- a/tests/spec/ext_memory_object/common.h
+++ b/tests/spec/ext_memory_object/common.h
@@ -42,4 +42,12 @@ void
  parse_tex_layout(const char **args, unsigned num_args,
 const char *usage_prefix, struct tex_layout *layout);
  
+bool

+create_mem_obj_for_vk_dev_mem(VkDevice dev, VkDeviceMemory mem,
+ uint64_t size, GLuint *mem_obj);
+
+void
+create_tex_from_vk_dev_mem(const struct tex_layout *layout,
+  GLuint mem_obj, unsigned offset, GLuint *tex);
+
  #endif
diff --git a/tests/spec/ext_memory_object/vk_common.c 
b/tests/spec/ext_memory_object/vk_common.c
index 2a02d058c..8b38c4b10 100644
--- a/tests/spec/ext_memory_object/vk_common.c
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -565,3 +565,15 @@ vk_create_fence(VkDevice dev)
  
  return fence;

  }
+
+PFN_vkGetMemoryFdKHR
+vk_get_proc_addr_for_mem_fd(VkDevice dev)
+{
+   static PFN_vkGetMemoryFdKHR get_fd = NULL;
+
+   if (get_fd == NULL)
+   get_fd = (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(
+   dev, 

Re: [Piglit] [v2 4/7] ext_memory_object: Support for setting up vulkan framebuffer

2017-12-18 Thread Andres Rodriguez



On 2017-12-18 08:17 AM, Topi Pohjolainen wrote:

v2: Store image size in order to know how much memory to import,
 see glImportMemoryFdEXT().

Signed-off-by: Topi Pohjolainen 
---
  tests/spec/ext_memory_object/vk_common.h |  34 
  tests/spec/ext_memory_object/vk_fb.c | 304 +++
  2 files changed, 338 insertions(+)
  create mode 100644 tests/spec/ext_memory_object/vk_fb.c

diff --git a/tests/spec/ext_memory_object/vk_common.h 
b/tests/spec/ext_memory_object/vk_common.h
index 590735253..3ad8fd6c3 100644
--- a/tests/spec/ext_memory_object/vk_common.h
+++ b/tests/spec/ext_memory_object/vk_common.h
@@ -34,12 +34,46 @@ 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;
+};
+
  VkDevice
  vk_init(void);
  
  void

  vk_cleanup(void);
  
+void

+vk_create_image(VkDevice dev, 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_setup_fb(VkDevice dev, 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(VkFormat format, unsigned num_samples,
  VkImageLayout sub_pass_layout,
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..4cb2b3722
--- /dev/null
+++ b/tests/spec/ext_memory_object/vk_fb.c
@@ -0,0 +1,304 @@
+/*
+ * 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
+vk_destroy_image(VkDevice dev, struct vk_image *image)
+{
+   if (image->image != VK_NULL_HANDLE)
+   vkDestroyImage(dev, image->image, NULL);
+
+   if (image->mem != VK_NULL_HANDLE)
+   vkFreeMemory(dev, image->mem, NULL);
+}
+
+void
+vk_create_image(VkDevice dev, 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)
+{
+   const VkImageType image_type =
+   z > 1 ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D;
+   const VkImageCreateInfo info = {
+   .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
+   .imageType = image_type,
+   .tiling = tiling,
+   .mipLevels = num_levels,
+   .arrayLayers = num_layers,
+   .samples = (VkSampleCountFlagBits)num_samples,
+   .format = format,
+   .extent = {
+   .width = w,
+   .height = h,
+   .depth = z,
+   },
+   .usage = usage,
+   };
+   VkMemoryRequirements mem_reqs;
+
+   image->image = VK_NULL_HANDLE;
+   image->mem = VK_NULL_HANDLE;
+   
+   if (vkCreateImage(dev, , NULL, >image) != VK_SUCCESS)
+   goto fail;
+
+   vkGetImageMemoryRequirements(dev, image->image, _reqs);
+
+   image->mem = vk_alloc_mem(
+   dev, _reqs, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
+   if (image->mem == 

Re: [Piglit] [v2 3/7] ext_memory_object: Support for drawing with vulkan

2017-12-18 Thread Andres Rodriguez



On 2017-12-18 08:17 AM, Topi Pohjolainen wrote:

Signed-off-by: Topi Pohjolainen 
---
  tests/spec/ext_memory_object/vk_common.c | 322 +++
  tests/spec/ext_memory_object/vk_common.h |  38 
  2 files changed, 360 insertions(+)

diff --git a/tests/spec/ext_memory_object/vk_common.c 
b/tests/spec/ext_memory_object/vk_common.c
index ab871d501..2a02d058c 100644
--- a/tests/spec/ext_memory_object/vk_common.c
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -243,3 +243,325 @@ vk_cleanup(void)
if (inst != VK_NULL_HANDLE)
vkDestroyInstance(inst, _alloc_cb);
  }
+
+VkRenderPass
+vk_create_render_pass(VkFormat format, unsigned num_samples,
+ VkImageLayout sub_pass_layout,
+ VkImageLayout final_layout)
+{
+const VkRenderPassCreateInfo info = {
+.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
+   .attachmentCount = 1,
+   .pAttachments = (VkAttachmentDescription[]) { {
+   .samples = (VkSampleCountFlagBits)num_samples,
+   .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
+   .storeOp = VK_ATTACHMENT_STORE_OP_STORE,
+   .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
+   .finalLayout = final_layout,
+   .format = format,
+   }, },
+   .subpassCount = 1,
+   .pSubpasses = (VkSubpassDescription[]) { {
+   .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
+   .colorAttachmentCount = 1,
+   .pColorAttachments = (VkAttachmentReference[]) {
+   {
+   .layout = sub_pass_layout,
+   }, },
+   .preserveAttachmentCount = 1,
+   .pPreserveAttachments = (uint32_t[]) { 0 },
+   } },
+   };
+
+   VkRenderPass pass = VK_NULL_HANDLE;
+   if (vkCreateRenderPass(dev, , NULL, ) != VK_SUCCESS)
+   pass = VK_NULL_HANDLE;
+
+   return pass;
+}
+
+VkShaderModule
+vk_add_shader(const void *code, size_t size)
+{
+   const VkShaderModuleCreateInfo info = {
+.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
+.codeSize = size,
+.pCode = code
+   };
+
+   VkShaderModule module = VK_NULL_HANDLE;
+   if (vkCreateShaderModule(dev, , NULL, ) != VK_SUCCESS)
+   module = VK_NULL_HANDLE;
+
+   return module;
+}
+
+VkPipeline
+vk_create_pipeline(unsigned w, unsigned h, unsigned num_samples,
+  VkPrimitiveTopology topology,
+  unsigned attr_stride, VkFormat attr_format,
+  VkRenderPass render_pass,
+  VkShaderModule fs, VkShaderModule vs)
+{
+const VkPipelineVertexInputStateCreateInfo vi_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
+   .vertexBindingDescriptionCount = 1,
+   .pVertexBindingDescriptions =
+   (VkVertexInputBindingDescription[]) { {
+   .binding = 0,
+   .stride = attr_stride,
+   .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
+   }, },
+   .vertexAttributeDescriptionCount = 1,
+   .pVertexAttributeDescriptions =
+   (VkVertexInputAttributeDescription[]) { {
+   .location = 0,
+   .binding = 0,
+   .format = attr_format,
+   .offset = 0
+   }, }
+   };
+   const VkPipelineInputAssemblyStateCreateInfo ia_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
+   .topology = topology,
+   .primitiveRestartEnable = false
+   };
+   const VkViewport viewport = { 0.0, 0.0, w, h, 0.0, 1.0 };
+   const VkRect2D scissor = { { 0, 0 }, {w, h } };
+   const VkPipelineViewportStateCreateInfo vp_info = {
+   .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
+   .viewportCount = 1,
+   .pViewports = ,
+   .scissorCount = 1,
+   .pScissors = 
+   };
+   const VkPipelineRasterizationStateCreateInfo rs_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
+   .depthClampEnable = false,
+   .rasterizerDiscardEnable = false,
+   .polygonMode = VK_POLYGON_MODE_FILL,
+   .cullMode = VK_CULL_MODE_NONE,
+   .frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE,
+   .depthBiasConstantFactor = 0.0f,
+   .depthBiasClamp = 0.0f,
+   .depthBiasSlopeFactor = 0.0f,
+   

Re: [Piglit] [v2 2/7] ext_memory_object: Support for setting up vulkan device

2017-12-18 Thread Andres Rodriguez



On 2017-12-18 08:17 AM, Topi Pohjolainen wrote:

Signed-off-by: Topi Pohjolainen 
---
  tests/spec/ext_memory_object/vk_common.c | 245 +++
  tests/spec/ext_memory_object/vk_common.h |  38 +
  2 files changed, 283 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..ab871d501
--- /dev/null
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -0,0 +1,245 @@
+/*
+ * 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 VkInstance inst = VK_NULL_HANDLE;
+static VkPhysicalDevice phys_dev = VK_NULL_HANDLE;
+static VkDevice dev = VK_NULL_HANDLE;
+static VkPipelineCache pipeline_cache = VK_NULL_HANDLE;
+static VkCommandPool cmd_pool = VK_NULL_HANDLE;
+static VkCommandBuffer cmd_buf = VK_NULL_HANDLE;
+static VkQueue queue = VK_NULL_HANDLE;
+


Since these variables are file scope consider giving them names that are 
less likely to alias with local variables (which happens a lot in this 
file, even with variables of different types!).


Not sure if there is any specific naming convention in piglit, but full 
names + the 's' prefix would probably be okay. E.g. sInstance, 
sPhysDevice, sDevice, etc.




+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);
+   memset(mem, 139, size);


Might want to document why 139 is used here, is just to poison the 
memory to test for bad usage?




+   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 = "piglit_vk_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 dev = VK_NULL_HANDLE > +
+   if (vkEnumeratePhysicalDevices(inst, , NULL) != VK_SUCCESS ||
+   count == 0)
+   return VK_NULL_HANDLE;
+
+   count = 1;
+   if (vkEnumeratePhysicalDevices(inst, , ) != VK_SUCCESS ||
+   count != 1) > +  dev = VK_NULL_HANDLE;
+


This should be simple to adapt to handle cases with more than one 
physical device. An array can be allocated dynamically of size count and 
you just return array[0].



+   return dev;
+}
+
+static 

Re: [Piglit] [v2 4/7] ext_memory_object: Support for setting up vulkan framebuffer

2017-12-18 Thread Fredrik Höglund
On Monday 18 December 2017, Topi Pohjolainen wrote:
> v2: Store image size in order to know how much memory to import,
> see glImportMemoryFdEXT().
> 
> Signed-off-by: Topi Pohjolainen 
> ---
>  tests/spec/ext_memory_object/vk_common.h |  34 
>  tests/spec/ext_memory_object/vk_fb.c | 304 
> +++
>  2 files changed, 338 insertions(+)
>  create mode 100644 tests/spec/ext_memory_object/vk_fb.c
> 
> diff --git a/tests/spec/ext_memory_object/vk_common.h 
> b/tests/spec/ext_memory_object/vk_common.h
> index 590735253..3ad8fd6c3 100644
> --- a/tests/spec/ext_memory_object/vk_common.h
> +++ b/tests/spec/ext_memory_object/vk_common.h
> @@ -34,12 +34,46 @@ 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;
> +};
> +
>  VkDevice
>  vk_init(void);
>  
>  void
>  vk_cleanup(void);
>  
> +void
> +vk_create_image(VkDevice dev, 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_setup_fb(VkDevice dev, 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(VkFormat format, unsigned num_samples,
> VkImageLayout sub_pass_layout,
> 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..4cb2b3722
> --- /dev/null
> +++ b/tests/spec/ext_memory_object/vk_fb.c
> @@ -0,0 +1,304 @@
> +/*
> + * 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
> +vk_destroy_image(VkDevice dev, struct vk_image *image)
> +{
> + if (image->image != VK_NULL_HANDLE)
> + vkDestroyImage(dev, image->image, NULL);
> +
> + if (image->mem != VK_NULL_HANDLE)
> + vkFreeMemory(dev, image->mem, NULL);
> +}
> +
> +void
> +vk_create_image(VkDevice dev, 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)
> +{
> + const VkImageType image_type =
> + z > 1 ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D;
> + const VkImageCreateInfo info = {
> + .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
> + .imageType = image_type,
> + .tiling = tiling,
> + .mipLevels = num_levels,
> + .arrayLayers = num_layers,
> + .samples = (VkSampleCountFlagBits)num_samples,
> + .format = format,
> + .extent = {
> + .width = w,
> + .height = h,
> + .depth = z,
> + },
> + .usage = usage,
> + };
> + VkMemoryRequirements mem_reqs;
> +
> + image->image = VK_NULL_HANDLE;
> + image->mem = VK_NULL_HANDLE;
> + 
> + if (vkCreateImage(dev, , NULL, >image) != VK_SUCCESS)
> + goto fail;

You need to include a VkExternalMemoryImageCreateInfoKHR 

Re: [Piglit] [PATCH] ext_transform_feedback-max-varyings: reduce output upon failures

2017-12-18 Thread Charmaine Lee

Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Monday, December 18, 2017 2:28:14 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende; Brian Paul
Subject: [PATCH] ext_transform_feedback-max-varyings: reduce output upon 
failures

Stop running the test after 10 failures.  As it was, a failure could
lead to nearly 9MB of output.
---
 tests/spec/ext_transform_feedback/max-varyings.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index 4a5086c..1f83b60 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -249,6 +249,7 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
int vertex, varying, i;
float (*buffer)[4] = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER,
 GL_READ_ONLY);
+   int numFail = 0;

for (vertex = 0; vertex < 6; ++vertex) {
for (varying = 0; varying < num_xfb_varyings; ++varying) {
@@ -273,10 +274,14 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
   actual[0], actual[1], actual[2],
   actual[3]);
pass = GL_FALSE;
+   if (++numFail >= 10) {
+   goto end;
+   }
}
}
}

+end:
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);

return pass;
@@ -322,9 +327,12 @@ draw(GLuint vs, GLuint fs, int num_xfb_varyings,

glEndTransformFeedback();
pass = check_xfb_output(max_varyings, num_xfb_varyings,
- offset, xfb_varyings) && pass;
+ offset, xfb_varyings);

glDeleteProgram(prog);
+   if (!pass) {
+   break;
+   }
}

return pass;
@@ -341,8 +349,10 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
glClear(GL_COLOR_BUFFER_BIT);

for (row = 0; row < max_xfb_varyings; row++) {
-   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings) &&
-  pass;
+   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings);
+   if (!pass) {
+   goto end;
+   }
}

for (row = 0; row < max_xfb_varyings; row++) {
@@ -359,10 +369,11 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
   " captured and offset %d\n",
   row + 1, col);
pass = GL_FALSE;
-   break;
+   goto end;
}
}
}
+end:
return pass;
 }

--
1.9.1

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


[Piglit] [Bug 86651] [i965 Bisected]Piglit glx_glx-pixmap-multi fails, with DRI3 disabled

2017-12-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=86651

Fabian Bieler  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #4 from Fabian Bieler  ---
Fixed by:
758a28d06cac0c0bd4b41bf0b07400cf3398c989
glx-query-renderer-coverage: Fix broken glXCreateNewContext call

-- 
You are receiving this mail because:
You are the QA Contact for the bug.___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] ext_transform_feedback-max-varyings: reduce output upon failures

2017-12-18 Thread Brian Paul
Stop running the test after 10 failures.  As it was, a failure could
lead to nearly 9MB of output.
---
 tests/spec/ext_transform_feedback/max-varyings.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index 4a5086c..1f83b60 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -249,6 +249,7 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
int vertex, varying, i;
float (*buffer)[4] = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER,
 GL_READ_ONLY);
+   int numFail = 0;
 
for (vertex = 0; vertex < 6; ++vertex) {
for (varying = 0; varying < num_xfb_varyings; ++varying) {
@@ -273,10 +274,14 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
   actual[0], actual[1], actual[2],
   actual[3]);
pass = GL_FALSE;
+   if (++numFail >= 10) {
+   goto end;
+   }
}
}
}
 
+end:
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
 
return pass;
@@ -322,9 +327,12 @@ draw(GLuint vs, GLuint fs, int num_xfb_varyings,
 
glEndTransformFeedback();
pass = check_xfb_output(max_varyings, num_xfb_varyings,
- offset, xfb_varyings) && pass;
+ offset, xfb_varyings);
 
glDeleteProgram(prog);
+   if (!pass) {
+   break;
+   }
}
 
return pass;
@@ -341,8 +349,10 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
glClear(GL_COLOR_BUFFER_BIT);
 
for (row = 0; row < max_xfb_varyings; row++) {
-   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings) &&
-  pass;
+   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings);
+   if (!pass) {
+   goto end;
+   }
}
 
for (row = 0; row < max_xfb_varyings; row++) {
@@ -359,10 +369,11 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
   " captured and offset %d\n",
   row + 1, col);
pass = GL_FALSE;
-   break;
+   goto end;
}
}
}
+end:
return pass;
 }
 
-- 
1.9.1

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


[Piglit] [PATCH] ext_transform_feedback-interleaved: disable unneeded printfs()

2017-12-18 Thread Brian Paul
No need to print passing cases.  Reduced log noise.
---
 tests/spec/ext_transform_feedback/interleaved.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/spec/ext_transform_feedback/interleaved.c 
b/tests/spec/ext_transform_feedback/interleaved.c
index a52474c..0d237d7 100644
--- a/tests/spec/ext_transform_feedback/interleaved.c
+++ b/tests/spec/ext_transform_feedback/interleaved.c
@@ -189,7 +189,8 @@ enum piglit_result piglit_display(void)
if (fabs(ptr[i] - expected[i]) > 0.01) {
printf("Buffer[%i]: %f,  Expected: %f\n", i, ptr[i], 
expected[i]);
pass = GL_FALSE;
-   } else {
+   } else if (0) {
+   /* debug */
printf("Buffer[%i]: %f,  Expected: %f -- OK\n", i, 
ptr[i], expected[i]);
}
}
-- 
1.9.1

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


Re: [Piglit] [PATCH] arb_shader_image_load_store: correct tessellation typo

2017-12-18 Thread Francisco Jerez
Andres Gomez  writes:

> Cc: Francisco Jerez 
> Signed-off-by: Andres Gomez 
> ---
>  tests/spec/arb_shader_image_load_store/grid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/arb_shader_image_load_store/grid.c 
> b/tests/spec/arb_shader_image_load_store/grid.c
> index 68d80b102..261dbfd13 100644
> --- a/tests/spec/arb_shader_image_load_store/grid.c
> +++ b/tests/spec/arb_shader_image_load_store/grid.c
> @@ -261,7 +261,7 @@ generate_program_v(const struct grid_info grid, const 
> char **sources)
>   GL_GEOMETRY_SHADER_BIT);
>  const unsigned stages =
>  (grid.stages |
> - /* Make a full pipeline if a tesselation shader was
> + /* Make a full pipeline if a tessellation shader was

Actually both are valid spellings AFAIA -- Unless you are searching for
the ARB extension string I guess ;).

>* requested. */
>   (grid.stages & tess_stages ? graphic_stages : 0) |
>   /* Make sure there is always a vertex and fragment
> -- 
> 2.14.2


signature.asc
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] arb_internalformat_query2: correct tessellation typo

2017-12-18 Thread Andres Gomez
Cc: Alejandro Piñeiro 
Signed-off-by: Andres Gomez 
---
 tests/spec/arb_internalformat_query2/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/arb_internalformat_query2/common.c 
b/tests/spec/arb_internalformat_query2/common.c
index a5686c0a5..9fa5fa9d1 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -612,7 +612,7 @@ check_query2_pname_dependencies(const GLenum pname)
 
 case GL_TESS_CONTROL_TEXTURE:
 case GL_TESS_EVALUATION_TEXTURE:
-if 
(!piglit_is_extension_supported("GL_ARB_tesselation_shader"))
+if 
(!piglit_is_extension_supported("GL_ARB_tessellation_shader"))
 return false;
 break;
 
-- 
2.14.2

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


[Piglit] [PATCH] arb_shader_image_load_store: correct tessellation typo

2017-12-18 Thread Andres Gomez
Cc: Francisco Jerez 
Signed-off-by: Andres Gomez 
---
 tests/spec/arb_shader_image_load_store/grid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/arb_shader_image_load_store/grid.c 
b/tests/spec/arb_shader_image_load_store/grid.c
index 68d80b102..261dbfd13 100644
--- a/tests/spec/arb_shader_image_load_store/grid.c
+++ b/tests/spec/arb_shader_image_load_store/grid.c
@@ -261,7 +261,7 @@ generate_program_v(const struct grid_info grid, const char 
**sources)
  GL_GEOMETRY_SHADER_BIT);
 const unsigned stages =
 (grid.stages |
- /* Make a full pipeline if a tesselation shader was
+ /* Make a full pipeline if a tessellation shader was
   * requested. */
  (grid.stages & tess_stages ? graphic_stages : 0) |
  /* Make sure there is always a vertex and fragment
-- 
2.14.2

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


[Piglit] [PATCH 3/3] travis: add generator unittests

2017-12-18 Thread Andres Gomez
Cc: Dylan Baker 
Cc: Juan A. Suarez Romero 
Signed-off-by: Andres Gomez 
---
 .travis.yml | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 1d6c954f5..b47829ff9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,15 +3,15 @@ cache: pip
 matrix:
   include:
 - python: 2.7
-  env: TOX_ENV="py27-{noaccel,accel-nix,streams}"
+  env: TOX_ENV="py27-{generator,noaccel,accel-nix,streams}"
 - python: 3.3
-  env: TOX_ENV="py33-{noaccel,accel-nix,streams}"
+  env: TOX_ENV="py33-{generator,noaccel,accel-nix,streams}"
 - python: 3.4
-  env: TOX_ENV="py34-{noaccel,accel-nix,streams}"
+  env: TOX_ENV="py34-{generator,noaccel,accel-nix,streams}"
 - python: 3.5
-  env: TOX_ENV="py35-{noaccel,accel-nix,streams}"
+  env: TOX_ENV="py35-{generator,noaccel,accel-nix,streams}"
 - python: 3.6
-  env: TOX_ENV="py36-{noaccel,accel-nix,streams}"
+  env: TOX_ENV="py36-{generator,noaccel,accel-nix,streams}"
 install:
 pip install tox
 script:
-- 
2.14.2

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


[Piglit] [PATCH 2/3] unittests: update python generator

2017-12-18 Thread Andres Gomez
Cc: Dylan Baker 
Signed-off-by: Andres Gomez 
---
 unittests/generators/test_generators.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/unittests/generators/test_generators.py 
b/unittests/generators/test_generators.py
index a3ea3e29e..ccb57e725 100644
--- a/unittests/generators/test_generators.py
+++ b/unittests/generators/test_generators.py
@@ -45,10 +45,14 @@ import pytest
 'gen_cl_int_builtins',
 'gen_cl_math_builtins',
 'gen_cl_relational_builtins',
+'gen_cl_shuffle2_builtins',
+'gen_cl_shuffle_builtins',
 'gen_cl_store_tests',
+'gen_cl_vload_tests',
+'gen_cl_vstore_tests',
 'gen_const_builtin_equal_tests',
 'gen_constant_array_size_tests_fp64',
-'gen_conversion_fp64',
+'gen_conversion',
 'gen_extensions_defined',
 'gen_flat_interpolation_qualifier',
 'gen_inout_fp64',
@@ -59,6 +63,7 @@ import pytest
 'gen_shader_bit_encoding_tests',
 'gen_shader_framebuffer_fetch_tests',
 'gen_shader_image_load_store_tests',
+'gen_shader_image_nv_image_formats_tests',
 'gen_shader_intel_conservative_rasterization',
 'gen_shader_precision_tests',
 'gen_tcs_input_tests',
-- 
2.14.2

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


[Piglit] [PATCH 1/3] unittests: correct tessellation typo

2017-12-18 Thread Andres Gomez
Cc: Dylan Baker 
Signed-off-by: Andres Gomez 
---
 unittests/generators/test_glsl.py | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/unittests/generators/test_glsl.py 
b/unittests/generators/test_glsl.py
index 66e3f66e1..5eec79484 100644
--- a/unittests/generators/test_glsl.py
+++ b/unittests/generators/test_glsl.py
@@ -300,18 +300,18 @@ class TestMinVersion_for_stage_with_ext(object):
 TCS (OpenGL)"""
 self._test('tesc', glsl.Version('410'), (glsl.Version('410'), None))
 self._test('tesc', glsl.Version('140'),
-   (glsl.Version('140'), 'GL_ARB_tesselation_shader'))
+   (glsl.Version('140'), 'GL_ARB_tessellation_shader'))
 self._test('tesc', glsl.Version('110'),
-   (glsl.Version('140'), 'GL_ARB_tesselation_shader'))
+   (glsl.Version('140'), 'GL_ARB_tessellation_shader'))
 
 def test_opengl_tese(self):
 """generated_tests.modules.glsl.MinVersion.for_stage_with_ext:
 TES (OpenGL)"""
 self._test('tese', glsl.Version('410'), (glsl.Version('410'), None))
 self._test('tese', glsl.Version('140'),
-   (glsl.Version('140'), 'GL_ARB_tesselation_shader'))
+   (glsl.Version('140'), 'GL_ARB_tessellation_shader'))
 self._test('tese', glsl.Version('110'),
-   (glsl.Version('140'), 'GL_ARB_tesselation_shader'))
+   (glsl.Version('140'), 'GL_ARB_tessellation_shader'))
 
 def test_opengl_comp(self):
 """generated_tests.modules.glsl.MinVersion.for_stage_with_ext:
@@ -352,9 +352,9 @@ class TestMinVersion_for_stage_with_ext(object):
 self._test('tesc', glsl.Version('320 es'),
(glsl.Version('320 es'), None))
 self._test('tesc', glsl.Version('310 es'),
-   (glsl.Version('310 es'), 'GL_OES_tesselation_shader'))
+   (glsl.Version('310 es'), 'GL_OES_tessellation_shader'))
 self._test('tesc', glsl.Version('100'),
-   (glsl.Version('310 es'), 'GL_OES_tesselation_shader'))
+   (glsl.Version('310 es'), 'GL_OES_tessellation_shader'))
 
 def test_opengles_tese(self):
 """generated_tests.modules.glsl.MinVersion.for_stage_with_ext:
@@ -362,9 +362,9 @@ class TestMinVersion_for_stage_with_ext(object):
 self._test('tese', glsl.Version('320 es'),
(glsl.Version('320 es'), None))
 self._test('tese', glsl.Version('310 es'),
-   (glsl.Version('310 es'), 'GL_OES_tesselation_shader'))
+   (glsl.Version('310 es'), 'GL_OES_tessellation_shader'))
 self._test('tese', glsl.Version('100'),
-   (glsl.Version('310 es'), 'GL_OES_tesselation_shader'))
+   (glsl.Version('310 es'), 'GL_OES_tessellation_shader'))
 
 def test_opengles_comp(self):
 """generated_tests.modules.glsl.MinVersion.for_stage_with_ext:
-- 
2.14.2

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


[Piglit] [PATCH 0/3] Enable generator unittests

2017-12-18 Thread Andres Gomez
This is a small series which correct some small mistakes, update the
unit test for the generator and enables it in Travis CI.

Andres Gomez (3):
  unittests: correct tessellation typo
  unittests: update python generator
  travis: add generator unittests

 .travis.yml | 10 +-
 unittests/generators/test_generators.py |  7 ++-
 unittests/generators/test_glsl.py   | 16 
 3 files changed, 19 insertions(+), 14 deletions(-)

-- 
2.14.2

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


Re: [Piglit] Move and rename tests from bugs/ to spec/ directory.

2017-12-18 Thread Brian Paul

On 12/16/2017 12:20 PM, Fabian Bieler wrote:

Also includes some formatting fixes,

updated some comments (particularly added license comments) and

corrected value of config.supports_gl_compat_version in some cases.



Some tests were moved to different profiles in all.py (noted in commit
msg).


Otherwise no changes.


Looks good.  Thanks!

Reviewed-by: Brian Paul 







Nicolai Hähnle, Vinson Lee, Wiktor Janas: Do any of you take issue with
the addition of the MIT copyright notice?
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_piglit=DwIGaQ=uilaK90D4TOVoH58JNXRgQ=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA=X1F6hpmEs_mJ476uE9u_Ipd37Jd6yAVrarcS-VFYYLw=_ygqJCgOCtw8Y0JIyzR1IWylr0ibLgnRE6KGBkvg8i0=



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


Re: [Piglit] [PATCH 5/5] egl: add eglCopyBuffers test

2017-12-18 Thread Emil Velikov
On 13 December 2017 at 12:54, Tapani Pälli  wrote:

>> The test doesn't care how well eglCopyBuffers itself works - aim it to
>> illustrate the buggy validation in Mesa.
>> Hence the wait + pixmap readback are not really needed.
>>
>> Admittedly the test name is quite misleading as-is - I'm short on
>> alternatives though :-(
>
>
> OK, yeah that is fine. It's not far from 'complete test' though but such
> athing can be also added later.
>
Agreed. Would you have any additional suggestions on this patch?
Input on the nitpicks (originally put by yours truly) would be appreciated:

 - suggestions for test name and category?
 - should we bother at all with piglit_egl_get_default_display(EGL_NONE)
 - yay X11+DRI3 crashes somewhere in the xshmfence code... DRI2 works
fine.

Thanks
Emil
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 07/20] Move tex1d-2border test from bugs to spec dir.

2017-12-18 Thread Emil Velikov
Hi Fabian,

On 16 December 2017 at 19:21, Fabian Bieler  wrote:
> ---
>  tests/all.py|   2 +-
>  tests/bugs/CMakeLists.gl.txt|   1 -
>  tests/bugs/tex1d-2dborder.c | 126 
> 
>  tests/spec/gl-1.4/CMakeLists.gl.txt |   1 +
>  tests/spec/gl-1.4/tex1d-2dborder.c  | 126 
> 
>  5 files changed, 128 insertions(+), 128 deletions(-)
>  delete mode 100644 tests/bugs/tex1d-2dborder.c
>  create mode 100644 tests/spec/gl-1.4/tex1d-2dborder.c
>
Small suggestion for the future:

For historical reasons, git produces iffy delete/create patch. The
following will tell it to always produce a "rename" one, where the
actual diff will be present ;-)
$git config --global diff.renames true

-Emil
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] tox: stick to pytest 3.2.5

2017-12-18 Thread Andres Gomez
This is:

Reviewed-by: Andres Gomez 

On Mon, 2017-12-18 at 13:45 +0100, Juan A. Suarez Romero wrote:
> Newer pytest versions (>=3.3.) require new versions of PythonSix
> (>=1.10.0).
> 
> We want to keep the current PythonSix version required by piglit.
> 
> So le'ts keep using a pytest version that doesn't force us to increase
> PythonSix.
> ---
>  tox.ini | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tox.ini b/tox.ini
> index c1b7a0104..12e8abd9f 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -20,7 +20,7 @@ deps =
>  py27-accel-nix: backports.lzma
>  py27-accel-nix: subprocess32
>  py{35,36}: mako==1.0.2
> -pytest>=3.0.3
> +pytest==3.2.5
>  pytest-mock
>  pytest-pythonpath
>  pytest-raises
-- 
Br,

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


[Piglit] [v2 7/7] ext_memory_object: Test render with vulkan and sample with gl

2017-12-18 Thread Topi Pohjolainen
Example:

./bin/ext_memory_object-vk_export_image_as_tex 0 0 GL_TEXTURE_2D GL_RGBA 1 64 
64 1 0 1 0 1 -auto -fbo

Usage in turn gives:

Usage: ./bin/ext_memory_object-vk_export_image_as_tex   

 

TODO: First two arguments do not have parser support yet and are
  ignored. For now test uses hardcoded values of
  VK_FORMAT_R8G8B8A8_UNORM and VK_IMAGE_TILING_LINEAR
  respectively,

Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_memory_object/CMakeLists.gl.txt |  18 ++
 .../ext_memory_object/vk_export_image_as_tex.c | 262 +
 tests/spec/ext_memory_object/vk_fragcoord.fs   |   7 +
 tests/spec/ext_memory_object/vk_fragcoord.vs   |   8 +
 4 files changed, 295 insertions(+)
 create mode 100644 tests/spec/ext_memory_object/vk_export_image_as_tex.c
 create mode 100644 tests/spec/ext_memory_object/vk_fragcoord.fs
 create mode 100644 tests/spec/ext_memory_object/vk_fragcoord.vs

diff --git a/tests/spec/ext_memory_object/CMakeLists.gl.txt 
b/tests/spec/ext_memory_object/CMakeLists.gl.txt
index 3a714e6af..601618685 100644
--- a/tests/spec/ext_memory_object/CMakeLists.gl.txt
+++ b/tests/spec/ext_memory_object/CMakeLists.gl.txt
@@ -1,3 +1,16 @@
+
+add_custom_command (
+   OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord_vs.h
+   COMMAND python3 
${CMAKE_CURRENT_SOURCE_DIR}/compile_and_dump_glsl_as_spirv.py 
--with-glslc=${GLSLC} --stage=vertex 
${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord.vs > 
${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord_vs.h
+   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord.vs
+)
+
+add_custom_command (
+   OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord_fs.h
+   COMMAND python3 
${CMAKE_CURRENT_SOURCE_DIR}/compile_and_dump_glsl_as_spirv.py 
--with-glslc=${GLSLC} --stage=fragment 
${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord.fs > 
${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord_fs.h
+   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord.fs
+)
+
 include_directories(
${GLEXT_INCLUDE_DIR}
${OPENGL_INCLUDE_PATH}
@@ -6,9 +19,14 @@ include_directories(
 link_libraries (
piglitutil_${piglit_target_api}
${OPENGL_gl_LIBRARY}
+   ${LIBVULKAN_LDFLAGS}
 )
 
 piglit_add_executable (ext_memory_object-api-errors api-errors.c)
 
+piglit_add_executable (ext_memory_object-vk_export_image_as_tex
+  vk_export_image_as_tex.c common.c vk_fb.c vk_common.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord_fs.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/vk_fragcoord_vs.h)
 
 # vim: ft=cmake:
diff --git a/tests/spec/ext_memory_object/vk_export_image_as_tex.c 
b/tests/spec/ext_memory_object/vk_export_image_as_tex.c
new file mode 100644
index 0..448fea890
--- /dev/null
+++ b/tests/spec/ext_memory_object/vk_export_image_as_tex.c
@@ -0,0 +1,262 @@
+/*
+ * 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.
+ */
+
+/**
+ * Test GL sampling memory exported from Vulkan.
+ *
+ * Test draws with Vulkan an image with gradient color where intensity of red
+ * increases horizontally and intensity of green increases vertically. This
+ * image is exported to GL which creates a texture against it and samples it
+ * with a custom fragment shader. The shader compares the sampled values
+ * against the expected gradient and writes green in case of match and
+ * otherwise red. Finally the test probes for the green.
+ */
+
+#include "piglit-util-gl.h"
+#include "vk_common.h"
+#include "common.h"
+#include "vk_fragcoord_vs.h"
+#include "vk_fragcoord_fs.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 20;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+struct tex_layout test_tex_layout;
+
+static VkDevice vk_dev = VK_NULL_HANDLE;

[Piglit] [v2 5/7] ext_memory_object: Add tex layout command line

2017-12-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_memory_object/common.c | 71 +++
 tests/spec/ext_memory_object/common.h | 45 ++
 2 files changed, 116 insertions(+)
 create mode 100644 tests/spec/ext_memory_object/common.c
 create mode 100644 tests/spec/ext_memory_object/common.h

diff --git a/tests/spec/ext_memory_object/common.c 
b/tests/spec/ext_memory_object/common.c
new file mode 100644
index 0..4e629a787
--- /dev/null
+++ b/tests/spec/ext_memory_object/common.c
@@ -0,0 +1,71 @@
+/*
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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 "common.h"
+
+static void
+print_usage_and_exit(const char *usage_prefix)
+{
+   printf("Usage: %s   "
+  "  "
+  "   \n",
+  usage_prefix);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+static unsigned
+read_unsigned(const char *s, const char *usage_prefix)
+{
+   char *endptr = NULL;
+   unsigned res = strtol(s, , 0);
+   if (endptr != s + strlen(s))
+   print_usage_and_exit(usage_prefix);
+   
+   return res;
+}
+
+void
+parse_tex_layout(const char **args, unsigned num_args,
+const char *usage_prefix, struct tex_layout *layout)
+{
+   if (num_args < 12)
+   print_usage_and_exit(usage_prefix);
+
+   /* TODO: Add "tests/util/gen_dispatch.py" style generator and proper
+*   parser.
+*/
+   layout->src_format = VK_FORMAT_R8G8B8A8_UNORM;
+   layout->src_tiling = VK_IMAGE_TILING_LINEAR;
+
+   layout->target = piglit_get_gl_enum_from_name(args[2]);
+   layout->format = piglit_get_gl_enum_from_name(args[3]);
+   layout->num_samples = read_unsigned(args[4], usage_prefix);
+   layout->w = read_unsigned(args[5], usage_prefix);
+   layout->h = read_unsigned(args[6], usage_prefix);
+   layout->z = read_unsigned(args[7], usage_prefix);
+   layout->first_level = read_unsigned(args[8], usage_prefix);
+   layout->num_levels = read_unsigned(args[9], usage_prefix);
+   layout->first_layer = read_unsigned(args[10], usage_prefix);
+   layout->num_layers = read_unsigned(args[11], usage_prefix);
+}
diff --git a/tests/spec/ext_memory_object/common.h 
b/tests/spec/ext_memory_object/common.h
new file mode 100644
index 0..35e54c529
--- /dev/null
+++ b/tests/spec/ext_memory_object/common.h
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#include "piglit-util-gl.h"
+#include 
+
+struct tex_layout {
+   VkFormat src_format;
+   VkImageTiling src_tiling;
+
+   GLenum target, format;
+   unsigned num_samples;
+   unsigned w, 

[Piglit] [v2 6/7] ext_memory_object: Support for importing vulkan memory

2017-12-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_memory_object/common.c| 71 
 tests/spec/ext_memory_object/common.h|  8 
 tests/spec/ext_memory_object/vk_common.c | 12 ++
 tests/spec/ext_memory_object/vk_common.h |  3 ++
 4 files changed, 94 insertions(+)

diff --git a/tests/spec/ext_memory_object/common.c 
b/tests/spec/ext_memory_object/common.c
index 4e629a787..b389b73ce 100644
--- a/tests/spec/ext_memory_object/common.c
+++ b/tests/spec/ext_memory_object/common.c
@@ -23,6 +23,7 @@
  */
 
 #include "common.h"
+#include "vk_common.h"
 
 static void
 print_usage_and_exit(const char *usage_prefix)
@@ -69,3 +70,73 @@ parse_tex_layout(const char **args, unsigned num_args,
layout->first_layer = read_unsigned(args[10], usage_prefix);
layout->num_layers = read_unsigned(args[11], usage_prefix);
 }
+
+bool
+create_mem_obj_for_vk_dev_mem(VkDevice dev, VkDeviceMemory mem,
+ uint64_t size, GLuint *mem_obj)
+{
+   PFN_vkGetMemoryFdKHR get_fd = vk_get_proc_addr_for_mem_fd(dev);
+   const VkMemoryGetFdInfoKHR info = {
+   .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR,
+   .memory = mem,
+   .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR
+   };
+   int fd;
+
+   assert(get_fd);
+   if (get_fd(dev, , ) != VK_SUCCESS)
+   return false;
+
+   glCreateMemoryObjectsEXT(1, mem_obj);
+
+   glImportMemoryFdEXT(*mem_obj, size, GL_HANDLE_TYPE_OPAQUE_FD_EXT, fd);
+
+   return true;
+}
+
+void
+create_tex_from_vk_dev_mem(const struct tex_layout *layout,
+  GLuint mem_obj, unsigned offset, GLuint *tex)
+{
+   assert(layout->num_samples == 1);
+
+   glGenTextures(1, tex);
+   glBindTexture(layout->target, *tex);
+
+   switch (layout->target) {
+   case GL_TEXTURE_1D:
+   assert(layout->z == 1);
+   assert(layout->h == 1);
+   glTexStorageMem1DEXT(layout->target, layout->num_levels,
+layout->format, layout->w,
+mem_obj, offset);
+   break;
+   case GL_TEXTURE_1D_ARRAY:
+   assert(layout->z == 1);
+   assert(layout->h == 1);
+   glTexStorageMem2DEXT(layout->target, layout->num_levels,
+layout->format, layout->w,
+layout->num_layers,
+mem_obj, offset);
+   case GL_TEXTURE_2D:
+   assert(layout->z == 1);
+   glTexStorageMem2DEXT(layout->target, layout->num_levels,
+layout->format, layout->w, layout->h,
+mem_obj, offset);
+   break;
+   case GL_TEXTURE_2D_ARRAY:
+   assert(layout->z == 1);
+   glTexStorageMem3DEXT(layout->target, layout->num_levels,
+layout->format,
+layout->w, layout->h, layout->num_layers,
+mem_obj, offset);
+   case GL_TEXTURE_3D:
+   glTexStorageMem3DEXT(layout->target, layout->num_levels,
+layout->format,
+layout->w, layout->h, layout->z,
+mem_obj, offset);
+   break;
+   default:
+   assert(!"Invalid target");
+   }
+}
diff --git a/tests/spec/ext_memory_object/common.h 
b/tests/spec/ext_memory_object/common.h
index 35e54c529..efd4528b5 100644
--- a/tests/spec/ext_memory_object/common.h
+++ b/tests/spec/ext_memory_object/common.h
@@ -42,4 +42,12 @@ void
 parse_tex_layout(const char **args, unsigned num_args,
 const char *usage_prefix, struct tex_layout *layout);
 
+bool
+create_mem_obj_for_vk_dev_mem(VkDevice dev, VkDeviceMemory mem,
+ uint64_t size, GLuint *mem_obj);
+
+void
+create_tex_from_vk_dev_mem(const struct tex_layout *layout,
+  GLuint mem_obj, unsigned offset, GLuint *tex);
+
 #endif
diff --git a/tests/spec/ext_memory_object/vk_common.c 
b/tests/spec/ext_memory_object/vk_common.c
index 2a02d058c..8b38c4b10 100644
--- a/tests/spec/ext_memory_object/vk_common.c
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -565,3 +565,15 @@ vk_create_fence(VkDevice dev)
 
 return fence;
 }
+
+PFN_vkGetMemoryFdKHR
+vk_get_proc_addr_for_mem_fd(VkDevice dev)
+{
+   static PFN_vkGetMemoryFdKHR get_fd = NULL;
+
+   if (get_fd == NULL)
+   get_fd = (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(
+   dev, "vkGetMemoryFdKHR");
+
+   return get_fd;
+}
diff --git a/tests/spec/ext_memory_object/vk_common.h 
b/tests/spec/ext_memory_object/vk_common.h
index 

[Piglit] [v2 4/7] ext_memory_object: Support for setting up vulkan framebuffer

2017-12-18 Thread Topi Pohjolainen
v2: Store image size in order to know how much memory to import,
see glImportMemoryFdEXT().

Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_memory_object/vk_common.h |  34 
 tests/spec/ext_memory_object/vk_fb.c | 304 +++
 2 files changed, 338 insertions(+)
 create mode 100644 tests/spec/ext_memory_object/vk_fb.c

diff --git a/tests/spec/ext_memory_object/vk_common.h 
b/tests/spec/ext_memory_object/vk_common.h
index 590735253..3ad8fd6c3 100644
--- a/tests/spec/ext_memory_object/vk_common.h
+++ b/tests/spec/ext_memory_object/vk_common.h
@@ -34,12 +34,46 @@ 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;
+};
+
 VkDevice
 vk_init(void);
 
 void
 vk_cleanup(void);
 
+void
+vk_create_image(VkDevice dev, 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_setup_fb(VkDevice dev, 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(VkFormat format, unsigned num_samples,
  VkImageLayout sub_pass_layout,
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..4cb2b3722
--- /dev/null
+++ b/tests/spec/ext_memory_object/vk_fb.c
@@ -0,0 +1,304 @@
+/*
+ * 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
+vk_destroy_image(VkDevice dev, struct vk_image *image)
+{
+   if (image->image != VK_NULL_HANDLE)
+   vkDestroyImage(dev, image->image, NULL);
+
+   if (image->mem != VK_NULL_HANDLE)
+   vkFreeMemory(dev, image->mem, NULL);
+}
+
+void
+vk_create_image(VkDevice dev, 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)
+{
+   const VkImageType image_type =
+   z > 1 ? VK_IMAGE_TYPE_3D : VK_IMAGE_TYPE_2D;
+   const VkImageCreateInfo info = {
+   .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
+   .imageType = image_type,
+   .tiling = tiling,
+   .mipLevels = num_levels,
+   .arrayLayers = num_layers,
+   .samples = (VkSampleCountFlagBits)num_samples,
+   .format = format,
+   .extent = {
+   .width = w,
+   .height = h,
+   .depth = z,
+   },
+   .usage = usage,
+   };
+   VkMemoryRequirements mem_reqs;
+
+   image->image = VK_NULL_HANDLE;
+   image->mem = VK_NULL_HANDLE;
+   
+   if (vkCreateImage(dev, , NULL, >image) != VK_SUCCESS)
+   goto fail;
+
+   vkGetImageMemoryRequirements(dev, image->image, _reqs);
+
+   image->mem = vk_alloc_mem(
+   dev, _reqs, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
+   if (image->mem == VK_NULL_HANDLE)
+   goto fail;
+
+   image->size = mem_reqs.size;
+

[Piglit] [v2 3/7] ext_memory_object: Support for drawing with vulkan

2017-12-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_memory_object/vk_common.c | 322 +++
 tests/spec/ext_memory_object/vk_common.h |  38 
 2 files changed, 360 insertions(+)

diff --git a/tests/spec/ext_memory_object/vk_common.c 
b/tests/spec/ext_memory_object/vk_common.c
index ab871d501..2a02d058c 100644
--- a/tests/spec/ext_memory_object/vk_common.c
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -243,3 +243,325 @@ vk_cleanup(void)
if (inst != VK_NULL_HANDLE)
vkDestroyInstance(inst, _alloc_cb);
 }
+
+VkRenderPass
+vk_create_render_pass(VkFormat format, unsigned num_samples,
+ VkImageLayout sub_pass_layout,
+ VkImageLayout final_layout)
+{
+const VkRenderPassCreateInfo info = {
+.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
+   .attachmentCount = 1,
+   .pAttachments = (VkAttachmentDescription[]) { {
+   .samples = (VkSampleCountFlagBits)num_samples,
+   .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
+   .storeOp = VK_ATTACHMENT_STORE_OP_STORE,
+   .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
+   .finalLayout = final_layout,
+   .format = format,
+   }, },
+   .subpassCount = 1,
+   .pSubpasses = (VkSubpassDescription[]) { {
+   .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
+   .colorAttachmentCount = 1,
+   .pColorAttachments = (VkAttachmentReference[]) {
+   {
+   .layout = sub_pass_layout,
+   }, },
+   .preserveAttachmentCount = 1,
+   .pPreserveAttachments = (uint32_t[]) { 0 },
+   } },
+   };
+
+   VkRenderPass pass = VK_NULL_HANDLE;
+   if (vkCreateRenderPass(dev, , NULL, ) != VK_SUCCESS)
+   pass = VK_NULL_HANDLE;
+
+   return pass;
+}
+
+VkShaderModule
+vk_add_shader(const void *code, size_t size)
+{
+   const VkShaderModuleCreateInfo info = {
+.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
+.codeSize = size, 
+.pCode = code
+   };
+
+   VkShaderModule module = VK_NULL_HANDLE;
+   if (vkCreateShaderModule(dev, , NULL, ) != VK_SUCCESS)
+   module = VK_NULL_HANDLE;
+
+   return module;
+}
+
+VkPipeline
+vk_create_pipeline(unsigned w, unsigned h, unsigned num_samples,
+  VkPrimitiveTopology topology,
+  unsigned attr_stride, VkFormat attr_format,
+  VkRenderPass render_pass,
+  VkShaderModule fs, VkShaderModule vs)
+{
+const VkPipelineVertexInputStateCreateInfo vi_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
+   .vertexBindingDescriptionCount = 1,
+   .pVertexBindingDescriptions =
+   (VkVertexInputBindingDescription[]) { {
+   .binding = 0,
+   .stride = attr_stride,
+   .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
+   }, },
+   .vertexAttributeDescriptionCount = 1,
+   .pVertexAttributeDescriptions =
+   (VkVertexInputAttributeDescription[]) { {
+   .location = 0,
+   .binding = 0,
+   .format = attr_format,
+   .offset = 0
+   }, }
+   };
+   const VkPipelineInputAssemblyStateCreateInfo ia_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
+   .topology = topology,
+   .primitiveRestartEnable = false
+   };
+   const VkViewport viewport = { 0.0, 0.0, w, h, 0.0, 1.0 };
+   const VkRect2D scissor = { { 0, 0 }, {w, h } };
+   const VkPipelineViewportStateCreateInfo vp_info = {
+   .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
+   .viewportCount = 1,
+   .pViewports = ,
+   .scissorCount = 1,
+   .pScissors = 
+   };
+   const VkPipelineRasterizationStateCreateInfo rs_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
+   .depthClampEnable = false,
+   .rasterizerDiscardEnable = false,
+   .polygonMode = VK_POLYGON_MODE_FILL,
+   .cullMode = VK_CULL_MODE_NONE,
+   .frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE,
+   .depthBiasConstantFactor = 0.0f,
+   .depthBiasClamp = 0.0f,
+   .depthBiasSlopeFactor = 0.0f,
+   .lineWidth = 1.0f
+   };
+   const 

[Piglit] [v2 2/7] ext_memory_object: Support for setting up vulkan device

2017-12-18 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_memory_object/vk_common.c | 245 +++
 tests/spec/ext_memory_object/vk_common.h |  38 +
 2 files changed, 283 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..ab871d501
--- /dev/null
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -0,0 +1,245 @@
+/*
+ * 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 VkInstance inst = VK_NULL_HANDLE;
+static VkPhysicalDevice phys_dev = VK_NULL_HANDLE;
+static VkDevice dev = VK_NULL_HANDLE;
+static VkPipelineCache pipeline_cache = VK_NULL_HANDLE;
+static VkCommandPool cmd_pool = VK_NULL_HANDLE;
+static VkCommandBuffer cmd_buf = VK_NULL_HANDLE;
+static VkQueue queue = VK_NULL_HANDLE;
+
+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);
+   memset(mem, 139, 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 = "piglit_vk_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 dev = VK_NULL_HANDLE;
+
+   if (vkEnumeratePhysicalDevices(inst, , NULL) != VK_SUCCESS ||
+   count == 0)
+   return VK_NULL_HANDLE;
+
+   count = 1;
+   if (vkEnumeratePhysicalDevices(inst, , ) != VK_SUCCESS ||
+   count != 1)
+   dev = VK_NULL_HANDLE;
+
+   return dev;
+}
+
+static VkDevice
+create_vk_device(VkPhysicalDevice phys_dev)
+{
+   const VkDeviceCreateInfo info = {
+   .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
+   .queueCreateInfoCount = 1,
+   .pQueueCreateInfos = &(VkDeviceQueueCreateInfo) {
+   .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
+   .queueFamilyIndex = 0,
+   .queueCount = 1,
+   .pQueuePriorities = (float[]) {1.0f},
+   },
+   };
+VkDevice dev = VK_NULL_HANDLE;
+
+   if (vkCreateDevice(phys_dev, , NULL, ) != VK_SUCCESS)
+   dev = VK_NULL_HANDLE;
+
+   return dev;
+}

[Piglit] v2: ext_memory_object: Test sampling memory exported from Vulkan

2017-12-18 Thread Topi Pohjolainen
First draft only contained the Vulkan rendering part. This revision
adds the remaining bits: importing the memory to GL, creating a texture
for it and sampling it.

While there is now a fair bit of infrastructure that can be re-used, I
feel that a lot more work remains.

Along the way I needed GL support and drafted some initial support for
Intel Mesa driver:

git://people.freedesktop.org/~tpohjola/mesa:ext_memory_object

Jason: I was wondering how GL drivers are meant to deduce the tiling.
   I suppose this is meant to happen outside the GL-api but I
   couldn't think of anything else than trying to read that from
   the buffer object (see the Intel driver hook).

Piglit work can be found in:

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

CC: Jason Ekstrand 
CC: Andres Rodriguez 

Topi Pohjolainen (7):
  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: Test render with vulkan and sample with gl

 tests/spec/ext_memory_object/CMakeLists.gl.txt |  18 +
 tests/spec/ext_memory_object/common.c  | 142 +
 tests/spec/ext_memory_object/common.h  |  53 ++
 .../compile_and_dump_glsl_as_spirv.py  | 139 +
 tests/spec/ext_memory_object/vk_common.c   | 579 +
 tests/spec/ext_memory_object/vk_common.h   | 113 
 .../ext_memory_object/vk_export_image_as_tex.c | 262 ++
 tests/spec/ext_memory_object/vk_fb.c   | 304 +++
 tests/spec/ext_memory_object/vk_fragcoord.fs   |   7 +
 tests/spec/ext_memory_object/vk_fragcoord.vs   |   8 +
 10 files changed, 1625 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

-- 
2.14.1

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


[Piglit] [v2 1/7] ext_memory_object: Add script for turning glsl into spirv c-array

2017-12-18 Thread Topi Pohjolainen
This stripped down version of glsl_scraper.py found in crucible.

Signed-off-by: Topi Pohjolainen 
---
 .../compile_and_dump_glsl_as_spirv.py  | 139 +
 1 file changed, 139 insertions(+)
 create mode 100644 
tests/spec/ext_memory_object/compile_and_dump_glsl_as_spirv.py

diff --git a/tests/spec/ext_memory_object/compile_and_dump_glsl_as_spirv.py 
b/tests/spec/ext_memory_object/compile_and_dump_glsl_as_spirv.py
new file mode 100644
index 0..b7fdeafe2
--- /dev/null
+++ b/tests/spec/ext_memory_object/compile_and_dump_glsl_as_spirv.py
@@ -0,0 +1,139 @@
+#! /usr/bin/env python3
+
+import argparse
+import io
+import os
+import re
+import shutil
+import struct
+import subprocess
+import sys
+import tempfile
+from textwrap import dedent
+
+class ShaderCompileError(RuntimeError):
+def __init__(self, *args):
+super(ShaderCompileError, self).__init__(*args)
+
+class Shader:
+def __init__(self, stage, infname):
+self.stage = stage
+self.infname = infname
+self.dwords = None
+self.var_prefix = os.path.basename(infname).replace('.', '_')
+
+def __run_glslc(self, extra_args=[]):
+stage_flag = '-fshader-stage=' + self.stage
+
+with subprocess.Popen([glslc] + extra_args +
+  [stage_flag, '-std=430core', '-o', '-',
+   self.infname],
+  stdout = subprocess.PIPE,
+  stderr = subprocess.PIPE,
+  stdin = subprocess.PIPE) as proc:
+
+out, err = proc.communicate(timeout=30)
+
+if proc.returncode != 0:
+# Unfortunately, glslang dumps errors to standard out.
+# However, since we don't really want to count on that,
+# we'll grab the output of both
+message = out.decode('utf-8') + '\n' + err.decode('utf-8')
+raise ShaderCompileError(message.strip())
+
+return out
+
+def compile(self):
+def dwords(f):
+while True:
+dword_str = f.read(4)
+if not dword_str:
+return
+assert len(dword_str) == 4
+yield struct.unpack('I', dword_str)[0]
+
+spirv = self.__run_glslc()
+self.dwords = list(dwords(io.BytesIO(spirv)))
+self.assembly = str(self.__run_glslc(['-S']), 'utf-8')
+
+def _dump_glsl_code(self, f, var_name):
+# First dump the GLSL source as strings
+f.write('static const char {0}[] ='.format(var_name))
+f.write('\n"#version 330\\n"')
+
+infile = open_file(self.infname, 'r')
+for line in infile:
+f.write('\n"{0}\\n"'.format(line.strip('\n')))
+f.write(';\n\n')
+
+def _dump_spirv_code(self, f, var_name):
+f.write('/* SPIR-V Assembly:\n')
+f.write(' *\n')
+for line in self.assembly.splitlines():
+f.write(' * ' + line + '\n')
+f.write(' */\n')
+
+f.write('static const uint32_t {0}[] = {{'.format(var_name))
+line_start = 0
+while line_start < len(self.dwords):
+f.write('\n')
+for i in range(line_start, min(line_start + 6, len(self.dwords))):
+f.write(' 0x{:08x},'.format(self.dwords[i]))
+line_start += 6
+f.write('\n};\n')
+
+def dump_c_code(self, f):
+self._dump_glsl_code(f, self.var_prefix + '_glsl_src')
+self._dump_spirv_code(f, self.var_prefix + '_spir_v_src')
+
+def parse_args():
+description = dedent("""\
+This program compiles the given glsl source file into SPIR-V and
+writes it to another C file as an array of 32-bit words.
+
+If '-' is passed as the input file or output file, stdin or stdout
+will be used instead of a file on disc.""")
+
+p = argparse.ArgumentParser(
+description=description,
+formatter_class=argparse.RawDescriptionHelpFormatter)
+p.add_argument('-o', '--outfile', default='-',
+help='Output to the given file (default: stdout).')
+p.add_argument('--with-glslc', metavar='PATH',
+default='glslc',
+dest='glslc',
+help='Full path to the glslc shader compiler.')
+p.add_argument('--stage', dest='stage')
+p.add_argument('infile', metavar='INFILE')
+
+return p.parse_args()
+
+def open_file(name, mode):
+if name == '-':
+if mode == 'w':
+return sys.stdout
+elif mode == 'r':
+return sys.stdin
+else:
+assert False
+else:
+return open(name, mode)
+
+args = parse_args()
+outfname = args.outfile
+glslc = args.glslc
+
+shader = Shader(args.stage, args.infile)
+shader.compile()
+
+with open_file(outfname, 'w') as outfile:
+

Re: [Piglit] [PATCH] tox: stick to pytest 3.2.5

2017-12-18 Thread Juan A. Suarez Romero
I've sent this patch twice. Apologies.


J.A.

On Mon, 2017-12-18 at 13:45 +0100, Juan A. Suarez Romero wrote:
> Newer pytest versions (>=3.3.) require new versions of PythonSix
> (>=1.10.0).
> 
> We want to keep the current PythonSix version required by piglit.
> 
> So le'ts keep using a pytest version that doesn't force us to increase
> PythonSix.
> ---
>  tox.ini | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tox.ini b/tox.ini
> index c1b7a0104..12e8abd9f 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -20,7 +20,7 @@ deps =
>  py27-accel-nix: backports.lzma
>  py27-accel-nix: subprocess32
>  py{35,36}: mako==1.0.2
> -pytest>=3.0.3
> +pytest==3.2.5
>  pytest-mock
>  pytest-pythonpath
>  pytest-raises
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] tox: stick to pytest 3.2.5

2017-12-18 Thread Juan A. Suarez Romero
Newer pytest versions (>=3.3.) require new versions of PythonSix
(>=1.10.0).

We want to keep the current PythonSix version required by piglit.

So le'ts keep using a pytest version that doesn't force us to increase
PythonSix.
---
 tox.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tox.ini b/tox.ini
index c1b7a0104..12e8abd9f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -20,7 +20,7 @@ deps =
 py27-accel-nix: backports.lzma
 py27-accel-nix: subprocess32
 py{35,36}: mako==1.0.2
-pytest>=3.0.3
+pytest==3.2.5
 pytest-mock
 pytest-pythonpath
 pytest-raises
-- 
2.14.3

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


[Piglit] [PATCH] tox: stick to pytest 3.2.5

2017-12-18 Thread Juan A. Suarez Romero
Newer pytest versions (>=3.3.) require new versions of PythonSix
(>=1.10.0).

We want to keep the current PythonSix version required by piglit.

So le'ts keep using a pytest version that doesn't force us to increase
PythonSix.
---
 tox.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tox.ini b/tox.ini
index c1b7a0104..12e8abd9f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -20,7 +20,7 @@ deps =
 py27-accel-nix: backports.lzma
 py27-accel-nix: subprocess32
 py{35,36}: mako==1.0.2
-pytest>=3.0.3
+pytest==3.2.5
 pytest-mock
 pytest-pythonpath
 pytest-raises
-- 
2.14.3

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


Re: [Piglit] [PATCH 1/2] tox: use six >= 1.10.0

2017-12-18 Thread Juan A. Suarez Romero
On Fri, 2017-12-15 at 11:57 +0100, Juan A. Suarez Romero wrote:

I've been talking with Andres about this series.

The thing is that in tox.ini we ask for pytest>=3.0.3. And the latest
version, 3.3.1, comes with a couple of drawbacks:

- It doesn't work with python 3.3.
- It doesn't work with PythonSix 1.5.2 (it requires 1.10.0 or greater).


The patches in the series just remove support for python 3.3 and bump
up PythonSix version to 1.10.0


But actually, we want to keep the current PythonSix version, and also
be able to test with python3.3, as piglit can be used with python3.3.

Hence, we agreed it is better to test using pyttest<3.3.1, and forget
about this series.

I'll send a new version to fix this issue.


> ---
>  tox.ini | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tox.ini b/tox.ini
> index c1b7a0104..2bd99f544 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -27,7 +27,7 @@ deps =
>  pytest-warnings
>  pytest-timeout
>  py{27,33,34}: mako==0.8.0
> -six==1.5.2
> +six>=1.10.0
>  {accel,noaccel,streams}: jsonschema
>  streams: jsonstreams>=0.4.1
>  commands = 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] tox: pytest requires python != 3.3

2017-12-18 Thread Andres Gomez
The message should state why we do this.

The reason is that python3.3 is not supported any more by the installed
 3.3.1 version of pytest, since we don't force a maximum version any
more after 2b0a9cc7a.

On Fri, 2017-12-15 at 11:57 +0100, Juan A. Suarez Romero wrote:
> Let's remove python3.3 support.
> ---
>  .travis.yml | 2 --
>  tox.ini | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 1d6c954f5..5e6011f6d 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -4,8 +4,6 @@ matrix:
>include:
>  - python: 2.7
>env: TOX_ENV="py27-{noaccel,accel-nix,streams}"
> -- python: 3.3
> -  env: TOX_ENV="py33-{noaccel,accel-nix,streams}"
>  - python: 3.4
>env: TOX_ENV="py34-{noaccel,accel-nix,streams}"
>  - python: 3.5
> diff --git a/tox.ini b/tox.ini
> index 2bd99f544..562095a12 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -1,5 +1,5 @@
>  [tox]
> -envlist = py{27,33,34,35,36}-{generator,noaccel}, 
> py{27,33,34,35,36}-accel-{win,nix}, py{27,33,34,35,36}-streams
> +envlist = py{27,34,35,36}-{generator,noaccel}, 
> py{27,34,35,36}-accel-{win,nix}, py{27,34,35,36}-streams
>  skipsdist = True
>  
>  [pytest]
> @@ -16,7 +16,7 @@ deps =
>  accel: simplejson
>  generator: numpy==1.7.0
>  mock==1.0.1
> -py27-accel-nix,py{33,34,35,36}-{accel,noaccel}: psutil
> +py27-accel-nix,py{34,35,36}-{accel,noaccel}: psutil
>  py27-accel-nix: backports.lzma
>  py27-accel-nix: subprocess32
>  py{35,36}: mako==1.0.2
-- 
Br,

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


Re: [Piglit] [PATCH 1/2] tox: use six >= 1.10.0

2017-12-18 Thread Andres Gomez
On Fri, 2017-12-15 at 11:57 +0100, Juan A. Suarez Romero wrote:
> ---
>  tox.ini | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tox.ini b/tox.ini
> index c1b7a0104..2bd99f544 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -27,7 +27,7 @@ deps =
>  pytest-warnings
>  pytest-timeout
>  py{27,33,34}: mako==0.8.0
> -six==1.5.2
> +six>=1.10.0

It feels safer to me just to remove the explicit version dependency.
pytest is already demanding a specific minimum version so, if it is
available, it should be already installed in the first place, isn't it?

-- 
Br,

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