diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index ef40d155f..4e0d74e70 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -103,7 +103,6 @@ struct FetchTexture bool32 cubemap; uint32_t mips; uint32_t arraysize; - uint32_t numSubresources; uint32_t creationFlags; uint32_t msQual, msSamp; uint64_t byteSize; diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index 14b846419..679ab9ea6 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -430,7 +430,6 @@ void ImageViewer::RefreshFile() texDetails.format = rgba8_unorm; // reasonable defaults - texDetails.numSubresources = 1; texDetails.dimension = 2; texDetails.arraysize = 1; texDetails.width = 1; @@ -588,7 +587,6 @@ void ImageViewer::RefreshFile() texDetails.height = read_data.height; texDetails.depth = read_data.depth; texDetails.mips = read_data.mips; - texDetails.numSubresources = texDetails.arraysize * texDetails.mips; texDetails.format = read_data.format; texDetails.dimension = 1; if(texDetails.width > 1) @@ -597,7 +595,7 @@ void ImageViewer::RefreshFile() texDetails.dimension = 3; m_FrameRecord.frameInfo.fileSize = 0; - for(uint32_t i = 0; i < texDetails.numSubresources; i++) + for(uint32_t i = 0; i < texDetails.arraysize * texDetails.mips; i++) m_FrameRecord.frameInfo.fileSize += read_data.subsizes[i]; } @@ -628,7 +626,7 @@ void ImageViewer::RefreshFile() } else { - for(uint32_t i = 0; i < texDetails.numSubresources; i++) + for(uint32_t i = 0; i < texDetails.arraysize * texDetails.mips; i++) { m_Proxy->SetProxyTextureData(m_TextureID, i / texDetails.mips, i % texDetails.mips, read_data.subdata[i], (size_t)read_data.subsizes[i]); diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index 41331847b..d8198ca31 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -1044,13 +1044,12 @@ void Serialiser::Serialise(const char *name, FetchTexture &el) Serialise("", el.cubemap); Serialise("", el.mips); Serialise("", el.arraysize); - Serialise("", el.numSubresources); Serialise("", el.creationFlags); Serialise("", el.msQual); Serialise("", el.msSamp); Serialise("", el.byteSize); - SIZE_CHECK(FetchTexture, 152); + SIZE_CHECK(FetchTexture, 144); } template <> diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index aa5e64864..dc2125f7b 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -74,8 +74,6 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.cubemap = false; tex.format = MakeResourceFormat(desc.Format); - tex.numSubresources = desc.MipLevels; - tex.creationFlags = 0; if(desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) tex.creationFlags |= eTextureCreate_SRV; @@ -86,10 +84,11 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS) tex.creationFlags |= eTextureCreate_UAV; - if(desc.MipLevels == 0) - tex.numSubresources = CalcNumMips(desc.Width, 1, 1); + tex.mips = desc.MipLevels; + + if(desc.MipLevels == 0) + tex.mips = CalcNumMips(desc.Width, 1, 1); - tex.mips = tex.numSubresources; tex.arraysize = desc.ArraySize; tex.resType = tex.arraysize > 1 ? eResType_Texture1DArray : eResType_Texture1D; @@ -97,8 +96,6 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.msQual = 0; tex.msSamp = 1; - tex.numSubresources *= desc.ArraySize; - tex.customName = true; if(str == "") @@ -121,7 +118,7 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.name = str; tex.byteSize = 0; - for(uint32_t s = 0; s < tex.numSubresources; s++) + for(uint32_t s = 0; s < tex.mips * tex.arraysize; s++) tex.byteSize += GetByteSize(d3dtex, s); return tex; @@ -147,8 +144,6 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.depth = 1; tex.format = MakeResourceFormat(desc.Format); - tex.numSubresources = desc.MipLevels; - tex.creationFlags = 0; if(desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) tex.creationFlags |= eTextureCreate_SRV; @@ -165,10 +160,11 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) if(desc.MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE) tex.cubemap = true; - if(desc.MipLevels == 0) - tex.numSubresources = CalcNumMips(desc.Width, desc.Height, 1); + tex.mips = desc.MipLevels; + + if(desc.MipLevels == 0) + tex.mips = CalcNumMips(desc.Width, desc.Height, 1); - tex.mips = tex.numSubresources; tex.arraysize = desc.ArraySize; tex.msQual = desc.SampleDesc.Quality; @@ -180,8 +176,6 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) if(tex.msSamp > 1) tex.resType = tex.arraysize > 1 ? eResType_Texture2DMSArray : eResType_Texture2DMS; - tex.numSubresources *= desc.ArraySize; - tex.customName = true; if(str == "") @@ -218,7 +212,7 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.name = str; tex.byteSize = 0; - for(uint32_t s = 0; s < tex.numSubresources; s++) + for(uint32_t s = 0; s < tex.arraysize * tex.mips; s++) tex.byteSize += GetByteSize(d3dtex, s); return tex; @@ -242,8 +236,6 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.cubemap = false; tex.format = MakeResourceFormat(desc.Format); - tex.numSubresources = desc.MipLevels; - tex.resType = eResType_Texture3D; tex.creationFlags = 0; @@ -256,13 +248,14 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS) tex.creationFlags |= eTextureCreate_UAV; + tex.mips = desc.MipLevels; + if(desc.MipLevels == 0) - tex.numSubresources = CalcNumMips(desc.Width, desc.Height, desc.Depth); + tex.mips = CalcNumMips(desc.Width, desc.Height, desc.Depth); tex.msQual = 0; tex.msSamp = 1; - tex.mips = tex.numSubresources; tex.arraysize = 1; tex.customName = true; @@ -284,7 +277,7 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.name = str; tex.byteSize = 0; - for(uint32_t s = 0; s < tex.numSubresources; s++) + for(uint32_t s = 0; s < tex.arraysize * tex.mips; s++) tex.byteSize += GetByteSize(d3dtex, s); return tex; @@ -303,7 +296,6 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.cubemap = false; tex.mips = 1; tex.arraysize = 1; - tex.numSubresources = 1; tex.msQual = 0; tex.msSamp = 1; diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index b2acb6db3..4599674ae 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -151,7 +151,6 @@ FetchTexture D3D12Replay::GetTexture(ResourceId id) ret.height = desc.Height; ret.depth = desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? desc.DepthOrArraySize : 1; ret.arraysize = desc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D ? desc.DepthOrArraySize : 1; - ret.numSubresources = GetNumSubresources(&desc); ret.mips = desc.MipLevels; ret.msQual = desc.SampleDesc.Quality; ret.msSamp = RDCMAX(1U, desc.SampleDesc.Count); diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index ea279cbfc..7b63459fd 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -458,7 +458,6 @@ void GLReplay::CacheTexture(ResourceId id) tex.cubemap = false; tex.mips = 1; tex.arraysize = 1; - tex.numSubresources = 1; tex.creationFlags = 0; tex.msQual = 0; tex.msSamp = 1; @@ -478,7 +477,6 @@ void GLReplay::CacheTexture(ResourceId id) tex.cubemap = false; tex.mips = 1; tex.arraysize = 1; - tex.numSubresources = 1; tex.creationFlags = eTextureCreate_RTV; tex.msQual = 0; tex.msSamp = RDCMAX(1, res.samples); @@ -689,7 +687,6 @@ void GLReplay::CacheTexture(ResourceId id) tex.cubemap = false; tex.mips = 1; tex.arraysize = 1; - tex.numSubresources = 1; tex.creationFlags = eTextureCreate_SRV; tex.msQual = 0; tex.msSamp = 1; @@ -705,8 +702,6 @@ void GLReplay::CacheTexture(ResourceId id) tex.mips = GetNumMips(gl.m_Real, target, res.resource.name, tex.width, tex.height, tex.depth); - tex.numSubresources = tex.mips * tex.arraysize; - GLint compressed; gl.glGetTextureLevelParameterivEXT(res.resource.name, levelQueryType, 0, eGL_TEXTURE_COMPRESSED, &compressed); diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index a23038d2c..edab24e49 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -801,7 +801,6 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id) ret.height = iminfo.extent.height; ret.depth = iminfo.extent.depth; ret.mips = iminfo.mipLevels; - ret.numSubresources = ret.mips * ret.arraysize; ret.byteSize = 0; for(uint32_t s = 0; s < ret.mips; s++) diff --git a/renderdocui/Interop/FetchInfo.cs b/renderdocui/Interop/FetchInfo.cs index ac9394d4a..012183f2b 100644 --- a/renderdocui/Interop/FetchInfo.cs +++ b/renderdocui/Interop/FetchInfo.cs @@ -307,7 +307,6 @@ namespace renderdoc public bool cubemap; public UInt32 mips; public UInt32 arraysize; - public UInt32 numSubresources; public TextureCreationFlags creationFlags; public UInt32 msQual, msSamp; public UInt64 byteSize; diff --git a/renderdocui/Windows/Dialogs/TextureSaveDialog.cs b/renderdocui/Windows/Dialogs/TextureSaveDialog.cs index d046033c0..49b3174e5 100644 --- a/renderdocui/Windows/Dialogs/TextureSaveDialog.cs +++ b/renderdocui/Windows/Dialogs/TextureSaveDialog.cs @@ -52,7 +52,6 @@ namespace renderdocui.Windows.Dialogs tex.cubemap = true; tex.msSamp = 2; tex.mips = 5; - tex.numSubresources = tex.arraysize * tex.mips; } } @@ -115,7 +114,7 @@ namespace renderdocui.Windows.Dialogs String[] cubeFaces = { "X+", "X-", "Y+", "Y-", "Z+", "Z-" }; - UInt32 numSlices = (Math.Max(1, tex.depth) * tex.numSubresources) / tex.mips; + UInt32 numSlices = Math.Max(tex.arraysize, tex.depth); sliceSelect.Items.Clear(); diff --git a/renderdocui/Windows/TextureViewer.cs b/renderdocui/Windows/TextureViewer.cs index 5d2af04b8..538b8b95e 100644 --- a/renderdocui/Windows/TextureViewer.cs +++ b/renderdocui/Windows/TextureViewer.cs @@ -1723,7 +1723,7 @@ namespace renderdocui.Windows sliceFace.Items.Clear(); - if (tex.numSubresources == tex.mips && tex.depth <= 1) + if (tex.arraysize == 1 && tex.depth <= 1) { sliceFace.Enabled = false; } @@ -1735,7 +1735,7 @@ namespace renderdocui.Windows String[] cubeFaces = { "X+", "X-", "Y+", "Y-", "Z+", "Z-" }; - UInt32 numSlices = (Math.Max(1, tex.depth) * tex.numSubresources) / tex.mips; + UInt32 numSlices = tex.arraysize; // for 3D textures, display the number of slices at this mip if(tex.depth > 1)