mirror of https://github.com/PCSX2/pcsx2.git
HostDisplay: Remove levels/layers from HostDisplayTexture
Wasn't implemented for updates, and we're not going to use it any time soon.
This commit is contained in:
parent
3caebb31ae
commit
e3b4d13c47
|
@ -35,14 +35,11 @@ class D3D11HostDisplayTexture : public HostDisplayTexture
|
|||
{
|
||||
public:
|
||||
D3D11HostDisplayTexture(Microsoft::WRL::ComPtr<ID3D11Texture2D> texture,
|
||||
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> srv, u32 width, u32 height, u32 layers,
|
||||
u32 levels, bool dynamic)
|
||||
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> 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<ID3D11ShaderResourceView> 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<bool>(m_swap_chain);
|
||||
}
|
||||
|
||||
std::unique_ptr<HostDisplayTexture> D3D11HostDisplay::CreateTexture(u32 width, u32 height, u32 layers, u32 levels,
|
||||
const void* data, u32 data_stride, bool dynamic /* = false */)
|
||||
std::unique_ptr<HostDisplayTexture> 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<HostDisplayTexture> D3D11HostDisplay::CreateTexture(u32 width, u
|
|||
if (FAILED(hr))
|
||||
return {};
|
||||
|
||||
return std::make_unique<D3D11HostDisplayTexture>(std::move(texture), std::move(srv), width, height, layers, levels, dynamic);
|
||||
return std::make_unique<D3D11HostDisplayTexture>(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<D3D11HostDisplayTexture*>(texture);
|
||||
if (!d3d11_texture->IsDynamic())
|
||||
|
|
|
@ -58,10 +58,8 @@ public:
|
|||
void DestroyRenderSurface() override;
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
std::unique_ptr<HostDisplayTexture> 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<HostDisplayTexture> 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;
|
||||
|
||||
|
|
|
@ -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<void*>(static_cast<uintptr_t>(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<HostDisplayTexture> OpenGLHostDisplay::CreateTexture(u32 width, u32 height, u32 layers, u32 levels,
|
||||
const void* data, u32 data_stride, bool dynamic /* = false */)
|
||||
std::unique_ptr<HostDisplayTexture> 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<HostDisplayTexture> OpenGLHostDisplay::CreateTexture(u32 width,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return std::make_unique<OpenGLHostDisplayTexture>(id, width, height, layers, levels);
|
||||
return std::make_unique<OpenGLHostDisplayTexture>(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<OpenGLHostDisplayTexture*>(texture);
|
||||
|
||||
|
|
|
@ -52,10 +52,8 @@ public:
|
|||
void DestroyRenderSurface() override;
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
std::unique_ptr<HostDisplayTexture> 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<HostDisplayTexture> 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;
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ public:
|
|||
void* GetHandle() const override { return const_cast<Vulkan::Texture*>(&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<HostDisplayTexture> VulkanHostDisplay::CreateTexture(
|
||||
u32 width, u32 height, u32 layers, u32 levels, const void* data, u32 data_stride, bool dynamic /* = false */)
|
||||
std::unique_ptr<HostDisplayTexture> 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);
|
||||
|
||||
|
|
|
@ -43,10 +43,8 @@ public:
|
|||
void DestroyRenderSurface() override;
|
||||
std::string GetDriverInfo() const override;
|
||||
|
||||
std::unique_ptr<HostDisplayTexture> 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<HostDisplayTexture> 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;
|
||||
|
||||
|
|
|
@ -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<HostDisplayTexture> 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<HostDisplayTexture> 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.
|
||||
|
|
Loading…
Reference in New Issue