mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Fix serialisation of number of subresource in D3D11 initial state
* The serialised value changes the number of serialised buffers later, so it must be saved exactly right and not post-multiplied with data that won't be available during structured import.
This commit is contained in:
@@ -467,7 +467,10 @@ bool D3D11InitParams::IsSupportedVersion(uint64_t ver)
|
||||
if(ver == CurrentVersion)
|
||||
return true;
|
||||
|
||||
// we can check other older versions we support here.
|
||||
// 0x0F -> 0x10 - serialised the number of subresources in resource initial states after
|
||||
// multiplying on sample count rather than before
|
||||
if(ver == 0x0F)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ struct D3D11InitParams
|
||||
D3D_FEATURE_LEVEL FeatureLevels[16];
|
||||
|
||||
// check if a frame capture section version is supported
|
||||
static const uint64_t CurrentVersion = 0xF;
|
||||
static const uint64_t CurrentVersion = 0x10;
|
||||
static bool IsSupportedVersion(uint64_t ver);
|
||||
};
|
||||
|
||||
|
||||
@@ -663,12 +663,27 @@ bool WrappedID3D11Device::Serialise_InitialState(SerialiserType &ser, ResourceId
|
||||
tex->GetDesc(&desc);
|
||||
|
||||
uint32_t NumSubresources = desc.MipLevels * desc.ArraySize;
|
||||
SERIALISE_ELEMENT(NumSubresources);
|
||||
|
||||
bool multisampled = desc.SampleDesc.Count > 1 || desc.SampleDesc.Quality > 0;
|
||||
|
||||
if(multisampled)
|
||||
NumSubresources *= desc.SampleDesc.Count;
|
||||
// in version 0xF and before, we mistakenly multiplied on the sample count to the number of
|
||||
// subresources after serialisation - meaning the loop below breaks for pure structured data
|
||||
// serialisation.
|
||||
// After version 0x10 we pre-multiply before serialising, because the result is the same either
|
||||
// way and we don't need the un-multiplied value.
|
||||
if(ser.VersionAtLeast(0x10))
|
||||
{
|
||||
if(multisampled)
|
||||
NumSubresources *= desc.SampleDesc.Count;
|
||||
|
||||
SERIALISE_ELEMENT(NumSubresources);
|
||||
}
|
||||
else
|
||||
{
|
||||
SERIALISE_ELEMENT(NumSubresources);
|
||||
|
||||
if(multisampled)
|
||||
NumSubresources *= desc.SampleDesc.Count;
|
||||
}
|
||||
|
||||
// this value is serialised here for compatibility with pre-v1.1 captures. In prior versions the
|
||||
// 'save all initials' option, if disabled, meant a heuristic was used to determine if this
|
||||
|
||||
Reference in New Issue
Block a user