diff --git a/pcsx2/Frontend/D3D11HostDisplay.cpp b/pcsx2/Frontend/D3D11HostDisplay.cpp index 90bbdc9eca..3b3d1f3939 100644 --- a/pcsx2/Frontend/D3D11HostDisplay.cpp +++ b/pcsx2/Frontend/D3D11HostDisplay.cpp @@ -35,14 +35,11 @@ class D3D11HostDisplayTexture : public HostDisplayTexture { public: D3D11HostDisplayTexture(Microsoft::WRL::ComPtr texture, - Microsoft::WRL::ComPtr srv, u32 width, u32 height, u32 layers, - u32 levels, bool dynamic) + Microsoft::WRL::ComPtr srv, u32 width, u32 height, bool dynamic) : m_texture(std::move(texture)) , m_srv(std::move(srv)) , m_width(width) , m_height(height) - , m_layers(layers) - , m_levels(levels) , m_dynamic(dynamic) { } @@ -51,8 +48,6 @@ public: void* GetHandle() const override { return m_srv.Get(); } u32 GetWidth() const override { return m_width; } u32 GetHeight() const override { return m_height; } - u32 GetLayers() const override { return m_layers; } - u32 GetLevels() const override { return m_levels; } __fi ID3D11Texture2D* GetD3DTexture() const { return m_texture.Get(); } __fi ID3D11ShaderResourceView* GetD3DSRV() const { return m_srv.Get(); } @@ -64,8 +59,6 @@ private: Microsoft::WRL::ComPtr m_srv; u32 m_width; u32 m_height; - u32 m_layers; - u32 m_levels; bool m_dynamic; }; @@ -135,10 +128,9 @@ bool D3D11HostDisplay::HasRenderSurface() const return static_cast(m_swap_chain); } -std::unique_ptr D3D11HostDisplay::CreateTexture(u32 width, u32 height, u32 layers, u32 levels, - const void* data, u32 data_stride, bool dynamic /* = false */) +std::unique_ptr D3D11HostDisplay::CreateTexture(u32 width, u32 height, const void* data, u32 data_stride, bool dynamic /* = false */) { - const CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8G8B8A8_UNORM, width, height, layers, levels, + const CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8G8B8A8_UNORM, width, height, 1u, 1u, D3D11_BIND_SHADER_RESOURCE, dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT, dynamic ? D3D11_CPU_ACCESS_WRITE : 0, 1, 0, 0); const D3D11_SUBRESOURCE_DATA srd{data, data_stride, data_stride * height}; @@ -154,11 +146,10 @@ std::unique_ptr D3D11HostDisplay::CreateTexture(u32 width, u if (FAILED(hr)) return {}; - return std::make_unique(std::move(texture), std::move(srv), width, height, layers, levels, dynamic); + return std::make_unique(std::move(texture), std::move(srv), width, height, dynamic); } -void D3D11HostDisplay::UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, - const void* texture_data, u32 texture_data_stride) +void D3D11HostDisplay::UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* texture_data, u32 texture_data_stride) { D3D11HostDisplayTexture* d3d11_texture = static_cast(texture); if (!d3d11_texture->IsDynamic()) diff --git a/pcsx2/Frontend/D3D11HostDisplay.h b/pcsx2/Frontend/D3D11HostDisplay.h index 9da4c902af..bef98794fe 100644 --- a/pcsx2/Frontend/D3D11HostDisplay.h +++ b/pcsx2/Frontend/D3D11HostDisplay.h @@ -58,10 +58,8 @@ public: void DestroyRenderSurface() override; std::string GetDriverInfo() const override; - std::unique_ptr CreateTexture(u32 width, u32 height, u32 layers, u32 levels, - const void* data, u32 data_stride, bool dynamic = false) override; - void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* texture_data, - u32 texture_data_stride) override; + std::unique_ptr CreateTexture(u32 width, u32 height, const void* data, u32 data_stride, bool dynamic = false) override; + void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* texture_data, u32 texture_data_stride) override; bool GetHostRefreshRate(float* refresh_rate) override; diff --git a/pcsx2/Frontend/OpenGLHostDisplay.cpp b/pcsx2/Frontend/OpenGLHostDisplay.cpp index db36aa3956..849080894c 100644 --- a/pcsx2/Frontend/OpenGLHostDisplay.cpp +++ b/pcsx2/Frontend/OpenGLHostDisplay.cpp @@ -29,12 +29,10 @@ class OpenGLHostDisplayTexture : public HostDisplayTexture { public: - OpenGLHostDisplayTexture(GLuint texture, u32 width, u32 height, u32 layers, u32 levels) + OpenGLHostDisplayTexture(GLuint texture, u32 width, u32 height) : m_texture(texture) , m_width(width) , m_height(height) - , m_layers(layers) - , m_levels(levels) { } ~OpenGLHostDisplayTexture() override = default; @@ -42,8 +40,6 @@ public: void* GetHandle() const override { return reinterpret_cast(static_cast(m_texture)); } u32 GetWidth() const override { return m_width; } u32 GetHeight() const override { return m_height; } - u32 GetLayers() const override { return m_layers; } - u32 GetLevels() const override { return m_levels; } GLuint GetGLID() const { return m_texture; } @@ -82,8 +78,7 @@ void* OpenGLHostDisplay::GetRenderSurface() const return nullptr; } -std::unique_ptr OpenGLHostDisplay::CreateTexture(u32 width, u32 height, u32 layers, u32 levels, - const void* data, u32 data_stride, bool dynamic /* = false */) +std::unique_ptr OpenGLHostDisplay::CreateTexture(u32 width, u32 height, const void* data, u32 data_stride, bool dynamic /* = false */) { // clear error glGetError(); @@ -105,11 +100,10 @@ std::unique_ptr OpenGLHostDisplay::CreateTexture(u32 width, return nullptr; } - return std::make_unique(id, width, height, layers, levels); + return std::make_unique(id, width, height); } -void OpenGLHostDisplay::UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, - const void* texture_data, u32 texture_data_stride) +void OpenGLHostDisplay::UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* texture_data, u32 texture_data_stride) { OpenGLHostDisplayTexture* tex = static_cast(texture); diff --git a/pcsx2/Frontend/OpenGLHostDisplay.h b/pcsx2/Frontend/OpenGLHostDisplay.h index 25c0ce49b7..42bc9cc32e 100644 --- a/pcsx2/Frontend/OpenGLHostDisplay.h +++ b/pcsx2/Frontend/OpenGLHostDisplay.h @@ -52,10 +52,8 @@ public: void DestroyRenderSurface() override; std::string GetDriverInfo() const override; - std::unique_ptr CreateTexture(u32 width, u32 height, u32 layers, u32 levels, const void* data, - u32 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; + std::unique_ptr CreateTexture(u32 width, u32 height, const void* data, u32 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; void SetVSync(VsyncMode mode) override; diff --git a/pcsx2/Frontend/VulkanHostDisplay.cpp b/pcsx2/Frontend/VulkanHostDisplay.cpp index eec6b88ded..88712bf565 100644 --- a/pcsx2/Frontend/VulkanHostDisplay.cpp +++ b/pcsx2/Frontend/VulkanHostDisplay.cpp @@ -28,8 +28,6 @@ public: void* GetHandle() const override { return const_cast(&m_texture); } u32 GetWidth() const override { return m_texture.GetWidth(); } u32 GetHeight() const override { return m_texture.GetHeight(); } - u32 GetLayers() const override { return m_texture.GetLayers(); } - u32 GetLevels() const override { return m_texture.GetLevels(); } const Vulkan::Texture& GetTexture() const { return m_texture; } Vulkan::Texture& GetTexture() { return m_texture; } @@ -178,19 +176,15 @@ static bool UploadBufferToTexture(Vulkan::Texture* texture, u32 width, u32 heigh return true; } -std::unique_ptr VulkanHostDisplay::CreateTexture( - u32 width, u32 height, u32 layers, u32 levels, const void* data, u32 data_stride, bool dynamic /* = false */) +std::unique_ptr VulkanHostDisplay::CreateTexture(u32 width, u32 height, const void* data, u32 data_stride, bool dynamic /* = false */) { static constexpr VkFormat vk_format = VK_FORMAT_R8G8B8A8_UNORM; static constexpr VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; Vulkan::Texture texture; - if (!texture.Create(width, height, levels, layers, vk_format, VK_SAMPLE_COUNT_1_BIT, - (layers > 1) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, usage)) - { + if (!texture.Create(width, height, 1, 1, vk_format, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, usage)) return {}; - } texture.TransitionToLayout(g_vulkan_context->GetCurrentCommandBuffer(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); diff --git a/pcsx2/Frontend/VulkanHostDisplay.h b/pcsx2/Frontend/VulkanHostDisplay.h index 9f1963b823..88b30cd67a 100644 --- a/pcsx2/Frontend/VulkanHostDisplay.h +++ b/pcsx2/Frontend/VulkanHostDisplay.h @@ -43,10 +43,8 @@ public: void DestroyRenderSurface() override; std::string GetDriverInfo() const override; - std::unique_ptr CreateTexture(u32 width, u32 height, u32 layers, u32 levels, - const void* data, u32 data_stride, bool dynamic = false) override; - void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* texture_data, - u32 texture_data_stride) override; + std::unique_ptr CreateTexture(u32 width, u32 height, const void* data, u32 data_stride, bool dynamic = false) override; + void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* texture_data, u32 texture_data_stride) override; void SetVSync(VsyncMode mode) override; diff --git a/pcsx2/HostDisplay.h b/pcsx2/HostDisplay.h index 90414d7e45..edb7db61ce 100644 --- a/pcsx2/HostDisplay.h +++ b/pcsx2/HostDisplay.h @@ -36,8 +36,6 @@ public: virtual void* GetHandle() const = 0; virtual u32 GetWidth() const = 0; virtual u32 GetHeight() const = 0; - virtual u32 GetLayers() const = 0; - virtual u32 GetLevels() const = 0; }; /// Interface to the frontend's renderer. @@ -114,10 +112,8 @@ public: virtual void ResizeRenderWindow(s32 new_window_width, s32 new_window_height, float new_window_scale) = 0; /// Creates an abstracted RGBA8 texture. If dynamic, the texture can be updated with UpdateTexture() below. - virtual std::unique_ptr CreateTexture(u32 width, u32 height, u32 layers, u32 levels, const void* data, - u32 data_stride, bool dynamic = false) = 0; - virtual void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* data, - u32 data_stride) = 0; + virtual std::unique_ptr CreateTexture(u32 width, u32 height, const void* data, u32 data_stride, bool dynamic = false) = 0; + virtual void UpdateTexture(HostDisplayTexture* texture, u32 x, u32 y, u32 width, u32 height, const void* data, u32 data_stride) = 0; /// Returns false if the window was completely occluded. If frame_skip is set, the frame won't be /// displayed, but the GPU command queue will still be flushed.