From 19847c4574c241c658647e1e8d5b6bba3a9d2f42 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 31 Oct 2019 17:13:01 +0000 Subject: [PATCH] GL doesn't support block-compressed 3D textures --- renderdoc/core/image_viewer.cpp | 2 +- renderdoc/core/replay_proxy.cpp | 2 +- renderdoc/core/replay_proxy.h | 2 +- renderdoc/driver/d3d11/d3d11_replay.cpp | 4 ++-- renderdoc/driver/d3d11/d3d11_replay.h | 2 +- renderdoc/driver/d3d12/d3d12_replay.cpp | 4 ++-- renderdoc/driver/d3d12/d3d12_replay.h | 2 +- renderdoc/driver/gl/gl_replay.cpp | 18 ++++++++++++++---- renderdoc/driver/gl/gl_replay.h | 2 +- renderdoc/driver/vulkan/vk_replay.cpp | 2 +- renderdoc/driver/vulkan/vk_replay.h | 2 +- renderdoc/replay/replay_driver.h | 2 +- 12 files changed, 27 insertions(+), 17 deletions(-) diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index fde1224d4..3dc2a01ee 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -305,7 +305,7 @@ public: { RDCERR("Calling proxy-render functions on an image viewer"); } - bool IsTextureSupported(const ResourceFormat &format) { return true; } + bool IsTextureSupported(const TextureDescription &tex) { return true; } bool NeedRemapForFetch(const ResourceFormat &format) { return false; } ResourceId CreateProxyBuffer(const BufferDescription &templateBuf) { diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index b49eaa01d..05f226dc0 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -2143,7 +2143,7 @@ void ReplayProxy::RemapProxyTextureIfNeeded(TextureDescription &tex, GetTextureD return; } - if(m_Proxy->IsTextureSupported(tex.format)) + if(m_Proxy->IsTextureSupported(tex)) return; if(tex.format.Special()) diff --git a/renderdoc/core/replay_proxy.h b/renderdoc/core/replay_proxy.h index 41348c4cf..c50ecdbdc 100644 --- a/renderdoc/core/replay_proxy.h +++ b/renderdoc/core/replay_proxy.h @@ -559,7 +559,7 @@ public: RDCERR("Calling proxy-render functions on a proxy serialiser"); } - bool IsTextureSupported(const ResourceFormat &format) { return true; } + bool IsTextureSupported(const TextureDescription &tex) { return true; } ResourceId CreateProxyBuffer(const BufferDescription &templateBuf) { RDCERR("Calling proxy-render functions on a proxy serialiser"); diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index f0c280d3a..ae4a19234 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -3576,9 +3576,9 @@ void D3D11Replay::SetProxyTextureData(ResourceId texid, const Subresource &sub, } } -bool D3D11Replay::IsTextureSupported(const ResourceFormat &format) +bool D3D11Replay::IsTextureSupported(const TextureDescription &tex) { - return MakeDXGIFormat(format) != DXGI_FORMAT_UNKNOWN; + return MakeDXGIFormat(tex.format) != DXGI_FORMAT_UNKNOWN; } bool D3D11Replay::NeedRemapForFetch(const ResourceFormat &format) diff --git a/renderdoc/driver/d3d11/d3d11_replay.h b/renderdoc/driver/d3d11/d3d11_replay.h index ddca494f0..20b01dd38 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.h +++ b/renderdoc/driver/d3d11/d3d11_replay.h @@ -203,7 +203,7 @@ public: ResourceId CreateProxyTexture(const TextureDescription &templateTex); void SetProxyTextureData(ResourceId texid, const Subresource &sub, byte *data, size_t dataSize); - bool IsTextureSupported(const ResourceFormat &format); + bool IsTextureSupported(const TextureDescription &tex); bool NeedRemapForFetch(const ResourceFormat &format); ResourceId CreateProxyBuffer(const BufferDescription &templateBuf); diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 8754e649e..51547a6ac 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -2670,9 +2670,9 @@ std::vector D3D12Replay::GetPassEvents(uint32_t eventId) return passEvents; } -bool D3D12Replay::IsTextureSupported(const ResourceFormat &format) +bool D3D12Replay::IsTextureSupported(const TextureDescription &tex) { - return MakeDXGIFormat(format) != DXGI_FORMAT_UNKNOWN; + return MakeDXGIFormat(tex.format) != DXGI_FORMAT_UNKNOWN; } bool D3D12Replay::NeedRemapForFetch(const ResourceFormat &format) diff --git a/renderdoc/driver/d3d12/d3d12_replay.h b/renderdoc/driver/d3d12/d3d12_replay.h index e830a06d8..4a245556b 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.h +++ b/renderdoc/driver/d3d12/d3d12_replay.h @@ -165,7 +165,7 @@ public: ResourceId CreateProxyTexture(const TextureDescription &templateTex); void SetProxyTextureData(ResourceId texid, const Subresource &sub, byte *data, size_t dataSize); - bool IsTextureSupported(const ResourceFormat &format); + bool IsTextureSupported(const TextureDescription &tex); bool NeedRemapForFetch(const ResourceFormat &format); ResourceId CreateProxyBuffer(const BufferDescription &templateBuf); diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index f2289b2f9..90dd5f5c6 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -3290,22 +3290,32 @@ void GLReplay::SetProxyTextureData(ResourceId texid, const Subresource &sub, byt } } -bool GLReplay::IsTextureSupported(const ResourceFormat &format) +bool GLReplay::IsTextureSupported(const TextureDescription &tex) { // We couldn't create proxy textures for ASTC textures (see MakeGLFormat). So we give back false // and let RemapProxyTextureIfNeeded to set remap type for them. - if(format.type == ResourceFormatType::ASTC) + if(tex.format.type == ResourceFormatType::ASTC) return false; // we don't try to replay alpha8 textures, as we stick strictly to core profile GL - if(format.type == ResourceFormatType::A8) + if(tex.format.type == ResourceFormatType::A8) return false; // BGRA is not accepted as an internal format in case of GL // EXT_texture_format_BGRA8888 is required for creating BGRA proxy textures in case of GLES - if(format.BGRAOrder()) + if(tex.format.BGRAOrder()) return IsGLES && HasExt[EXT_texture_format_BGRA8888]; + // don't support 3D block compressed textures + if(tex.dimension == 3 && + (tex.format.type == ResourceFormatType::BC1 || tex.format.type == ResourceFormatType::BC2 || + tex.format.type == ResourceFormatType::BC1 || tex.format.type == ResourceFormatType::BC2 || + tex.format.type == ResourceFormatType::BC3 || tex.format.type == ResourceFormatType::BC4 || + tex.format.type == ResourceFormatType::BC5 || tex.format.type == ResourceFormatType::BC6 || + tex.format.type == ResourceFormatType::BC7 || tex.format.type == ResourceFormatType::ASTC || + tex.format.type == ResourceFormatType::ETC2 || tex.format.type == ResourceFormatType::EAC)) + return false; + return true; } diff --git a/renderdoc/driver/gl/gl_replay.h b/renderdoc/driver/gl/gl_replay.h index 7208e9418..59e973fa4 100644 --- a/renderdoc/driver/gl/gl_replay.h +++ b/renderdoc/driver/gl/gl_replay.h @@ -220,7 +220,7 @@ public: ResourceId CreateProxyTexture(const TextureDescription &templateTex); void SetProxyTextureData(ResourceId texid, const Subresource &sub, byte *data, size_t dataSize); - bool IsTextureSupported(const ResourceFormat &format); + bool IsTextureSupported(const TextureDescription &tex); bool NeedRemapForFetch(const ResourceFormat &format); ResourceId CreateProxyBuffer(const BufferDescription &templateBuf); diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index d7c017cfd..a5d53a90c 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -4098,7 +4098,7 @@ void VulkanReplay::SetProxyTextureData(ResourceId texid, const Subresource &sub, VULKANNOTIMP("SetProxyTextureData"); } -bool VulkanReplay::IsTextureSupported(const ResourceFormat &format) +bool VulkanReplay::IsTextureSupported(const TextureDescription &tex) { return true; } diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 3facf42d8..189b9703c 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -380,7 +380,7 @@ public: ResourceId CreateProxyTexture(const TextureDescription &templateTex); void SetProxyTextureData(ResourceId texid, const Subresource &sub, byte *data, size_t dataSize); - bool IsTextureSupported(const ResourceFormat &format); + bool IsTextureSupported(const TextureDescription &tex); bool NeedRemapForFetch(const ResourceFormat &format); ResourceId CreateProxyBuffer(const BufferDescription &templateBuf); diff --git a/renderdoc/replay/replay_driver.h b/renderdoc/replay/replay_driver.h index 0f4a52803..6e4302370 100644 --- a/renderdoc/replay/replay_driver.h +++ b/renderdoc/replay/replay_driver.h @@ -210,7 +210,7 @@ public: virtual ResourceId CreateProxyTexture(const TextureDescription &templateTex) = 0; virtual void SetProxyTextureData(ResourceId texid, const Subresource &sub, byte *data, size_t dataSize) = 0; - virtual bool IsTextureSupported(const ResourceFormat &format) = 0; + virtual bool IsTextureSupported(const TextureDescription &tex) = 0; virtual ResourceId CreateProxyBuffer(const BufferDescription &templateBuf) = 0; virtual void SetProxyBufferData(ResourceId bufid, byte *data, size_t dataSize) = 0;