Initial implementation of Image

Basic shell class for Image

Bug b/119620767

Change-Id: I75d37dd8c1a9b98264fe6dae68cd4753d6942103
Reviewed-on: https://swiftshader-review.googlesource.com/c/22610
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Vulkan/VkDestroy.h b/src/Vulkan/VkDestroy.h
index 1686bf0..0931bb7 100644
--- a/src/Vulkan/VkDestroy.h
+++ b/src/Vulkan/VkDestroy.h
@@ -19,6 +19,7 @@
 #include "VkDeviceMemory.hpp"
 #include "VkEvent.hpp"
 #include "VkFence.hpp"
+#include "VkImage.hpp"
 #include "VkInstance.hpp"
 #include "VkPipeline.hpp"
 #include "VkPipelineLayout.hpp"
diff --git a/src/Vulkan/VkImage.cpp b/src/Vulkan/VkImage.cpp
new file mode 100644
index 0000000..e5856ac
--- /dev/null
+++ b/src/Vulkan/VkImage.cpp
@@ -0,0 +1,33 @@
+// Copyright 2018 The SwiftShader Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "VkImage.hpp"
+
+namespace vk
+{
+
+Image::Image(const VkImageCreateInfo* pCreateInfo, void* mem)
+{
+}
+
+void Image::destroy(const VkAllocationCallbacks* pAllocator)
+{
+}
+
+size_t Image::ComputeRequiredAllocationSize(const VkImageCreateInfo* pCreateInfo)
+{
+	return 0;
+}
+
+} // namespace vk
\ No newline at end of file
diff --git a/src/Vulkan/VkImage.hpp b/src/Vulkan/VkImage.hpp
new file mode 100644
index 0000000..9e4261f
--- /dev/null
+++ b/src/Vulkan/VkImage.hpp
@@ -0,0 +1,42 @@
+// Copyright 2018 The SwiftShader Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef VK_IMAGE_HPP_
+#define VK_IMAGE_HPP_
+
+#include "VkObject.hpp"
+
+namespace vk
+{
+
+class Image : public Object<Image, VkImage>
+{
+public:
+	Image(const VkImageCreateInfo* pCreateInfo, void* mem);
+	~Image() = delete;
+	void destroy(const VkAllocationCallbacks* pAllocator);
+
+	static size_t ComputeRequiredAllocationSize(const VkImageCreateInfo* pCreateInfo);
+
+private:
+};
+
+static inline Image* Cast(VkImage object)
+{
+	return reinterpret_cast<Image*>(object);
+}
+
+} // namespace vk
+
+#endif // VK_IMAGE_HPP_
\ No newline at end of file
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index 2d4df6f..c4180cb 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -23,6 +23,7 @@
 #include "VkEvent.hpp"
 #include "VkFence.hpp"
 #include "VkGetProcAddress.h"
+#include "VkImage.hpp"
 #include "VkInstance.hpp"
 #include "VkPhysicalDevice.hpp"
 #include "VkPipeline.hpp"
@@ -711,9 +712,12 @@
 	TRACE("(VkDevice device = 0x%X, const VkImageCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkImage* pImage = 0x%X)",
 		    device, pCreateInfo, pAllocator, pImage);
 
-	UNIMPLEMENTED();
+	if(pCreateInfo->pNext)
+	{
+		UNIMPLEMENTED();
+	}
 
-	return VK_SUCCESS;
+	return vk::Image::Create(pAllocator, pCreateInfo, pImage);
 }
 
 VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
@@ -721,7 +725,7 @@
 	TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
 		    device, image, pAllocator);
 
-	UNIMPLEMENTED();
+	vk::destroy(image, pAllocator);
 }
 
 VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)
diff --git a/src/Vulkan/vulkan.vcxproj b/src/Vulkan/vulkan.vcxproj
index 1f44cc4..266dcea 100644
--- a/src/Vulkan/vulkan.vcxproj
+++ b/src/Vulkan/vulkan.vcxproj
@@ -106,6 +106,7 @@
     <ClCompile Include="VkDevice.cpp" />

     <ClCompile Include="VkDeviceMemory.cpp" />

     <ClCompile Include="VkGetProcAddress.cpp" />

+    <ClCompile Include="VkImage.cpp" />

     <ClCompile Include="VkInstance.cpp" />

     <ClCompile Include="VkMemory.cpp" />

     <ClCompile Include="VkPhysicalDevice.cpp" />

@@ -196,6 +197,7 @@
     <ClInclude Include="VkEvent.hpp" />

     <ClInclude Include="VkFence.hpp" />

     <ClInclude Include="VkGetProcAddress.h" />

+    <ClInclude Include="VkImage.hpp" />

     <ClInclude Include="VkInstance.hpp" />

     <ClInclude Include="VkMemory.h" />

     <ClInclude Include="VkObject.hpp" />

diff --git a/src/Vulkan/vulkan.vcxproj.filters b/src/Vulkan/vulkan.vcxproj.filters
index de1d38f..642ff05 100644
--- a/src/Vulkan/vulkan.vcxproj.filters
+++ b/src/Vulkan/vulkan.vcxproj.filters
@@ -231,6 +231,9 @@
     <ClCompile Include="VkPipelineLayout.cpp">

       <Filter>Source Files\Vulkan</Filter>

     </ClCompile>

+    <ClCompile Include="VkImage.cpp">

+      <Filter>Source Files\Vulkan</Filter>

+    </ClCompile>

     <ClCompile Include="VkPromotedExtensions.cpp">

       <Filter>Source Files\Vulkan</Filter>

     </ClCompile>

@@ -272,6 +275,9 @@
     <ClInclude Include="VkGetProcAddress.h">

       <Filter>Header Files\Vulkan</Filter>

     </ClInclude>

+    <ClInclude Include="VkImage.hpp">

+      <Filter>Header Files\Vulkan</Filter>

+    </ClInclude>

     <ClInclude Include="VkInstance.hpp">

       <Filter>Header Files\Vulkan</Filter>

     </ClInclude>