Move vulkan backend implementation into the filament::backend namespace
This commit is contained in:
committed by
Mathias Agopian
parent
25b73ddcfa
commit
271cda88aa
@@ -27,9 +27,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
|
||||
using namespace backend;
|
||||
namespace filament::backend {
|
||||
|
||||
Driver* PlatformVkAndroid::createDriver(void* const sharedContext) noexcept {
|
||||
ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts.");
|
||||
@@ -50,4 +48,4 @@ void* PlatformVkAndroid::createVkSurfaceKHR(void* nativeWindow, void* vkinstance
|
||||
return (void*) surface;
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,26 +14,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_ANDROID_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_ANDROID_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_ANDROID_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_ANDROID_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include "VulkanPlatform.h"
|
||||
|
||||
namespace filament {
|
||||
namespace filament::backend {
|
||||
|
||||
class PlatformVkAndroid final : public backend::VulkanPlatform {
|
||||
class PlatformVkAndroid final : public VulkanPlatform {
|
||||
public:
|
||||
|
||||
backend::Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
|
||||
void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint64_t flags) noexcept override;
|
||||
|
||||
int getOSVersion() const noexcept override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_ANDROID_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_ANDROID_H
|
||||
|
||||
@@ -14,23 +14,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_COCOA_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_COCOA_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_COCOA_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_COCOA_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include "VulkanPlatform.h"
|
||||
|
||||
namespace filament {
|
||||
namespace filament::backend {
|
||||
|
||||
class PlatformVkCocoa final : public backend::VulkanPlatform {
|
||||
class PlatformVkCocoa final : public VulkanPlatform {
|
||||
public:
|
||||
backend::Driver* createDriver(void* sharedContext) noexcept override;
|
||||
Driver* createDriver(void* sharedContext) noexcept override;
|
||||
void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint64_t flags) noexcept override;
|
||||
int getOSVersion() const noexcept override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_COCOA_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_COCOA_H
|
||||
|
||||
@@ -32,9 +32,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
|
||||
using namespace backend;
|
||||
namespace filament::backend {
|
||||
|
||||
Driver* PlatformVkCocoa::createDriver(void* sharedContext) noexcept {
|
||||
ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts.");
|
||||
@@ -61,4 +59,4 @@ void* PlatformVkCocoa::createVkSurfaceKHR(void* nativeWindow, void* instance, ui
|
||||
return surface;
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,23 +14,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_COCOA_TOUCH_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_COCOA_TOUCH_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_COCOA_TOUCH_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_COCOA_TOUCH_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include "VulkanPlatform.h"
|
||||
|
||||
namespace filament {
|
||||
namespace filament::backend {
|
||||
|
||||
class PlatformVkCocoaTouch final : public backend::VulkanPlatform {
|
||||
class PlatformVkCocoaTouch final : public VulkanPlatform {
|
||||
public:
|
||||
backend::Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint64_t flags) noexcept override;
|
||||
int getOSVersion() const noexcept override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKAN_CONTEXTMANAGERVKCOCOATOUCH_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKAN_CONTEXTMANAGERVKCOCOATOUCH_H
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
|
||||
using namespace backend;
|
||||
namespace filament::backend {
|
||||
|
||||
Driver* PlatformVkCocoaTouch::createDriver(void* const sharedContext) noexcept {
|
||||
ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts.");
|
||||
@@ -68,4 +66,4 @@ void* PlatformVkCocoaTouch::createVkSurfaceKHR(void* nativeWindow, void* instanc
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
|
||||
using namespace backend;
|
||||
namespace filament::backend {
|
||||
|
||||
Driver* PlatformVkLinuxWayland::createDriver(void* const sharedContext) noexcept {
|
||||
ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts.");
|
||||
@@ -65,4 +63,4 @@ void* PlatformVkLinuxWayland::createVkSurfaceKHR(void* nativeWindow, void* insta
|
||||
return surface;
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_LINUX_WAYLAND_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_LINUX_WAYLAND_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_LINUX_WAYLAND_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_LINUX_WAYLAND_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -23,18 +23,18 @@
|
||||
#include <backend/DriverEnums.h>
|
||||
#include "VulkanPlatform.h"
|
||||
|
||||
namespace filament {
|
||||
namespace filament::backend {
|
||||
|
||||
class PlatformVkLinuxWayland final : public backend::VulkanPlatform {
|
||||
class PlatformVkLinuxWayland final : public VulkanPlatform {
|
||||
public:
|
||||
|
||||
backend::Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
|
||||
void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint64_t flags) noexcept override;
|
||||
|
||||
int getOSVersion() const noexcept override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_LINUX_WAYLAND_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_LINUX_WAYLAND_H
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
|
||||
using namespace backend;
|
||||
namespace filament::backend {
|
||||
|
||||
static constexpr const char* LIBRARY_X11 = "libX11.so.6";
|
||||
|
||||
@@ -120,4 +118,4 @@ const bool windowIsXCB = true;
|
||||
return surface;
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_LINUX_X11_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_LINUX_X11_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_LINUX_X11_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_LINUX_X11_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
namespace filament {
|
||||
namespace filament::backend {
|
||||
|
||||
class PlatformVkLinuxX11 final : public backend::VulkanPlatform {
|
||||
class PlatformVkLinuxX11 final : public VulkanPlatform {
|
||||
public:
|
||||
|
||||
backend::Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
|
||||
void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint64_t flags) noexcept override;
|
||||
|
||||
@@ -50,6 +50,6 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_LINUX_X11_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_LINUX_X11_H
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
|
||||
using namespace backend;
|
||||
namespace filament::backend {
|
||||
|
||||
Driver* PlatformVkWindows::createDriver(void* const sharedContext) noexcept {
|
||||
ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts.");
|
||||
@@ -51,4 +49,4 @@ void* PlatformVkWindows::createVkSurfaceKHR(void* nativeWindow, void* instance,
|
||||
return surface;
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,20 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_WINDOWS_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_WINDOWS_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_WINDOWS_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_WINDOWS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include "VulkanPlatform.h"
|
||||
|
||||
namespace filament {
|
||||
namespace filament::backend {
|
||||
|
||||
class PlatformVkWindows final : public backend::VulkanPlatform {
|
||||
class PlatformVkWindows final : public VulkanPlatform {
|
||||
public:
|
||||
|
||||
backend::Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
Driver* createDriver(void* const sharedContext) noexcept override;
|
||||
|
||||
void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint64_t flags) noexcept override;
|
||||
|
||||
@@ -37,6 +37,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKAN_PLATFORM_VK_WINDOWS_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKAN_PLATFORM_VK_WINDOWS_H
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
using namespace bluevk;
|
||||
using namespace utils;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
struct BlitterUniforms {
|
||||
int sampleCount;
|
||||
@@ -419,5 +418,4 @@ void VulkanBlitter::blitSlowDepth(VkImageAspectFlags aspect, VkFilter filter,
|
||||
mPipelineCache.bindUniformBuffer(0, previousUbo.buffer, previousUbo.offset, previousUbo.size);
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANBLITTER_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANBLITTER_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANBLITTER_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANBLITTER_H
|
||||
|
||||
#include "VulkanContext.h"
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
class VulkanBuffer;
|
||||
class VulkanFboCache;
|
||||
@@ -73,7 +72,6 @@ private:
|
||||
VulkanSamplerCache& mSamplerCache;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANBLITTER_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANBLITTER_H
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
VulkanBuffer::VulkanBuffer(VulkanContext& context, VulkanStagePool& stagePool,
|
||||
VkBufferUsageFlags usage, uint32_t numBytes) : mUsage(usage) {
|
||||
@@ -114,5 +113,4 @@ void VulkanBuffer::loadFromCpu(VulkanContext& context, VulkanStagePool& stagePoo
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,14 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANBUFFER_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANBUFFER_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANBUFFER_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANBUFFER_H
|
||||
|
||||
#include "VulkanContext.h"
|
||||
#include "VulkanStagePool.h"
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
// Encapsulates a Vulkan buffer, its attached DeviceMemory and a staging area.
|
||||
class VulkanBuffer {
|
||||
@@ -39,7 +38,6 @@ private:
|
||||
VkBufferUsageFlags mUsage = {};
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANBUFFER_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANBUFFER_H
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
using namespace bluevk;
|
||||
using namespace utils;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
VulkanCmdFence::VulkanCmdFence(VkDevice device, bool signaled) : device(device) {
|
||||
VkFenceCreateInfo fenceCreateInfo { .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO };
|
||||
@@ -264,8 +263,7 @@ void VulkanCommands::updateFences() {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANCOMMANDS_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANCOMMANDS_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANCOMMANDS_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANCOMMANDS_H
|
||||
|
||||
#include <bluevk/BlueVK.h>
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
#include <utils/Condition.h>
|
||||
#include <utils/Mutex.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
// Wrapper to enable use of shared_ptr for implementing shared ownership of low-level Vulkan fences.
|
||||
struct VulkanCmdFence {
|
||||
@@ -107,7 +106,6 @@ class VulkanCommands {
|
||||
CommandBufferObserver* mObserver = nullptr;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANCOMMANDS_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANCOMMANDS_H
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANCONSTANTS_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANCONSTANTS_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANCONSTANTS_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANCONSTANTS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@ using namespace bluevk;
|
||||
|
||||
using utils::FixedCapacityVector;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
VkImage VulkanAttachment::getImage() const {
|
||||
return texture ? texture->getVkImage() : VK_NULL_HANDLE;
|
||||
@@ -367,5 +366,4 @@ void VulkanContext::createEmptyTexture(VulkanStagePool& stagePool) {
|
||||
emptyTexture->updateImage(pbd, 1, 1, 1, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANCONTEXT_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANCONTEXT_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANCONTEXT_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANCONTEXT_H
|
||||
|
||||
#include "VulkanPipelineCache.h"
|
||||
#include "VulkanCommands.h"
|
||||
@@ -28,8 +28,7 @@
|
||||
VK_DEFINE_HANDLE(VmaAllocator)
|
||||
VK_DEFINE_HANDLE(VmaPool)
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
struct VulkanRenderTarget;
|
||||
struct VulkanSwapChain;
|
||||
@@ -98,7 +97,6 @@ struct VulkanContext {
|
||||
std::string currentDebugMarker;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANCONTEXT_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANCONTEXT_H
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
#include <utils/debug.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
// Always wait at least 3 frames after a DriverAPI-level resource has been destroyed for safe
|
||||
// destruction, due to potential usage by outstanding command buffers and triple buffering.
|
||||
@@ -95,5 +94,4 @@ void VulkanDisposer::reset() noexcept {
|
||||
mDisposables.clear();
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANDISPOSER_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANDISPOSER_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANDISPOSER_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANDISPOSER_H
|
||||
|
||||
#include <tsl/robin_map.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
// VulkanDisposer tracks resources (such as textures or vertex buffers) that need deferred
|
||||
// destruction due to potential use by a Vulkan command buffer. Resources are represented with void*
|
||||
@@ -56,7 +55,6 @@ private:
|
||||
tsl::robin_map<Key, Disposable> mDisposables;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANDISPOSER_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANDISPOSER_H
|
||||
|
||||
@@ -85,8 +85,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsCallback(VkDebugUtilsMessageSeverityFla
|
||||
|
||||
#endif
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
Driver* VulkanDriverFactory::create(VulkanPlatform* const platform,
|
||||
const char* const* ppRequiredExtensions, uint32_t requiredExtensionCount) noexcept {
|
||||
@@ -373,12 +372,12 @@ void VulkanDriver::beginFrame(int64_t monotonic_clock_ns, uint32_t frameId) {
|
||||
}
|
||||
|
||||
void VulkanDriver::setFrameScheduledCallback(Handle<HwSwapChain> sch,
|
||||
backend::FrameScheduledCallback callback, void* user) {
|
||||
FrameScheduledCallback callback, void* user) {
|
||||
|
||||
}
|
||||
|
||||
void VulkanDriver::setFrameCompletedCallback(Handle<HwSwapChain> sch,
|
||||
backend::FrameCompletedCallback callback, void* user) {
|
||||
FrameCompletedCallback callback, void* user) {
|
||||
|
||||
}
|
||||
|
||||
@@ -531,7 +530,7 @@ void VulkanDriver::createDefaultRenderTargetR(Handle<HwRenderTarget> rth, int) {
|
||||
|
||||
void VulkanDriver::createRenderTargetR(Handle<HwRenderTarget> rth,
|
||||
TargetBufferFlags targets, uint32_t width, uint32_t height, uint8_t samples,
|
||||
backend::MRT color, TargetBufferInfo depth, TargetBufferInfo stencil) {
|
||||
MRT color, TargetBufferInfo depth, TargetBufferInfo stencil) {
|
||||
VulkanAttachment colorTargets[MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT] = {};
|
||||
for (int i = 0; i < MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT; i++) {
|
||||
if (color[i].handle) {
|
||||
@@ -744,7 +743,7 @@ Handle<HwStream> VulkanDriver::createStreamAcquired() {
|
||||
}
|
||||
|
||||
void VulkanDriver::setAcquiredImage(Handle<HwStream> sh, void* image,
|
||||
backend::CallbackHandler* handler, backend::StreamCallback cb, void* userData) {
|
||||
CallbackHandler* handler, StreamCallback cb, void* userData) {
|
||||
}
|
||||
|
||||
void VulkanDriver::setStreamDimensions(Handle<HwStream> sh, uint32_t width, uint32_t height) {
|
||||
@@ -799,7 +798,7 @@ bool VulkanDriver::isTextureSwizzleSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VulkanDriver::isTextureFormatMipmappable(backend::TextureFormat format) {
|
||||
bool VulkanDriver::isTextureFormatMipmappable(TextureFormat format) {
|
||||
switch (format) {
|
||||
case TextureFormat::DEPTH16:
|
||||
case TextureFormat::DEPTH24:
|
||||
@@ -863,7 +862,7 @@ math::float2 VulkanDriver::getClipSpaceParams() {
|
||||
}
|
||||
|
||||
uint8_t VulkanDriver::getMaxDrawBuffers() {
|
||||
return backend::MRT::MIN_SUPPORTED_RENDER_TARGET_COUNT; // TODO: query real value
|
||||
return MRT::MIN_SUPPORTED_RENDER_TARGET_COUNT; // TODO: query real value
|
||||
}
|
||||
|
||||
void VulkanDriver::setVertexBufferObject(Handle<HwVertexBuffer> vbh, uint32_t index,
|
||||
@@ -1722,8 +1721,8 @@ void VulkanDriver::draw(PipelineState pipelineState, Handle<HwRenderPrimitive> r
|
||||
|
||||
// Declare fixed-size arrays that get passed to the pipeCache and to vkCmdBindVertexBuffers.
|
||||
VulkanPipelineCache::VertexArray varray = {};
|
||||
VkBuffer buffers[backend::MAX_VERTEX_ATTRIBUTE_COUNT] = {};
|
||||
VkDeviceSize offsets[backend::MAX_VERTEX_ATTRIBUTE_COUNT] = {};
|
||||
VkBuffer buffers[MAX_VERTEX_ATTRIBUTE_COUNT] = {};
|
||||
VkDeviceSize offsets[MAX_VERTEX_ATTRIBUTE_COUNT] = {};
|
||||
|
||||
// For each attribute, append to each of the above lists.
|
||||
const uint32_t bufferCount = prim.vertexBuffer->attributes.size();
|
||||
@@ -1942,7 +1941,6 @@ void VulkanDriver::debugCommandBegin(CommandStream* cmds, bool synchronous, cons
|
||||
// explicit instantiation of the Dispatcher
|
||||
template class ConcreteDispatcher<VulkanDriver>;
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANDRIVER_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANDRIVER_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANDRIVER_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANDRIVER_H
|
||||
|
||||
#include "VulkanPipelineCache.h"
|
||||
#include "VulkanBlitter.h"
|
||||
@@ -34,22 +34,21 @@
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Allocator.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
class VulkanPlatform;
|
||||
struct VulkanSamplerGroup;
|
||||
|
||||
class VulkanDriver final : public DriverBase {
|
||||
public:
|
||||
static Driver* create(backend::VulkanPlatform* platform,
|
||||
static Driver* create(VulkanPlatform* platform,
|
||||
const char* const* ppEnabledExtensions, uint32_t enabledExtensionCount) noexcept;
|
||||
|
||||
private:
|
||||
|
||||
void debugCommandBegin(CommandStream* cmds, bool synchronous, const char* methodName) noexcept override;
|
||||
|
||||
inline VulkanDriver(backend::VulkanPlatform* platform,
|
||||
inline VulkanDriver(VulkanPlatform* platform,
|
||||
const char* const* ppEnabledExtensions, uint32_t enabledExtensionCount) noexcept;
|
||||
|
||||
~VulkanDriver() noexcept override;
|
||||
@@ -57,7 +56,7 @@ private:
|
||||
ShaderModel getShaderModel() const noexcept final;
|
||||
|
||||
template<typename T>
|
||||
friend class backend::ConcreteDispatcher;
|
||||
friend class ConcreteDispatcher;
|
||||
|
||||
#define DECL_DRIVER_API(methodName, paramsDecl, params) \
|
||||
UTILS_ALWAYS_INLINE inline void methodName(paramsDecl);
|
||||
@@ -76,29 +75,29 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
backend::HandleAllocatorVK mHandleAllocator;
|
||||
HandleAllocatorVK mHandleAllocator;
|
||||
|
||||
backend::VulkanPlatform& mContextManager;
|
||||
VulkanPlatform& mContextManager;
|
||||
|
||||
template<typename D, typename ... ARGS>
|
||||
backend::Handle<D> initHandle(ARGS&& ... args) noexcept {
|
||||
Handle<D> initHandle(ARGS&& ... args) noexcept {
|
||||
return mHandleAllocator.allocateAndConstruct<D>(std::forward<ARGS>(args) ...);
|
||||
}
|
||||
|
||||
template<typename D>
|
||||
backend::Handle<D> allocHandle() noexcept {
|
||||
Handle<D> allocHandle() noexcept {
|
||||
return mHandleAllocator.allocate<D>();
|
||||
}
|
||||
|
||||
template<typename D, typename B, typename ... ARGS>
|
||||
typename std::enable_if<std::is_base_of<B, D>::value, D>::type*
|
||||
construct(backend::Handle<B> const& handle, ARGS&& ... args) noexcept {
|
||||
construct(Handle<B> const& handle, ARGS&& ... args) noexcept {
|
||||
return mHandleAllocator.construct<D, B>(handle, std::forward<ARGS>(args) ...);
|
||||
}
|
||||
|
||||
template<typename B, typename D,
|
||||
typename = typename std::enable_if<std::is_base_of<B, D>::value, D>::type>
|
||||
void destruct(backend::Handle<B> handle, D const* p) noexcept {
|
||||
void destruct(Handle<B> handle, D const* p) noexcept {
|
||||
return mHandleAllocator.deallocate(handle, p);
|
||||
}
|
||||
|
||||
@@ -106,7 +105,7 @@ private:
|
||||
typename std::enable_if_t<
|
||||
std::is_pointer_v<Dp> &&
|
||||
std::is_base_of_v<B, typename std::remove_pointer_t<Dp>>, Dp>
|
||||
handle_cast(backend::Handle<B>& handle) noexcept {
|
||||
handle_cast(Handle<B>& handle) noexcept {
|
||||
return mHandleAllocator.handle_cast<Dp, B>(handle);
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ private:
|
||||
inline typename std::enable_if_t<
|
||||
std::is_pointer_v<Dp> &&
|
||||
std::is_base_of_v<B, typename std::remove_pointer_t<Dp>>, Dp>
|
||||
handle_cast(backend::Handle<B> const& handle) noexcept {
|
||||
handle_cast(Handle<B> const& handle) noexcept {
|
||||
return mHandleAllocator.handle_cast<Dp, B>(handle);
|
||||
}
|
||||
|
||||
@@ -147,7 +146,6 @@ private:
|
||||
VkDebugUtilsMessengerEXT mDebugMessenger = VK_NULL_HANDLE;
|
||||
};
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANDRIVER_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANDRIVER_H
|
||||
|
||||
@@ -14,24 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANDRIVERFACTORY_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANDRIVERFACTORY_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANDRIVERFACTORY_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANDRIVERFACTORY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
namespace filament::backend {
|
||||
|
||||
namespace backend {
|
||||
class VulkanPlatform;
|
||||
class Driver;
|
||||
|
||||
class VulkanDriverFactory {
|
||||
public:
|
||||
static backend::Driver* create(backend::VulkanPlatform* platform,
|
||||
static Driver* create(VulkanPlatform* platform,
|
||||
const char* const* ppEnabledExtensions, uint32_t enabledExtensionCount) noexcept;
|
||||
};
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif //TNT_FILAMENT_DRIVER_VULKANDRIVERFACTORY_H
|
||||
#endif //TNT_FILAMENT_BACKEND_VULKANDRIVERFACTORY_H
|
||||
|
||||
@@ -27,8 +27,7 @@ static constexpr uint32_t TIME_BEFORE_EVICTION = VK_MAX_COMMAND_BUFFERS;
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
bool VulkanFboCache::RenderPassEq::operator()(const RenderPassKey& k1,
|
||||
const RenderPassKey& k2) const {
|
||||
@@ -358,5 +357,4 @@ void VulkanFboCache::gc() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANFBOCACHE_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANFBOCACHE_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANFBOCACHE_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANFBOCACHE_H
|
||||
|
||||
#include "VulkanContext.h"
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
#include <tsl/robin_map.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
// Avoid using VkImageLayout since it requires 4 bytes.
|
||||
enum class VulkanDepthLayout : uint8_t {
|
||||
@@ -149,7 +148,6 @@ inline VkImageLayout toVkImageLayout(VulkanDepthLayout layout) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANFBOCACHE_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANFBOCACHE_H
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
static void flipVertically(VkRect2D* rect, uint32_t framebufferHeight) {
|
||||
rect->offset.y = framebufferHeight - rect->offset.y - rect->extent.height;
|
||||
@@ -230,23 +229,23 @@ VulkanBufferObject::VulkanBufferObject(VulkanContext& context, VulkanStagePool&
|
||||
bindingType(bindingType) {
|
||||
}
|
||||
|
||||
void VulkanRenderPrimitive::setPrimitiveType(backend::PrimitiveType pt) {
|
||||
void VulkanRenderPrimitive::setPrimitiveType(PrimitiveType pt) {
|
||||
this->type = pt;
|
||||
switch (pt) {
|
||||
case backend::PrimitiveType::NONE:
|
||||
case backend::PrimitiveType::POINTS:
|
||||
case PrimitiveType::NONE:
|
||||
case PrimitiveType::POINTS:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
|
||||
break;
|
||||
case backend::PrimitiveType::LINES:
|
||||
case PrimitiveType::LINES:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
break;
|
||||
case backend::PrimitiveType::LINE_STRIP:
|
||||
case PrimitiveType::LINE_STRIP:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||
break;
|
||||
case backend::PrimitiveType::TRIANGLES:
|
||||
case PrimitiveType::TRIANGLES:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
break;
|
||||
case backend::PrimitiveType::TRIANGLE_STRIP:
|
||||
case PrimitiveType::TRIANGLE_STRIP:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||
break;
|
||||
}
|
||||
@@ -281,5 +280,4 @@ VulkanTimerQuery::~VulkanTimerQuery() {
|
||||
mContext.timestamps.used.unset(startingQueryIndex / 2);
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANHANDLES_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANHANDLES_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANHANDLES_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANHANDLES_H
|
||||
|
||||
#include "VulkanDriver.h"
|
||||
#include "VulkanPipelineCache.h"
|
||||
@@ -24,8 +24,7 @@
|
||||
#include "VulkanTexture.h"
|
||||
#include "VulkanUtility.h"
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
struct VulkanProgram : public HwProgram {
|
||||
VulkanProgram(VulkanContext& context, const Program& builder) noexcept;
|
||||
@@ -106,7 +105,7 @@ struct VulkanSamplerGroup : public HwSamplerGroup {
|
||||
};
|
||||
|
||||
struct VulkanRenderPrimitive : public HwRenderPrimitive {
|
||||
void setPrimitiveType(backend::PrimitiveType pt);
|
||||
void setPrimitiveType(PrimitiveType pt);
|
||||
void setBuffers(VulkanVertexBuffer* vertexBuffer, VulkanIndexBuffer* indexBuffer);
|
||||
VulkanVertexBuffer* vertexBuffer = nullptr;
|
||||
VulkanIndexBuffer* indexBuffer = nullptr;
|
||||
@@ -145,7 +144,6 @@ inline constexpr VkBufferUsageFlagBits getBufferObjectUsage(
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANHANDLES_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANHANDLES_H
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANMEMORY_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANMEMORY_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANMEMORY_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANMEMORY_H
|
||||
|
||||
#include <bluevk/BlueVK.h> // must be included before vk_mem_alloc
|
||||
|
||||
#include "vk_mem_alloc.h"
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANMEMORY_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANMEMORY_H
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
static VulkanPipelineCache::RasterState createDefaultRasterState();
|
||||
|
||||
@@ -923,7 +922,6 @@ static VulkanPipelineCache::RasterState createDefaultRasterState() {
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANPIPELINECACHE_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANPIPELINECACHE_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANPIPELINECACHE_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANPIPELINECACHE_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/TargetBufferInfo.h>
|
||||
@@ -38,8 +38,7 @@ VK_DEFINE_HANDLE(VmaAllocator)
|
||||
VK_DEFINE_HANDLE(VmaAllocation)
|
||||
VK_DEFINE_HANDLE(VmaPool)
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
struct VulkanProgram;
|
||||
|
||||
@@ -58,10 +57,10 @@ public:
|
||||
VulkanPipelineCache& operator=(VulkanPipelineCache const&) = delete;
|
||||
|
||||
static constexpr uint32_t UBUFFER_BINDING_COUNT = Program::BINDING_COUNT;
|
||||
static constexpr uint32_t SAMPLER_BINDING_COUNT = backend::MAX_SAMPLER_COUNT;
|
||||
static constexpr uint32_t SAMPLER_BINDING_COUNT = MAX_SAMPLER_COUNT;
|
||||
static constexpr uint32_t TARGET_BINDING_COUNT = MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT;
|
||||
static constexpr uint32_t SHADER_MODULE_COUNT = 2;
|
||||
static constexpr uint32_t VERTEX_ATTRIBUTE_COUNT = backend::MAX_VERTEX_ATTRIBUTE_COUNT;
|
||||
static constexpr uint32_t VERTEX_ATTRIBUTE_COUNT = MAX_VERTEX_ATTRIBUTE_COUNT;
|
||||
|
||||
// Three descriptor set layouts: uniforms, combined image samplers, and input attachments.
|
||||
static constexpr uint32_t DESCRIPTOR_TYPE_COUNT = 3;
|
||||
@@ -429,7 +428,6 @@ private:
|
||||
VmaAllocation mDummyMemory;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANPIPELINECACHE_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANPIPELINECACHE_H
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
|
||||
#include "VulkanPlatform.h"
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
VulkanPlatform::~VulkanPlatform() = default;
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANPLATFORM_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANPLATFORM_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANPLATFORM_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANPLATFORM_H
|
||||
|
||||
#include <backend/Platform.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
class VulkanPlatform : public DefaultPlatform {
|
||||
public:
|
||||
@@ -30,7 +29,6 @@ public:
|
||||
~VulkanPlatform() override;
|
||||
};
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif //TNT_FILAMENT_DRIVER_VULKANPLATFORM_H
|
||||
#endif //TNT_FILAMENT_BACKEND_VULKANPLATFORM_H
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
constexpr inline VkSamplerAddressMode getWrapMode(SamplerWrapMode mode) noexcept {
|
||||
switch (mode) {
|
||||
@@ -99,7 +98,7 @@ constexpr inline VkBool32 getCompareEnable(SamplerCompareMode mode) noexcept {
|
||||
|
||||
VulkanSamplerCache::VulkanSamplerCache(VulkanContext& context) : mContext(context) {}
|
||||
|
||||
VkSampler VulkanSamplerCache::getSampler(backend::SamplerParams params) noexcept {
|
||||
VkSampler VulkanSamplerCache::getSampler(SamplerParams params) noexcept {
|
||||
auto iter = mCache.find(params.u);
|
||||
if (UTILS_LIKELY(iter != mCache.end())) {
|
||||
return iter->second;
|
||||
@@ -135,5 +134,4 @@ void VulkanSamplerCache::reset() noexcept {
|
||||
mCache.clear();
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,29 +14,27 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANSAMPLERCACHE_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANSAMPLERCACHE_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANSAMPLERCACHE_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANSAMPLERCACHE_H
|
||||
|
||||
#include "VulkanContext.h"
|
||||
#include "VulkanUtility.h"
|
||||
|
||||
#include <tsl/robin_map.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
// Simple manager for VkSampler objects.
|
||||
class VulkanSamplerCache {
|
||||
public:
|
||||
explicit VulkanSamplerCache(VulkanContext&);
|
||||
VkSampler getSampler(backend::SamplerParams params) noexcept;
|
||||
VkSampler getSampler(SamplerParams params) noexcept;
|
||||
void reset() noexcept;
|
||||
private:
|
||||
VulkanContext& mContext;
|
||||
tsl::robin_map<uint32_t, VkSampler> mCache;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANSAMPLERCACHE_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANSAMPLERCACHE_H
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
|
||||
static constexpr uint32_t TIME_BEFORE_EVICTION = VK_MAX_COMMAND_BUFFERS;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
VulkanStage const* VulkanStagePool::acquireStage(uint32_t numBytes) {
|
||||
// First check if a stage exists whose capacity is greater than or equal to the requested size.
|
||||
@@ -203,5 +202,4 @@ void VulkanStagePool::reset() noexcept {
|
||||
mFreeStages.clear();
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,16 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANSTAGEPOOL_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANSTAGEPOOL_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANSTAGEPOOL_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANSTAGEPOOL_H
|
||||
|
||||
#include "VulkanContext.h"
|
||||
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
// Immutable POD representing a shared CPU-GPU staging area.
|
||||
struct VulkanStage {
|
||||
@@ -79,7 +78,6 @@ private:
|
||||
uint64_t mCurrentFrame = 0;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANSTAGEPOOL_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANSTAGEPOOL_H
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
using namespace bluevk;
|
||||
using namespace utils;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
bool VulkanSwapChain::acquire() {
|
||||
if (headlessQueue) {
|
||||
@@ -355,5 +354,4 @@ VulkanTexture& VulkanSwapChain::getDepthTexture() {
|
||||
return *mDepth;
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANSWAPCHAIN_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANSWAPCHAIN_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANSWAPCHAIN_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANSWAPCHAIN_H
|
||||
|
||||
#include "VulkanContext.h"
|
||||
#include "VulkanDriver.h"
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
#include <utils/FixedCapacityVector.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
|
||||
struct VulkanSwapChain : public HwSwapChain {
|
||||
VulkanSwapChain(VulkanContext& context, VulkanStagePool& stagePool, VkSurfaceKHR vksurface);
|
||||
@@ -70,7 +70,6 @@ private:
|
||||
std::unique_ptr<VulkanTexture> mDepth;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANSWAPCHAIN_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANSWAPCHAIN_H
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
VulkanTexture::VulkanTexture(VulkanContext& context, VkImage image, VkFormat format, uint8_t samples,
|
||||
uint32_t width, uint32_t height, TextureUsage tusage, VulkanStagePool& stagePool) :
|
||||
@@ -488,5 +487,4 @@ VkImageLayout VulkanTexture::getVkLayout(uint32_t layer, uint32_t level) const {
|
||||
return mSubresourceLayouts.get(key);
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANTEXTURE_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANTEXTURE_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANTEXTURE_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANTEXTURE_H
|
||||
|
||||
#include "VulkanDriver.h"
|
||||
#include "VulkanBuffer.h"
|
||||
@@ -23,8 +23,7 @@
|
||||
|
||||
#include <utils/RangeMap.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
struct VulkanTexture : public HwTexture {
|
||||
|
||||
@@ -109,7 +108,6 @@ private:
|
||||
VulkanStagePool& mStagePool;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANTEXTURE_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANTEXTURE_H
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
|
||||
using namespace bluevk;
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
void createSemaphore(VkDevice device, VkSemaphore *semaphore) {
|
||||
VkSemaphoreCreateInfo createInfo = {};
|
||||
@@ -333,7 +332,7 @@ uint32_t getBytesPerPixel(TextureFormat format) {
|
||||
}
|
||||
|
||||
VkCompareOp getCompareOp(SamplerCompareFunc func) {
|
||||
using Compare = backend::SamplerCompareFunc;
|
||||
using Compare = SamplerCompareFunc;
|
||||
switch (func) {
|
||||
case Compare::LE: return VK_COMPARE_OP_LESS_OR_EQUAL;
|
||||
case Compare::GE: return VK_COMPARE_OP_GREATER_OR_EQUAL;
|
||||
@@ -347,7 +346,6 @@ VkCompareOp getCompareOp(SamplerCompareFunc func) {
|
||||
}
|
||||
|
||||
VkBlendFactor getBlendFactor(BlendFunction mode) {
|
||||
using BlendFunction = filament::backend::BlendFunction;
|
||||
switch (mode) {
|
||||
case BlendFunction::ZERO: return VK_BLEND_FACTOR_ZERO;
|
||||
case BlendFunction::ONE: return VK_BLEND_FACTOR_ONE;
|
||||
@@ -364,7 +362,6 @@ VkBlendFactor getBlendFactor(BlendFunction mode) {
|
||||
}
|
||||
|
||||
VkCullModeFlags getCullMode(CullingMode mode) {
|
||||
using CullingMode = filament::backend::CullingMode;
|
||||
switch (mode) {
|
||||
case CullingMode::NONE: return VK_CULL_MODE_NONE;
|
||||
case CullingMode::FRONT: return VK_CULL_MODE_FRONT_BIT;
|
||||
@@ -659,8 +656,7 @@ uint8_t reduceSampleCount(uint8_t sampleCount, VkSampleCountFlags mask) {
|
||||
return mostSignificantBit((sampleCount - 1) & mask);
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
bool operator<(const VkImageSubresourceRange& a, const VkImageSubresourceRange& b) {
|
||||
if (a.aspectMask < b.aspectMask) return true;
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_VULKANUTILITY_H
|
||||
#define TNT_FILAMENT_DRIVER_VULKANUTILITY_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_VULKANUTILITY_H
|
||||
#define TNT_FILAMENT_BACKEND_VULKANUTILITY_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <bluevk/BlueVK.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
struct VulkanLayoutTransition {
|
||||
VkImage image;
|
||||
@@ -66,9 +65,8 @@ bool equivalent(const VkExtent2D& a, const VkExtent2D& b);
|
||||
bool isDepthFormat(VkFormat format);
|
||||
uint8_t reduceSampleCount(uint8_t sampleCount, VkSampleCountFlags mask);
|
||||
|
||||
} // namespace filament
|
||||
} // namespace backend
|
||||
} // namespace filament::backend
|
||||
|
||||
bool operator<(const VkImageSubresourceRange& a, const VkImageSubresourceRange& b);
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_VULKANUTILITY_H
|
||||
#endif // TNT_FILAMENT_BACKEND_VULKANUTILITY_H
|
||||
|
||||
Reference in New Issue
Block a user