Initial implementation of RenderPass
Basic shell class for RenderPass
Bug b/119620965
Change-Id: Ice98943587f363f8cf03eddd3cc4c504b899d682
Reviewed-on: https://swiftshader-review.googlesource.com/c/22612
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 fffe7fc..0957d89 100644
--- a/src/Vulkan/VkDestroy.h
+++ b/src/Vulkan/VkDestroy.h
@@ -28,6 +28,7 @@
#include "VkQueue.hpp"
#include "VkSemaphore.hpp"
#include "VkShaderModule.hpp"
+#include "VkRenderPass.hpp"
namespace vk
{
diff --git a/src/Vulkan/VkRenderPass.cpp b/src/Vulkan/VkRenderPass.cpp
new file mode 100644
index 0000000..3222f53
--- /dev/null
+++ b/src/Vulkan/VkRenderPass.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 "VkRenderPass.hpp"
+
+namespace vk
+{
+
+RenderPass::RenderPass(const VkRenderPassCreateInfo* pCreateInfo, void* mem)
+{
+}
+
+void RenderPass::destroy(const VkAllocationCallbacks* pAllocator)
+{
+}
+
+size_t RenderPass::ComputeRequiredAllocationSize(const VkRenderPassCreateInfo* pCreateInfo)
+{
+ return 0;
+}
+
+} // namespace vk
\ No newline at end of file
diff --git a/src/Vulkan/VkRenderPass.hpp b/src/Vulkan/VkRenderPass.hpp
new file mode 100644
index 0000000..5d0273e
--- /dev/null
+++ b/src/Vulkan/VkRenderPass.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_RENDER_PASS_HPP_
+#define VK_RENDER_PASS_HPP_
+
+#include "VkObject.hpp"
+
+namespace vk
+{
+
+class RenderPass : public Object<RenderPass, VkRenderPass>
+{
+public:
+ RenderPass(const VkRenderPassCreateInfo* pCreateInfo, void* mem);
+ ~RenderPass() = delete;
+ void destroy(const VkAllocationCallbacks* pAllocator);
+
+ static size_t ComputeRequiredAllocationSize(const VkRenderPassCreateInfo* pCreateInfo);
+
+private:
+};
+
+static inline RenderPass* Cast(VkRenderPass object)
+{
+ return reinterpret_cast<RenderPass*>(object);
+}
+
+} // namespace vk
+
+#endif // VK_RENDER_PASS_HPP_
\ No newline at end of file
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index e46ea33..8bea5e9 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -32,6 +32,7 @@
#include "VkQueue.hpp"
#include "VkSemaphore.hpp"
#include "VkShaderModule.hpp"
+#include "VkRenderPass.hpp"
#include <algorithm>
#include <cstring>
@@ -988,9 +989,12 @@
TRACE("(VkDevice device = 0x%X, const VkRenderPassCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkRenderPass* pRenderPass = 0x%X)",
device, pCreateInfo, pAllocator, pRenderPass);
- UNIMPLEMENTED();
+ if(pCreateInfo->pNext || pCreateInfo->flags)
+ {
+ UNIMPLEMENTED();
+ }
- return VK_SUCCESS;
+ return vk::RenderPass::Create(pAllocator, pCreateInfo, pRenderPass);
}
VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator)
@@ -998,7 +1002,7 @@
TRACE("(VkDevice device = 0x%X, VkRenderPass renderPass = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
device, renderPass, pAllocator);
- UNIMPLEMENTED();
+ vk::destroy(renderPass, pAllocator);
}
VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity)
diff --git a/src/Vulkan/vulkan.vcxproj b/src/Vulkan/vulkan.vcxproj
index d02954b..78ebcfa 100644
--- a/src/Vulkan/vulkan.vcxproj
+++ b/src/Vulkan/vulkan.vcxproj
@@ -115,6 +115,7 @@
<ClCompile Include="VkPipelineLayout.cpp" />
<ClCompile Include="VkPromotedExtensions.cpp" />
<ClCompile Include="VkQueue.cpp" />
+ <ClCompile Include="VkRenderPass.cpp" />
<ClCompile Include="VkShaderModule.cpp" />
<ClCompile Include="..\Device\Blitter.cpp" />
<ClCompile Include="..\Device\Clipper.cpp" />
@@ -207,6 +208,7 @@
<ClInclude Include="VkPipeline.hpp" />
<ClInclude Include="VkPipelineLayout.hpp" />
<ClInclude Include="VkQueue.hpp" />
+ <ClInclude Include="VkRenderPass.hpp" />
<ClInclude Include="VkSemaphore.hpp" />
<ClInclude Include="VkShaderModule.hpp" />
<ClInclude Include="..\Device\Blitter.hpp" />
diff --git a/src/Vulkan/vulkan.vcxproj.filters b/src/Vulkan/vulkan.vcxproj.filters
index 6017bc0..492be8e 100644
--- a/src/Vulkan/vulkan.vcxproj.filters
+++ b/src/Vulkan/vulkan.vcxproj.filters
@@ -243,6 +243,9 @@
<ClCompile Include="VkFramebuffer.cpp">
<Filter>Source Files\Vulkan</Filter>
</ClCompile>
+ <ClCompile Include="VkRenderPass.cpp">
+ <Filter>Source Files\Vulkan</Filter>
+ </ClCompile>
<ClCompile Include="VkShaderModule.cpp">
<Filter>Source Files\Vulkan</Filter>
</ClCompile>
@@ -305,6 +308,9 @@
<ClInclude Include="VkQueue.hpp">
<Filter>Header Files\Vulkan</Filter>
</ClInclude>
+ <ClInclude Include="VkRenderPass.hpp">
+ <Filter>Header Files\Vulkan</Filter>
+ </ClInclude>
<ClInclude Include="VkSemaphore.hpp">
<Filter>Header Files\Vulkan</Filter>
</ClInclude>