Add irrlicht device pointer to vulkan driver

This commit is contained in:
Benau 2022-05-26 17:22:39 +08:00
parent 78f871d7f2
commit ac5351ae5e
3 changed files with 13 additions and 7 deletions

View File

@ -34,7 +34,8 @@ namespace GE
public: public:
//! constructor //! constructor
GEVulkanDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, SDL_Window* window); GEVulkanDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, SDL_Window* window,
IrrlichtDevice* device);
//! destructor //! destructor
virtual ~GEVulkanDriver(); virtual ~GEVulkanDriver();
@ -332,6 +333,7 @@ namespace GE
std::unique_lock<std::mutex> getGraphicsQueue(VkQueue* queue) const; std::unique_lock<std::mutex> getGraphicsQueue(VkQueue* queue) const;
void waitIdle(); void waitIdle();
void setDisableWaitIdle(bool val) { m_disable_wait_idle = val; } void setDisableWaitIdle(bool val) { m_disable_wait_idle = val; }
IrrlichtDevice* getIrrlichtDevice() const { return m_irrlicht_device; }
private: private:
struct SwapChainSupportDetails struct SwapChainSupportDetails
{ {
@ -448,6 +450,8 @@ namespace GE
SDL_Window* m_window; SDL_Window* m_window;
bool m_disable_wait_idle; bool m_disable_wait_idle;
IrrlichtDevice* m_irrlicht_device;
void createInstance(SDL_Window* window); void createInstance(SDL_Window* window);
void findPhysicalDevice(); void findPhysicalDevice();
bool checkDeviceExtensions(VkPhysicalDevice device); bool checkDeviceExtensions(VkPhysicalDevice device);

View File

@ -450,9 +450,10 @@ std::atomic_bool g_schedule_pausing_rendering(false);
std::atomic_bool g_paused_rendering(false); std::atomic_bool g_paused_rendering(false);
GEVulkanDriver::GEVulkanDriver(const SIrrlichtCreationParameters& params, GEVulkanDriver::GEVulkanDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, SDL_Window* window) io::IFileSystem* io, SDL_Window* window,
IrrlichtDevice* device)
: CNullDriver(io, core::dimension2d<u32>(0, 0)), : CNullDriver(io, core::dimension2d<u32>(0, 0)),
m_params(params) m_params(params), m_irrlicht_device(device)
{ {
m_vk.reset(new VK()); m_vk.reset(new VK());
m_physical_device = VK_NULL_HANDLE; m_physical_device = VK_NULL_HANDLE;
@ -2029,9 +2030,10 @@ namespace irr
namespace video namespace video
{ {
IVideoDriver* createVulkanDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createVulkanDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, SDL_Window* window) io::IFileSystem* io, SDL_Window* window,
IrrlichtDevice* device)
{ {
return new GE::GEVulkanDriver(params, io, window); return new GE::GEVulkanDriver(params, io, window, device);
} // createVulkanDriver } // createVulkanDriver
} }
} }

View File

@ -42,7 +42,7 @@ namespace irr
#endif #endif
#ifdef _IRR_COMPILE_WITH_VULKAN_ #ifdef _IRR_COMPILE_WITH_VULKAN_
IVideoDriver* createVulkanDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createVulkanDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io, SDL_Window* win); io::IFileSystem* io, SDL_Window* win, IrrlichtDevice* device);
#endif #endif
} // end namespace video } // end namespace video
@ -637,7 +637,7 @@ void CIrrDeviceSDL::createDriver()
#ifdef _IRR_COMPILE_WITH_VULKAN_ #ifdef _IRR_COMPILE_WITH_VULKAN_
try try
{ {
VideoDriver = video::createVulkanDriver(CreationParams, FileSystem, Window); VideoDriver = video::createVulkanDriver(CreationParams, FileSystem, Window, this);
} }
catch (std::exception& e) catch (std::exception& e)
{ {