mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-14 06:15:46 -04:00
HostDisplay: Move most backend logic to FrontendCommon
This commit is contained in:
@ -14,57 +14,44 @@ class SwapChain;
|
||||
|
||||
namespace FrontendCommon {
|
||||
|
||||
class VulkanHostDisplay
|
||||
class VulkanHostDisplay : public HostDisplay
|
||||
{
|
||||
public:
|
||||
VulkanHostDisplay();
|
||||
~VulkanHostDisplay();
|
||||
virtual ~VulkanHostDisplay();
|
||||
|
||||
ALWAYS_INLINE HostDisplay::RenderAPI GetRenderAPI() const { return HostDisplay::RenderAPI::Vulkan; }
|
||||
ALWAYS_INLINE void* GetRenderDevice() const { return nullptr; }
|
||||
ALWAYS_INLINE void* GetRenderContext() const { return nullptr; }
|
||||
virtual RenderAPI GetRenderAPI() const override;
|
||||
virtual void* GetRenderDevice() const override;
|
||||
virtual void* GetRenderContext() const override;
|
||||
|
||||
std::unique_ptr<HostDisplayTexture> CreateTexture(u32 width, u32 height, const void* data, u32 data_stride,
|
||||
bool dynamic);
|
||||
void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* data,
|
||||
u32 data_stride);
|
||||
virtual bool HasRenderDevice() const override;
|
||||
virtual bool HasRenderSurface() const override;
|
||||
|
||||
virtual bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device) override;
|
||||
virtual bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device) override;
|
||||
virtual void DestroyRenderDevice() override;
|
||||
|
||||
virtual bool MakeRenderContextCurrent() override;
|
||||
virtual bool DoneRenderContextCurrent() override;
|
||||
|
||||
virtual bool ChangeRenderWindow(const WindowInfo& new_wi) override;
|
||||
virtual void ResizeRenderWindow(s32 new_window_width, s32 new_window_height) override;
|
||||
virtual void DestroyRenderSurface() override;
|
||||
|
||||
std::unique_ptr<HostDisplayTexture> CreateTexture(u32 width, u32 height, const void* initial_data,
|
||||
u32 initial_data_stride, bool dynamic) override;
|
||||
void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* texture_data,
|
||||
u32 texture_data_stride) override;
|
||||
bool DownloadTexture(const void* texture_handle, u32 x, u32 y, u32 width, u32 height, void* out_data,
|
||||
u32 out_data_stride);
|
||||
u32 out_data_stride) override;
|
||||
|
||||
void SetVSync(bool enabled);
|
||||
virtual void SetVSync(bool enabled) override;
|
||||
|
||||
bool BeginRender();
|
||||
void RenderDisplay(s32 left, s32 top, s32 width, s32 height, void* texture_handle, u32 texture_width,
|
||||
u32 texture_height, u32 texture_view_x, u32 texture_view_y, u32 texture_view_width,
|
||||
u32 texture_view_height, bool linear_filter);
|
||||
void RenderImGui();
|
||||
void RenderSoftwareCursor(s32 left, s32 top, s32 width, s32 height, HostDisplayTexture* texture_handle);
|
||||
void EndRenderAndPresent();
|
||||
|
||||
bool CreateContextAndSwapChain(const WindowInfo& wi, std::string_view gpu_name, bool debug_device);
|
||||
bool HasContext() const;
|
||||
void DestroyContext();
|
||||
|
||||
void CreateShaderCache(std::string_view shader_cache_directory, bool debug_shaders);
|
||||
void DestroyShaderCache();
|
||||
|
||||
bool CreateResources();
|
||||
void DestroyResources();
|
||||
|
||||
bool CreateImGuiContext();
|
||||
void DestroyImGuiContext();
|
||||
|
||||
ALWAYS_INLINE u32 GetSwapChainWidth() const { return m_swap_chain->GetWidth(); }
|
||||
ALWAYS_INLINE u32 GetSwapChainHeight() const { return m_swap_chain->GetHeight(); }
|
||||
ALWAYS_INLINE bool HasSwapChain() const { return static_cast<bool>(m_swap_chain); }
|
||||
|
||||
bool RecreateSwapChain(const WindowInfo& new_wi);
|
||||
void ResizeSwapChain(u32 new_width, u32 new_height);
|
||||
void DestroySwapChain();
|
||||
virtual bool Render() override;
|
||||
|
||||
static std::vector<std::string> EnumerateAdapterNames();
|
||||
|
||||
private:
|
||||
protected:
|
||||
struct PushConstants
|
||||
{
|
||||
float src_rect_left;
|
||||
@ -73,6 +60,21 @@ private:
|
||||
float src_rect_height;
|
||||
};
|
||||
|
||||
virtual bool CreateResources();
|
||||
virtual void DestroyResources();
|
||||
|
||||
virtual bool CreateImGuiContext();
|
||||
virtual void DestroyImGuiContext();
|
||||
|
||||
void RenderDisplay();
|
||||
void RenderImGui();
|
||||
void RenderSoftwareCursor();
|
||||
|
||||
void RenderDisplay(s32 left, s32 top, s32 width, s32 height, void* texture_handle, u32 texture_width,
|
||||
s32 texture_height, s32 texture_view_x, s32 texture_view_y, s32 texture_view_width,
|
||||
s32 texture_view_height, bool linear_filter);
|
||||
void RenderSoftwareCursor(s32 left, s32 top, s32 width, s32 height, HostDisplayTexture* texture_handle);
|
||||
|
||||
std::unique_ptr<Vulkan::SwapChain> m_swap_chain;
|
||||
|
||||
VkDescriptorSetLayout m_descriptor_set_layout = VK_NULL_HANDLE;
|
||||
|
Reference in New Issue
Block a user