tests: Add begining of render test
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d731549..b0e576b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -3,7 +3,8 @@
     )
 
 SET(COMMON_CPP
-   xglgpu.cpp
+    xglgpu.cpp
+    xgldevice.cpp
    )
 
 include_directories(
@@ -25,6 +26,12 @@
    COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
 target_link_libraries(xgl_image_tests XGL gtest gtest_main)
 
+add_executable(xgl_render_tests render_tests.cpp ${COMMON_CPP})
+set_target_properties(xgl_render_tests
+   PROPERTIES
+   COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
+target_link_libraries(xgl_render_tests XGL gtest gtest_main)
+
 target_link_libraries(xglinfo XGL)
 
 add_subdirectory(gtest-1.7.0)
diff --git a/tests/image_tests.cpp b/tests/image_tests.cpp
index 1eee8a6..6192c64 100644
--- a/tests/image_tests.cpp
+++ b/tests/image_tests.cpp
@@ -61,20 +61,20 @@
 #include <xgl.h>
 #include "gtest-1.7.0/include/gtest/gtest.h"
 
-// #include "gtest/gtest.h"
-#include "xglgpu.h"
+#include "xgldevice.h"
 
 class XglImageTest : public ::testing::Test {
 public:
-    XglGpu *gpu;
     void CreateImage(XGL_UINT w, XGL_UINT h);
     void DestroyImage();
 
     void CreateImageView(XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo,
                          XGL_IMAGE_VIEW* pView);
     void DestroyImageView(XGL_IMAGE_VIEW imageView);
+    XGL_DEVICE device() {return m_device->device();}
 
 protected:
+    XglDevice *m_device;
     XGL_APPLICATION_INFO app_info;
     XGL_PHYSICAL_GPU objs[MAX_GPUS];
     XGL_UINT gpu_count;
@@ -97,7 +97,7 @@
         ASSERT_XGL_SUCCESS(err);
         ASSERT_GE(1, this->gpu_count) << "No GPU available";
 
-        this->gpu = new XglGpu(0, objs[0]);
+        this->m_device = new XglDevice(0, objs[0]);
     }
 
     virtual void TearDown() {
@@ -138,7 +138,7 @@
      * fixed structure.
      */
 
-    err = xglGetFormatInfo(this->gpu->device(), fmt,
+    err = xglGetFormatInfo(this->device(), fmt,
                            XGL_INFO_TYPE_FORMAT_PROPERTIES,
                            &size, &image_fmt);
     ASSERT_XGL_SUCCESS(err);
@@ -185,7 +185,7 @@
     //        XGL_DEVICE                                  device,
     //        const XGL_IMAGE_CREATE_INFO*                pCreateInfo,
     //        XGL_IMAGE*                                  pImage);
-    err = xglCreateImage(this->gpu->device(), &imageCreateInfo, &m_image);
+    err = xglCreateImage(device(), &imageCreateInfo, &m_image);
     ASSERT_XGL_SUCCESS(err);
 
     XGL_MEMORY_REQUIREMENTS mem_req;
@@ -210,7 +210,7 @@
     memcpy(mem_info.heaps, mem_req.heaps, sizeof(XGL_UINT)*XGL_MAX_MEMORY_HEAPS);
     mem_info.memPriority = XGL_MEMORY_PRIORITY_NORMAL;
     mem_info.flags = XGL_MEMORY_ALLOC_SHAREABLE_BIT;
-    err = xglAllocMemory(this->gpu->device(), &mem_info, &m_image_mem);
+    err = xglAllocMemory(device(), &mem_info, &m_image_mem);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglBindObjectMemory(image, m_image_mem, 0);
@@ -231,7 +231,7 @@
                                    XGL_IMAGE_VIEW *pView)
 {
     pCreateInfo->image = this->m_image;
-    ASSERT_XGL_SUCCESS(xglCreateImageView(gpu->device(), pCreateInfo, pView));
+    ASSERT_XGL_SUCCESS(xglCreateImageView(device(), pCreateInfo, pView));
 }
 
 void XglImageTest::DestroyImageView(XGL_IMAGE_VIEW imageView)
diff --git a/tests/init.cpp b/tests/init.cpp
index f6fb75e..b0de580 100644
--- a/tests/init.cpp
+++ b/tests/init.cpp
@@ -61,18 +61,20 @@
 #include <xgl.h>
 #include "gtest-1.7.0/include/gtest/gtest.h"
 
-#include "xglgpu.h"
+#include "xgldevice.h"
 #include "shader_il.h"
 
 class XglTest : public ::testing::Test {
 public:
-    XglGpu *gpu;
     void CreateImageTest();
 
+    XGL_DEVICE device() {return m_device->device();}
+
 protected:
     XGL_APPLICATION_INFO app_info;
     XGL_PHYSICAL_GPU objs[MAX_GPUS];
     XGL_UINT gpu_count;
+    XglDevice *m_device;
 
     virtual void SetUp() {
         XGL_RESULT err;
@@ -90,7 +92,7 @@
         ASSERT_XGL_SUCCESS(err);
         ASSERT_GE(1, this->gpu_count) << "No GPU available";
 
-        this->gpu = new XglGpu(0, objs[0]);
+        this->m_device = new XglDevice(0, objs[0]);
     }
 
     virtual void TearDown() {
@@ -142,7 +144,7 @@
     // TODO: Try variety of memory priorities
     alloc_info.memPriority = XGL_MEMORY_PRIORITY_NORMAL;
 
-    err = xglAllocMemory(this->gpu->device(), &alloc_info, &gpu_mem);
+    err = xglAllocMemory(device(), &alloc_info, &gpu_mem);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglMapMemory(gpu_mem, 0, (XGL_VOID **) &pData);
@@ -174,7 +176,7 @@
     memset(&event_info, 0, sizeof(event_info));
     event_info.sType = XGL_STRUCTURE_TYPE_EVENT_CREATE_INFO;
 
-    err = xglCreateEvent(this->gpu->device(), &event_info, &event);
+    err = xglCreateEvent(device(), &event_info, &event);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglGetObjectInfo(event, XGL_INFO_TYPE_MEMORY_REQUIREMENTS,
@@ -198,7 +200,7 @@
     memcpy(mem_info.heaps, mem_req.heaps, sizeof(XGL_UINT)*XGL_MAX_MEMORY_HEAPS);
     mem_info.memPriority = XGL_MEMORY_PRIORITY_NORMAL;
     mem_info.flags = XGL_MEMORY_ALLOC_SHAREABLE_BIT;
-    err = xglAllocMemory(this->gpu->device(), &mem_info, &event_mem);
+    err = xglAllocMemory(device(), &mem_info, &event_mem);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglBindObjectMemory(event, event_mem, 0);
@@ -240,7 +242,7 @@
     //                XGL_FLAGS                               flags;      // Reserved
     fence_info.sType = XGL_STRUCTURE_TYPE_FENCE_CREATE_INFO;
 
-    err = xglCreateFence(this->gpu->device(), &fence_info, &fence);
+    err = xglCreateFence(device(), &fence_info, &fence);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglGetFenceStatus(fence);
@@ -255,7 +257,7 @@
     //            const XGL_FENCE*                            pFences,
     //            XGL_BOOL                                    waitAll,
     //            XGL_UINT64                                  timeout);
-    err = xglWaitForFences(this->gpu->device(), 1, &fence, XGL_TRUE, 0);
+    err = xglWaitForFences(device(), 1, &fence, XGL_TRUE, 0);
     EXPECT_EQ(XGL_ERROR_UNAVAILABLE, err);
 
     // TODO: Attached to command buffer and test GetFenceStatus
@@ -306,7 +308,7 @@
     //            const XGL_QUERY_POOL_CREATE_INFO*           pCreateInfo,
     //            XGL_QUERY_POOL*                             pQueryPool);
 
-    err = xglCreateQueryPool(this->gpu->device(), &query_info, &query_pool);
+    err = xglCreateQueryPool(device(), &query_info, &query_pool);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglGetObjectInfo(query_pool, XGL_INFO_TYPE_MEMORY_REQUIREMENTS,
@@ -333,7 +335,7 @@
     // TODO: are the flags right?
     // TODO: Should this be pinned? Or maybe a separate test with pinned.
     mem_info.flags = XGL_MEMORY_ALLOC_SHAREABLE_BIT;
-    err = xglAllocMemory(this->gpu->device(), &mem_info, &query_mem);
+    err = xglAllocMemory(device(), &mem_info, &query_mem);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglBindObjectMemory(query_pool, query_mem, 0);
@@ -368,14 +370,14 @@
     ASSERT_XGL_SUCCESS(err);
 }
 
-void getQueue(XglGpu *gpu, XGL_QUEUE_TYPE qtype, const char *qname)
+void getQueue(XglDevice *device, XGL_QUEUE_TYPE qtype, const char *qname)
 {
     int que_idx;
     XGL_RESULT err;
     XGL_QUEUE queue;
 
-    for (que_idx = 0; que_idx < gpu->queue_props->queueCount; que_idx++) {
-        err = xglGetDeviceQueue(gpu->device(), qtype, que_idx, &queue);
+    for (que_idx = 0; que_idx < device->queue_props->queueCount; que_idx++) {
+        err = xglGetDeviceQueue(device->device(), qtype, que_idx, &queue);
         ASSERT_EQ(XGL_SUCCESS, err) << "xglGetDeviceQueue: " << qname << " queue #" << que_idx << ": Failed with error: " << xgl_result_string(err);
     }
 }
@@ -384,7 +386,7 @@
 {
     XGL_UINT que_idx;
 
-    ASSERT_NE(0, gpu->queue_props->queueCount) << "No heaps available for GPU #" << gpu->id << ": " << gpu->props.gpuName;
+    ASSERT_NE(0, m_device->queue_props->queueCount) << "No heaps available for GPU #" << m_device->id << ": " << m_device->props.gpuName;
 
 //            XGL_RESULT XGLAPI xglGetDeviceQueue(
 //                XGL_DEVICE                                  device,
@@ -400,7 +402,7 @@
      * starting at zero.
      */
 
-    for (que_idx = 0; que_idx < gpu->queue_props->queueCount; que_idx++) {
+    for (que_idx = 0; que_idx < m_device->queue_props->queueCount; que_idx++) {
 
 //                typedef enum _XGL_QUEUE_FLAGS
 //                {
@@ -418,16 +420,16 @@
 //                    XGL_MAX_ENUM(_XGL_QUEUE_TYPE)
 //                } XGL_QUEUE_TYPE;
 
-        if (gpu->queue_props->queueFlags & XGL_QUEUE_GRAPHICS_BIT) {
-            getQueue(gpu, XGL_QUEUE_TYPE_GRAPHICS, "Graphics");
+        if (m_device->queue_props->queueFlags & XGL_QUEUE_GRAPHICS_BIT) {
+            getQueue(m_device, XGL_QUEUE_TYPE_GRAPHICS, "Graphics");
         }
 
-        if (gpu->queue_props->queueFlags & XGL_QUEUE_COMPUTE_BIT) {
-            getQueue(gpu, XGL_QUEUE_TYPE_GRAPHICS, "Compute");
+        if (m_device->queue_props->queueFlags & XGL_QUEUE_COMPUTE_BIT) {
+            getQueue(m_device, XGL_QUEUE_TYPE_GRAPHICS, "Compute");
         }
 
-        if (gpu->queue_props->queueFlags & XGL_QUEUE_DMA_BIT) {
-            getQueue(gpu, XGL_QUEUE_TYPE_GRAPHICS, "DMA");
+        if (m_device->queue_props->queueFlags & XGL_QUEUE_DMA_BIT) {
+            getQueue(m_device, XGL_QUEUE_TYPE_GRAPHICS, "DMA");
         }
 
         // TODO: What do we do about EXTENDED_BIT?
@@ -476,7 +478,7 @@
      * fixed structure.
      */
 
-    err = xglGetFormatInfo(this->gpu->device(), fmt,
+    err = xglGetFormatInfo(device(), fmt,
                            XGL_INFO_TYPE_FORMAT_PROPERTIES,
                            &size, &image_fmt);
     ASSERT_XGL_SUCCESS(err);
@@ -523,7 +525,7 @@
 //        XGL_DEVICE                                  device,
 //        const XGL_IMAGE_CREATE_INFO*                pCreateInfo,
 //        XGL_IMAGE*                                  pImage);
-    err = xglCreateImage(this->gpu->device(), &imageCreateInfo, &image);
+    err = xglCreateImage(device(), &imageCreateInfo, &image);
     ASSERT_XGL_SUCCESS(err);
 
     // Verify image resources
@@ -599,7 +601,7 @@
     memcpy(mem_info.heaps, mem_req.heaps, sizeof(XGL_UINT)*XGL_MAX_MEMORY_HEAPS);
     mem_info.memPriority = XGL_MEMORY_PRIORITY_NORMAL;
     mem_info.flags = XGL_MEMORY_ALLOC_SHAREABLE_BIT;
-    err = xglAllocMemory(this->gpu->device(), &mem_info, &image_mem);
+    err = xglAllocMemory(device(), &mem_info, &image_mem);
     ASSERT_XGL_SUCCESS(err);
 
     err = xglBindObjectMemory(image, image_mem, 0);
@@ -639,7 +641,7 @@
 //        const XGL_IMAGE_VIEW_CREATE_INFO*           pCreateInfo,
 //        XGL_IMAGE_VIEW*                             pView);
 
-    err = xglCreateImageView(gpu->device(), &viewInfo, &view);
+    err = xglCreateImageView(device(), &viewInfo, &view);
     ASSERT_XGL_SUCCESS(err) << "xglCreateImageView failed";
 
     // TODO: Test image memory.
@@ -690,7 +692,7 @@
     createInfo.pCode = code;
     createInfo.codeSize = codeSize;
     createInfo.flags = 0;
-    err = xglCreateShader(gpu->device(), &createInfo, &shader);
+    err = xglCreateShader(device(), &createInfo, &shader);
     ASSERT_XGL_SUCCESS(err);
 
     ASSERT_XGL_SUCCESS(xglDestroyObject(shader));
diff --git a/tests/render_tests.cpp b/tests/render_tests.cpp
new file mode 100644
index 0000000..349117f
--- /dev/null
+++ b/tests/render_tests.cpp
@@ -0,0 +1,293 @@
+// Copyright 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+//  XGL tests
+//
+//  Copyright (C) 2014 LunarG, 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 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.
+
+
+// Basic rendering tests
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <xgl.h>
+#include "gtest-1.7.0/include/gtest/gtest.h"
+
+#include "xgldevice.h"
+
+class XglRenderTest : public ::testing::Test {
+public:
+    void CreateImage(XGL_UINT w, XGL_UINT h);
+    void DestroyImage();
+
+    void CreateImageView(XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo,
+                         XGL_IMAGE_VIEW* pView);
+    void DestroyImageView(XGL_IMAGE_VIEW imageView);
+    XGL_DEVICE device() {return m_device->device();}
+
+protected:
+    XGL_APPLICATION_INFO app_info;
+    XGL_PHYSICAL_GPU objs[MAX_GPUS];
+    XGL_UINT gpu_count;
+    XGL_IMAGE m_image;
+    XGL_GPU_MEMORY m_image_mem;
+    XglDevice *m_device;
+
+    virtual void SetUp() {
+        XGL_RESULT err;
+
+        this->app_info.sType = XGL_STRUCTURE_TYPE_APPLICATION_INFO;
+        this->app_info.pNext = NULL;
+        this->app_info.pAppName = (const XGL_CHAR *) "base";
+        this->app_info.appVersion = 1;
+        this->app_info.pEngineName = (const XGL_CHAR *) "unittest";
+        this->app_info.engineVersion = 1;
+        this->app_info.apiVersion = XGL_MAKE_VERSION(0, 22, 0);
+
+        err = xglInitAndEnumerateGpus(&app_info, NULL,
+                                      MAX_GPUS, &this->gpu_count, objs);
+        ASSERT_XGL_SUCCESS(err);
+        ASSERT_GE(1, this->gpu_count) << "No GPU available";
+
+        m_device = new XglDevice(0, objs[0]);
+        m_device->get_device_queue();
+    }
+
+    virtual void TearDown() {
+        xglInitAndEnumerateGpus(&this->app_info, XGL_NULL_HANDLE, 0, &gpu_count, XGL_NULL_HANDLE);
+    }
+};
+
+
+void XglRenderTest::CreateImage(XGL_UINT w, XGL_UINT h)
+{
+    XGL_RESULT err;
+    XGL_IMAGE image;
+    XGL_UINT mipCount;
+    XGL_SIZE size;
+    XGL_FORMAT fmt;
+    XGL_FORMAT_PROPERTIES image_fmt;
+
+    mipCount = 0;
+
+    XGL_UINT _w = w;
+    XGL_UINT _h = h;
+    while( ( _w > 0 ) || ( _h > 0 ) )
+    {
+        _w >>= 1;
+        _h >>= 1;
+        mipCount++;
+    }
+
+    fmt.channelFormat = XGL_CH_FMT_R8G8B8A8;
+    fmt.numericFormat = XGL_NUM_FMT_UINT;
+    // TODO: Pick known good format rather than just expect common format
+    /*
+     * XXX: What should happen if given NULL HANDLE for the pData argument?
+     * We're not requesting XGL_INFO_TYPE_MEMORY_REQUIREMENTS so there is
+     * an expectation that pData is a valid pointer.
+     * However, why include a returned size value? That implies that the
+     * amount of data may vary and that doesn't work well for using a
+     * fixed structure.
+     */
+
+    err = xglGetFormatInfo(this->m_device->device(), fmt,
+                           XGL_INFO_TYPE_FORMAT_PROPERTIES,
+                           &size, &image_fmt);
+    ASSERT_XGL_SUCCESS(err);
+
+    //    typedef struct _XGL_IMAGE_CREATE_INFO
+    //    {
+    //        XGL_STRUCTURE_TYPE                      sType;                      // Must be XGL_STRUCTURE_TYPE_IMAGE_CREATE_INFO
+    //        const XGL_VOID*                         pNext;                      // Pointer to next structure.
+    //        XGL_IMAGE_TYPE                          imageType;
+    //        XGL_FORMAT                              format;
+    //        XGL_EXTENT3D                            extent;
+    //        XGL_UINT                                mipLevels;
+    //        XGL_UINT                                arraySize;
+    //        XGL_UINT                                samples;
+    //        XGL_IMAGE_TILING                        tiling;
+    //        XGL_FLAGS                               usage;                      // XGL_IMAGE_USAGE_FLAGS
+    //        XGL_FLAGS                               flags;                      // XGL_IMAGE_CREATE_FLAGS
+    //    } XGL_IMAGE_CREATE_INFO;
+
+
+    XGL_IMAGE_CREATE_INFO imageCreateInfo = {};
+    imageCreateInfo.sType = XGL_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
+    imageCreateInfo.imageType = XGL_IMAGE_2D;
+    imageCreateInfo.format = fmt;
+    imageCreateInfo.arraySize = 1;
+    imageCreateInfo.extent.width = w;
+    imageCreateInfo.extent.height = h;
+    imageCreateInfo.extent.depth = 1;
+    imageCreateInfo.mipLevels = mipCount;
+    imageCreateInfo.samples = 1;
+    imageCreateInfo.tiling = XGL_LINEAR_TILING;
+
+    // Image usage flags
+    //    typedef enum _XGL_IMAGE_USAGE_FLAGS
+    //    {
+    //        XGL_IMAGE_USAGE_SHADER_ACCESS_READ_BIT                  = 0x00000001,
+    //        XGL_IMAGE_USAGE_SHADER_ACCESS_WRITE_BIT                 = 0x00000002,
+    //        XGL_IMAGE_USAGE_COLOR_ATTACHMENT_BIT                    = 0x00000004,
+    //        XGL_IMAGE_USAGE_DEPTH_STENCIL_BIT                       = 0x00000008,
+    //    } XGL_IMAGE_USAGE_FLAGS;
+    imageCreateInfo.usage = XGL_IMAGE_USAGE_SHADER_ACCESS_WRITE_BIT | XGL_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+
+    //    XGL_RESULT XGLAPI xglCreateImage(
+    //        XGL_DEVICE                                  device,
+    //        const XGL_IMAGE_CREATE_INFO*                pCreateInfo,
+    //        XGL_IMAGE*                                  pImage);
+    err = xglCreateImage(device(), &imageCreateInfo, &m_image);
+    ASSERT_XGL_SUCCESS(err);
+
+    XGL_MEMORY_REQUIREMENTS mem_req;
+    XGL_UINT data_size;
+    err = xglGetObjectInfo(image, XGL_INFO_TYPE_MEMORY_REQUIREMENTS,
+                           &data_size, &mem_req);
+    ASSERT_XGL_SUCCESS(err);
+    ASSERT_EQ(data_size, sizeof(mem_req));
+    ASSERT_NE(0, mem_req.size) << "xglGetObjectInfo (Event): Failed - expect images to require memory";
+
+    //        XGL_RESULT XGLAPI xglAllocMemory(
+    //            XGL_DEVICE                                  device,
+    //            const XGL_MEMORY_ALLOC_INFO*                pAllocInfo,
+    //            XGL_GPU_MEMORY*                             pMem);
+    XGL_MEMORY_ALLOC_INFO mem_info;
+
+    memset(&mem_info, 0, sizeof(mem_info));
+    mem_info.sType = XGL_STRUCTURE_TYPE_MEMORY_ALLOC_INFO;
+    mem_info.allocationSize = mem_req.size;
+    mem_info.alignment = mem_req.alignment;
+    mem_info.heapCount = mem_req.heapCount;
+    memcpy(mem_info.heaps, mem_req.heaps, sizeof(XGL_UINT)*XGL_MAX_MEMORY_HEAPS);
+    mem_info.memPriority = XGL_MEMORY_PRIORITY_NORMAL;
+    mem_info.flags = XGL_MEMORY_ALLOC_SHAREABLE_BIT;
+    err = xglAllocMemory(device(), &mem_info, &m_image_mem);
+    ASSERT_XGL_SUCCESS(err);
+
+    err = xglBindObjectMemory(image, m_image_mem, 0);
+    ASSERT_XGL_SUCCESS(err);
+}
+
+void XglRenderTest::DestroyImage()
+{
+    // All done with image memory, clean up
+    ASSERT_XGL_SUCCESS(xglBindObjectMemory(m_image, XGL_NULL_HANDLE, 0));
+
+    ASSERT_XGL_SUCCESS(xglFreeMemory(m_image_mem));
+
+    ASSERT_XGL_SUCCESS(xglDestroyObject(m_image));
+}
+
+void XglRenderTest::CreateImageView(XGL_IMAGE_VIEW_CREATE_INFO *pCreateInfo,
+                                   XGL_IMAGE_VIEW *pView)
+{
+    pCreateInfo->image = this->m_image;
+    ASSERT_XGL_SUCCESS(xglCreateImageView(device(), pCreateInfo, pView));
+}
+
+void XglRenderTest::DestroyImageView(XGL_IMAGE_VIEW imageView)
+{
+    ASSERT_XGL_SUCCESS(xglDestroyObject(imageView));
+}
+
+TEST_F(XglRenderTest, DrawTriangleTest) {
+    XGL_FORMAT fmt;
+    XGL_IMAGE_VIEW imageView;
+    XGL_RESULT err;
+
+    fmt.channelFormat = XGL_CH_FMT_R8G8B8A8;
+    fmt.numericFormat = XGL_NUM_FMT_UINT;
+
+    CreateImage(512, 256);
+
+    //    typedef struct _XGL_IMAGE_VIEW_CREATE_INFO
+    //    {
+    //        XGL_STRUCTURE_TYPE                      sType;                  // Must be XGL_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO
+    //        const XGL_VOID*                         pNext;                  // Pointer to next structure
+    //        XGL_IMAGE                               image;
+    //        XGL_IMAGE_VIEW_TYPE                     viewType;
+    //        XGL_FORMAT                              format;
+    //        XGL_CHANNEL_MAPPING                     channels;
+    //        XGL_IMAGE_SUBRESOURCE_RANGE             subresourceRange;
+    //        XGL_FLOAT                               minLod;
+    //    } XGL_IMAGE_VIEW_CREATE_INFO;
+    XGL_IMAGE_VIEW_CREATE_INFO viewInfo = {};
+    viewInfo.sType = XGL_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
+    viewInfo.viewType = XGL_IMAGE_VIEW_2D;
+    viewInfo.format = fmt;
+
+    viewInfo.channels.r = XGL_CHANNEL_SWIZZLE_R;
+    viewInfo.channels.g = XGL_CHANNEL_SWIZZLE_G;
+    viewInfo.channels.b = XGL_CHANNEL_SWIZZLE_B;
+    viewInfo.channels.a = XGL_CHANNEL_SWIZZLE_A;
+
+    viewInfo.subresourceRange.baseArraySlice = 0;
+    viewInfo.subresourceRange.arraySize = 1;
+    viewInfo.subresourceRange.baseMipLevel = 0;
+    viewInfo.subresourceRange.mipLevels = 1;
+    viewInfo.subresourceRange.aspect = XGL_IMAGE_ASPECT_COLOR;
+
+    //    XGL_RESULT XGLAPI xglCreateImageView(
+    //        XGL_DEVICE                                  device,
+    //        const XGL_IMAGE_VIEW_CREATE_INFO*           pCreateInfo,
+    //        XGL_IMAGE_VIEW*                             pView);
+
+    CreateImageView(&viewInfo, &imageView);
+
+    DestroyImageView(imageView);
+}
+
+int main(int argc, char **argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/tests/xgldevice.cpp b/tests/xgldevice.cpp
new file mode 100644
index 0000000..1a15a53
--- /dev/null
+++ b/tests/xgldevice.cpp
@@ -0,0 +1,84 @@
+#include "xgldevice.h"
+
+XglDevice::XglDevice(XGL_UINT id, XGL_PHYSICAL_GPU obj) :
+    m_flags(0),
+    XglGpu(id, obj)
+{
+    init_device();
+    init_formats();
+}
+
+
+void XglDevice::init_device()
+{
+    XGL_DEVICE_CREATE_INFO info = {};
+    XGL_RESULT err;
+    XGL_SIZE size;
+    XGL_UINT i;
+
+    info.sType = XGL_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
+    info.maxValidationLevel = XGL_VALIDATION_LEVEL_END_RANGE;
+    info.flags = XGL_DEVICE_CREATE_VALIDATION_BIT;
+
+    /* request all queues */
+    info.queueRecordCount = this->queue_count;
+    info.pRequestedQueues = this->queue_reqs;
+
+    /* enable all extensions */
+    info.extensionCount = this->extension_count;
+    info.ppEnabledExtensionNames = this->extensions;
+
+    err = xglCreateDevice(this->gpuObj, &info, &m_xgl_device_object);
+    ASSERT_XGL_SUCCESS(err);
+
+    err = xglGetMemoryHeapCount(m_xgl_device_object, &this->heap_count);
+    ASSERT_XGL_SUCCESS(err);
+    ASSERT_GE(1, this->heap_count) << "No memory heaps available";
+
+    this->heap_props = new XGL_MEMORY_HEAP_PROPERTIES [this->heap_count];
+    ASSERT_TRUE(NULL != this->heap_props) << "Out of memory";
+
+    for (i = 0; i < this->heap_count; i++) {
+        err = xglGetMemoryHeapInfo(m_xgl_device_object, i,
+                                   XGL_INFO_TYPE_MEMORY_HEAP_PROPERTIES,
+                                   &size, &this->heap_props[i]);
+        ASSERT_XGL_SUCCESS(err);
+        ASSERT_EQ(size, sizeof(this->heap_props[0])) << "Invalid heap property size";
+    }
+}
+
+void XglDevice::init_formats()
+{
+    XGL_CHANNEL_FORMAT ch;
+    XGL_NUM_FORMAT num;
+
+    for (int chInt = XGL_CH_FMT_UNDEFINED; chInt < XGL_MAX_CH_FMT; chInt++) {
+        for (int numInt = 0; numInt < XGL_MAX_NUM_FMT; numInt++) {
+            XGL_FORMAT fmt = {};
+            XGL_RESULT err;
+            XGL_SIZE size;
+
+            fmt.channelFormat = static_cast<XGL_CHANNEL_FORMAT>(chInt);
+            fmt.numericFormat = static_cast<XGL_NUM_FORMAT>(numInt);
+
+            err = xglGetFormatInfo(m_xgl_device_object, fmt,
+                                   XGL_INFO_TYPE_FORMAT_PROPERTIES,
+                                   &size, &this->format_props[ch][num]);
+            if (err) {
+                memset(&this->format_props[ch][num], 0,
+                       sizeof(this->format_props[ch][num]));
+            }
+            else if (size != sizeof(this->format_props[ch][num])) {
+                ASSERT_EQ(size, sizeof(this->format_props[ch][num])) << "Incorrect data size";
+            }
+        }
+    }
+}
+
+void XglDevice::get_device_queue()
+{
+    XGL_RESULT err;
+
+    err = xglGetDeviceQueue(this->device(), XGL_QUEUE_TYPE_GRAPHICS, 0, &this->m_queue);
+    ASSERT_XGL_SUCCESS(err) << "xglGetDeviceQueue failed";
+}
diff --git a/tests/xgldevice.h b/tests/xgldevice.h
new file mode 100644
index 0000000..9024ac0
--- /dev/null
+++ b/tests/xgldevice.h
@@ -0,0 +1,21 @@
+#ifndef XGLDEVICE_H
+#define XGLDEVICE_H
+
+#include "xglgpu.h"
+
+class XglDevice : public XglGpu
+{
+public:
+    XglDevice(XGL_UINT id, XGL_PHYSICAL_GPU obj);
+
+    XGL_DEVICE device() {return this->m_xgl_device_object;}
+    void init_formats();
+    void init_device();
+    void get_device_queue();
+
+private:
+    XGL_DEVICE m_xgl_device_object;
+    uint32_t m_flags;
+};
+
+#endif // XGLDEVICE_H
diff --git a/tests/xglgpu.cpp b/tests/xglgpu.cpp
index b459ba3..b8446c5 100644
--- a/tests/xglgpu.cpp
+++ b/tests/xglgpu.cpp
@@ -12,8 +12,6 @@
 
     this->init_gpu();
     this->init_extensions();
-    this->init_device();
-    this->init_formats();
 }
 
 void XglGpu::init_gpu()
@@ -100,69 +98,3 @@
     }
 }
 
-void XglGpu::init_device()
-{
-    XGL_DEVICE_CREATE_INFO info = {};
-    XGL_RESULT err;
-    XGL_SIZE size;
-    XGL_UINT i;
-
-    info.sType = XGL_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
-    info.maxValidationLevel = XGL_VALIDATION_LEVEL_END_RANGE;
-    info.flags = XGL_DEVICE_CREATE_VALIDATION_BIT;
-
-    /* request all queues */
-    info.queueRecordCount = this->queue_count;
-    info.pRequestedQueues = this->queue_reqs;
-
-    /* enable all extensions */
-    info.extensionCount = this->extension_count;
-    info.ppEnabledExtensionNames = this->extensions;
-
-    err = xglCreateDevice(this->gpuObj, &info, &this->m_devObj);
-    ASSERT_XGL_SUCCESS(err);
-
-    err = xglGetMemoryHeapCount(this->m_devObj, &this->heap_count);
-    ASSERT_XGL_SUCCESS(err);
-    ASSERT_GE(1, this->heap_count) << "No memory heaps available";
-
-    this->heap_props = new XGL_MEMORY_HEAP_PROPERTIES [this->heap_count];
-    ASSERT_TRUE(NULL != this->heap_props) << "Out of memory";
-
-    for (i = 0; i < this->heap_count; i++) {
-        err = xglGetMemoryHeapInfo(this->m_devObj, i,
-                                   XGL_INFO_TYPE_MEMORY_HEAP_PROPERTIES,
-                                   &size, &this->heap_props[i]);
-        ASSERT_XGL_SUCCESS(err);
-        ASSERT_EQ(size, sizeof(this->heap_props[0])) << "Invalid heap property size";
-    }
-}
-
-void XglGpu::init_formats()
-{
-    XGL_CHANNEL_FORMAT ch;
-    XGL_NUM_FORMAT num;
-
-    for (int chInt = XGL_CH_FMT_UNDEFINED; chInt < XGL_MAX_CH_FMT; chInt++) {
-        for (int numInt = 0; numInt < XGL_MAX_NUM_FMT; numInt++) {
-            XGL_FORMAT fmt = {};
-            XGL_RESULT err;
-            XGL_SIZE size;
-
-            fmt.channelFormat = static_cast<XGL_CHANNEL_FORMAT>(chInt);
-            fmt.numericFormat = static_cast<XGL_NUM_FORMAT>(numInt);
-
-            err = xglGetFormatInfo(this->m_devObj, fmt,
-                                   XGL_INFO_TYPE_FORMAT_PROPERTIES,
-                                   &size, &this->format_props[ch][num]);
-            if (err) {
-                memset(&this->format_props[ch][num], 0,
-                       sizeof(this->format_props[ch][num]));
-            }
-            else if (size != sizeof(this->format_props[ch][num])) {
-                ASSERT_EQ(size, sizeof(this->format_props[ch][num])) << "Incorrect data size";
-            }
-        }
-    }
-}
-
diff --git a/tests/xglgpu.h b/tests/xglgpu.h
index 6cfbdb3..e2b7cb8 100644
--- a/tests/xglgpu.h
+++ b/tests/xglgpu.h
@@ -15,9 +15,7 @@
     XglGpu(XGL_UINT id, XGL_PHYSICAL_GPU gpuObj);
     void init_gpu();
     void init_extensions();
-    void init_device();
     void init_formats();
-    XGL_DEVICE device() {return this->m_devObj;}
 
     // Do we want to hide/abstract this data?
 // private:
@@ -36,9 +34,7 @@
     XGL_UINT extension_count;
     const XGL_CHAR **extensions;
 
-    // Device info
-    // struct app_dev dev;
-    XGL_DEVICE m_devObj;
+    XGL_QUEUE m_queue;
 
     XGL_UINT heap_count;
     XGL_MEMORY_HEAP_PROPERTIES *heap_props;