tests: fold xglimage.{cpp,h} into xglrenderframework.{cpp,h}
XglImage is a part of the render framework.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index eaeb3ee..75a3b44 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -14,7 +14,6 @@
SET(COMMON_CPP
xgldevice.cpp
- xglimage.cpp
xglrenderframework.cpp
xgltestbinding.cpp
xgltestframework.cpp
diff --git a/tests/render_tests.cpp b/tests/render_tests.cpp
index b195035..7f05d11 100644
--- a/tests/render_tests.cpp
+++ b/tests/render_tests.cpp
@@ -73,7 +73,6 @@
#include "gtest-1.7.0/include/gtest/gtest.h"
#include "xgldevice.h"
-#include "xglimage.h"
#include "icd-bil.h"
#define GLM_FORCE_RADIANS
diff --git a/tests/xgldevice.cpp b/tests/xgldevice.cpp
index 13016c4..a431c91 100644
--- a/tests/xgldevice.cpp
+++ b/tests/xgldevice.cpp
@@ -1,7 +1,7 @@
+#include "xglrenderframework.h"
#include "xgldevice.h"
-#include "xglimage.h"
XglDevice::XglDevice(XGL_UINT id, XGL_PHYSICAL_GPU obj) :
xgl_testing::Device(obj), id(id)
diff --git a/tests/xglimage.cpp b/tests/xglimage.cpp
deleted file mode 100644
index 265529b..0000000
--- a/tests/xglimage.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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.
-
-#include "xglimage.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-#include <iostream>
-#include <fstream>
-using namespace std;
-
-XglImage::XglImage(XglDevice *dev)
-{
- m_device = dev;
- m_imageInfo.view = XGL_NULL_HANDLE;
- m_imageInfo.state = XGL_IMAGE_STATE_UNINITIALIZED_TARGET;
-}
-
-void XglImage::init(XGL_UINT32 w, XGL_UINT32 h,
- XGL_FORMAT fmt, XGL_FLAGS usage,
- XGL_IMAGE_TILING tiling)
-{
- XGL_UINT mipCount;
-
- mipCount = 0;
-
- XGL_UINT _w = w;
- XGL_UINT _h = h;
- while( ( _w > 0 ) || ( _h > 0 ) )
- {
- _w >>= 1;
- _h >>= 1;
- mipCount++;
- }
-
- XGL_IMAGE_CREATE_INFO imageCreateInfo = xgl_testing::Image::create_info();
- imageCreateInfo.imageType = XGL_IMAGE_2D;
- imageCreateInfo.format = fmt;
- imageCreateInfo.extent.width = w;
- imageCreateInfo.extent.height = h;
- imageCreateInfo.mipLevels = mipCount;
- imageCreateInfo.tiling = tiling;
-
- imageCreateInfo.usage = usage;
-
- xgl_testing::Image::init(*m_device, imageCreateInfo);
-
- m_imageInfo.state = XGL_IMAGE_STATE_UNINITIALIZED_TARGET;
-
- XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO createView = {
- XGL_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
- XGL_NULL_HANDLE,
- obj(),
- {XGL_CH_FMT_R8G8B8A8, XGL_NUM_FMT_UNORM},
- 0,
- 0,
- 1
- };
-
- m_targetView.init(*m_device, createView);
-}
-
-XGL_RESULT XglImage::MapMemory(XGL_VOID** ptr)
-{
- *ptr = map();
- return (*ptr) ? XGL_SUCCESS : XGL_ERROR_UNKNOWN;
-}
-
-XGL_RESULT XglImage::UnmapMemory()
-{
- unmap();
- return XGL_SUCCESS;
-}
diff --git a/tests/xglimage.h b/tests/xglimage.h
deleted file mode 100644
index d7119b5..0000000
--- a/tests/xglimage.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// 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.
-
-#ifndef XGLIMAGE_H
-#define XGLIMAGE_H
-
-#include "xgldevice.h"
-
-/**
-*******************************************************************************
-* @brief xglImage class wraps an XGL Image object
-*
-* Use this class to allocate and manage XGL image objects and associated
-* bound memory and views.
-*
-********************************************************************************
-*/
-class XglImage : public xgl_testing::Image
-{
-public:
- XglImage(XglDevice *dev);
-
- // 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;
-public:
- void init( XGL_UINT32 w, XGL_UINT32 h,
- XGL_FORMAT fmt, XGL_FLAGS usage,
- XGL_IMAGE_TILING tiling=XGL_LINEAR_TILING);
-
- // void clear( CommandBuffer*, XGL_UINT[4] );
- // void prepare( CommandBuffer*, XGL_IMAGE_STATE );
-
- void state( XGL_IMAGE_STATE state )
- {
- m_imageInfo.state = state;
- }
- XGL_GPU_MEMORY memory() const
- {
- const std::vector<XGL_GPU_MEMORY> mems = memories();
- return mems.empty() ? XGL_NULL_HANDLE : mems[0];
- }
-
-
- XGL_IMAGE image() const
- {
- return obj();
- }
- XGL_COLOR_ATTACHMENT_VIEW targetView()const
- {
- return m_targetView.obj();
- }
-
- XGL_IMAGE_STATE state() const
- {
- return ( XGL_IMAGE_STATE )m_imageInfo.state;
- }
- XGL_UINT32 width() const
- {
- return extent().width;
- }
- XGL_UINT32 height() const
- {
- return extent().height;
- }
-
- XGL_RESULT MapMemory(XGL_VOID** ptr);
- XGL_RESULT UnmapMemory();
-
-protected:
- XglDevice *m_device;
-
- xgl_testing::ColorAttachmentView m_targetView;
- XGL_IMAGE_VIEW_ATTACH_INFO m_imageInfo;
-};
-
-#endif // XGLIMAGE_H
diff --git a/tests/xglrenderframework.cpp b/tests/xglrenderframework.cpp
index 4e96145..ab1fd0f 100644
--- a/tests/xglrenderframework.cpp
+++ b/tests/xglrenderframework.cpp
@@ -385,6 +385,69 @@
xglCmdBindDescriptorSet(commandBuffer, XGL_PIPELINE_BIND_POINT_GRAPHICS, 0, obj(), 0 );
}
+XglImage::XglImage(XglDevice *dev)
+{
+ m_device = dev;
+ m_imageInfo.view = XGL_NULL_HANDLE;
+ m_imageInfo.state = XGL_IMAGE_STATE_UNINITIALIZED_TARGET;
+}
+
+void XglImage::init(XGL_UINT32 w, XGL_UINT32 h,
+ XGL_FORMAT fmt, XGL_FLAGS usage,
+ XGL_IMAGE_TILING tiling)
+{
+ XGL_UINT mipCount;
+
+ mipCount = 0;
+
+ XGL_UINT _w = w;
+ XGL_UINT _h = h;
+ while( ( _w > 0 ) || ( _h > 0 ) )
+ {
+ _w >>= 1;
+ _h >>= 1;
+ mipCount++;
+ }
+
+ XGL_IMAGE_CREATE_INFO imageCreateInfo = xgl_testing::Image::create_info();
+ imageCreateInfo.imageType = XGL_IMAGE_2D;
+ imageCreateInfo.format = fmt;
+ imageCreateInfo.extent.width = w;
+ imageCreateInfo.extent.height = h;
+ imageCreateInfo.mipLevels = mipCount;
+ imageCreateInfo.tiling = tiling;
+
+ imageCreateInfo.usage = usage;
+
+ xgl_testing::Image::init(*m_device, imageCreateInfo);
+
+ m_imageInfo.state = XGL_IMAGE_STATE_UNINITIALIZED_TARGET;
+
+ XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO createView = {
+ XGL_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO,
+ XGL_NULL_HANDLE,
+ obj(),
+ {XGL_CH_FMT_R8G8B8A8, XGL_NUM_FMT_UNORM},
+ 0,
+ 0,
+ 1
+ };
+
+ m_targetView.init(*m_device, createView);
+}
+
+XGL_RESULT XglImage::MapMemory(XGL_VOID** ptr)
+{
+ *ptr = map();
+ return (*ptr) ? XGL_SUCCESS : XGL_ERROR_UNKNOWN;
+}
+
+XGL_RESULT XglImage::UnmapMemory()
+{
+ unmap();
+ return XGL_SUCCESS;
+}
+
XglTextureObj::XglTextureObj(XglDevice *device)
{
m_device = device;
diff --git a/tests/xglrenderframework.h b/tests/xglrenderframework.h
index a89a033..f43d34b 100644
--- a/tests/xglrenderframework.h
+++ b/tests/xglrenderframework.h
@@ -29,6 +29,7 @@
#define XGLRENDERFRAMEWORK_H
#include "xgltestframework.h"
+#include "xgldevice.h"
class XglRenderFramework : public XglTestFramework
{
@@ -161,6 +162,70 @@
XGL_INDEX_TYPE m_indexType;
};
+class XglImage : public xgl_testing::Image
+{
+public:
+ XglImage(XglDevice *dev);
+
+ // 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;
+public:
+ void init( XGL_UINT32 w, XGL_UINT32 h,
+ XGL_FORMAT fmt, XGL_FLAGS usage,
+ XGL_IMAGE_TILING tiling=XGL_LINEAR_TILING);
+
+ // void clear( CommandBuffer*, XGL_UINT[4] );
+ // void prepare( CommandBuffer*, XGL_IMAGE_STATE );
+
+ void state( XGL_IMAGE_STATE state )
+ {
+ m_imageInfo.state = state;
+ }
+ XGL_GPU_MEMORY memory() const
+ {
+ const std::vector<XGL_GPU_MEMORY> mems = memories();
+ return mems.empty() ? XGL_NULL_HANDLE : mems[0];
+ }
+
+
+ XGL_IMAGE image() const
+ {
+ return obj();
+ }
+ XGL_COLOR_ATTACHMENT_VIEW targetView()const
+ {
+ return m_targetView.obj();
+ }
+
+ XGL_IMAGE_STATE state() const
+ {
+ return ( XGL_IMAGE_STATE )m_imageInfo.state;
+ }
+ XGL_UINT32 width() const
+ {
+ return extent().width;
+ }
+ XGL_UINT32 height() const
+ {
+ return extent().height;
+ }
+
+ XGL_RESULT MapMemory(XGL_VOID** ptr);
+ XGL_RESULT UnmapMemory();
+
+protected:
+ XglDevice *m_device;
+
+ xgl_testing::ColorAttachmentView m_targetView;
+ XGL_IMAGE_VIEW_ATTACH_INFO m_imageInfo;
+};
+
class XglTextureObj : public xgl_testing::Image
{
public:
diff --git a/tests/xgltestframework.cpp b/tests/xgltestframework.cpp
index a10c4cf..5b3b8c2 100644
--- a/tests/xgltestframework.cpp
+++ b/tests/xgltestframework.cpp
@@ -21,6 +21,7 @@
// DEALINGS IN THE SOFTWARE.
#include "xgltestframework.h"
+#include "xglrenderframework.h"
#include "GL/freeglut_std.h"
//#include "ShaderLang.h"
#include "GlslangToBil.h"
diff --git a/tests/xgltestframework.h b/tests/xgltestframework.h
index 9a33b74..5345609 100644
--- a/tests/xgltestframework.h
+++ b/tests/xgltestframework.h
@@ -24,10 +24,10 @@
#define XGLTESTFRAMEWORK_H
#include "gtest-1.7.0/include/gtest/gtest.h"
-#include "xglimage.h"
#include "ShaderLang.h"
#include "GLSL450Lib.h"
#include "icd-bil.h"
+#include "test_common.h"
#include <stdlib.h>
#include <stdio.h>
@@ -42,6 +42,8 @@
using namespace std;
+class XglImage;
+
class XglTestImageRecord
{
public: