OSDN Git Service

Initial implementation of Framebuffer
authorAlexis Hetu <sugoi@google.com>
Thu, 15 Nov 2018 20:11:36 +0000 (15:11 -0500)
committerAlexis Hétu <sugoi@google.com>
Fri, 16 Nov 2018 14:54:51 +0000 (14:54 +0000)
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>
src/Vulkan/VkDestroy.h
src/Vulkan/VkFramebuffer.cpp [new file with mode: 0644]
src/Vulkan/VkFramebuffer.hpp [new file with mode: 0644]
src/Vulkan/libVulkan.cpp
src/Vulkan/vulkan.vcxproj
src/Vulkan/vulkan.vcxproj.filters

index 0931bb7..fffe7fc 100644 (file)
@@ -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 (file)
index 0000000..e31e938
--- /dev/null
@@ -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 (file)
index 0000000..6e4fc93
--- /dev/null
@@ -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_
index c4180cb..e46ea33 100644 (file)
@@ -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 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFram
        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)
index 266dcea..d02954b 100644 (file)
@@ -105,6 +105,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor
     <ClCompile Include="VkDebug.cpp" />\r
     <ClCompile Include="VkDevice.cpp" />\r
     <ClCompile Include="VkDeviceMemory.cpp" />\r
+    <ClCompile Include="VkFramebuffer.cpp" />\r
     <ClCompile Include="VkGetProcAddress.cpp" />\r
     <ClCompile Include="VkImage.cpp" />\r
     <ClCompile Include="VkInstance.cpp" />\r
@@ -196,6 +197,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor
     <ClInclude Include="VkDeviceMemory.hpp" />\r
     <ClInclude Include="VkEvent.hpp" />\r
     <ClInclude Include="VkFence.hpp" />\r
+    <ClInclude Include="VkFramebuffer.hpp" />\r
     <ClInclude Include="VkGetProcAddress.h" />\r
     <ClInclude Include="VkImage.hpp" />\r
     <ClInclude Include="VkInstance.hpp" />\r
index 642ff05..6017bc0 100644 (file)
     <ClCompile Include="VkQueue.cpp">\r
       <Filter>Source Files\Vulkan</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="VkFramebuffer.cpp">\r
+      <Filter>Source Files\Vulkan</Filter>\r
+    </ClCompile>\r
     <ClCompile Include="VkShaderModule.cpp">\r
       <Filter>Source Files\Vulkan</Filter>\r
     </ClCompile>\r
     <ClInclude Include="VkFence.hpp">\r
       <Filter>Header Files\Vulkan</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="VkFramebuffer.hpp">\r
+      <Filter>Header Files\Vulkan</Filter>\r
+    </ClInclude>\r
     <ClInclude Include="VkGetProcAddress.h">\r
       <Filter>Header Files\Vulkan</Filter>\r
     </ClInclude>\r