Store resource type with initial contents data

This commit is contained in:
baldurk
2017-08-31 10:48:16 +01:00
parent 43d8cf7a57
commit 8994bc0fb8
6 changed files with 110 additions and 78 deletions
+5 -1
View File
@@ -303,11 +303,15 @@ public:
struct InitialContentData
{
InitialContentData(WrappedResourceType r, uint32_t n, byte *b) : resource(r), num(n), blob(b) {}
InitialContentData(uint32_t t, WrappedResourceType r, uint32_t n, byte *b)
: resourceType(t), resource(r), num(n), blob(b)
{
}
InitialContentData()
: resource((WrappedResourceType)RecordType::NullResource), num(0), blob(NULL)
{
}
uint32_t resourceType;
WrappedResourceType resource;
uint32_t num;
byte *blob;
+35 -29
View File
@@ -1297,7 +1297,7 @@ bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res)
stage, 0, UNWRAP(WrappedID3D11UnorderedAccessView1, uav));
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(stage, 0, NULL));
Id, D3D11ResourceManager::InitialContentData(type, stage, 0, NULL));
}
}
}
@@ -1326,7 +1326,7 @@ bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res)
m_pImmediateContext->GetReal()->CopyResource(stage, UNWRAP(WrappedID3D11Buffer, buf));
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(stage, 0, NULL));
Id, D3D11ResourceManager::InitialContentData(type, stage, 0, NULL));
}
}
else if(type == Resource_Texture1D)
@@ -1355,7 +1355,7 @@ bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res)
m_pImmediateContext->GetReal()->CopyResource(stage, UNWRAP(WrappedID3D11Texture1D, tex1D));
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(stage, 0, NULL));
Id, D3D11ResourceManager::InitialContentData(type, stage, 0, NULL));
}
}
else if(type == Resource_Texture2D)
@@ -1432,7 +1432,7 @@ bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res)
}
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(stage, 0, NULL));
Id, D3D11ResourceManager::InitialContentData(type, stage, 0, NULL));
}
}
else if(type == Resource_Texture3D)
@@ -1461,7 +1461,7 @@ bool WrappedID3D11Device::Prepare_InitialState(ID3D11DeviceChild *res)
m_pImmediateContext->GetReal()->CopyResource(stage, UNWRAP(WrappedID3D11Texture3D1, tex3D));
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(stage, 0, NULL));
Id, D3D11ResourceManager::InitialContentData(type, stage, 0, NULL));
}
}
@@ -1571,7 +1571,7 @@ bool WrappedID3D11Device::Serialise_InitialState(ResourceId resid, ID3D11DeviceC
SERIALISE_ELEMENT(uint32_t, initCount, 0);
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(NULL, initCount, NULL));
Id, D3D11ResourceManager::InitialContentData(type, NULL, initCount, NULL));
}
}
else
@@ -1737,8 +1737,8 @@ bool WrappedID3D11Device::Serialise_InitialState(ResourceId resid, ID3D11DeviceC
}
else
{
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(contents, eInitialContents_Copy, NULL));
m_ResourceManager->SetInitialContents(Id, D3D11ResourceManager::InitialContentData(
type, contents, eInitialContents_Copy, NULL));
}
for(UINT sub = 0; sub < numSubresources; sub++)
@@ -1942,8 +1942,8 @@ bool WrappedID3D11Device::Serialise_InitialState(ResourceId resid, ID3D11DeviceC
contents = contentsMS;
}
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(contents, eInitialContents_Copy, NULL));
m_ResourceManager->SetInitialContents(Id, D3D11ResourceManager::InitialContentData(
type, contents, eInitialContents_Copy, NULL));
}
for(UINT sub = 0; sub < numSubresources; sub++)
@@ -2086,8 +2086,8 @@ bool WrappedID3D11Device::Serialise_InitialState(ResourceId resid, ID3D11DeviceC
}
else
{
m_ResourceManager->SetInitialContents(
Id, D3D11ResourceManager::InitialContentData(contents, eInitialContents_Copy, NULL));
m_ResourceManager->SetInitialContents(Id, D3D11ResourceManager::InitialContentData(
type, contents, eInitialContents_Copy, NULL));
}
for(UINT sub = 0; sub < numSubresources; sub++)
@@ -2175,7 +2175,7 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
}
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(NULL, countData, NULL));
id, D3D11ResourceManager::InitialContentData(type, NULL, countData, NULL));
SAFE_RELEASE(stage);
}
@@ -2206,8 +2206,9 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
}
else
{
m_ResourceManager->SetInitialContents(id, D3D11ResourceManager::InitialContentData(
initContents, eInitialContents_ClearRTV, NULL));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(type, initContents,
eInitialContents_ClearRTV, NULL));
}
}
else if(!hasData && desc.MipLevels == 1 && (desc.BindFlags & D3D11_BIND_DEPTH_STENCIL))
@@ -2229,8 +2230,9 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
}
else
{
m_ResourceManager->SetInitialContents(id, D3D11ResourceManager::InitialContentData(
initContents, eInitialContents_ClearDSV, NULL));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(type, initContents,
eInitialContents_ClearDSV, NULL));
}
}
else if(desc.Usage != D3D11_USAGE_IMMUTABLE)
@@ -2256,7 +2258,8 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
UNWRAP(WrappedID3D11Texture1D, tex1D));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(initContents, eInitialContents_Copy, NULL));
id, D3D11ResourceManager::InitialContentData(type, initContents, eInitialContents_Copy,
NULL));
}
}
}
@@ -2290,8 +2293,9 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
}
else
{
m_ResourceManager->SetInitialContents(id, D3D11ResourceManager::InitialContentData(
initContents, eInitialContents_ClearRTV, NULL));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(type, initContents,
eInitialContents_ClearRTV, NULL));
}
}
else if(!hasData && desc.MipLevels == 1 && (desc.BindFlags & D3D11_BIND_DEPTH_STENCIL))
@@ -2316,8 +2320,9 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
}
else
{
m_ResourceManager->SetInitialContents(id, D3D11ResourceManager::InitialContentData(
initContents, eInitialContents_ClearDSV, NULL));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(type, initContents,
eInitialContents_ClearDSV, NULL));
}
}
else if(desc.Usage != D3D11_USAGE_IMMUTABLE)
@@ -2343,7 +2348,8 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
UNWRAP(WrappedID3D11Texture2D1, tex2D));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(initContents, eInitialContents_Copy, NULL));
id, D3D11ResourceManager::InitialContentData(type, initContents, eInitialContents_Copy,
NULL));
}
}
}
@@ -2374,8 +2380,9 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
}
else
{
m_ResourceManager->SetInitialContents(id, D3D11ResourceManager::InitialContentData(
initContents, eInitialContents_ClearRTV, NULL));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(type, initContents,
eInitialContents_ClearRTV, NULL));
}
}
else if(!hasData && desc.Usage != D3D11_USAGE_IMMUTABLE)
@@ -2399,7 +2406,8 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
UNWRAP(WrappedID3D11Texture3D1, tex3D));
m_ResourceManager->SetInitialContents(
id, D3D11ResourceManager::InitialContentData(initContents, eInitialContents_Copy, NULL));
id, D3D11ResourceManager::InitialContentData(type, initContents, eInitialContents_Copy,
NULL));
}
}
}
@@ -2408,9 +2416,7 @@ void WrappedID3D11Device::Create_InitialState(ResourceId id, ID3D11DeviceChild *
void WrappedID3D11Device::Apply_InitialState(ID3D11DeviceChild *live,
D3D11ResourceManager::InitialContentData initial)
{
ResourceType type = IdentifyTypeByPtr(live);
if(type == Resource_UnorderedAccessView)
if(initial.resourceType == Resource_UnorderedAccessView)
{
ID3D11UnorderedAccessView *uav = (ID3D11UnorderedAccessView *)live;
+5 -3
View File
@@ -133,7 +133,8 @@ bool WrappedID3D11Device::Serialise_CreateBuffer(const D3D11_BUFFER_DESC *pDesc,
else
{
m_ResourceManager->SetInitialContents(
pBuffer, D3D11ResourceManager::InitialContentData(stage, eInitialContents_Copy, NULL));
pBuffer, D3D11ResourceManager::InitialContentData(Resource_Buffer, stage,
eInitialContents_Copy, NULL));
}
}
@@ -2619,8 +2620,9 @@ bool WrappedID3D11Device::Serialise_OpenSharedResource(HANDLE hResource, REFIID
}
else
{
m_ResourceManager->SetInitialContents(pResource, D3D11ResourceManager::InitialContentData(
stage, eInitialContents_Copy, NULL));
m_ResourceManager->SetInitialContents(
pResource, D3D11ResourceManager::InitialContentData(Resource_Buffer, stage,
eInitialContents_Copy, NULL));
}
}
+13 -10
View File
@@ -666,8 +666,8 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res)
memcpy(descs, heap->GetDescriptors(), sizeof(D3D12Descriptor) * numElems);
SetInitialContents(heap->GetResourceID(),
D3D12ResourceManager::InitialContentData(NULL, numElems, (byte *)descs));
SetInitialContents(heap->GetResourceID(), D3D12ResourceManager::InitialContentData(
type, NULL, numElems, (byte *)descs));
return true;
}
else if(type == Resource_Resource)
@@ -685,7 +685,7 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res)
{
D3D12NOTIMP("Multisampled initial contents");
SetInitialContents(GetResID(r), D3D12ResourceManager::InitialContentData(NULL, 2, NULL));
SetInitialContents(GetResID(r), D3D12ResourceManager::InitialContentData(type, NULL, 2, NULL));
return true;
}
else if(desc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
@@ -696,7 +696,8 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res)
if(heapProps.Type == D3D12_HEAP_TYPE_READBACK)
{
// already on readback heap, just mark that we can map it directly and continue
SetInitialContents(GetResID(r), D3D12ResourceManager::InitialContentData(NULL, 1, NULL));
SetInitialContents(GetResID(r),
D3D12ResourceManager::InitialContentData(type, NULL, 1, NULL));
return true;
}
@@ -737,7 +738,8 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res)
m_Device->Evict(1, &pageable);
}
SetInitialContents(GetResID(r), D3D12ResourceManager::InitialContentData(copyDst, 0, NULL));
SetInitialContents(GetResID(r),
D3D12ResourceManager::InitialContentData(type, copyDst, 0, NULL));
return true;
}
else
@@ -850,7 +852,8 @@ bool D3D12ResourceManager::Prepare_InitialState(ID3D12DeviceChild *res)
SAFE_DELETE_ARRAY(layouts);
SetInitialContents(GetResID(r), D3D12ResourceManager::InitialContentData(copyDst, 0, NULL));
SetInitialContents(GetResID(r),
D3D12ResourceManager::InitialContentData(type, copyDst, 0, NULL));
return true;
}
}
@@ -982,7 +985,7 @@ bool D3D12ResourceManager::Serialise_InitialState(ResourceId resid, ID3D12Device
SAFE_DELETE_ARRAY(descs);
SetInitialContents(id, D3D12ResourceManager::InitialContentData(copyheap, 0, NULL));
SetInitialContents(id, D3D12ResourceManager::InitialContentData(type, copyheap, 0, NULL));
}
else if(type == Resource_Resource)
{
@@ -1047,7 +1050,7 @@ bool D3D12ResourceManager::Serialise_InitialState(ResourceId resid, ID3D12Device
else
SAFE_DELETE_ARRAY(ptr);
SetInitialContents(id, D3D12ResourceManager::InitialContentData(copySrc, 1, NULL));
SetInitialContents(id, D3D12ResourceManager::InitialContentData(type, copySrc, 1, NULL));
return true;
}
@@ -1069,7 +1072,7 @@ void D3D12ResourceManager::Create_InitialState(ResourceId id, ID3D12DeviceChild
{
// set a NULL heap, if there are no initial contents for a descriptor heap we just leave
// it all entirely undefined.
SetInitialContents(id, D3D12ResourceManager::InitialContentData(NULL, 1, NULL));
SetInitialContents(id, D3D12ResourceManager::InitialContentData(type, NULL, 1, NULL));
}
else if(type == Resource_Resource)
{
@@ -1085,7 +1088,7 @@ void D3D12ResourceManager::Create_InitialState(ResourceId id, ID3D12DeviceChild
void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live, InitialContentData data)
{
D3D12ResourceType type = IdentifyTypeByPtr(live);
D3D12ResourceType type = (D3D12ResourceType)data.resourceType;
if(type == Resource_DescriptorHeap)
{
+27 -16
View File
@@ -464,7 +464,8 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
gl.glBindBuffer(eGL_COPY_READ_BUFFER, oldbuf1);
gl.glBindBuffer(eGL_COPY_WRITE_BUFFER, oldbuf2);
SetInitialContents(Id, InitialContentData(BufferRes(res.Context, buf), length, NULL));
SetInitialContents(
Id, InitialContentData(res.Namespace, BufferRes(res.Context, buf), length, NULL));
}
else if(res.Namespace == eResProgram)
{
@@ -488,7 +489,7 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
byte *data = Serialiser::AllocAlignedBuffer(sizeof(FramebufferInitialData));
RDCEraseMem(data, sizeof(FramebufferInitialData));
SetInitialContents(Id, InitialContentData(GLResource(MakeNullResource), 0, data));
SetInitialContents(Id, InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, data));
// if FBOs aren't shared we need to fetch the data for this FBO on the right context. It's
// not safe for us to go changing contexts ourselves (the context could be active on another
@@ -519,7 +520,7 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
byte *data = Serialiser::AllocAlignedBuffer(sizeof(FeedbackInitialData));
RDCEraseMem(data, sizeof(FeedbackInitialData));
SetInitialContents(Id, InitialContentData(GLResource(MakeNullResource), 0, data));
SetInitialContents(Id, InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, data));
// queue initial state fetching if we're not on the right context, see above in FBOs for more
// explanation of this.
@@ -537,7 +538,7 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
byte *data = Serialiser::AllocAlignedBuffer(sizeof(VAOInitialData));
RDCEraseMem(data, sizeof(VAOInitialData));
SetInitialContents(Id, InitialContentData(GLResource(MakeNullResource), 0, data));
SetInitialContents(Id, InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, data));
// queue initial state fetching if we're not on the right context, see above in FBOs for more
// explanation of this.
@@ -674,7 +675,8 @@ void GLResourceManager::PrepareTextureInitialContents(ResourceId liveid, Resourc
// textures can get here as GL_NONE if they were created and dirtied (by setting lots of
// texture parameters) without ever having storage allocated (via glTexStorage or glTexImage).
// in that case, just ignore as we won't bother with the initial states.
SetInitialContents(origid, InitialContentData(GLResource(MakeNullResource), 0, (byte *)state));
SetInitialContents(
origid, InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, (byte *)state));
}
else if(details.curType != eGL_TEXTURE_BUFFER)
{
@@ -925,7 +927,8 @@ void GLResourceManager::PrepareTextureInitialContents(ResourceId liveid, Resourc
(GLint *)&state->maxLevel);
}
SetInitialContents(origid, InitialContentData(TextureRes(res.Context, tex), 0, (byte *)state));
SetInitialContents(
origid, InitialContentData(res.Namespace, TextureRes(res.Context, tex), 0, (byte *)state));
}
else
{
@@ -941,7 +944,8 @@ void GLResourceManager::PrepareTextureInitialContents(ResourceId liveid, Resourc
gl.glGetTextureLevelParameterivEXT(res.name, details.curType, 0, eGL_TEXTURE_BUFFER_SIZE,
(GLint *)&state->texBufSize);
SetInitialContents(origid, InitialContentData(GLResource(MakeNullResource), 0, (byte *)state));
SetInitialContents(
origid, InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, (byte *)state));
}
}
@@ -1049,7 +1053,8 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
SAFE_DELETE_ARRAY(data);
SetInitialContents(Id, InitialContentData(BufferRes(m_GL->GetCtx(), buf), len, NULL));
SetInitialContents(
Id, InitialContentData(res.Namespace, BufferRes(m_GL->GetCtx(), buf), len, NULL));
}
}
else if(res.Namespace == eResProgram)
@@ -1126,7 +1131,8 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
SerialiseProgramUniforms(gl, m_pSerialiser, initProg, &details.locationTranslate, false);
SetInitialContents(Id, InitialContentData(ProgramRes(m_GL->GetCtx(), initProg), 0, NULL));
SetInitialContents(
Id, InitialContentData(res.Namespace, ProgramRes(m_GL->GetCtx(), initProg), 0, NULL));
}
}
else if(res.Namespace == eResTexture)
@@ -1560,10 +1566,11 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
}
if(textype != eGL_TEXTURE_BUFFER && !details.view)
SetInitialContents(Id,
InitialContentData(TextureRes(m_GL->GetCtx(), tex), 0, (byte *)state));
SetInitialContents(Id, InitialContentData(res.Namespace, TextureRes(m_GL->GetCtx(), tex),
0, (byte *)state));
else
SetInitialContents(Id, InitialContentData(GLResource(MakeNullResource), 0, (byte *)state));
SetInitialContents(
Id, InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, (byte *)state));
gl.glBindBuffer(eGL_PIXEL_UNPACK_BUFFER, pub);
@@ -1588,7 +1595,8 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
byte *blob = Serialiser::AllocAlignedBuffer(sizeof(data));
memcpy(blob, &data, sizeof(data));
SetInitialContents(Id, InitialContentData(GLResource(MakeNullResource), 0, blob));
SetInitialContents(Id,
InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, blob));
}
}
else if(res.Namespace == eResFeedback)
@@ -1608,7 +1616,8 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
byte *blob = Serialiser::AllocAlignedBuffer(sizeof(data));
memcpy(blob, &data, sizeof(data));
SetInitialContents(Id, InitialContentData(GLResource(MakeNullResource), 0, blob));
SetInitialContents(Id,
InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, blob));
}
}
else if(res.Namespace == eResVertexArray)
@@ -1634,7 +1643,8 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
byte *blob = Serialiser::AllocAlignedBuffer(sizeof(data));
memcpy(blob, &data, sizeof(data));
SetInitialContents(Id, InitialContentData(GLResource(MakeNullResource), 0, blob));
SetInitialContents(Id,
InitialContentData(res.Namespace, GLResource(MakeNullResource), 0, blob));
}
}
else if(res.Namespace == eResRenderbuffer)
@@ -1668,7 +1678,8 @@ void GLResourceManager::Create_InitialState(ResourceId id, GLResource live, bool
byte *data = Serialiser::AllocAlignedBuffer(sizeof(VAOInitialData));
RDCEraseMem(data, sizeof(VAOInitialData));
SetInitialContents(id, InitialContentData(GLResource(MakeNullResource), 0, data));
SetInitialContents(id,
InitialContentData(eResVertexArray, GLResource(MakeNullResource), 0, data));
Prepare_InitialState(live, data);
}
+25 -19
View File
@@ -211,7 +211,8 @@ bool WrappedVulkan::Prepare_SparseInitialState(WrappedVkBuffer *buf)
ObjDisp(d)->DestroyBuffer(Unwrap(d), bufdeletes[i], NULL);
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(GetWrapped(readbackmem), 0, (byte *)info));
id, VulkanResourceManager::InitialContentData(eResBuffer, GetWrapped(readbackmem), 0,
(byte *)info));
return true;
}
@@ -386,7 +387,8 @@ bool WrappedVulkan::Prepare_SparseInitialState(WrappedVkImage *im)
ObjDisp(d)->DestroyBuffer(Unwrap(d), bufdeletes[i], NULL);
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(GetWrapped(readbackmem), 0, (byte *)blob));
id, VulkanResourceManager::InitialContentData(eResImage, GetWrapped(readbackmem), 0,
(byte *)blob));
return true;
}
@@ -518,7 +520,7 @@ bool WrappedVulkan::Serialise_SparseBufferInitialState(
m_CleanupMems.push_back(mem);
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(GetWrapped(buf), 0, (byte *)info));
id, VulkanResourceManager::InitialContentData(eResBuffer, GetWrapped(buf), 0, (byte *)info));
}
return true;
@@ -726,8 +728,9 @@ bool WrappedVulkan::Serialise_SparseImageInitialState(ResourceId id,
m_CleanupMems.push_back(mem);
GetResourceManager()->SetInitialContents(id, VulkanResourceManager::InitialContentData(
GetWrapped(buf), eInitialContents_Sparse, blob));
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(eResImage, GetWrapped(buf),
eInitialContents_Sparse, blob));
}
return true;
@@ -984,7 +987,7 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
info[e++] = record->descInfo->descBindings[i][b];
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(NULL, 0, (byte *)info));
id, VulkanResourceManager::InitialContentData(type, NULL, 0, (byte *)info));
return true;
}
else if(type == eResBuffer)
@@ -1290,8 +1293,8 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
}
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(GetWrapped(readbackmem), (uint32_t)mrq.size,
NULL));
id, VulkanResourceManager::InitialContentData(type, GetWrapped(readbackmem),
(uint32_t)mrq.size, NULL));
return true;
}
@@ -1378,8 +1381,8 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
ObjDisp(d)->DestroyBuffer(Unwrap(d), dstBuf, NULL);
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(GetWrapped(readbackmem), (uint32_t)datasize,
NULL));
id, VulkanResourceManager::InitialContentData(type, GetWrapped(readbackmem),
(uint32_t)datasize, NULL));
return true;
}
@@ -1619,7 +1622,7 @@ bool WrappedVulkan::Serialise_InitialState(ResourceId resid, WrappedVkRes *)
SAFE_DELETE_ARRAY(bindings);
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(NULL, validBinds, blob));
id, VulkanResourceManager::InitialContentData(type, NULL, validBinds, blob));
}
else if(type == eResBuffer)
{
@@ -1685,7 +1688,7 @@ bool WrappedVulkan::Serialise_InitialState(ResourceId resid, WrappedVkRes *)
ObjDisp(d)->UnmapMemory(Unwrap(d), Unwrap(uploadmem));
VulkanResourceManager::InitialContentData initial(GetWrapped(buf), 0, NULL);
VulkanResourceManager::InitialContentData initial(type, GetWrapped(buf), 0, NULL);
VulkanCreationInfo::Image &c = m_CreationInfo.m_Image[liveid];
@@ -1928,7 +1931,8 @@ bool WrappedVulkan::Serialise_InitialState(ResourceId resid, WrappedVkRes *)
m_CleanupMems.push_back(mem);
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(GetWrapped(buf), (uint32_t)dataSize, NULL));
id, VulkanResourceManager::InitialContentData(type, GetWrapped(buf), (uint32_t)dataSize,
NULL));
}
else
{
@@ -1964,20 +1968,22 @@ void WrappedVulkan::Create_InitialState(ResourceId id, WrappedVkRes *live, bool
if(m_ImageLayouts.find(liveid) == m_ImageLayouts.end())
{
RDCERR("Couldn't find image info for %llu", id);
GetResourceManager()->SetInitialContents(id, VulkanResourceManager::InitialContentData(
NULL, eInitialContents_ClearColorImage, NULL));
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(type, NULL,
eInitialContents_ClearColorImage, NULL));
return;
}
ImageLayouts &layouts = m_ImageLayouts[liveid];
if(layouts.subresourceStates[0].subresourceRange.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT)
GetResourceManager()->SetInitialContents(id, VulkanResourceManager::InitialContentData(
NULL, eInitialContents_ClearColorImage, NULL));
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(type, NULL,
eInitialContents_ClearColorImage, NULL));
else
GetResourceManager()->SetInitialContents(
id, VulkanResourceManager::InitialContentData(
NULL, eInitialContents_ClearDepthStencilImage, NULL));
type, NULL, eInitialContents_ClearDepthStencilImage, NULL));
}
else if(type == eResDeviceMemory)
{
@@ -1992,7 +1998,7 @@ void WrappedVulkan::Create_InitialState(ResourceId id, WrappedVkRes *live, bool
void WrappedVulkan::Apply_InitialState(WrappedVkRes *live,
VulkanResourceManager::InitialContentData initial)
{
VkResourceType type = IdentifyTypeByPtr(live);
VkResourceType type = (VkResourceType)initial.resourceType;
ResourceId id = GetResourceManager()->GetID(live);