From: Alexis Hetu Date: Thu, 15 Nov 2018 19:51:15 +0000 (-0500) Subject: Initial implementation of Image X-Git-Tag: android-x86-9.0-r1~514 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f62f375c00b29865fa3b35f95680972dd401ce89;p=android-x86%2Fexternal-swiftshader.git 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 Reviewed-by: Nicolas Capens --- diff --git a/src/Vulkan/VkDestroy.h b/src/Vulkan/VkDestroy.h index 1686bf0d0..0931bb727 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 000000000..e5856ac0c --- /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 000000000..9e4261f60 --- /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 +{ +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(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 2d4df6fac..c4180cb67 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 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreat 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 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const 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 1f44cc465..266dceae6 100644 --- a/src/Vulkan/vulkan.vcxproj +++ b/src/Vulkan/vulkan.vcxproj @@ -106,6 +106,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor + @@ -196,6 +197,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor + diff --git a/src/Vulkan/vulkan.vcxproj.filters b/src/Vulkan/vulkan.vcxproj.filters index de1d38fa2..642ff05d0 100644 --- a/src/Vulkan/vulkan.vcxproj.filters +++ b/src/Vulkan/vulkan.vcxproj.filters @@ -231,6 +231,9 @@ Source Files\Vulkan + + Source Files\Vulkan + Source Files\Vulkan @@ -272,6 +275,9 @@ Header Files\Vulkan + + Header Files\Vulkan + Header Files\Vulkan