ComputeSystemVKImpl.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #ifdef JPH_USE_VK
  6. #include <Jolt/Compute/VK/ComputeSystemVKWithAllocator.h>
  7. JPH_NAMESPACE_BEGIN
  8. /// Implementation of ComputeSystemVK that fully initializes Vulkan
  9. class JPH_EXPORT ComputeSystemVKImpl : public ComputeSystemVKWithAllocator
  10. {
  11. public:
  12. JPH_DECLARE_RTTI_VIRTUAL(JPH_EXPORT, ComputeSystemVKImpl)
  13. /// Destructor
  14. virtual ~ComputeSystemVKImpl() override;
  15. /// Initialize the compute system
  16. bool Initialize(ComputeSystemResult &outResult);
  17. protected:
  18. /// Override to perform actions once the instance has been created
  19. virtual void OnInstanceCreated() { /* Do nothing */ }
  20. /// Override to add platform specific instance extensions
  21. virtual void GetInstanceExtensions(Array<const char *> &outExtensions) { /* Add nothing */ }
  22. /// Override to add platform specific device extensions
  23. virtual void GetDeviceExtensions(Array<const char *> &outExtensions) { /* Add nothing */ }
  24. /// Override to enable specific features
  25. virtual void GetEnabledFeatures(VkPhysicalDeviceFeatures2 &ioFeatures) { /* Add nothing */ }
  26. /// Override to check for present support on a given device and queue family
  27. virtual bool HasPresentSupport(VkPhysicalDevice inDevice, uint32 inQueueFamilyIndex) { return true; }
  28. /// Override to select the surface format
  29. virtual VkSurfaceFormatKHR SelectFormat(VkPhysicalDevice inDevice) { return { VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR }; }
  30. VkInstance mInstance = VK_NULL_HANDLE;
  31. #ifdef JPH_DEBUG
  32. VkDebugUtilsMessengerEXT mDebugMessenger = VK_NULL_HANDLE;
  33. #endif
  34. uint32 mGraphicsQueueIndex = 0;
  35. uint32 mPresentQueueIndex = 0;
  36. VkQueue mGraphicsQueue = VK_NULL_HANDLE;
  37. VkQueue mPresentQueue = VK_NULL_HANDLE;
  38. VkSurfaceFormatKHR mSelectedFormat;
  39. };
  40. JPH_NAMESPACE_END
  41. #endif // JPH_USE_VK