diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index 74b911813..646b68418 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -294,7 +294,6 @@ public: rdcarray GetPassEvents(uint32_t eventId) { return rdcarray(); } rdcarray GetUsage(ResourceId id) { return rdcarray(); } bool IsRenderOutput(ResourceId id) { return false; } - ResourceId GetLiveID(ResourceId id) { return id; } rdcarray EnumerateCounters() { return {}; } CounterDescription DescribeCounter(GPUCounter counterID) { diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index 7e5a6b849..70749b13c 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -61,7 +61,6 @@ rdcstr DoStringise(const ReplayProxyPacket &el) STRINGISE_ENUM_NAMED(eReplayProxy_SavePipelineState, "SavePipelineState"); STRINGISE_ENUM_NAMED(eReplayProxy_GetUsage, "GetUsage"); - STRINGISE_ENUM_NAMED(eReplayProxy_GetLiveID, "GetLiveID"); STRINGISE_ENUM_NAMED(eReplayProxy_GetFrameRecord, "GetFrameRecord"); STRINGISE_ENUM_NAMED(eReplayProxy_IsRenderOutput, "IsRenderOutput"); STRINGISE_ENUM_NAMED(eReplayProxy_NeedRemapForFetch, "NeedRemapForFetch"); @@ -742,51 +741,6 @@ FrameRecord ReplayProxy::GetFrameRecord() PROXY_FUNCTION(GetFrameRecord); } -template -ResourceId ReplayProxy::Proxied_GetLiveID(ParamSerialiser ¶mser, ReturnSerialiser &retser, - ResourceId id) -{ - if(paramser.IsWriting()) - { - if(m_LiveIDs.find(id) != m_LiveIDs.end()) - return m_LiveIDs[id]; - - if(m_LocalTextures.find(id) != m_LocalTextures.end()) - return id; - } - - if(paramser.IsErrored() || retser.IsErrored() || m_IsErrored) - return ResourceId(); - - const ReplayProxyPacket expectedPacket = eReplayProxy_GetLiveID; - ReplayProxyPacket packet = eReplayProxy_GetLiveID; - ResourceId ret; - - { - BEGIN_PARAMS(); - SERIALISE_ELEMENT(id); - END_PARAMS(); - } - - { - REMOTE_EXECUTION(); - if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored) - ret = m_Remote->GetLiveID(id); - } - - SERIALISE_RETURN(ret); - - if(paramser.IsWriting()) - m_LiveIDs[id] = ret; - - return ret; -} - -ResourceId ReplayProxy::GetLiveID(ResourceId id) -{ - PROXY_FUNCTION(GetLiveID, id); -} - template rdcarray ReplayProxy::Proxied_FetchCounters(ParamSerialiser ¶mser, ReturnSerialiser &retser, @@ -1317,8 +1271,7 @@ rdcstr ReplayProxy::Proxied_DisassembleShader(ParamSerialiser ¶mser, ReturnS if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored) { - refl = - m_Remote->GetShader(m_Remote->GetLiveID(pipeline), m_Remote->GetLiveID(Shader), EntryPoint); + refl = m_Remote->GetShader(pipeline, Shader, EntryPoint); ret = m_Remote->DisassembleShader(pipeline, refl, target); } @@ -1516,9 +1469,6 @@ void ReplayProxy::Proxied_ReplaceResource(ParamSerialiser ¶mser, ReturnSeria m_Remote->ReplaceResource(from, to); } - if(paramser.IsWriting()) - m_LiveIDs.clear(); - SERIALISE_RETURN_VOID(); } @@ -1546,9 +1496,6 @@ void ReplayProxy::Proxied_RemoveReplacement(ParamSerialiser ¶mser, ReturnSer m_Remote->RemoveReplacement(id); } - if(paramser.IsWriting()) - m_LiveIDs.clear(); - SERIALISE_RETURN_VOID(); } @@ -1865,12 +1812,11 @@ void ReplayProxy::Proxied_SavePipelineState(ParamSerialiser ¶mser, ReturnSer for(size_t i = 0; i < ARRAY_COUNT(stages); i++) if(stages[i]->resourceId != ResourceId()) stages[i]->reflection = - GetShader(ResourceId(), GetLiveID(stages[i]->resourceId), ShaderEntryPoint()); + GetShader(ResourceId(), stages[i]->resourceId, ShaderEntryPoint()); if(m_D3D11PipelineState->inputAssembly.resourceId != ResourceId()) - m_D3D11PipelineState->inputAssembly.bytecode = - GetShader(ResourceId(), GetLiveID(m_D3D11PipelineState->inputAssembly.resourceId), - ShaderEntryPoint()); + m_D3D11PipelineState->inputAssembly.bytecode = GetShader( + ResourceId(), m_D3D11PipelineState->inputAssembly.resourceId, ShaderEntryPoint()); } else if(m_APIProps.pipelineType == GraphicsAPI::D3D12 && m_D3D12PipelineState) { @@ -1881,12 +1827,11 @@ void ReplayProxy::Proxied_SavePipelineState(ParamSerialiser ¶mser, ReturnSer &m_D3D12PipelineState->ampShader, &m_D3D12PipelineState->meshShader, }; - ResourceId pipe = GetLiveID(m_D3D12PipelineState->pipelineResourceId); + ResourceId pipe = m_D3D12PipelineState->pipelineResourceId; for(size_t i = 0; i < ARRAY_COUNT(stages); i++) if(stages[i]->resourceId != ResourceId()) - stages[i]->reflection = - GetShader(pipe, GetLiveID(stages[i]->resourceId), ShaderEntryPoint()); + stages[i]->reflection = GetShader(pipe, stages[i]->resourceId, ShaderEntryPoint()); } else if(m_APIProps.pipelineType == GraphicsAPI::OpenGL && m_GLPipelineState) { @@ -1899,7 +1844,7 @@ void ReplayProxy::Proxied_SavePipelineState(ParamSerialiser ¶mser, ReturnSer for(size_t i = 0; i < ARRAY_COUNT(stages); i++) if(stages[i]->shaderResourceId != ResourceId()) stages[i]->reflection = - GetShader(ResourceId(), GetLiveID(stages[i]->shaderResourceId), ShaderEntryPoint()); + GetShader(ResourceId(), stages[i]->shaderResourceId, ShaderEntryPoint()); } else if(m_APIProps.pipelineType == GraphicsAPI::Vulkan && m_VulkanPipelineState) { @@ -1910,16 +1855,16 @@ void ReplayProxy::Proxied_SavePipelineState(ParamSerialiser ¶mser, ReturnSer &m_VulkanPipelineState->taskShader, &m_VulkanPipelineState->meshShader, }; - ResourceId pipe = GetLiveID(m_VulkanPipelineState->graphics.pipelineResourceId); + ResourceId pipe = m_VulkanPipelineState->graphics.pipelineResourceId; for(size_t i = 0; i < ARRAY_COUNT(stages); i++) { if(i == 5) - pipe = GetLiveID(m_VulkanPipelineState->compute.pipelineResourceId); + pipe = m_VulkanPipelineState->compute.pipelineResourceId; if(stages[i]->resourceId != ResourceId()) stages[i]->reflection = - GetShader(pipe, GetLiveID(stages[i]->resourceId), + GetShader(pipe, stages[i]->resourceId, ShaderEntryPoint(stages[i]->entryPoint, stages[i]->stage)); } } @@ -2874,10 +2819,6 @@ void ReplayProxy::RefreshPreviewWindow() if(cfg.resourceId == ResourceId()) cfg.resourceId = curDraw->copyDestination; - // if we did get a texture, get the live ID for it - if(cfg.resourceId != ResourceId()) - cfg.resourceId = m_Replay->GetLiveID(cfg.resourceId); - if(cfg.resourceId != ResourceId()) { TextureDescription texInfo = m_Replay->GetTexture(cfg.resourceId); @@ -3155,7 +3096,6 @@ bool ReplayProxy::Tick(int type) case eReplayProxy_GetDescriptorLocations: GetDescriptorLocations(ResourceId(), {}); break; case eReplayProxy_GetDescriptorStores: GetDescriptorStores(); break; case eReplayProxy_GetUsage: GetUsage(ResourceId()); break; - case eReplayProxy_GetLiveID: GetLiveID(ResourceId()); break; case eReplayProxy_GetFrameRecord: GetFrameRecord(); break; case eReplayProxy_IsRenderOutput: IsRenderOutput(ResourceId()); break; case eReplayProxy_NeedRemapForFetch: NeedRemapForFetch(ResourceFormat()); break; diff --git a/renderdoc/core/replay_proxy.h b/renderdoc/core/replay_proxy.h index 780b50947..c6fe71ba6 100644 --- a/renderdoc/core/replay_proxy.h +++ b/renderdoc/core/replay_proxy.h @@ -66,7 +66,6 @@ enum ReplayProxyPacket eReplayProxy_SavePipelineState, eReplayProxy_GetUsage, - eReplayProxy_GetLiveID, eReplayProxy_GetFrameRecord, eReplayProxy_IsRenderOutput, eReplayProxy_NeedRemapForFetch, @@ -499,8 +498,6 @@ public: IMPLEMENT_FUNCTION_PROXIED(bool, IsRenderOutput, ResourceId id); - IMPLEMENT_FUNCTION_PROXIED(ResourceId, GetLiveID, ResourceId id); - IMPLEMENT_FUNCTION_PROXIED(rdcarray, EnumerateCounters); IMPLEMENT_FUNCTION_PROXIED(CounterDescription, DescribeCounter, GPUCounter counterID); IMPLEMENT_FUNCTION_PROXIED(rdcarray, FetchCounters, @@ -657,8 +654,6 @@ private: // should not be treated as proxied. std::set m_LocalTextures; - std::map m_LiveIDs; - struct ShaderReflKey { ShaderReflKey() {} diff --git a/renderdoc/core/resource_manager.h b/renderdoc/core/resource_manager.h index 084271967..aab4fe940 100644 --- a/renderdoc/core/resource_manager.h +++ b/renderdoc/core/resource_manager.h @@ -647,8 +647,6 @@ public: // with 456, then calling this function with either ID 123 or ID 456 will return ID 123. ResourceId GetUnreplacedID(ResourceId id); - ResourceId GetLiveID(ResourceId id); - // Serialise in which resources need initial contents and set them up. void CreateInitialContents(ReadSerialiser &ser); @@ -1971,16 +1969,3 @@ ResourceId ResourceManager::GetUnreplacedID(ResourceId id) return id; } - -template -ResourceId ResourceManager::GetLiveID(ResourceId id) -{ - if(id == ResourceId()) - return id; - - auto it = m_Replacements.find(id); - if(it != m_Replacements.end()) - return it->second; - - return id; -} diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index 992022c89..4577f974c 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -445,8 +445,7 @@ bool WrappedID3D11DeviceContext::Serialise_BeginCaptureFrame(SerialiserType &ser { if(m_pDevice->GetResourceManager()->HasLiveResource(c.id)) { - StreamOutData &so = - m_pDevice->GetSOHiddenCounterForBuffer(m_pDevice->GetResourceManager()->GetLiveID(c.id)); + StreamOutData &so = m_pDevice->GetSOHiddenCounterForBuffer(c.id); so.numPrims = c.counterValue; so.stride = c.stride; } diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index 4e503dc22..822d1d4e3 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -338,8 +338,7 @@ rdcarray D3D11Replay::GetDisassemblyTargets(bool withPipeline) rdcstr D3D11Replay::DisassembleShader(ResourceId pipeline, const ShaderReflection *refl, const rdcstr &target) { - auto it = - WrappedShader::m_ShaderList.find(m_pDevice->GetResourceManager()->GetLiveID(refl->resourceId)); + auto it = WrappedShader::m_ShaderList.find(refl->resourceId); if(it == WrappedShader::m_ShaderList.end()) return "; Invalid Shader Specified"; @@ -1746,16 +1745,6 @@ rdcarray D3D11Replay::GetPassEvents(uint32_t eventId) return passEvents; } -ResourceId D3D11Replay::GetLiveID(ResourceId id) -{ - ID3D11UnorderedAccessView *counterUAV = GetDebugManager()->GetCounterBufferUAV(id); - if(counterUAV) - return id; - if(!m_pDevice->GetResourceManager()->HasLiveResource(id)) - return ResourceId(); - return m_pDevice->GetResourceManager()->GetLiveID(id); -} - void D3D11Replay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subresource &sub, CompType typeCast, float pixel[4]) { diff --git a/renderdoc/driver/d3d11/d3d11_replay.h b/renderdoc/driver/d3d11/d3d11_replay.h index 68df2bb8c..ccdf148bc 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.h +++ b/renderdoc/driver/d3d11/d3d11_replay.h @@ -225,8 +225,6 @@ public: void InitPostVSBuffers(uint32_t eventId); void InitPostVSBuffers(const rdcarray &passEvents); - ResourceId GetLiveID(ResourceId id); - void PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subresource &sub, CompType typeCast, float pixel[4]); bool GetMinMax(ResourceId texid, const Subresource &sub, CompType typeCast, float *minval, diff --git a/renderdoc/driver/d3d12/d3d12_initstate.cpp b/renderdoc/driver/d3d12/d3d12_initstate.cpp index 249fcc883..3334c91fc 100644 --- a/renderdoc/driver/d3d12/d3d12_initstate.cpp +++ b/renderdoc/driver/d3d12/d3d12_initstate.cpp @@ -980,7 +980,7 @@ bool D3D12ResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceI D3D12_RESOURCE_DESC resDesc = liveRes->GetDesc(); D3D12_HEAP_PROPERTIES heapProps = {}; - if(!m_Device->IsSparseResource(GetLiveID(id))) + if(!m_Device->IsSparseResource(id)) liveRes->GetHeapProperties(&heapProps, NULL); const bool isCPUCopyHeap = @@ -1115,7 +1115,7 @@ bool D3D12ResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceI else { D3D12_HEAP_PROPERTIES heapProps = {}; - if(!m_Device->IsSparseResource(GetLiveID(id))) + if(!m_Device->IsSparseResource(id)) liveRes->GetHeapProperties(&heapProps, NULL); // if the resource is sparse, create on default heap diff --git a/renderdoc/driver/d3d12/d3d12_manager.cpp b/renderdoc/driver/d3d12/d3d12_manager.cpp index da3189752..71ab98a49 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.cpp +++ b/renderdoc/driver/d3d12/d3d12_manager.cpp @@ -3888,17 +3888,13 @@ void D3D12ResourceManager::SerialiseResourceStates( SERIALISE_ELEMENT_LOCAL(Resource, srcit->first).TypedAs("ID3D12Resource *"_lit); SERIALISE_ELEMENT_LOCAL(States, srcit->second); - ResourceId liveid; if(IsReplayingAndReading() && HasLiveResource(Resource)) - liveid = GetLiveID(Resource); - - if(IsReplayingAndReading() && liveid != ResourceId()) { - processed.insert(liveid); + processed.insert(Resource); for(size_t m = 0; m < States.size(); m++) { - D3D12ResourceLayout srcState = states[liveid][m]; + D3D12ResourceLayout srcState = states[Resource][m]; D3D12ResourceLayout dstState = States[m]; // because of some extreme ugliness on the D3D12 side, resources can be created in new @@ -3918,7 +3914,7 @@ void D3D12ResourceManager::SerialiseResourceStates( if(srcState != dstState) { - AddStateResetBarrier(srcState, dstState, (ID3D12Resource *)GetCurrentResource(liveid), + AddStateResetBarrier(srcState, dstState, (ID3D12Resource *)GetCurrentResource(Resource), (UINT)m, barriers); } } diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 031757e04..9b00f2943 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -726,13 +726,6 @@ void D3D12Replay::FreeCustomShader(ResourceId id) } } -ResourceId D3D12Replay::GetLiveID(ResourceId id) -{ - if(!m_pDevice->GetResourceManager()->HasLiveResource(id)) - return ResourceId(); - return m_pDevice->GetResourceManager()->GetLiveID(id); -} - rdcarray D3D12Replay::GetUsage(ResourceId id) { if(m_pDevice->GetResourceList().find(id) == m_pDevice->GetResourceList().end()) @@ -3410,8 +3403,7 @@ void D3D12Replay::GetBufferData(ResourceId buff, uint64_t offset, uint64_t lengt if(it == m_pDevice->GetResourceList().end() || it->second == NULL) { - RDCERR("Getting buffer data for unknown buffer %s!", - ToStr(m_pDevice->GetResourceManager()->GetLiveID(buff)).c_str()); + RDCERR("Getting buffer data for unknown buffer %s!", ToStr(buff).c_str()); return; } @@ -3419,8 +3411,7 @@ void D3D12Replay::GetBufferData(ResourceId buff, uint64_t offset, uint64_t lengt if(buffer->GetDesc().Dimension != D3D12_RESOURCE_DIMENSION_BUFFER) { - RDCERR("Getting buffer data for non-buffer %s!", - ToStr(m_pDevice->GetResourceManager()->GetLiveID(buff)).c_str()); + RDCERR("Getting buffer data for non-buffer %s!", ToStr(buff).c_str()); return; } @@ -3772,15 +3763,13 @@ void D3D12Replay::GetTextureData(ResourceId tex, const Subresource &sub, if(resource == NULL) { - RDCERR("Trying to get texture data for unknown ID %s!", - ToStr(m_pDevice->GetResourceManager()->GetLiveID(tex)).c_str()); + RDCERR("Trying to get texture data for unknown ID %s!", ToStr(tex).c_str()); return; } if(resource->GetDesc().Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) { - RDCERR("Getting texture data for buffer %s!", - ToStr(m_pDevice->GetResourceManager()->GetLiveID(tex)).c_str()); + RDCERR("Getting texture data for buffer %s!", ToStr(tex).c_str()); return; } diff --git a/renderdoc/driver/d3d12/d3d12_replay.h b/renderdoc/driver/d3d12/d3d12_replay.h index 90edd87cc..ff21711f1 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.h +++ b/renderdoc/driver/d3d12/d3d12_replay.h @@ -194,7 +194,6 @@ public: // indicates that EID alias is the same as eventId void AliasPostVSBuffers(uint32_t eventId, uint32_t alias) { m_PostVSAlias[alias] = eventId; } - ResourceId GetLiveID(ResourceId id); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subresource &sub, CompType typeCast, float pixel[4]); diff --git a/renderdoc/driver/d3d12/d3d12_serialise.cpp b/renderdoc/driver/d3d12/d3d12_serialise.cpp index 5a1511037..7c80439a6 100644 --- a/renderdoc/driver/d3d12/d3d12_serialise.cpp +++ b/renderdoc/driver/d3d12/d3d12_serialise.cpp @@ -452,11 +452,6 @@ void DoSerialise(SerialiserType &ser, D3D12Descriptor &el) el.data.nonsamp.type = type; } - // we serialise via a pointer. This means if the resource isn't present it becomes NULL and we set - // the ResourceId to 0 on replay, and otherwise we get the live ID as we want. As a benefit, it's - // also invisibly backwards compatible - D3D12ResourceManager *rm = (D3D12ResourceManager *)ser.GetUserData(); - switch(type) { case D3D12DescriptorType::Sampler: @@ -478,14 +473,7 @@ void DoSerialise(SerialiserType &ser, D3D12Descriptor &el) } case D3D12DescriptorType::SRV: { - ResourceId Resource = el.data.nonsamp.resource; - - ser.Serialise("Resource"_lit, Resource).TypedAs("ID3D12Resource *"_lit).Important(); - - // convert to Live ID on replay - if(ser.IsReading() && !ser.IsStructurising()) - el.data.nonsamp.resource = - rm->HasLiveResource(Resource) ? rm->GetLiveID(Resource) : ResourceId(); + ser.Serialise("Resource"_lit, el.data.nonsamp.resource).TypedAs("ID3D12Resource *"_lit).Important(); // special case because of squeezed descriptor D3D12_SHADER_RESOURCE_VIEW_DESC desc; @@ -498,48 +486,21 @@ void DoSerialise(SerialiserType &ser, D3D12Descriptor &el) } case D3D12DescriptorType::RTV: { - ResourceId Resource = el.data.nonsamp.resource; - - ser.Serialise("Resource"_lit, Resource).TypedAs("ID3D12Resource *"_lit).Important(); - - // convert to Live ID on replay - if(ser.IsReading() && !ser.IsStructurising()) - el.data.nonsamp.resource = - rm->HasLiveResource(Resource) ? rm->GetLiveID(Resource) : ResourceId(); - + ser.Serialise("Resource"_lit, el.data.nonsamp.resource).TypedAs("ID3D12Resource *"_lit).Important(); ser.Serialise("Descriptor"_lit, el.data.nonsamp.rtv); break; } case D3D12DescriptorType::DSV: { - ResourceId Resource = el.data.nonsamp.resource; - - ser.Serialise("Resource"_lit, Resource).TypedAs("ID3D12Resource *"_lit).Important(); - - // convert to Live ID on replay - if(ser.IsReading() && !ser.IsStructurising()) - el.data.nonsamp.resource = - rm->HasLiveResource(Resource) ? rm->GetLiveID(Resource) : ResourceId(); - + ser.Serialise("Resource"_lit, el.data.nonsamp.resource).TypedAs("ID3D12Resource *"_lit).Important(); ser.Serialise("Descriptor"_lit, el.data.nonsamp.dsv); break; } case D3D12DescriptorType::UAV: { - ResourceId Resource = el.data.nonsamp.resource; - ResourceId CounterResource = el.data.nonsamp.counterResource; - - ser.Serialise("Resource"_lit, Resource).TypedAs("ID3D12Resource *"_lit).Important(); - ser.Serialise("CounterResource"_lit, CounterResource).TypedAs("ID3D12Resource *"_lit); - - // convert to Live ID on replay - if(ser.IsReading() && !ser.IsStructurising()) - { - el.data.nonsamp.resource = - rm->HasLiveResource(Resource) ? rm->GetLiveID(Resource) : ResourceId(); - el.data.nonsamp.counterResource = - rm->HasLiveResource(CounterResource) ? rm->GetLiveID(CounterResource) : ResourceId(); - } + ser.Serialise("Resource"_lit, el.data.nonsamp.resource).TypedAs("ID3D12Resource *"_lit).Important(); + ser.Serialise("CounterResource"_lit, el.data.nonsamp.counterResource) + .TypedAs("ID3D12Resource *"_lit); // special case because of squeezed descriptor D3D12_UNORDERED_ACCESS_VIEW_DESC desc; diff --git a/renderdoc/driver/gl/gl_initstate.cpp b/renderdoc/driver/gl/gl_initstate.cpp index 8fefa1ccd..306a78a4c 100644 --- a/renderdoc/driver/gl/gl_initstate.cpp +++ b/renderdoc/driver/gl/gl_initstate.cpp @@ -1174,9 +1174,9 @@ bool GLResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceId i if(IsReplayingAndReading()) { // need to write to serialise the location translation table - WrappedOpenGL::ProgramData &details = m_Driver->GetWriteableProgram(GetLiveID(id)); + WrappedOpenGL::ProgramData &details = m_Driver->GetWriteableProgram(id); - m_Driver->FillReflectionArray(GetLiveID(id), stages); + m_Driver->FillReflectionArray(id, stages); GLuint initProg = drv.glCreateProgram(); @@ -1389,9 +1389,7 @@ bool GLResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceId i // Otherwise this texture has no initial state to apply if(TextureState.internalformat != eGL_NONE && !ser.IsErrored()) { - WrappedOpenGL::TextureData &details = (ser.IsWriting() || IsStructuredExporting(m_State)) - ? m_Driver->m_Textures[id] - : m_Driver->m_Textures[GetLiveID(id)]; + WrappedOpenGL::TextureData &details = m_Driver->m_Textures[id]; if(TextureState.type == eGL_TEXTURE_BUFFER || TextureState.isView) { diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 07e973b91..373da61a7 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -200,13 +200,6 @@ rdcarray GLReplay::GetSupportedWindowSystems() return ret; } -ResourceId GLReplay::GetLiveID(ResourceId id) -{ - if(!m_pDriver->GetResourceManager()->HasLiveResource(id)) - return ResourceId(); - return m_pDriver->GetResourceManager()->GetLiveID(id); -} - rdcarray GLReplay::GetAvailableGPUs() { // GL doesn't support multiple GPUs, return an empty list @@ -811,8 +804,7 @@ rdcarray GLReplay::GetDisassemblyTargets(bool withPipeline) rdcstr GLReplay::DisassembleShader(ResourceId pipeline, const ShaderReflection *refl, const rdcstr &target) { - ResourceId liveId = m_pDriver->GetResourceManager()->GetLiveID(refl->resourceId); - const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->GetShader(liveId); + const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->GetShader(refl->resourceId); if(shaderDetails.sources.empty() && shaderDetails.spirvWords.empty() && shaderDetails.convertedSpirvWords.empty()) @@ -820,7 +812,7 @@ rdcstr GLReplay::DisassembleShader(ResourceId pipeline, const ShaderReflection * if(target == SPIRVDisassemblyTarget || target.empty()) { - m_pDriver->GetWriteableShader(liveId).Disassemble(refl->entryPoint); + m_pDriver->GetWriteableShader(refl->resourceId).Disassemble(refl->entryPoint); return shaderDetails.disassembly; } diff --git a/renderdoc/driver/gl/gl_replay.h b/renderdoc/driver/gl/gl_replay.h index a13ac0c61..5ea86a464 100644 --- a/renderdoc/driver/gl/gl_replay.h +++ b/renderdoc/driver/gl/gl_replay.h @@ -256,8 +256,6 @@ public: void InitPostVSBuffers(uint32_t eventId); void InitPostVSBuffers(const rdcarray &passEvents); - ResourceId GetLiveID(ResourceId id); - void PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subresource &sub, CompType typeCast, float pixel[4]); bool GetMinMax(ResourceId texid, const Subresource &sub, CompType typeCast, float *minval, diff --git a/renderdoc/driver/gl/gl_shaderdebug.cpp b/renderdoc/driver/gl/gl_shaderdebug.cpp index 4567b6d76..5fe0671d6 100644 --- a/renderdoc/driver/gl/gl_shaderdebug.cpp +++ b/renderdoc/driver/gl/gl_shaderdebug.cpp @@ -123,7 +123,7 @@ public: m_SamplerDescriptors.append(replay->GetSamplerDescriptors(store, ranges)); } - store = replay->GetLiveID(acc.descriptorStore); + store = acc.descriptorStore; ranges.clear(); } @@ -690,8 +690,7 @@ public: return true; } - WrappedOpenGL::TextureData &texDetails = - m_pDriver->m_Textures[m_pDriver->GetResourceManager()->GetLiveID(imageDescriptor.resource)]; + WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[imageDescriptor.resource]; SamplingProgramConfig config; @@ -1684,9 +1683,8 @@ private: if(bufData.resource != ResourceId()) { - m_pDriver->GetReplay()->GetBufferData( - m_pDriver->GetResourceManager()->GetLiveID(bufData.resource), bufData.byteOffset, - bufData.byteSize, data); + m_pDriver->GetReplay()->GetBufferData(bufData.resource, bufData.byteOffset, + bufData.byteSize, data); } } @@ -1719,7 +1717,7 @@ private: if(imgData.type == DescriptorType::TypedBuffer || imgData.type == DescriptorType::ReadWriteTypedBuffer) { - ResourceId buffer = m_pDriver->GetResourceManager()->GetLiveID(imgData.resource); + ResourceId buffer = imgData.resource; uint64_t offset = imgData.byteOffset; GLenum format = MakeGLFormat(imgData.format); uint64_t byteWidth = imgData.byteSize; @@ -1734,13 +1732,11 @@ private: data.samplePitch = data.slicePitch = data.rowPitch = data.width * data.texelSize; - m_pDriver->GetReplay()->GetBufferData( - m_pDriver->GetResourceManager()->GetLiveID(imgData.resource), offset, data.rowPitch, - data.bytes); + m_pDriver->GetReplay()->GetBufferData(imgData.resource, offset, data.rowPitch, data.bytes); } else if(imgData.resource != ResourceId()) { - ResourceId id = m_pDriver->GetResourceManager()->GetLiveID(imgData.resource); + ResourceId id = imgData.resource; const WrappedOpenGL::TextureData &texProps = m_pDriver->m_Textures[id]; uint32_t mip = imgData.firstMip; diff --git a/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp index af13fb849..7e930ceb4 100644 --- a/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_draw_funcs.cpp @@ -4686,8 +4686,7 @@ bool WrappedOpenGL::Serialise_glClearTexImage(SerialiserType &ser, GLuint textur { AddEvent(); - ResourceId liveId = GetResourceManager()->GetResID(texture); - ResourceId id = liveId; + ResourceId id = GetResourceManager()->GetResID(texture); ActionDescription action; action.flags |= ActionFlags::Clear; @@ -4701,7 +4700,7 @@ bool WrappedOpenGL::Serialise_glClearTexImage(SerialiserType &ser, GLuint textur AddAction(action); - m_ResourceUses[liveId].push_back(EventUsage(m_CurEventID, ResourceUsage::Clear)); + m_ResourceUses[id].push_back(EventUsage(m_CurEventID, ResourceUsage::Clear)); } } @@ -4835,8 +4834,7 @@ bool WrappedOpenGL::Serialise_glClearTexSubImage(SerialiserType &ser, GLuint tex { AddEvent(); - ResourceId liveId = GetResourceManager()->GetResID(texture); - ResourceId id = liveId; + ResourceId id = GetResourceManager()->GetResID(texture); ActionDescription action; action.flags |= ActionFlags::Clear; @@ -4850,7 +4848,7 @@ bool WrappedOpenGL::Serialise_glClearTexSubImage(SerialiserType &ser, GLuint tex AddAction(action); - m_ResourceUses[liveId].push_back(EventUsage(m_CurEventID, ResourceUsage::Clear)); + m_ResourceUses[id].push_back(EventUsage(m_CurEventID, ResourceUsage::Clear)); } } diff --git a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp index d687b0452..a0f8c05da 100644 --- a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp @@ -2567,8 +2567,7 @@ bool WrappedOpenGL::Serialise_glNamedRenderbufferStorageEXT(SerialiserType &ser, if(IsReplayingAndReading()) { - ResourceId liveId = GetResourceManager()->GetResID(renderbuffer); - TextureData &texDetails = m_Textures[liveId]; + TextureData &texDetails = m_Textures[GetResourceManager()->GetResID(renderbuffer)]; GLenum fmt = GetBaseFormat(internalformat); @@ -2769,8 +2768,7 @@ bool WrappedOpenGL::Serialise_glNamedRenderbufferStorageMultisampleEXT(Serialise // present CheckReplayFunctionPresent(glRenderbufferStorageMultisample); - ResourceId liveId = GetResourceManager()->GetResID(renderbuffer); - TextureData &texDetails = m_Textures[liveId]; + TextureData &texDetails = m_Textures[GetResourceManager()->GetResID(renderbuffer)]; GLenum fmt = GetBaseFormat(internalformat); @@ -3006,8 +3004,7 @@ bool WrappedOpenGL::Serialise_glRenderbufferStorageMultisampleEXT(SerialiserType { CheckReplayFunctionPresent(glRenderbufferStorageMultisampleEXT); - ResourceId liveId = GetResourceManager()->GetResID(renderbuffer); - TextureData &texDetails = m_Textures[liveId]; + TextureData &texDetails = m_Textures[GetResourceManager()->GetResID(renderbuffer)]; GLenum fmt = GetBaseFormat(internalformat); diff --git a/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp index 6642633f3..3baea40d0 100644 --- a/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_interop_funcs.cpp @@ -331,26 +331,26 @@ bool WrappedOpenGL::Serialise_wglDXRegisterObjectNV(SerialiserType &ser, GLResou if(type != eGL_NONE) { - ResourceId liveId = GetResourceManager()->GetResID(Resource); - m_Textures[liveId].curType = type; - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = RDCMAX(depth, samples); - m_Textures[liveId].samples = samples; - m_Textures[liveId].dimension = 2; + ResourceId id = GetResourceManager()->GetResID(Resource); + m_Textures[id].curType = type; + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = RDCMAX(depth, samples); + m_Textures[id].samples = samples; + m_Textures[id].dimension = 2; if(type == eGL_TEXTURE_1D || type == eGL_TEXTURE_1D_ARRAY) - m_Textures[liveId].dimension = 1; + m_Textures[id].dimension = 1; else if(type == eGL_TEXTURE_3D) - m_Textures[liveId].dimension = 3; + m_Textures[id].dimension = 3; - m_Textures[liveId].internalFormat = internalFormat; - m_Textures[liveId].mipsValid = (1 << mips) - 1; + m_Textures[id].internalFormat = internalFormat; + m_Textures[id].mipsValid = (1 << mips) - 1; } if(type == eGL_NONE || type == eGL_TEXTURE_BUFFER) { - ResourceId liveId = GetResourceManager()->GetResID(Resource); - m_Buffers[liveId].size = width; + ResourceId id = GetResourceManager()->GetResID(Resource); + m_Buffers[id].size = width; } AddResourceInitChunk(Resource); @@ -1430,19 +1430,19 @@ bool WrappedOpenGL::Serialise_glTextureStorageMem1DEXT(SerialiserType &ser, GLui if(IsReplayingAndReading()) { // Replay external texture storage backed by external memory as just a plain texture. - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = 1; - m_Textures[liveId].depth = 1; - m_Textures[liveId].dimension = 1; - m_Textures[liveId].internalFormat = internalFormat; - m_Textures[liveId].emulated = false; - m_Textures[liveId].mipsValid = (1 << levels) - 1; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = 1; + m_Textures[id].depth = 1; + m_Textures[id].dimension = 1; + m_Textures[id].internalFormat = internalFormat; + m_Textures[id].emulated = false; + m_Textures[id].mipsValid = (1 << levels) - 1; - GL.glTextureStorage1DEXT(texture.name, m_Textures[liveId].curType, levels, internalFormat, width); + GL.glTextureStorage1DEXT(texture.name, m_Textures[id].curType, levels, internalFormat, width); AddResourceInitChunk(texture); - DerivedResource(memory, liveId); + DerivedResource(memory, id); } return true; @@ -1539,20 +1539,20 @@ bool WrappedOpenGL::Serialise_glTextureStorageMem2DEXT(SerialiserType &ser, GLui if(IsReplayingAndReading()) { // Replay external texture storage backed by external memory as just a plain texture. - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = 1; - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = internalFormat; - m_Textures[liveId].emulated = false; - m_Textures[liveId].mipsValid = (1 << levels) - 1; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = 1; + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = internalFormat; + m_Textures[id].emulated = false; + m_Textures[id].mipsValid = (1 << levels) - 1; - GL.glTextureStorage2DEXT(texture.name, m_Textures[liveId].curType, levels, internalFormat, - width, height); + GL.glTextureStorage2DEXT(texture.name, m_Textures[id].curType, levels, internalFormat, width, + height); AddResourceInitChunk(texture); - DerivedResource(memory, liveId); + DerivedResource(memory, id); } return true; @@ -1657,21 +1657,21 @@ bool WrappedOpenGL::Serialise_glTextureStorageMem2DMultisampleEXT( CheckReplayFunctionPresent(glTexStorage2DMultisample); // Replay external texture storage backed by external memory as just a plain texture. - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = 1; - m_Textures[liveId].samples = samples; - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = internalFormat; - m_Textures[liveId].emulated = false; - m_Textures[liveId].mipsValid = 1; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = 1; + m_Textures[id].samples = samples; + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = internalFormat; + m_Textures[id].emulated = false; + m_Textures[id].mipsValid = 1; - GL.glTextureStorage2DMultisampleEXT(texture.name, m_Textures[liveId].curType, samples, + GL.glTextureStorage2DMultisampleEXT(texture.name, m_Textures[id].curType, samples, internalFormat, width, height, fixedSampleLocations); AddResourceInitChunk(texture); - DerivedResource(memory, liveId); + DerivedResource(memory, id); } return true; @@ -1778,20 +1778,20 @@ bool WrappedOpenGL::Serialise_glTextureStorageMem3DEXT(SerialiserType &ser, GLui if(IsReplayingAndReading()) { // Replay external texture storage backed by external memory as just a plain texture. - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = depth; - m_Textures[liveId].dimension = 3; - m_Textures[liveId].internalFormat = internalFormat; - m_Textures[liveId].emulated = false; - m_Textures[liveId].mipsValid = (1 << levels) - 1; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = depth; + m_Textures[id].dimension = 3; + m_Textures[id].internalFormat = internalFormat; + m_Textures[id].emulated = false; + m_Textures[id].mipsValid = (1 << levels) - 1; - GL.glTextureStorage3DEXT(texture.name, m_Textures[liveId].curType, levels, internalFormat, - width, height, depth); + GL.glTextureStorage3DEXT(texture.name, m_Textures[id].curType, levels, internalFormat, width, + height, depth); AddResourceInitChunk(texture); - DerivedResource(memory, liveId); + DerivedResource(memory, id); } return true; @@ -1892,21 +1892,21 @@ bool WrappedOpenGL::Serialise_glTextureStorageMem3DMultisampleEXT( if(IsReplayingAndReading()) { // Replay external texture storage backed by external memory as just a plain texture. - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = depth; - m_Textures[liveId].samples = samples; - m_Textures[liveId].dimension = 3; - m_Textures[liveId].internalFormat = internalFormat; - m_Textures[liveId].emulated = false; - m_Textures[liveId].mipsValid = 1; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = depth; + m_Textures[id].samples = samples; + m_Textures[id].dimension = 3; + m_Textures[id].internalFormat = internalFormat; + m_Textures[id].emulated = false; + m_Textures[id].mipsValid = 1; - GL.glTextureStorage3DMultisampleEXT(texture.name, m_Textures[liveId].curType, samples, + GL.glTextureStorage3DMultisampleEXT(texture.name, m_Textures[id].curType, samples, internalFormat, width, height, depth, fixedSampleLocations); AddResourceInitChunk(texture); - DerivedResource(memory, liveId); + DerivedResource(memory, id); } return true; diff --git a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp index 004ee09e1..a8e74f382 100644 --- a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp @@ -613,10 +613,10 @@ bool WrappedOpenGL::Serialise_glCreateShader(SerialiserType &ser, GLenum type, G GLResource res = ShaderRes(GetCtx(), real); - ResourceId liveId = GetResourceManager()->RegisterResource(Shader, res); + ResourceId id = GetResourceManager()->RegisterResource(Shader, res); GetResourceManager()->AddLiveResource(Shader, res); - m_Shaders[liveId].type = type; + m_Shaders[id].type = type; AddResource(Shader, ResourceType::Shader, "Shader"); } @@ -691,9 +691,9 @@ bool WrappedOpenGL::Serialise_glShaderSource(SerialiserType &ser, GLuint shaderH for(size_t i = 0; i < sources.size(); i++) strs.push_back(sources[i].c_str()); - ResourceId liveId = GetResourceManager()->GetResID(shader); + ResourceId id = GetResourceManager()->GetResID(shader); - m_Shaders[liveId].sources = sources; + m_Shaders[id].sources = sources; GL.glShaderSource(shader.name, (GLsizei)sources.size(), strs.data(), NULL); @@ -704,9 +704,9 @@ bool WrappedOpenGL::Serialise_glShaderSource(SerialiserType &ser, GLuint shaderH // Doing this means we support the case of recompiling a shader different ways // and relinking a program before use, which is still moderately crazy and // so people who do that should be moderately ashamed. - if(m_Shaders[liveId].GetReflection()->resourceId != ResourceId()) + if(m_Shaders[id].GetReflection()->resourceId != ResourceId()) { - m_Shaders[liveId].ClearReflection(); + m_Shaders[id].ClearReflection(); } AddResourceInitChunk(shader); @@ -758,11 +758,11 @@ bool WrappedOpenGL::Serialise_glCompileShader(SerialiserType &ser, GLuint shader if(IsReplayingAndReading()) { - ResourceId liveId = GetResourceManager()->GetResID(shader); + ResourceId id = GetResourceManager()->GetResID(shader); GL.glCompileShader(shader.name); - m_Shaders[liveId].ProcessCompilation(*this, liveId, shader.name); + m_Shaders[id].ProcessCompilation(*this, id, shader.name); AddResourceInitChunk(shader); } @@ -973,17 +973,17 @@ bool WrappedOpenGL::Serialise_glCreateShaderProgramv(SerialiserType &ser, GLenum GLResource res = ProgramRes(GetCtx(), real); - ResourceId liveId = m_ResourceManager->RegisterResource(Program, res); + ResourceId id = m_ResourceManager->RegisterResource(Program, res); GetResourceManager()->AddLiveResource(Program, res); - WrappedOpenGL::ProgramData &progDetails = m_Programs[liveId]; + WrappedOpenGL::ProgramData &progDetails = m_Programs[id]; progDetails.linked = true; - progDetails.shaders.push_back(liveId); - progDetails.stageShaders[ShaderIdx(type)] = liveId; + progDetails.shaders.push_back(id); + progDetails.stageShaders[ShaderIdx(type)] = id; progDetails.shaderProgramUnlinkable = true; - WrappedOpenGL::ShaderData &shadDetails = m_Shaders[liveId]; + WrappedOpenGL::ShaderData &shadDetails = m_Shaders[id]; shadDetails.type = type; shadDetails.sources.swap(src); @@ -1059,10 +1059,10 @@ bool WrappedOpenGL::Serialise_glCreateProgram(SerialiserType &ser, GLuint progra GLResource res = ProgramRes(GetCtx(), real); - ResourceId liveId = m_ResourceManager->RegisterResource(Program, res); + ResourceId id = m_ResourceManager->RegisterResource(Program, res); GetResourceManager()->AddLiveResource(Program, res); - m_Programs[liveId].linked = false; + m_Programs[id].linked = false; AddResource(Program, ResourceType::StateObject, "Program"); } @@ -1686,11 +1686,11 @@ bool WrappedOpenGL::Serialise_glShaderBinary(SerialiserType &ser, GLsizei count, if(IsReplayingAndReading()) { - ResourceId liveId = GetResourceManager()->GetResID(shader); + ResourceId id = GetResourceManager()->GetResID(shader); GL.glShaderBinary(1, &shader.name, binaryformat, binary, length); - m_Shaders[liveId].spirvWords.assign((uint32_t *)binary, length / sizeof(uint32_t)); + m_Shaders[id].spirvWords.assign((uint32_t *)binary, length / sizeof(uint32_t)); AddResourceInitChunk(shader); } @@ -1711,8 +1711,8 @@ void WrappedOpenGL::glShaderBinary(GLsizei count, const GLuint *shaders, GLenum { for(GLsizei i = 0; i < count; i++) { - ResourceId liveId = GetResourceManager()->GetResID(ShaderRes(GetCtx(), shaders[i])); - m_Shaders[liveId].spirvWords.assign((uint32_t *)binary, length / sizeof(uint32_t)); + ResourceId id = GetResourceManager()->GetResID(ShaderRes(GetCtx(), shaders[i])); + m_Shaders[id].spirvWords.assign((uint32_t *)binary, length / sizeof(uint32_t)); } } } @@ -2158,9 +2158,9 @@ bool WrappedOpenGL::Serialise_glCompileShaderIncludeARB(SerialiserType &ser, GLu { CheckReplayFunctionPresent(glCompileShaderIncludeARB); - ResourceId liveId = GetResourceManager()->GetResID(shader); + ResourceId id = GetResourceManager()->GetResID(shader); - WrappedOpenGL::ShaderData &shadDetails = m_Shaders[liveId]; + WrappedOpenGL::ShaderData &shadDetails = m_Shaders[id]; shadDetails.includepaths.clear(); shadDetails.includepaths.reserve(count); @@ -2170,7 +2170,7 @@ bool WrappedOpenGL::Serialise_glCompileShaderIncludeARB(SerialiserType &ser, GLu GL.glCompileShaderIncludeARB(shader.name, count, path, NULL); - shadDetails.ProcessCompilation(*this, liveId, shader.name); + shadDetails.ProcessCompilation(*this, id, shader.name); AddResourceInitChunk(shader); } @@ -2321,16 +2321,15 @@ bool WrappedOpenGL::Serialise_glSpecializeShader(SerialiserType &ser, GLuint sha { CheckReplayFunctionPresent(glSpecializeShader); - ResourceId liveId = GetResourceManager()->GetResID(shader); + ResourceId id = GetResourceManager()->GetResID(shader); GL.glSpecializeShader(shader.name, pEntryPoint, numSpecializationConstants, pConstantIndex, pConstantValue); - m_Shaders[liveId].spirv.Parse(m_Shaders[liveId].spirvWords); + m_Shaders[id].spirv.Parse(m_Shaders[id].spirvWords); - m_Shaders[liveId].ProcessSPIRVCompilation(*this, liveId, shader.name, pEntryPoint, - numSpecializationConstants, pConstantIndex, - pConstantValue); + m_Shaders[id].ProcessSPIRVCompilation(*this, id, shader.name, pEntryPoint, + numSpecializationConstants, pConstantIndex, pConstantValue); AddResourceInitChunk(shader); } @@ -2369,13 +2368,12 @@ void WrappedOpenGL::glSpecializeShader(GLuint shader, const GLchar *pEntryPoint, } else { - ResourceId liveId = GetResourceManager()->GetResID(ShaderRes(GetCtx(), shader)); + ResourceId id = GetResourceManager()->GetResID(ShaderRes(GetCtx(), shader)); - m_Shaders[liveId].spirv.Parse(m_Shaders[liveId].spirvWords); + m_Shaders[id].spirv.Parse(m_Shaders[id].spirvWords); - m_Shaders[liveId].ProcessSPIRVCompilation(*this, liveId, shader, pEntryPoint, - numSpecializationConstants, pConstantIndex, - pConstantValue); + m_Shaders[id].ProcessSPIRVCompilation( + *this, id, shader, pEntryPoint, numSpecializationConstants, pConstantIndex, pConstantValue); } } diff --git a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp index afb5a7052..836985ae6 100644 --- a/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_texture_funcs.cpp @@ -819,10 +819,9 @@ bool WrappedOpenGL::Serialise_glGenerateTextureMipmapEXT(SerialiserType &ser, GL AddEvent(); // all mips are now valid - ResourceId liveId = GetResourceManager()->GetResID(texture); - uint32_t mips = - CalcNumMips(m_Textures[liveId].width, m_Textures[liveId].height, m_Textures[liveId].depth); - m_Textures[liveId].mipsValid = (1 << mips) - 1; + ResourceId id = GetResourceManager()->GetResID(texture); + uint32_t mips = CalcNumMips(m_Textures[id].width, m_Textures[id].height, m_Textures[id].depth); + m_Textures[id].mipsValid = (1 << mips) - 1; ActionDescription action; action.flags |= ActionFlags::GenMips; @@ -936,14 +935,13 @@ bool WrappedOpenGL::Serialise_glInvalidateTexImage(SerialiserType &ser, GLuint t { GL.glInvalidateTexImage(texture.name, level); - ResourceId liveId = GetResourceManager()->GetResID(texture); + ResourceId id = GetResourceManager()->GetResID(texture); if(m_ReplayOptions.optimisation != ReplayOptimisationLevel::Fastest) { GLenum attach = eGL_COLOR_ATTACHMENT0; - ResourceFormat fmt = - MakeResourceFormat(m_Textures[liveId].curType, m_Textures[liveId].internalFormat); + ResourceFormat fmt = MakeResourceFormat(m_Textures[id].curType, m_Textures[id].internalFormat); if(fmt.type != ResourceFormatType::Regular && fmt.type != ResourceFormatType::D16S8 && fmt.type != ResourceFormatType::D24S8 && fmt.type != ResourceFormatType::D32S8 && @@ -951,11 +949,11 @@ bool WrappedOpenGL::Serialise_glInvalidateTexImage(SerialiserType &ser, GLuint t fmt.type != ResourceFormatType::R11G11B10) { // we don't expect to be able to render to this format, so fill it manually - GetReplay()->FillWithDiscardPattern(DiscardType::InvalidateCall, liveId, level); + GetReplay()->FillWithDiscardPattern(DiscardType::InvalidateCall, id, level); } else { - GLenum base = GetBaseFormat(m_Textures[liveId].internalFormat); + GLenum base = GetBaseFormat(m_Textures[id].internalFormat); if(base == eGL_DEPTH_STENCIL) attach = eGL_DEPTH_STENCIL_ATTACHMENT; else if(base == eGL_DEPTH_COMPONENT) @@ -970,11 +968,11 @@ bool WrappedOpenGL::Serialise_glInvalidateTexImage(SerialiserType &ser, GLuint t GL.glGenFramebuffers(1, &fb); GL.glBindFramebuffer(eGL_DRAW_FRAMEBUFFER, fb); - GLenum texTarget = m_Textures[liveId].curType; + GLenum texTarget = m_Textures[id].curType; if(texTarget == eGL_TEXTURE_3D) { - for(GLsizei z = 0; z < RDCMAX(1, m_Textures[liveId].depth >> level); z++) + for(GLsizei z = 0; z < RDCMAX(1, m_Textures[id].depth >> level); z++) { GL.glFramebufferTextureLayer(eGL_DRAW_FRAMEBUFFER, attach, texture.name, level, z); GetReplay()->FillWithDiscardPattern(DiscardType::InvalidateCall, fb, 1, &attach, 0, 0, @@ -984,7 +982,7 @@ bool WrappedOpenGL::Serialise_glInvalidateTexImage(SerialiserType &ser, GLuint t else if(texTarget == eGL_TEXTURE_2D_ARRAY || texTarget == eGL_TEXTURE_2D_MULTISAMPLE_ARRAY || texTarget == eGL_TEXTURE_CUBE_MAP || texTarget == eGL_TEXTURE_CUBE_MAP_ARRAY) { - GLsizei depth = m_Textures[liveId].depth; + GLsizei depth = m_Textures[id].depth; if(texTarget == eGL_TEXTURE_CUBE_MAP) depth *= 6; for(GLsizei z = 0; z < depth; z++) @@ -1003,7 +1001,7 @@ bool WrappedOpenGL::Serialise_glInvalidateTexImage(SerialiserType &ser, GLuint t } else if(texTarget == eGL_TEXTURE_1D_ARRAY) { - for(GLsizei z = 0; z < m_Textures[liveId].height; z++) + for(GLsizei z = 0; z < m_Textures[id].height; z++) { GL.glFramebufferTextureLayer(eGL_DRAW_FRAMEBUFFER, attach, texture.name, level, z); GetReplay()->FillWithDiscardPattern(DiscardType::InvalidateCall, fb, 1, &attach, 0, 0, @@ -1030,7 +1028,7 @@ bool WrappedOpenGL::Serialise_glInvalidateTexImage(SerialiserType &ser, GLuint t ActionDescription action; action.flags |= ActionFlags::Clear; - action.copyDestination = liveId; + action.copyDestination = id; AddAction(action); @@ -1096,14 +1094,13 @@ bool WrappedOpenGL::Serialise_glInvalidateTexSubImage(SerialiserType &ser, GLuin { GL.glInvalidateTexSubImage(texture.name, level, xoffset, yoffset, zoffset, width, height, depth); - ResourceId liveId = GetResourceManager()->GetResID(texture); + ResourceId id = GetResourceManager()->GetResID(texture); if(m_ReplayOptions.optimisation != ReplayOptimisationLevel::Fastest) { GLenum attach = eGL_COLOR_ATTACHMENT0; - ResourceFormat fmt = - MakeResourceFormat(m_Textures[liveId].curType, m_Textures[liveId].internalFormat); + ResourceFormat fmt = MakeResourceFormat(m_Textures[id].curType, m_Textures[id].internalFormat); if(fmt.type != ResourceFormatType::Regular && fmt.type != ResourceFormatType::D16S8 && fmt.type != ResourceFormatType::D24S8 && fmt.type != ResourceFormatType::D32S8 && @@ -1111,12 +1108,12 @@ bool WrappedOpenGL::Serialise_glInvalidateTexSubImage(SerialiserType &ser, GLuin fmt.type != ResourceFormatType::R11G11B10) { // we don't expect to be able to render to this format, so fill it manually - GetReplay()->FillWithDiscardPattern(DiscardType::InvalidateCall, liveId, level, xoffset, + GetReplay()->FillWithDiscardPattern(DiscardType::InvalidateCall, id, level, xoffset, yoffset, zoffset, width, height, depth); } else { - GLenum base = GetBaseFormat(m_Textures[liveId].internalFormat); + GLenum base = GetBaseFormat(m_Textures[id].internalFormat); if(base == eGL_DEPTH_STENCIL) attach = eGL_DEPTH_STENCIL_ATTACHMENT; else if(base == eGL_DEPTH_COMPONENT) @@ -1131,7 +1128,7 @@ bool WrappedOpenGL::Serialise_glInvalidateTexSubImage(SerialiserType &ser, GLuin GL.glGenFramebuffers(1, &fb); GL.glBindFramebuffer(eGL_DRAW_FRAMEBUFFER, fb); - GLenum texTarget = m_Textures[liveId].curType; + GLenum texTarget = m_Textures[id].curType; if(texTarget == eGL_TEXTURE_3D || texTarget == eGL_TEXTURE_2D_ARRAY || texTarget == eGL_TEXTURE_2D_MULTISAMPLE_ARRAY || texTarget == eGL_TEXTURE_CUBE_MAP || @@ -1182,7 +1179,7 @@ bool WrappedOpenGL::Serialise_glInvalidateTexSubImage(SerialiserType &ser, GLuin ActionDescription action; action.flags |= ActionFlags::Clear; - action.copyDestination = liveId; + action.copyDestination = id; AddAction(action); @@ -2746,21 +2743,21 @@ bool WrappedOpenGL::Serialise_glTextureImage1DEXT(SerialiserType &ser, GLuint te bool emulated = EmulateLuminanceFormat(texture.name, target, intFmt, format); internalformat = intFmt; - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].mipsValid |= 1 << level; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = 1; - m_Textures[liveId].depth = 1; + m_Textures[id].width = width; + m_Textures[id].height = 1; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 1; - m_Textures[liveId].internalFormat = (GLenum)internalformat; - m_Textures[liveId].initFormatHint = format; - m_Textures[liveId].initTypeHint = type; - m_Textures[liveId].emulated = emulated; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 1; + m_Textures[id].internalFormat = (GLenum)internalformat; + m_Textures[id].initFormatHint = format; + m_Textures[id].initTypeHint = type; + m_Textures[id].emulated = emulated; } // for creation type chunks we forcibly don't use the unpack buffers as we @@ -2995,23 +2992,23 @@ bool WrappedOpenGL::Serialise_glTextureImage2DEXT(SerialiserType &ser, GLuint te bool emulated = EmulateLuminanceFormat(texture.name, target, intFmt, format); internalformat = intFmt; - ResourceId liveId = GetResourceManager()->GetResID(texture); + ResourceId id = GetResourceManager()->GetResID(texture); - uint32_t mipsValid = m_Textures[liveId].mipsValid; - m_Textures[liveId].mipsValid |= 1 << level; + uint32_t mipsValid = m_Textures[id].mipsValid; + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = 1; + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = (GLenum)internalformat; - m_Textures[liveId].initFormatHint = format; - m_Textures[liveId].initTypeHint = type; - m_Textures[liveId].emulated = emulated; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = (GLenum)internalformat; + m_Textures[id].initFormatHint = format; + m_Textures[id].initTypeHint = type; + m_Textures[id].emulated = emulated; } // for creation type chunks we forcibly don't use the unpack buffers as we @@ -3036,8 +3033,7 @@ bool WrappedOpenGL::Serialise_glTextureImage2DEXT(SerialiserType &ser, GLuint te GL.glPixelStorei(eGL_UNPACK_ALIGNMENT, 1); } - if(TextureBinding(target) == eGL_TEXTURE_BINDING_CUBE_MAP && - mipsValid != m_Textures[liveId].mipsValid) + if(TextureBinding(target) == eGL_TEXTURE_BINDING_CUBE_MAP && mipsValid != m_Textures[id].mipsValid) { GLenum ts[] = { eGL_TEXTURE_CUBE_MAP_POSITIVE_X, eGL_TEXTURE_CUBE_MAP_NEGATIVE_X, @@ -3274,21 +3270,21 @@ bool WrappedOpenGL::Serialise_glTextureImage3DEXT(SerialiserType &ser, GLuint te bool emulated = EmulateLuminanceFormat(texture.name, target, intFmt, format); internalformat = intFmt; - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].mipsValid |= 1 << level; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = depth; + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = depth; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 3; - m_Textures[liveId].internalFormat = (GLenum)internalformat; - m_Textures[liveId].initFormatHint = format; - m_Textures[liveId].initTypeHint = type; - m_Textures[liveId].emulated = emulated; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 3; + m_Textures[id].internalFormat = (GLenum)internalformat; + m_Textures[id].initFormatHint = format; + m_Textures[id].initTypeHint = type; + m_Textures[id].emulated = emulated; } // for creation type chunks we forcibly don't use the unpack buffers as we @@ -3536,18 +3532,18 @@ bool WrappedOpenGL::Serialise_glCompressedTextureImage1DEXT(SerialiserType &ser, databuf = m_ScratchBuf.data(); } - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].mipsValid |= 1 << level; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = 1; - m_Textures[liveId].depth = 1; + m_Textures[id].width = width; + m_Textures[id].height = 1; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 1; - m_Textures[liveId].internalFormat = internalformat; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 1; + m_Textures[id].internalFormat = internalformat; } // for creation type chunks we forcibly don't use the unpack buffers as we @@ -3917,20 +3913,20 @@ bool WrappedOpenGL::Serialise_glCompressedTextureImage2DEXT(SerialiserType &ser, databuf = m_ScratchBuf.data(); } - ResourceId liveId = GetResourceManager()->GetResID(texture); + ResourceId id = GetResourceManager()->GetResID(texture); - uint32_t mipsValid = m_Textures[liveId].mipsValid; - m_Textures[liveId].mipsValid |= 1 << level; + uint32_t mipsValid = m_Textures[id].mipsValid; + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = 1; + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = internalformat; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = internalformat; } // for creation type chunks we forcibly don't use the unpack buffers as we @@ -3955,8 +3951,7 @@ bool WrappedOpenGL::Serialise_glCompressedTextureImage2DEXT(SerialiserType &ser, GL.glPixelStorei(eGL_UNPACK_ALIGNMENT, 1); } - if(TextureBinding(target) == eGL_TEXTURE_BINDING_CUBE_MAP && - mipsValid != m_Textures[liveId].mipsValid) + if(TextureBinding(target) == eGL_TEXTURE_BINDING_CUBE_MAP && mipsValid != m_Textures[id].mipsValid) { GLenum ts[] = { eGL_TEXTURE_CUBE_MAP_POSITIVE_X, eGL_TEXTURE_CUBE_MAP_NEGATIVE_X, @@ -4201,18 +4196,18 @@ bool WrappedOpenGL::Serialise_glCompressedTextureImage3DEXT(SerialiserType &ser, databuf = m_ScratchBuf.data(); } - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].mipsValid |= 1 << level; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = depth; + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = depth; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 3; - m_Textures[liveId].internalFormat = internalformat; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 3; + m_Textures[id].internalFormat = internalformat; } // for creation type chunks we forcibly don't use the unpack buffers as we @@ -4431,18 +4426,18 @@ bool WrappedOpenGL::Serialise_glCopyTextureImage1DEXT(SerialiserType &ser, GLuin if(IsReplayingAndReading()) { - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].mipsValid |= 1 << level; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = 1; - m_Textures[liveId].depth = 1; + m_Textures[id].width = width; + m_Textures[id].height = 1; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 1; - m_Textures[liveId].internalFormat = internalformat; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 1; + m_Textures[id].internalFormat = internalformat; } GL.glCopyTextureImage1DEXT(texture.name, target, level, internalformat, x, y, width, border); @@ -4594,18 +4589,18 @@ bool WrappedOpenGL::Serialise_glCopyTextureImage2DEXT(SerialiserType &ser, GLuin if(IsReplayingAndReading()) { - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].mipsValid |= 1 << level; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].mipsValid |= 1 << level; if(level == 0) // assume level 0 will always get a glTexImage call { - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = 1; + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = internalformat; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = internalformat; } GL.glCopyTextureImage2DEXT(texture.name, target, level, internalformat, x, y, width, height, @@ -4760,16 +4755,16 @@ bool WrappedOpenGL::Serialise_glTextureStorage1DEXT(SerialiserType &ser, GLuint GLenum dummy = eGL_NONE; bool emulated = EmulateLuminanceFormat(texture.name, target, internalformat, dummy); - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = 1; - m_Textures[liveId].depth = 1; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = 1; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 1; - m_Textures[liveId].internalFormat = internalformat; - m_Textures[liveId].emulated = emulated; - m_Textures[liveId].mipsValid = (1 << levels) - 1; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 1; + m_Textures[id].internalFormat = internalformat; + m_Textures[id].emulated = emulated; + m_Textures[id].mipsValid = (1 << levels) - 1; if(target != eGL_NONE) GL.glTextureStorage1DEXT(texture.name, target, levels, internalformat, width); @@ -4887,16 +4882,16 @@ bool WrappedOpenGL::Serialise_glTextureStorage2DEXT(SerialiserType &ser, GLuint GLenum dummy = eGL_NONE; bool emulated = EmulateLuminanceFormat(texture.name, target, internalformat, dummy); - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = 1; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = internalformat; - m_Textures[liveId].emulated = emulated; - m_Textures[liveId].mipsValid = (1 << levels) - 1; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = internalformat; + m_Textures[id].emulated = emulated; + m_Textures[id].mipsValid = (1 << levels) - 1; if(target != eGL_NONE) GL.glTextureStorage2DEXT(texture.name, target, levels, internalformat, width, height); @@ -5018,16 +5013,16 @@ bool WrappedOpenGL::Serialise_glTextureStorage3DEXT(SerialiserType &ser, GLuint GLenum dummy = eGL_NONE; bool emulated = EmulateLuminanceFormat(texture.name, target, internalformat, dummy); - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = depth; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = depth; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 3; - m_Textures[liveId].internalFormat = internalformat; - m_Textures[liveId].emulated = emulated; - m_Textures[liveId].mipsValid = (1 << levels) - 1; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 3; + m_Textures[id].internalFormat = internalformat; + m_Textures[id].emulated = emulated; + m_Textures[id].mipsValid = (1 << levels) - 1; if(target != eGL_NONE) GL.glTextureStorage3DEXT(texture.name, target, levels, internalformat, width, height, depth); @@ -5155,17 +5150,17 @@ bool WrappedOpenGL::Serialise_glTextureStorage2DMultisampleEXT(SerialiserType &s // if we promoted glTexImage2DMultisample to storage, we need a sized format internalformat = GetSizedFormat(internalformat); - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = 1; - m_Textures[liveId].samples = samples; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = 1; + m_Textures[id].samples = samples; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = internalformat; - m_Textures[liveId].emulated = emulated; - m_Textures[liveId].mipsValid = 1; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = internalformat; + m_Textures[id].emulated = emulated; + m_Textures[id].mipsValid = 1; // some applications may resize MSAA textures using old-style functions, so we can't promote to // storage DSA (and a non-storage DSA does not exist so can't be emulated)... @@ -5344,17 +5339,17 @@ bool WrappedOpenGL::Serialise_glTextureStorage3DMultisampleEXT(SerialiserType &s // if we promoted glTexImage3DMultisample to storage, we need a sized format internalformat = GetSizedFormat(internalformat); - ResourceId liveId = GetResourceManager()->GetResID(texture); - m_Textures[liveId].width = width; - m_Textures[liveId].height = height; - m_Textures[liveId].depth = depth; - m_Textures[liveId].samples = samples; + ResourceId id = GetResourceManager()->GetResID(texture); + m_Textures[id].width = width; + m_Textures[id].height = height; + m_Textures[id].depth = depth; + m_Textures[id].samples = samples; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].dimension = 2; - m_Textures[liveId].internalFormat = internalformat; - m_Textures[liveId].emulated = emulated; - m_Textures[liveId].mipsValid = 1; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].dimension = 2; + m_Textures[id].internalFormat = internalformat; + m_Textures[id].emulated = emulated; + m_Textures[id].mipsValid = 1; if(target != eGL_NONE) GL.glTextureStorage3DMultisampleEXT(texture.name, target, samples, internalformat, width, @@ -5584,8 +5579,8 @@ bool WrappedOpenGL::Serialise_glTextureSubImage1DEXT(SerialiserType &ser, GLuint else if(format == eGL_ALPHA) { // check if format was converted from alpha-only format to R8, and substitute - ResourceId liveId = GetResourceManager()->GetResID(texture); - if(m_Textures[liveId].internalFormat == eGL_R8) + ResourceId id = GetResourceManager()->GetResID(texture); + if(m_Textures[id].internalFormat == eGL_R8) format = eGL_RED; } @@ -5817,8 +5812,8 @@ bool WrappedOpenGL::Serialise_glTextureSubImage2DEXT(SerialiserType &ser, GLuint else if(format == eGL_ALPHA) { // check if format was converted from alpha-only format to R8, and substitute - ResourceId liveId = GetResourceManager()->GetResID(texture); - if(m_Textures[liveId].internalFormat == eGL_R8) + ResourceId id = GetResourceManager()->GetResID(texture); + if(m_Textures[id].internalFormat == eGL_R8) format = eGL_RED; } @@ -6058,8 +6053,8 @@ bool WrappedOpenGL::Serialise_glTextureSubImage3DEXT(SerialiserType &ser, GLuint else if(format == eGL_ALPHA) { // check if format was converted from alpha-only format to R8, and substitute - ResourceId liveId = GetResourceManager()->GetResID(texture); - if(m_Textures[liveId].internalFormat == eGL_R8) + ResourceId id = GetResourceManager()->GetResID(texture); + if(m_Textures[id].internalFormat == eGL_R8) format = eGL_RED; } @@ -6949,18 +6944,18 @@ bool WrappedOpenGL::Serialise_glTextureBufferRangeEXT(SerialiserType &ser, GLuin if(IsReplayingAndReading()) { - ResourceId liveId = GetResourceManager()->GetResID(texture); + ResourceId id = GetResourceManager()->GetResID(texture); if(IsLoading(m_State) && m_CurEventID == 0) { - m_Textures[liveId].width = + m_Textures[id].width = uint32_t(size) / uint32_t(GetByteSize(1, 1, 1, GetBaseFormat(internalformat), GetDataType(internalformat))); - m_Textures[liveId].height = 1; - m_Textures[liveId].depth = 1; + m_Textures[id].height = 1; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].internalFormat = internalformat; - m_Textures[liveId].mipsValid = 1; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].internalFormat = internalformat; + m_Textures[id].mipsValid = 1; } if(target != eGL_NONE) @@ -6971,7 +6966,7 @@ bool WrappedOpenGL::Serialise_glTextureBufferRangeEXT(SerialiserType &ser, GLuin (GLsizei)size); AddResourceInitChunk(texture); - DerivedResource(buffer, liveId); + DerivedResource(buffer, id); } return true; @@ -7126,19 +7121,19 @@ bool WrappedOpenGL::Serialise_glTextureBufferEXT(SerialiserType &ser, GLuint tex if(IsReplayingAndReading()) { - ResourceId liveId = GetResourceManager()->GetResID(texture); + ResourceId id = GetResourceManager()->GetResID(texture); if(IsLoading(m_State) && m_CurEventID == 0) { uint32_t Size = 1; GL.glGetNamedBufferParameterivEXT(buffer.name, eGL_BUFFER_SIZE, (GLint *)&Size); - m_Textures[liveId].width = Size / uint32_t(GetByteSize(1, 1, 1, GetBaseFormat(internalformat), - GetDataType(internalformat))); - m_Textures[liveId].height = 1; - m_Textures[liveId].depth = 1; + m_Textures[id].width = Size / uint32_t(GetByteSize(1, 1, 1, GetBaseFormat(internalformat), + GetDataType(internalformat))); + m_Textures[id].height = 1; + m_Textures[id].depth = 1; if(target != eGL_NONE) - m_Textures[liveId].curType = TextureTarget(target); - m_Textures[liveId].internalFormat = internalformat; - m_Textures[liveId].mipsValid = 1; + m_Textures[id].curType = TextureTarget(target); + m_Textures[id].internalFormat = internalformat; + m_Textures[id].mipsValid = 1; } if(target != eGL_NONE) @@ -7147,7 +7142,7 @@ bool WrappedOpenGL::Serialise_glTextureBufferEXT(SerialiserType &ser, GLuint tex GL.glTextureBuffer(texture.name, internalformat, buffer.name); AddResourceInitChunk(texture); - DerivedResource(buffer, liveId); + DerivedResource(buffer, id); } return true; diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index 9c5a8cb97..3f281a8cb 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -720,11 +720,7 @@ bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarrayHasLiveResource(resId)) - resId = rm->GetLiveID(resId); ResourceId sampId = slots[slot].sampler; - if(rm->HasLiveResource(sampId)) - sampId = rm->GetLiveID(sampId); switch(descType) { diff --git a/renderdoc/driver/vulkan/vk_initstate.cpp b/renderdoc/driver/vulkan/vk_initstate.cpp index fe98e6a18..b2e8c6167 100644 --- a/renderdoc/driver/vulkan/vk_initstate.cpp +++ b/renderdoc/driver/vulkan/vk_initstate.cpp @@ -1186,12 +1186,10 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V if(IsReplayingAndReading()) { WrappedVkRes *res = GetResourceManager()->GetLiveResource(id); - ResourceId liveid = GetResourceManager()->GetLiveID(id); VkDescriptorSet set = (VkDescriptorSet)(uint64_t)res; - const DescSetLayout &layout = - m_CreationInfo.m_DescSetLayout[m_DescriptorSetState[liveid].layout]; + const DescSetLayout &layout = m_CreationInfo.m_DescSetLayout[m_DescriptorSetState[id].layout]; if(layout.flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT) { @@ -1211,7 +1209,7 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V uint32_t descriptorCount = layoutBind.descriptorCount; if(layoutBind.variableSize) - descriptorCount = m_DescriptorSetState[liveid].data.variableDescriptorCount; + descriptorCount = m_DescriptorSetState[id].data.variableDescriptorCount; if(layoutBind.layoutDescType == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK) { @@ -1270,7 +1268,7 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V uint32_t descriptorCount = layoutBind.descriptorCount; if(layoutBind.variableSize) - descriptorCount = m_DescriptorSetState[liveid].data.variableDescriptorCount; + descriptorCount = m_DescriptorSetState[id].data.variableDescriptorCount; if(descriptorCount == 0) continue; @@ -1640,8 +1638,6 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V // the end of the program, and store the buffer to copy off in Apply if(IsReplayingAndReading() && ContentsSize > 0) { - ResourceId liveid = GetResourceManager()->GetLiveID(id); - if(type == eResDeviceMemory) { VkInitialContents initialContents(type, uploadMemory); @@ -1668,7 +1664,7 @@ bool WrappedVulkan::Serialise_InitialState(SerialiserType &ser, ResourceId id, V } } - VulkanCreationInfo::Image &c = m_CreationInfo.m_Image[liveid]; + VulkanCreationInfo::Image &c = m_CreationInfo.m_Image[id]; // for non-MSAA images, we're done - we'll do buffer-to-image copies with appropriate // offsets to copy out the subresources into the image itself. @@ -1792,10 +1788,8 @@ void WrappedVulkan::Create_InitialState(ResourceId id, WrappedVkRes *live, bool) } else if(type == eResImage) { - ResourceId liveid = GetResourceManager()->GetLiveID(id); - VkInitialContents::Tag tag = VkInitialContents::ClearColorImage; - LockedImageStateRef state = FindImageState(liveid); + LockedImageStateRef state = FindImageState(id); if(!state) { RDCERR("Couldn't find image info for %s", ToStr(id).c_str()); diff --git a/renderdoc/driver/vulkan/vk_manager.cpp b/renderdoc/driver/vulkan/vk_manager.cpp index df8f58b9f..27ac97174 100644 --- a/renderdoc/driver/vulkan/vk_manager.cpp +++ b/renderdoc/driver/vulkan/vk_manager.cpp @@ -379,15 +379,13 @@ void VulkanResourceManager::SerialiseImageStates(SerialiserType &ser, } if(hasLiveRes) { - ResourceId liveid = GetLiveID(Image); - if(IsLoading(m_State)) { - auto stit = states.find(liveid); + auto stit = states.find(Image); if(stit == states.end()) { imageState.subresourceStates.Unsplit(); - states.insert({liveid, LockingImageState(imageState)}); + states.insert({Image, LockingImageState(imageState)}); } else { @@ -398,8 +396,8 @@ void VulkanResourceManager::SerialiseImageStates(SerialiserType &ser, } else if(IsActiveReplaying(m_State)) { - auto current = states.find(liveid)->second.LockRead(); - auto stit = states.find(liveid); + auto current = states.find(Image)->second.LockRead(); + auto stit = states.find(Image); for(auto subit = imageState.subresourceStates.begin(); subit != imageState.subresourceStates.end(); ++subit) { @@ -542,9 +540,8 @@ bool VulkanResourceManager::Serialise_ImageRefs(ReadSerialiser &ser, { if(!HasLiveResource(it->image)) continue; - ResourceId liveid = GetLiveID(it->image); - auto stit = states.find(liveid); + auto stit = states.find(it->image); if(stit == states.end()) { RDCWARN("Found ImgRefs for unknown image"); diff --git a/renderdoc/driver/vulkan/vk_postvs.cpp b/renderdoc/driver/vulkan/vk_postvs.cpp index 987a8c550..19c47130a 100644 --- a/renderdoc/driver/vulkan/vk_postvs.cpp +++ b/renderdoc/driver/vulkan/vk_postvs.cpp @@ -2910,8 +2910,6 @@ void VulkanReplay::FetchMeshOut(uint32_t eventId, VulkanRenderState &state) ResourceId buf = chunk->FindChild("buffer")->AsResourceId(); uint64_t offs = chunk->FindChild("offset")->AsUInt64(); - buf = GetResourceManager()->GetLiveID(buf); - bytebuf dispatchArgs; GetBufferData(buf, offs, sizeof(VkDrawMeshTasksIndirectCommandEXT), dispatchArgs); diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index f5994b254..417d8b34f 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -273,15 +273,6 @@ rdcarray VulkanReplay::GetPassEvents(uint32_t eventId) return passEvents; } -ResourceId VulkanReplay::GetLiveID(ResourceId id) -{ - if(m_pDriver->m_InlineBuffers.find(id) != m_pDriver->m_InlineBuffers.end()) - return id; - if(!m_pDriver->GetResourceManager()->HasLiveResource(id)) - return ResourceId(); - return m_pDriver->GetResourceManager()->GetLiveID(id); -} - rdcarray VulkanReplay::GetDebugMessages() { return m_pDriver->GetDebugMessages(); @@ -562,8 +553,7 @@ void VulkanReplay::CachePipelineExecutables(ResourceId pipeline) rdcstr VulkanReplay::DisassembleShader(ResourceId pipeline, const ShaderReflection *refl, const rdcstr &target) { - auto it = m_pDriver->m_CreationInfo.m_ShaderModule.find( - GetResourceManager()->GetLiveID(refl->resourceId)); + auto it = m_pDriver->m_CreationInfo.m_ShaderModule.find(refl->resourceId); if(it == m_pDriver->m_CreationInfo.m_ShaderModule.end()) return "; Invalid Shader Specified"; @@ -5431,7 +5421,7 @@ void VulkanReplay::RefreshDerivedReplacements() void VulkanReplay::ModifyReplacementIfShaderEXT(ResourceId from, ResourceId &to) { // identify whether the original resource is a shader object - ResourceId shaderId = GetLiveID(from); + ResourceId shaderId = from; auto shadObj = m_pDriver->m_CreationInfo.m_ShaderObject.find(shaderId); if(shaderId != ResourceId() && shadObj != m_pDriver->m_CreationInfo.m_ShaderObject.end()) diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 7b2f8686f..4841f7b21 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -389,8 +389,6 @@ public: bool IsOutputWindowVisible(uint64_t id); void FlipOutputWindow(uint64_t id); - ResourceId GetLiveID(ResourceId id); - rdcarray EnumerateCounters(); CounterDescription DescribeCounter(GPUCounter counterID); rdcarray FetchCounters(const rdcarray &counters); diff --git a/renderdoc/driver/vulkan/vk_shaderdebug.cpp b/renderdoc/driver/vulkan/vk_shaderdebug.cpp index 2e6c052d3..6bc914805 100644 --- a/renderdoc/driver/vulkan/vk_shaderdebug.cpp +++ b/renderdoc/driver/vulkan/vk_shaderdebug.cpp @@ -170,7 +170,7 @@ public: m_SamplerDescriptors.append(replay->GetSamplerDescriptors(store, ranges)); } - store = replay->GetLiveID(acc.descriptorStore); + store = acc.descriptorStore; ranges.clear(); } @@ -2116,9 +2116,8 @@ private: if(bufData.resource != ResourceId()) { - m_pDriver->GetReplay()->GetBufferData( - m_pDriver->GetResourceManager()->GetLiveID(bufData.resource), bufData.byteOffset, - bufData.byteSize, data); + m_pDriver->GetReplay()->GetBufferData(bufData.resource, bufData.byteOffset, + bufData.byteSize, data); } } @@ -2160,7 +2159,7 @@ private: if(imgData.view == ResourceId()) { // descriptor buffer, no buffer view - buffer = m_pDriver->GetResourceManager()->GetLiveID(imgData.resource); + buffer = imgData.resource; offset = imgData.byteOffset; format = MakeVkFormat(imgData.format); byteWidth = imgData.byteSize; @@ -2168,7 +2167,7 @@ private: else { const VulkanCreationInfo::BufferView &viewProps = - m_Creation.GetBufferViewInfo(m_pDriver->GetResourceManager()->GetLiveID(imgData.view)); + m_Creation.GetBufferViewInfo(imgData.view); buffer = viewProps.buffer; offset = viewProps.offset; format = viewProps.format; @@ -2193,14 +2192,11 @@ private: data.samplePitch = data.slicePitch = data.rowPitch = data.width * data.texelSize; - m_pDriver->GetReplay()->GetBufferData( - m_pDriver->GetResourceManager()->GetLiveID(imgData.resource), offset, data.rowPitch, - data.bytes); + m_pDriver->GetReplay()->GetBufferData(imgData.resource, offset, data.rowPitch, data.bytes); } else if(imgData.view != ResourceId()) { - const VulkanCreationInfo::ImageView &viewProps = - m_Creation.GetImageViewInfo(m_pDriver->GetResourceManager()->GetLiveID(imgData.view)); + const VulkanCreationInfo::ImageView &viewProps = m_Creation.GetImageViewInfo(imgData.view); if(viewProps.image != ResourceId()) { const VulkanCreationInfo::Image &imageProps = m_Creation.GetImageInfo(viewProps.image); diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index b9c5ca990..b9461e8c8 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -1775,8 +1775,7 @@ bool WrappedVulkan::Serialise_vkBeginCommandBuffer(SerialiserType &ser, VkComman // propagate any name there might be if(m_CreationInfo.m_Names.find(CommandBuffer) != m_CreationInfo.m_Names.end()) - m_CreationInfo.m_Names[GetResourceManager()->GetLiveID(BakedCommandBuffer)] = - m_CreationInfo.m_Names[CommandBuffer]; + m_CreationInfo.m_Names[BakedCommandBuffer] = m_CreationInfo.m_Names[CommandBuffer]; { VulkanActionTreeNode *action = new VulkanActionTreeNode; @@ -3416,13 +3415,13 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(SerialiserType &ser, VkCommandBu { commandBuffer = RerecordCmdBuf(m_LastCmdBufferID); - ResourceId liveid = GetResID(pipeline); + ResourceId id = GetResID(pipeline); { VulkanRenderState &renderstate = GetCmdRenderState(); if(pipelineBindPoint == VK_PIPELINE_BIND_POINT_COMPUTE) { - renderstate.compute.pipeline = liveid; + renderstate.compute.pipeline = id; renderstate.compute.shaderObject = false; // disturb compute shader bound via vkCmdBindShadersEXT, if any @@ -3430,11 +3429,11 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(SerialiserType &ser, VkCommandBu } else if(pipelineBindPoint == VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) { - renderstate.rt.pipeline = liveid; + renderstate.rt.pipeline = id; } else { - renderstate.graphics.pipeline = liveid; + renderstate.graphics.pipeline = id; renderstate.graphics.shaderObject = false; // disturb graphics shaders bound via vkCmdBindShadersEXT, if any @@ -3445,7 +3444,7 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(SerialiserType &ser, VkCommandBu renderstate.shaderObjects[i] = ResourceId(); } - const VulkanCreationInfo::Pipeline &pipeInfo = m_CreationInfo.m_Pipeline[liveid]; + const VulkanCreationInfo::Pipeline &pipeInfo = m_CreationInfo.m_Pipeline[id]; // any static state from the pipeline invalidates any dynamic state previously bound for(uint32_t i = 0; i < VkDynamicCount; i++) @@ -3754,25 +3753,25 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(SerialiserType &ser, VkCommandBu } else { - ResourceId liveid = GetResID(pipeline); + ResourceId id = GetResID(pipeline); // track while reading, as we need to bind current topology & index byte width in AddAction if(pipelineBindPoint == VK_PIPELINE_BIND_POINT_COMPUTE) { - m_BakedCmdBufferInfo[m_LastCmdBufferID].state.compute.pipeline = liveid; + m_BakedCmdBufferInfo[m_LastCmdBufferID].state.compute.pipeline = id; m_BakedCmdBufferInfo[m_LastCmdBufferID].state.compute.shaderObject = false; } else if(pipelineBindPoint == VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) { - m_BakedCmdBufferInfo[m_LastCmdBufferID].state.rt.pipeline = liveid; + m_BakedCmdBufferInfo[m_LastCmdBufferID].state.rt.pipeline = id; m_BakedCmdBufferInfo[m_LastCmdBufferID].state.rt.shaderObject = false; } else { - m_BakedCmdBufferInfo[m_LastCmdBufferID].state.graphics.pipeline = liveid; + m_BakedCmdBufferInfo[m_LastCmdBufferID].state.graphics.pipeline = id; m_BakedCmdBufferInfo[m_LastCmdBufferID].state.graphics.shaderObject = false; - const VulkanCreationInfo::Pipeline &pipeInfo = m_CreationInfo.m_Pipeline[liveid]; + const VulkanCreationInfo::Pipeline &pipeInfo = m_CreationInfo.m_Pipeline[id]; if(!pipeInfo.dynamicStates[VkDynamicPrimitiveTopology]) { diff --git a/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp index 20c39d014..2a51c7c83 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_misc_funcs.cpp @@ -2776,13 +2776,7 @@ bool WrappedVulkan::Serialise_vkDebugMarkerSetObjectNameEXT( if(ObjectName == NULL) ObjectName = ""; - // if we don't have a live resource, this is probably a command buffer being named on the - // virtual non-existant parent, not any of the baked IDs. Just save the name on the base ID - // and we'll propagate it in Serialise_vkBeginCommandBuffer - if(!GetResourceManager()->HasLiveResource(Object) || GetResourceManager()->HasReplacement(Object)) - m_CreationInfo.m_Names[Object] = ObjectName; - else - m_CreationInfo.m_Names[GetResourceManager()->GetLiveID(Object)] = ObjectName; + m_CreationInfo.m_Names[Object] = ObjectName; ResourceDescription &descr = GetResourceDesc(Object); @@ -2920,13 +2914,7 @@ bool WrappedVulkan::Serialise_vkSetDebugUtilsObjectNameEXT( if(ObjectName == NULL) ObjectName = ""; - // if we don't have a live resource, this is probably a command buffer being named on the - // virtual non-existant parent, not any of the baked IDs. Just save the name on the base ID - // and we'll propagate it in Serialise_vkBeginCommandBuffer - if(!GetResourceManager()->HasLiveResource(Object) || GetResourceManager()->HasReplacement(Object)) - m_CreationInfo.m_Names[Object] = ObjectName; - else - m_CreationInfo.m_Names[GetResourceManager()->GetLiveID(Object)] = ObjectName; + m_CreationInfo.m_Names[Object] = ObjectName; ResourceDescription &descr = GetResourceDesc(Object); diff --git a/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp index f7ac5f105..0ec863f1c 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_wsi_funcs.cpp @@ -235,8 +235,8 @@ bool WrappedVulkan::Serialise_vkGetSwapchainImagesKHR(SerialiserType &ser, VkDev { SwapchainInfo &swapInfo = m_CreationInfo.m_SwapChain[Swapchain]; - ResourceId liveId = GetResourceManager()->WrapResource( - SwapchainImage, Unwrap(device), swapInfo.images[SwapchainImageIndex].userSwapImage); + GetResourceManager()->WrapResource(SwapchainImage, Unwrap(device), + swapInfo.images[SwapchainImageIndex].userSwapImage); m_CreationInfo.m_Names[GetResID(swapInfo.images[SwapchainImageIndex].userSwapImage)] = StringFormat::Fmt("Presentable Image %u", SwapchainImageIndex); diff --git a/renderdoc/replay/dummy_driver.cpp b/renderdoc/replay/dummy_driver.cpp index a49298b5b..8416c8c2b 100644 --- a/renderdoc/replay/dummy_driver.cpp +++ b/renderdoc/replay/dummy_driver.cpp @@ -216,11 +216,6 @@ void DummyDriver::InitPostVSBuffers(const rdcarray &passEvents) { } -ResourceId DummyDriver::GetLiveID(ResourceId id) -{ - return id; -} - MeshFormat DummyDriver::GetPostVSBuffers(uint32_t eventId, uint32_t instID, uint32_t viewID, MeshDataStage stage) { diff --git a/renderdoc/replay/dummy_driver.h b/renderdoc/replay/dummy_driver.h index ce657d592..6704911bf 100644 --- a/renderdoc/replay/dummy_driver.h +++ b/renderdoc/replay/dummy_driver.h @@ -82,8 +82,6 @@ public: void InitPostVSBuffers(uint32_t eventId); void InitPostVSBuffers(const rdcarray &passEvents); - ResourceId GetLiveID(ResourceId id); - MeshFormat GetPostVSBuffers(uint32_t eventId, uint32_t instID, uint32_t viewID, MeshDataStage stage); diff --git a/renderdoc/replay/replay_controller.cpp b/renderdoc/replay/replay_controller.cpp index 4a29c23f2..609aff9c6 100644 --- a/renderdoc/replay/replay_controller.cpp +++ b/renderdoc/replay/replay_controller.cpp @@ -129,7 +129,7 @@ rdcarray ReplayController::GetDescriptors(ResourceId descriptorStore { CHECK_REPLAY_THREAD(); - return m_pDevice->GetDescriptors(m_pDevice->GetLiveID(descriptorStore), ranges); + return m_pDevice->GetDescriptors(descriptorStore, ranges); } const rdcarray &ReplayController::GetDescriptorAccess() @@ -144,7 +144,7 @@ rdcarray ReplayController::GetDescriptorLocations( { CHECK_REPLAY_THREAD(); - return m_pDevice->GetDescriptorLocations(m_pDevice->GetLiveID(descriptorStore), ranges); + return m_pDevice->GetDescriptorLocations(descriptorStore, ranges); } rdcarray ReplayController::GetSamplerDescriptors( @@ -152,7 +152,7 @@ rdcarray ReplayController::GetSamplerDescriptors( { CHECK_REPLAY_THREAD(); - return m_pDevice->GetSamplerDescriptors(m_pDevice->GetLiveID(descriptorStore), ranges); + return m_pDevice->GetSamplerDescriptors(descriptorStore, ranges); } rdcarray ReplayController::GetDisassemblyTargets(bool withPipeline) @@ -187,7 +187,7 @@ rdcstr ReplayController::DisassembleShader(ResourceId pipeline, const ShaderRefl if(t == target) return GCNISA::Disassemble(refl->encoding, refl->stage, refl->rawBytes, target); - rdcstr ret = m_pDevice->DisassembleShader(m_pDevice->GetLiveID(pipeline), refl, target); + rdcstr ret = m_pDevice->DisassembleShader(pipeline, refl, target); FatalErrorCheck(); return ret; } @@ -513,7 +513,7 @@ rdcarray ReplayController::GetShaderEntryPoints(ResourceId sha { CHECK_REPLAY_THREAD(); - return m_pDevice->GetShaderEntryPoints(m_pDevice->GetLiveID(shader)); + return m_pDevice->GetShaderEntryPoints(shader); } const ShaderReflection *ReplayController::GetShader(ResourceId pipeline, ResourceId shader, @@ -521,14 +521,13 @@ const ShaderReflection *ReplayController::GetShader(ResourceId pipeline, Resourc { CHECK_REPLAY_THREAD(); - return m_pDevice->GetShader(m_pDevice->GetLiveID(pipeline), m_pDevice->GetLiveID(shader), entry); + return m_pDevice->GetShader(pipeline, shader, entry); } rdcarray ReplayController::GetUsage(ResourceId id) { CHECK_REPLAY_THREAD(); - id = m_pDevice->GetLiveID(id); if(id == ResourceId()) return {EventUsage(0, ResourceUsage::Unused)}; return m_pDevice->GetUsage(id); @@ -563,15 +562,7 @@ bytebuf ReplayController::GetBufferData(ResourceId buff, uint64_t offset, uint64 if(buff == ResourceId()) return retData; - ResourceId liveId = m_pDevice->GetLiveID(buff); - - if(liveId == ResourceId()) - { - RDCERR("Couldn't get Live ID for %s getting buffer data", ToStr(buff).c_str()); - return retData; - } - - m_pDevice->GetBufferData(liveId, offset, len, retData); + m_pDevice->GetBufferData(buff, offset, len, retData); FatalErrorCheck(); return retData; @@ -584,15 +575,10 @@ bytebuf ReplayController::GetTextureData(ResourceId tex, const Subresource &sub) bytebuf ret; - ResourceId liveId = m_pDevice->GetLiveID(tex); - - if(liveId == ResourceId()) - { - RDCERR("Couldn't get Live ID for %s getting texture data", ToStr(tex).c_str()); + if(tex == ResourceId()) return ret; - } - m_pDevice->GetTextureData(liveId, sub, GetTextureDataParams(), ret); + m_pDevice->GetTextureData(tex, sub, GetTextureDataParams(), ret); FatalErrorCheck(); return ret; @@ -604,16 +590,14 @@ ResultDetails ReplayController::SaveTexture(const TextureSave &saveData, const r RENDERDOC_PROFILEFUNCTION(); TextureSave sd = saveData; // mutable copy - ResourceId liveid = m_pDevice->GetLiveID(sd.resourceId); - if(liveid == ResourceId()) + if(sd.resourceId == ResourceId()) { - RETURN_ERROR_RESULT(ResultCode::InvalidParameter, - "Couldn't get Live ID for %s getting texture data", + RETURN_ERROR_RESULT(ResultCode::InvalidParameter, "Invalid ID for %s getting texture data", ToStr(sd.resourceId).c_str()); } - TextureDescription td = m_pDevice->GetTexture(liveid); + TextureDescription td = m_pDevice->GetTexture(sd.resourceId); // clamp sample/mip/slice indices if(td.msSamp == 1) @@ -909,7 +893,7 @@ ResultDetails ReplayController::SaveTexture(const TextureSave &saveData, const r Subresource sub = {mip, slice / sampleCount, slice % sampleCount}; bytebuf data; - m_pDevice->GetTextureData(liveid, sub, params, data); + m_pDevice->GetTextureData(sd.resourceId, sub, params, data); FatalErrorCheck(); if(data.empty()) @@ -1500,7 +1484,7 @@ rdcarray ReplayController::PixelHistory(ResourceId target, ui } } - ResourceId id = m_pDevice->GetLiveID(target); + ResourceId id = target; if(id == ResourceId()) return ret; @@ -1584,7 +1568,7 @@ rdcarray ReplayController::PixelHistory(ResourceId target, ui return ret; } - id = m_pDevice->GetLiveID(target); + id = target; if(id == ResourceId()) return ret; @@ -1610,7 +1594,7 @@ PixelValue ReplayController::PickPixel(ResourceId tex, uint32_t x, uint32_t y, if(tex == ResourceId()) return ret; - m_pDevice->PickPixel(m_pDevice->GetLiveID(tex), x, y, sub, typeCast, ret.floatValue.data()); + m_pDevice->PickPixel(tex, x, y, sub, typeCast, ret.floatValue.data()); FatalErrorCheck(); return ret; @@ -1624,8 +1608,7 @@ rdcpair ReplayController::GetMinMax(ResourceId textureId PixelValue minval = {{0.0f, 0.0f, 0.0f, 0.0f}}; PixelValue maxval = {{1.0f, 1.0f, 1.0f, 1.0f}}; - m_pDevice->GetMinMax(m_pDevice->GetLiveID(textureId), sub, typeCast, &minval.floatValue[0], - &maxval.floatValue[0]); + m_pDevice->GetMinMax(textureId, sub, typeCast, &minval.floatValue[0], &maxval.floatValue[0]); FatalErrorCheck(); return make_rdcpair(minval, maxval); @@ -1639,8 +1622,7 @@ rdcarray ReplayController::GetHistogram(ResourceId textureId, const Su rdcarray hist; - m_pDevice->GetHistogram(m_pDevice->GetLiveID(textureId), sub, typeCast, minval, maxval, channels, - hist); + m_pDevice->GetHistogram(textureId, sub, typeCast, minval, maxval, channels, hist); FatalErrorCheck(); return hist; @@ -1752,7 +1734,6 @@ rdcarray ReplayController::GetCBufferVariableContents( bytebuf data; if(buffer != ResourceId()) { - buffer = m_pDevice->GetLiveID(buffer); if(buffer != ResourceId()) { if(length > 0) @@ -1763,9 +1744,6 @@ rdcarray ReplayController::GetCBufferVariableContents( rdcarray v; - pipeline = m_pDevice->GetLiveID(pipeline); - shader = m_pDevice->GetLiveID(shader); - if(shader != ResourceId()) { m_pDevice->FillCBufferVariables(pipeline, shader, stage, entryPoint, cbufslot, v, data); @@ -2320,7 +2298,6 @@ void ReplayController::FetchPipelineState(uint32_t eventId) { if(store != ResourceId()) { - store = m_pDevice->GetLiveID(store); descs.append(m_pDevice->GetDescriptors(store, ranges)); samps.append(m_pDevice->GetSamplerDescriptors(store, ranges)); } @@ -2344,7 +2321,6 @@ void ReplayController::FetchPipelineState(uint32_t eventId) if(store != ResourceId()) { - store = m_pDevice->GetLiveID(store); descs.append(m_pDevice->GetDescriptors(store, ranges)); samps.append(m_pDevice->GetSamplerDescriptors(store, ranges)); } diff --git a/renderdoc/replay/replay_driver.h b/renderdoc/replay/replay_driver.h index 583a285ae..138a4146f 100644 --- a/renderdoc/replay/replay_driver.h +++ b/renderdoc/replay/replay_driver.h @@ -183,8 +183,6 @@ public: virtual void InitPostVSBuffers(uint32_t eventId) = 0; virtual void InitPostVSBuffers(const rdcarray &passEvents) = 0; - virtual ResourceId GetLiveID(ResourceId id) = 0; - virtual MeshFormat GetPostVSBuffers(uint32_t eventId, uint32_t instID, uint32_t viewID, MeshDataStage stage) = 0; diff --git a/renderdoc/replay/replay_output.cpp b/renderdoc/replay/replay_output.cpp index 78470dda4..b794cf03e 100644 --- a/renderdoc/replay/replay_output.cpp +++ b/renderdoc/replay/replay_output.cpp @@ -276,7 +276,7 @@ void ReplayOutput::RefreshOverlay() if(m_Type == ReplayOutputType::Texture && m_RenderData.texDisplay.overlay != DebugOverlay::NoOverlay) { - ResourceId id = m_pDevice->GetLiveID(m_RenderData.texDisplay.resourceId); + ResourceId id = m_RenderData.texDisplay.resourceId; if(id != ResourceId() && action && m_pDevice->IsRenderOutput(id)) { @@ -306,7 +306,6 @@ ResourceId ReplayOutput::GetCustomShaderTexID() { TextureDisplay texDisplay = m_RenderData.texDisplay; texDisplay.rawOutput = false; - texDisplay.resourceId = m_pDevice->GetLiveID(texDisplay.resourceId); m_CustomShaderResourceId = m_pDevice->ApplyCustomShader(texDisplay); m_pController->FatalErrorCheck(); @@ -454,7 +453,7 @@ bytebuf ReplayOutput::DrawThumbnail(int32_t width, int32_t height, ResourceId te disp.subresource = sub; disp.subresource.sample = 0; disp.customShaderId = ResourceId(); - disp.resourceId = m_pDevice->GetLiveID(textureId); + disp.resourceId = textureId; disp.typeCast = typeCast; disp.scale = -1.0f; disp.rangeMin = 0.0f; @@ -558,10 +557,10 @@ rdcpair ReplayOutput::PickVertex(uint32_t x, uint32_t y) if(cfg.position.vertexResourceId == ResourceId() || cfg.position.numIndices == 0) return errorReturn; - cfg.position.vertexResourceId = m_pDevice->GetLiveID(cfg.position.vertexResourceId); - cfg.position.indexResourceId = m_pDevice->GetLiveID(cfg.position.indexResourceId); - cfg.second.vertexResourceId = m_pDevice->GetLiveID(cfg.second.vertexResourceId); - cfg.second.indexResourceId = m_pDevice->GetLiveID(cfg.second.indexResourceId); + cfg.position.vertexResourceId = cfg.position.vertexResourceId; + cfg.position.indexResourceId = cfg.position.indexResourceId; + cfg.second.vertexResourceId = cfg.second.vertexResourceId; + cfg.second.indexResourceId = cfg.second.indexResourceId; // input data either doesn't vary with instance, or is trivial (all verts the same for that // element), so only care about fetching the right instance for post-VS stages @@ -760,8 +759,6 @@ void ReplayOutput::DisplayContext() disp.xOffset += w / 2.0f; disp.yOffset += h / 2.0f; - disp.resourceId = m_pDevice->GetLiveID(disp.resourceId); - m_pDevice->RenderTexture(disp); m_pController->FatalErrorCheck(); @@ -871,7 +868,7 @@ void ReplayOutput::Display() disp.subresource = m_Thumbnails[i].sub; disp.subresource.sample = 0; disp.customShaderId = ResourceId(); - disp.resourceId = m_pDevice->GetLiveID(m_Thumbnails[i].texture); + disp.resourceId = m_Thumbnails[i].texture; disp.typeCast = m_Thumbnails[i].typeCast; disp.scale = -1.0f; disp.rangeMin = 0.0f; @@ -917,7 +914,6 @@ void ReplayOutput::DisplayTex() TextureDisplay texDisplay = m_RenderData.texDisplay; texDisplay.rawOutput = false; - texDisplay.resourceId = m_pDevice->GetLiveID(texDisplay.resourceId); if(m_RenderData.texDisplay.overlay != DebugOverlay::NoOverlay && action) { @@ -942,7 +938,7 @@ void ReplayOutput::DisplayTex() m_CustomShaderResourceId = m_pDevice->ApplyCustomShader(texDisplay); m_pController->FatalErrorCheck(); - texDisplay.resourceId = m_pDevice->GetLiveID(m_CustomShaderResourceId); + texDisplay.resourceId = m_CustomShaderResourceId; texDisplay.typeCast = CompType::Typeless; texDisplay.customShaderId = ResourceId(); texDisplay.subresource.slice = 0; @@ -968,13 +964,13 @@ void ReplayOutput::DisplayTex() m_pDevice->RenderTexture(texDisplay); m_pController->FatalErrorCheck(); - ResourceId id = m_pDevice->GetLiveID(m_RenderData.texDisplay.resourceId); + ResourceId id = m_RenderData.texDisplay.resourceId; if(m_RenderData.texDisplay.overlay != DebugOverlay::NoOverlay && action && m_pDevice->IsRenderOutput(id) && m_RenderData.texDisplay.overlay != DebugOverlay::NaN && m_RenderData.texDisplay.overlay != DebugOverlay::Clipping && m_OverlayResourceId != ResourceId()) { - texDisplay.resourceId = m_pDevice->GetLiveID(m_OverlayResourceId); + texDisplay.resourceId = m_OverlayResourceId; texDisplay.red = texDisplay.green = texDisplay.blue = texDisplay.alpha = true; texDisplay.rawOutput = false; texDisplay.overlay = m_RenderData.texDisplay.overlay; @@ -1035,10 +1031,10 @@ void ReplayOutput::DisplayMesh() m_pController->FatalErrorCheck(); MeshDisplay mesh = m_RenderData.meshDisplay; - mesh.position.vertexResourceId = m_pDevice->GetLiveID(mesh.position.vertexResourceId); - mesh.position.indexResourceId = m_pDevice->GetLiveID(mesh.position.indexResourceId); - mesh.second.vertexResourceId = m_pDevice->GetLiveID(mesh.second.vertexResourceId); - mesh.second.indexResourceId = m_pDevice->GetLiveID(mesh.second.indexResourceId); + mesh.position.vertexResourceId = mesh.position.vertexResourceId; + mesh.position.indexResourceId = mesh.position.indexResourceId; + mesh.second.vertexResourceId = mesh.second.vertexResourceId; + mesh.second.indexResourceId = mesh.second.indexResourceId; rdcarray secondaryDraws;