Initial implementation of Framebuffer

Basic shell class for Framebuffer

Bug b/119621736

Change-Id: Iaf5466d311efe011ea7bbd4a6e3ab2802474f98e
Reviewed-on: https://swiftshader-review.googlesource.com/c/22611
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 0931bb7..fffe7fc 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 "VkFramebuffer.hpp"
 #include "VkImage.hpp"
 #include "VkInstance.hpp"
 #include "VkPipeline.hpp"
diff --git a/src/Vulkan/VkFramebuffer.cpp b/src/Vulkan/VkFramebuffer.cpp
new file mode 100644
index 0000000..e31e938
--- /dev/null
+++ b/src/Vulkan/VkFramebuffer.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 "VkFramebuffer.hpp"
+
+namespace vk
+{
+
+Framebuffer::Framebuffer(const VkFramebufferCreateInfo* pCreateInfo, void* mem)
+{
+}
+
+void Framebuffer::destroy(const VkAllocationCallbacks* pAllocator)
+{
+}
+
+size_t Framebuffer::ComputeRequiredAllocationSize(const VkFramebufferCreateInfo* pCreateInfo)
+{
+	return 0;
+}
+
+} // namespace vk
\ No newline at end of file
diff --git a/src/Vulkan/VkFramebuffer.hpp b/src/Vulkan/VkFramebuffer.hpp
new file mode 100644
index 0000000..6e4fc93
--- /dev/null
+++ b/src/Vulkan/VkFramebuffer.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_FRAMEBUFFER_HPP_
+#define VK_FRAMEBUFFER_HPP_
+
+#include "VkObject.hpp"
+
+namespace vk
+{
+
+class Framebuffer : public Object<Framebuffer, VkFramebuffer>
+{
+public:
+	Framebuffer(const VkFramebufferCreateInfo* pCreateInfo, void* mem);
+	~Framebuffer() = delete;
+	void destroy(const VkAllocationCallbacks* pAllocator);
+
+	static size_t ComputeRequiredAllocationSize(const VkFramebufferCreateInfo* pCreateInfo);
+
+private:
+};
+
+static inline Framebuffer* Cast(VkFramebuffer object)
+{
+	return reinterpret_cast<Framebuffer*>(object);
+}
+
+} // namespace vk
+
+#endif // VK_FRAMEBUFFER_HPP_
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index c4180cb..e46ea33 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -22,6 +22,7 @@
 #include "VkDeviceMemory.hpp"
 #include "VkEvent.hpp"
 #include "VkFence.hpp"
+#include "VkFramebuffer.hpp"
 #include "VkGetProcAddress.h"
 #include "VkImage.hpp"
 #include "VkInstance.hpp"
@@ -967,16 +968,19 @@
 	TRACE("(VkDevice device = 0x%X, const VkFramebufferCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkFramebuffer* pFramebuffer = 0x%X)",
 		    device, pCreateInfo, pAllocator, pFramebuffer);
 
-	UNIMPLEMENTED();
+	if(pCreateInfo->pNext || pCreateInfo->flags)
+	{
+		UNIMPLEMENTED();
+	}
 
-	return VK_SUCCESS;
+	return vk::Framebuffer::Create(pAllocator, pCreateInfo, pFramebuffer);
 }
 
 VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
 {
 	TRACE("(VkDevice device = 0x%X, VkFramebuffer framebuffer = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)");
 
-	UNIMPLEMENTED();
+	vk::destroy(framebuffer, pAllocator);
 }
 
 VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass)
diff --git a/src/Vulkan/vulkan.vcxproj b/src/Vulkan/vulkan.vcxproj
index 266dcea..d02954b 100644
--- a/src/Vulkan/vulkan.vcxproj
+++ b/src/Vulkan/vulkan.vcxproj
@@ -105,6 +105,7 @@
     <ClCompile Include="VkDebug.cpp" />

     <ClCompile Include="VkDevice.cpp" />

     <ClCompile Include="VkDeviceMemory.cpp" />

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

     <ClCompile Include="VkGetProcAddress.cpp" />

     <ClCompile Include="VkImage.cpp" />

     <ClCompile Include="VkInstance.cpp" />

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

     <ClInclude Include="VkEvent.hpp" />

     <ClInclude Include="VkFence.hpp" />

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

     <ClInclude Include="VkGetProcAddress.h" />

     <ClInclude Include="VkImage.hpp" />

     <ClInclude Include="VkInstance.hpp" />

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

       <Filter>Source Files\Vulkan</Filter>

     </ClCompile>

+    <ClCompile Include="VkFramebuffer.cpp">

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

+    </ClCompile>

     <ClCompile Include="VkShaderModule.cpp">

       <Filter>Source Files\Vulkan</Filter>

     </ClCompile>

@@ -272,6 +275,9 @@
     <ClInclude Include="VkFence.hpp">

       <Filter>Header Files\Vulkan</Filter>

     </ClInclude>

+    <ClInclude Include="VkFramebuffer.hpp">

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

+    </ClInclude>

     <ClInclude Include="VkGetProcAddress.h">

       <Filter>Header Files\Vulkan</Filter>

     </ClInclude>