Re: [Piglit] [PATCH 0/6] Set of little documentation and code cleanups

2017-12-22 Thread Rhys Kidd
On 21 December 2017 at 23:32, Rhys Kidd  wrote:

> On 21 December 2017 at 23:29, Brian Paul  wrote:
>
>> On 12/20/2017 11:49 PM, Rhys Kidd wrote:
>>
>>> Have been carrying these patches locally for a little while, but rebased
>>> to get
>>> them readdy for upstream given the cleaning up of bugs/ recently.
>>>
>>> Rhys Kidd (6):
>>>ext_framebuffer_object: Fix typo in two copyright blocks
>>>completions/bash: Fix spelling mistakes
>>>completions/bash: Update list of profile completions to match on
>>>README: Fix spelling mistakes
>>>README: Document deqp_gles3.py configuration deprecation
>>>framework: Correct comment typo in piglit.conf.example
>>>
>>>   README | 10 --
>>>   completions/bash/piglit| 23
>>> +++---
>>>   piglit.conf.example|  2 +-
>>>   tests/spec/ext_framebuffer_object/error-handling.c |  2 +-
>>>   tests/spec/ext_framebuffer_object/mipmap.c |  2 +-
>>>   5 files changed, 19 insertions(+), 20 deletions(-)
>>>
>>>
>> For the series, Reviewed-by: Brian Paul 
>>
>> Do you need me to push these for you?
>>
>>
> No need, I've got commit access to piglit to push these with your R-b.
> Thanks.
>
>
Committed to upstream master.

remote: Updating patchwork state for https://patchwork.freedesktop.
org/project/piglit/list/
remote: I: patch #194538 updated using rev 7815f5c8f6e74c441055c47517eb2e
4245cc284a
remote: I: patch #194539 updated using rev 51aa3df653d60bf2109904f8ebf71a
0e89e10b48
remote: I: patch #194540 updated using rev 04eb922d4d9d8bb40b68bb975b42ce
d509d165ae
remote: I: patch #194541 updated using rev 2fe3127f4f3e7b4f346020dcc55c18
0e756961d8
remote: I: patch #194542 updated using rev 7059e7c1c95ab1003683d44bb7f802
a577f1a62f
remote: I: patch #194543 updated using rev 3cfa4346b06cd55b06139bb80021c5
5432c3dc99
remote: I: 6 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/piglit.git
   a081b9519..3cfa4346b  master -> master
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] squash! arb_texture_multisample: stress test of very large textures

2017-12-22 Thread Fabian Bieler
Only limit texture size to 512x512 in quick.py.
---
If you squash this into your test it should only limit the texture size in the 
'quick' profile.

Two nitpicks:
> +   config.khr_no_error_support = PIGLIT_NO_ERRORS;
Isn't it possible for this test to generate GL errors during its attempts to 
create the largest possible texture?

> +   while (width > 1 && height > 1) {
> +   tex = create_texture_max_size(target, intFormat,
> + , , samples);
> +
> +   if (!tex) {
> +   printf("Failed to create MSAA texture\n");
> +   piglit_report_result(PIGLIT_FAIL);
> +   }
> +
> +   fbo = create_fbo(tex, target);
> +   if (!fbo) {
> +   /* texture creation worked, but FBO failed.
> +* Try smaller texture.
> +*/
> +   glDeleteTextures(1, );
> +   if (height >= width) {
> +   height /= 2;
> +   }
> +   else {
> +   width /= 2;
> +   }
> +   }
> +   else {
> +   break;
> +   }
> +   }
In theory it's possible to exit this loop without an fbo. I have no idea if 
there are GL implementations that can't create float fbos, so this might be 
pathological.

Reviewed-by: Fabian Bieler 

 tests/all.py   | 18 +++---
 tests/quick.py | 17 +
 .../spec/arb_texture_multisample/large-float-texture.c |  6 +-
 3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 330bd138e..7306e39e6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1653,18 +1653,14 @@ with profile.test_list.group_manager(
 # Group ARB_texture_multisample
 with profile.test_list.group_manager(
 PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample')) as g:
-# XXX limit texture size to 512x512.  The default (max supported size)
-# can be pretty slow.  Ideally, we should set --texsize in quick.py but
-# I haven't figured out how to make that work.
-size_arg = ['--texsize', '512']
-g(['arb_texture_multisample-large-float-texture'] + size_arg,
-  run_concurrent=False)
-g(['arb_texture_multisample-large-float-texture', '--array'] + size_arg,
-  run_concurrent=False)
-g(['arb_texture_multisample-large-float-texture', '--fp16'] + size_arg,
-  run_concurrent=False)
-g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'] + 
size_arg,
+g(['arb_texture_multisample-large-float-texture'], 'large-float-texture',
   run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'],
+  'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'],
+  'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'],
+  'large-float-texture-array-fp16', run_concurrent=False)
 g(['arb_texture_multisample-minmax'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x71-501x71'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x130-501x130'])
diff --git a/tests/quick.py b/tests/quick.py
index 1a7d674d0..53774e4db 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -68,6 +68,23 @@ with profile.test_list.group_manager(
 with profile.test_list.allow_reassignment:
 g(['ext_texture_env_combine-combine', '--quick'], 
'texture-env-combine')
 
+# Limit texture size to 512x512 for some texture_multisample tests.
+# The default (max supported size) can be pretty slow.
+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'ARB_texture_multisample')) as g:
+with profile.test_list.allow_reassignment:
+size_arg = ['--texsize', '512']
+g(['arb_texture_multisample-large-float-texture'] + size_arg,
+  'large-float-texture', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'] +
+  size_arg, 'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'] +
+  size_arg, 'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array',
+   '--fp16'] + size_arg,
+  'large-float-texture-array-fp16', run_concurrent=False)
+
 # These take too long
 profile.filters.append(lambda n, _: '-explosion' not in n)
 profile.filters.append(FilterVsIn())
diff --git a/tests/spec/arb_texture_multisample/large-float-texture.c 
b/tests/spec/arb_texture_multisample/large-float-texture.c
index 7e2db1ac8..7f8baac4e 100644
--- 

[Piglit] [PATCH] arb_texture_multisample: stress test of very large textures

2017-12-22 Thread Brian Paul
Create the largest possible 2D GL_RGBA_32F multisampled texture, load it
with known values the read it back and see if the values match up.

The --array option runs the test with a 2D texture array instead of an
MSAA texture.  There are other options to specify texture size, number of
samples, fp16 and a texel value scale.

Fails with NVIDIA's driver.  See code comments.

Note: The entry in all.py limits the texture size to 512x512 so it runs
in a reasonable amount of time.  Ideally, the texture size should be set
in quick.py instead but I've been unable to make that work.
---
 tests/all.py   |  12 +
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |   1 +
 .../arb_texture_multisample/large-float-texture.c  | 723 +
 3 files changed, 736 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/large-float-texture.c

diff --git a/tests/all.py b/tests/all.py
index 5d90e8f..681e3a0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1651,6 +1651,18 @@ with profile.test_list.group_manager(
 # Group ARB_texture_multisample
 with profile.test_list.group_manager(
 PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample')) as g:
+# XXX limit texture size to 512x512.  The default (max supported size)
+# can be pretty slow.  Ideally, we should set --texsize in quick.py but
+# I haven't figured out how to make that work.
+size_arg = ['--texsize', '512']
+g(['arb_texture_multisample-large-float-texture'] + size_arg,
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'] + size_arg,
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'] + size_arg,
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'] + 
size_arg,
+  run_concurrent=False)
 g(['arb_texture_multisample-minmax'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x71-501x71'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x130-501x130'])
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index a347143..31965c4 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (arb_texture_multisample-large-float-texture 
large-float-texture.c)
 piglit_add_executable (arb_texture_multisample-minmax minmax.c)
 piglit_add_executable (arb_texture_multisample-errors errors.c)
 piglit_add_executable (arb_texture_multisample-fb-completeness 
fb-completeness.c)
diff --git a/tests/spec/arb_texture_multisample/large-float-texture.c 
b/tests/spec/arb_texture_multisample/large-float-texture.c
new file mode 100644
index 000..7e2db1a
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/large-float-texture.c
@@ -0,0 +1,723 @@
+/*
+ * Copyright (c) 2017 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/** @file large-float-texture.c
+ *
+ * Test large MSAA float textures.  In particular, create/load a multisample
+ * texture then read it back and compare returned values.
+ * Also support array textures instead of MSAA as a sanity check / debug
+ * option.
+ *
+ * With some GPUs/drivers it appears that some sort of texture compression
+ * is used with MSAA textures which cross a certain threshold of sample/pixel
+ * or total memory size.  NVIDIA, for example fails this test for 16 or 32
+ * samples or textures > approx 2GB.  Perhaps the test tolerance should be
+ * loosened up.
+ *
+ * See code for command line arguments.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 30;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+   

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


[Piglit] [v4 10/11] ext_memory_object: Add helper for image type support

2017-12-22 Thread Topi Pohjolainen
v2:
- use VkPhysicalDeviceExternalImageFormatInfoKHR (Fredrik)
- use VkExternalImageFormatPropertiesKHR and check for
  VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR (Fredrik)
- pass usage, handle type and the expected feature as args
  (Fredrik)

CC: Fredrik Hoeglund 

Signed-off-by: Topi Pohjolainen 
---
 tests/spec/ext_memory_object/common.c| 39 
 tests/spec/ext_memory_object/common.h|  7 ++
 tests/spec/ext_memory_object/vk_common.c | 15 
 tests/spec/ext_memory_object/vk_common.h |  3 +++
 4 files changed, 64 insertions(+)

diff --git a/tests/spec/ext_memory_object/common.c 
b/tests/spec/ext_memory_object/common.c
index b07a8fcb0..246260fae 100644
--- a/tests/spec/ext_memory_object/common.c
+++ b/tests/spec/ext_memory_object/common.c
@@ -141,3 +141,42 @@ create_tex_from_vk_dev_mem(const struct tex_layout *layout,
assert(!"Invalid target");
}
 }
+
+bool
+is_layout_supported(struct vk_core *core,
+   const struct vk_image_layout *layout,
+   VkImageUsageFlagBits usage,
+   VkExternalMemoryHandleTypeFlagBitsKHR handle_type,
+   VkExternalMemoryFeatureFlagBitsKHR feature_needed)
+{
+   const VkPhysicalDeviceExternalImageFormatInfoKHR ext_format_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR,
+   .handleType = handle_type
+   };
+   const VkPhysicalDeviceImageFormatInfo2KHR info = {
+   .sType = 
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR,
+   .pNext = _format_info,
+   .format = layout->src_format,
+   .type = vk_get_image_type(layout->h, layout->z),
+   .tiling = layout->src_tiling,
+   .usage = usage,
+   };
+   VkExternalImageFormatPropertiesKHR ext_img_prop = {
+   .sType = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR
+   };
+   VkImageFormatProperties2KHR props = {
+   .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR,
+   .pNext = _img_prop,
+   };
+   PFN_vkGetPhysicalDeviceImageFormatProperties2KHR
+   vk_phys_dev_img_fmt_prop_2_khr =
+   vk_get_proc_addr_for_phys_dev_image_format_prop(
+   core->dev);
+
+   if (vk_phys_dev_img_fmt_prop_2_khr(
+   core->phys_dev, , ) != VK_SUCCESS)
+   return false;
+
+   return ext_img_prop.externalMemoryProperties.externalMemoryFeatures &
+  feature_needed;
+}
diff --git a/tests/spec/ext_memory_object/common.h 
b/tests/spec/ext_memory_object/common.h
index 240c305e8..993e225b9 100644
--- a/tests/spec/ext_memory_object/common.h
+++ b/tests/spec/ext_memory_object/common.h
@@ -44,4 +44,11 @@ void
 create_tex_from_vk_dev_mem(const struct tex_layout *layout,
   GLuint mem_obj, unsigned offset, GLuint *tex);
 
+bool
+is_layout_supported(struct vk_core *core,
+   const struct vk_image_layout *layout,
+   VkImageUsageFlagBits usage,
+   VkExternalMemoryHandleTypeFlagBitsKHR handle_type,
+   VkExternalMemoryFeatureFlagBitsKHR feature_needed);
+
 #endif
diff --git a/tests/spec/ext_memory_object/vk_common.c 
b/tests/spec/ext_memory_object/vk_common.c
index f8dea7b6e..5d32d850d 100644
--- a/tests/spec/ext_memory_object/vk_common.c
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -598,6 +598,21 @@ vk_get_proc_addr_for_mem_fd(VkDevice dev)
return get_fd;
 }
 
+PFN_vkGetPhysicalDeviceImageFormatProperties2KHR
+vk_get_proc_addr_for_phys_dev_image_format_prop(VkDevice dev)
+{
+   static PFN_vkGetPhysicalDeviceImageFormatProperties2KHR
+   get_prop = NULL;
+
+   if (get_prop == NULL)
+   get_prop = (PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)
+   vkGetDeviceProcAddr(
+   dev,
+   "vkGetPhysicalDeviceImageFormatProperties2KHR");
+
+   return get_prop;
+}
+
 void
 vk_create_simple_pipeline(struct vk_core *core,
  const struct vk_image_layout *layout,
diff --git a/tests/spec/ext_memory_object/vk_common.h 
b/tests/spec/ext_memory_object/vk_common.h
index 0efccf37a..3f1e70255 100644
--- a/tests/spec/ext_memory_object/vk_common.h
+++ b/tests/spec/ext_memory_object/vk_common.h
@@ -160,6 +160,9 @@ vk_get_proc_addr_for_image_mem_req(VkDevice dev);
 PFN_vkGetMemoryFdKHR
 vk_get_proc_addr_for_mem_fd(VkDevice dev);
 
+PFN_vkGetPhysicalDeviceImageFormatProperties2KHR
+vk_get_proc_addr_for_phys_dev_image_format_prop(VkDevice dev);
+
 void
 vk_create_simple_pipeline(struct vk_core *core,
  const struct vk_image_layout *layout,
-- 
2.14.1

___

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

2017-12-22 Thread Topi Pohjolainen
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)

v4:
- check also memoryTypeBits and
  VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT (Andres)
- unify allocation code paths (Andres)

CC: Andres Rodriguez 
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 | 340 +++
 3 files changed, 406 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 164b61108..916ec44a5 100644
--- a/tests/spec/ext_memory_object/vk_common.c
+++ b/tests/spec/ext_memory_object/vk_common.c
@@ -572,3 +572,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..31e746dd6
--- /dev/null
+++ b/tests/spec/ext_memory_object/vk_fb.c
@@ -0,0 +1,340 @@
+/*
+ * 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