Remove stored fake backbuffer data, display backbuffer on present calls

This commit is contained in:
baldurk
2015-10-15 16:58:55 +02:00
parent 19a13eefee
commit 313f53a820
4 changed files with 16 additions and 44 deletions
+2 -7
View File
@@ -343,8 +343,6 @@ WrappedVulkan::WrappedVulkan(const char *logFilename)
m_DrawcallStack.push_back(&m_ParentDrawcall);
m_FakeBBImgId = ResourceId();
m_FakeBBIm = VK_NULL_HANDLE;
RDCEraseEl(m_FakeBBExtent);
m_ResourceManager = new VulkanResourceManager(m_State, m_pSerialiser, this);
@@ -1246,9 +1244,6 @@ void WrappedVulkan::ProcessChunk(uint64_t offset, VulkanChunkType context)
ResourceId liveBBid = GetResourceManager()->GetLiveID(bbid);
m_FakeBBImgId = bbid;
m_FakeBBIm = GetResourceManager()->GetLiveHandle<VkImage>(bbid);
m_FakeBBExtent = m_ImageInfo[liveBBid].extent;
m_FakeBBFmt = MakeResourceFormat(m_ImageInfo[liveBBid].format);
bool HasCallstack = false;
localSerialiser->Serialise("HasCallstack", HasCallstack);
@@ -1346,7 +1341,7 @@ void WrappedVulkan::ReplayLog(uint32_t frameID, uint32_t startEventID, uint32_t
t.outputMask = 0;
t.srcQueueFamilyIndex = 0;
t.destQueueFamilyIndex = 0;
t.image = Unwrap(m_FakeBBIm);
t.image = Unwrap(GetResourceManager()->GetLiveHandle<VkImage>(m_FakeBBImgId));
t.oldLayout = st.subresourceStates[0].state;
t.newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
t.subresourceRange = st.subresourceStates[0].range;
@@ -1357,7 +1352,7 @@ void WrappedVulkan::ReplayLog(uint32_t frameID, uint32_t startEventID, uint32_t
ObjDisp(cmd)->CmdPipelineBarrier(Unwrap(cmd), VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, 1, (void **)&barrier);
VkClearColorValue clearColor = { { 0.0f, 0.0f, 0.0f, 1.0f, } };
ObjDisp(cmd)->CmdClearColorImage(Unwrap(cmd), Unwrap(m_FakeBBIm), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, &clearColor, 1, &t.subresourceRange);
ObjDisp(cmd)->CmdClearColorImage(Unwrap(cmd), t.image, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, &clearColor, 1, &t.subresourceRange);
vkr = ObjDisp(cmd)->EndCommandBuffer(Unwrap(cmd));
RDCASSERT(vkr == VK_SUCCESS);
-5
View File
@@ -202,11 +202,6 @@ private:
uint32_t GetGPULocalMemoryIndex(uint32_t resourceRequiredBitmask);
ResourceId m_FakeBBImgId;
VkImage m_FakeBBIm;
VkExtent3D m_FakeBBExtent;
ResourceFormat m_FakeBBFmt;
void GetFakeBB(ResourceId &id, VkImage &im, VkExtent3D &extent, ResourceFormat &fmt)
{ id = m_FakeBBImgId; im = m_FakeBBIm; extent = m_FakeBBExtent; fmt = m_FakeBBFmt; }
// VKTODO all these m_*Info things need to be locked and ensure we only access
// them in slow path functions like creation, or just moved elsewhere like inside
+2 -31
View File
@@ -496,14 +496,6 @@ vector<ResourceId> VulkanReplay::GetTextures()
VULKANNOTIMP("GetTextures");
vector<ResourceId> texs;
ResourceId id;
VkImage fakeBBIm = VK_NULL_HANDLE;
VkExtent3D fakeBBext;
ResourceFormat fakeBBfmt;
m_pDriver->GetFakeBB(id, fakeBBIm, fakeBBext, fakeBBfmt);
texs.push_back(m_pDriver->GetResourceManager()->GetLiveID(id));
for(auto it = m_pDriver->m_ImageInfo.begin(); it != m_pDriver->m_ImageInfo.end(); ++it)
{
// skip textures that aren't from the capture
@@ -1347,12 +1339,6 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id)
{
VULKANNOTIMP("GetTexture");
ResourceId resid;
VkImage fakeBBIm = VK_NULL_HANDLE;
VkExtent3D fakeBBext;
ResourceFormat fakeBBfmt;
m_pDriver->GetFakeBB(resid, fakeBBIm, fakeBBext, fakeBBfmt);
const ImgState &iminfo = m_pDriver->m_ImageInfo[id];
// VKTODOMED this should be fleshed out
@@ -1360,7 +1346,7 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id)
ret.ID = m_pDriver->GetResourceManager()->GetOriginalID(id);
ret.arraysize = iminfo.arraySize;
ret.byteSize = iminfo.extent.width*iminfo.extent.height*4; // VKTODOMED calculate proper byte size
ret.creationFlags = (ret.ID == resid ? eTextureCreate_SwapBuffer : 0)|eTextureCreate_SRV|eTextureCreate_RTV;
ret.creationFlags = (ret.ID == m_pDriver->m_FakeBBImgId ? eTextureCreate_SwapBuffer : 0)|eTextureCreate_SRV|eTextureCreate_RTV;
ret.cubemap = false;
ret.customName = false;
ret.width = iminfo.extent.width;
@@ -1370,7 +1356,7 @@ FetchTexture VulkanReplay::GetTexture(ResourceId id)
ret.mips = iminfo.mipLevels;
ret.msQual = 0;
ret.msSamp = 1;
ret.name = (ret.ID == resid ? "WSI Presentable Image" : StringFormat::Fmt("Image %llu", ret.ID));
ret.name = (ret.ID == m_pDriver->m_FakeBBImgId ? "WSI Presentable Image" : StringFormat::Fmt("Image %llu", ret.ID));
ret.numSubresources = ret.mips*ret.arraysize;
ret.format = MakeResourceFormat(iminfo.format);
switch(iminfo.type)
@@ -1714,21 +1700,6 @@ void VulkanReplay::SavePipelineState()
m_VulkanPipelineState.Pass.renderArea.height = state.renderArea.extent.height;
}
}
{
create_array_uninit(m_D3D11PipelineState.m_OM.RenderTargets, 1);
ResourceId id;
VkImage fakeBBIm = VK_NULL_HANDLE;
VkExtent3D fakeBBext;
ResourceFormat fakeBBfmt;
m_pDriver->GetFakeBB(id, fakeBBIm, fakeBBext, fakeBBfmt);
if(m_VulkanPipelineState.Pass.framebuffer.attachments.count > 0 && m_VulkanPipelineState.Pass.framebuffer.attachments[0].img != ResourceId())
id = m_VulkanPipelineState.Pass.framebuffer.attachments[0].img;
m_D3D11PipelineState.m_OM.RenderTargets[0].Resource = id;
}
}
void VulkanReplay::FillCBufferVariables(rdctype::array<ShaderConstant> invars, vector<ShaderVariable> &outvars, const vector<byte> &data, size_t &offset)
+12 -1
View File
@@ -274,7 +274,18 @@ namespace renderdocui.Windows
else if(compute)
return new ResourceId[0];
else
return core.CurPipelineState.GetOutputTargets();
{
var ret = core.CurPipelineState.GetOutputTargets();
if (ret.Length == 0 && curDraw != null && (curDraw.flags & DrawcallFlags.Present) != 0)
{
foreach (var t in core.CurTextures)
if ((t.creationFlags & TextureCreationFlags.SwapBuffer) != 0)
return new ResourceId[] { t.ID };
}
return ret;
}
}
public static ResourceId GetDepthTarget(Core core)