mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 01:16:31 +00:00
Batch up calls to GetBuffers/Textures to be more replay proxy friendly
This commit is contained in:
@@ -169,8 +169,8 @@ public:
|
||||
m_CustomTexID = m_Proxy->ApplyCustomShader(shader, m_TextureID, sub, typeCast);
|
||||
return m_CustomTexID;
|
||||
}
|
||||
const rdcarray<ResourceDescription> &GetResources() { return m_Resources; }
|
||||
rdcarray<ResourceId> GetTextures() { return {m_TextureID}; }
|
||||
rdcarray<ResourceDescription> GetResources() { return m_Resources; }
|
||||
rdcarray<TextureDescription> GetTextures() { return {m_TexDetails}; }
|
||||
TextureDescription GetTexture(ResourceId id) { return m_TexDetails; }
|
||||
void GetTextureData(ResourceId tex, const Subresource &sub, const GetTextureDataParams ¶ms,
|
||||
bytebuf &data)
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
void RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secondaryDraws, const MeshDisplay &cfg)
|
||||
{
|
||||
}
|
||||
rdcarray<ResourceId> GetBuffers() { return rdcarray<ResourceId>(); }
|
||||
rdcarray<BufferDescription> GetBuffers() { return {}; }
|
||||
rdcarray<DebugMessage> GetDebugMessages() { return rdcarray<DebugMessage>(); }
|
||||
BufferDescription GetBuffer(ResourceId id)
|
||||
{
|
||||
|
||||
@@ -386,12 +386,12 @@ rdcarray<DebugMessage> ReplayProxy::GetDebugMessages()
|
||||
}
|
||||
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
rdcarray<ResourceId> ReplayProxy::Proxied_GetTextures(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser)
|
||||
rdcarray<TextureDescription> ReplayProxy::Proxied_GetTextures(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser)
|
||||
{
|
||||
const ReplayProxyPacket expectedPacket = eReplayProxy_GetTextures;
|
||||
ReplayProxyPacket packet = eReplayProxy_GetTextures;
|
||||
rdcarray<ResourceId> ret;
|
||||
rdcarray<TextureDescription> ret;
|
||||
|
||||
{
|
||||
BEGIN_PARAMS();
|
||||
@@ -406,10 +406,16 @@ rdcarray<ResourceId> ReplayProxy::Proxied_GetTextures(ParamSerialiser ¶mser,
|
||||
|
||||
SERIALISE_RETURN(ret);
|
||||
|
||||
if(retser.IsReading())
|
||||
{
|
||||
for(const TextureDescription &tex : ret)
|
||||
m_TextureInfo[tex.resourceId] = tex;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> ReplayProxy::GetTextures()
|
||||
rdcarray<TextureDescription> ReplayProxy::GetTextures()
|
||||
{
|
||||
PROXY_FUNCTION(GetTextures);
|
||||
}
|
||||
@@ -448,12 +454,12 @@ TextureDescription ReplayProxy::GetTexture(ResourceId id)
|
||||
}
|
||||
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
rdcarray<ResourceId> ReplayProxy::Proxied_GetBuffers(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser)
|
||||
rdcarray<BufferDescription> ReplayProxy::Proxied_GetBuffers(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser)
|
||||
{
|
||||
const ReplayProxyPacket expectedPacket = eReplayProxy_GetBuffers;
|
||||
ReplayProxyPacket packet = eReplayProxy_GetBuffers;
|
||||
rdcarray<ResourceId> ret;
|
||||
rdcarray<BufferDescription> ret;
|
||||
|
||||
{
|
||||
BEGIN_PARAMS();
|
||||
@@ -471,17 +477,18 @@ rdcarray<ResourceId> ReplayProxy::Proxied_GetBuffers(ParamSerialiser ¶mser,
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> ReplayProxy::GetBuffers()
|
||||
rdcarray<BufferDescription> ReplayProxy::GetBuffers()
|
||||
{
|
||||
PROXY_FUNCTION(GetBuffers);
|
||||
}
|
||||
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
const rdcarray<ResourceDescription> &ReplayProxy::Proxied_GetResources(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser)
|
||||
rdcarray<ResourceDescription> ReplayProxy::Proxied_GetResources(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser)
|
||||
{
|
||||
const ReplayProxyPacket expectedPacket = eReplayProxy_GetResources;
|
||||
ReplayProxyPacket packet = eReplayProxy_GetResources;
|
||||
rdcarray<ResourceDescription> ret;
|
||||
|
||||
{
|
||||
BEGIN_PARAMS();
|
||||
@@ -491,15 +498,15 @@ const rdcarray<ResourceDescription> &ReplayProxy::Proxied_GetResources(ParamSeri
|
||||
{
|
||||
REMOTE_EXECUTION();
|
||||
if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored)
|
||||
m_Resources = m_Remote->GetResources();
|
||||
ret = m_Remote->GetResources();
|
||||
}
|
||||
|
||||
SERIALISE_RETURN(m_Resources);
|
||||
SERIALISE_RETURN(ret);
|
||||
|
||||
return m_Resources;
|
||||
return ret;
|
||||
}
|
||||
|
||||
const rdcarray<ResourceDescription> &ReplayProxy::GetResources()
|
||||
rdcarray<ResourceDescription> ReplayProxy::GetResources()
|
||||
{
|
||||
PROXY_FUNCTION(GetResources);
|
||||
}
|
||||
@@ -2798,7 +2805,8 @@ bool ReplayProxy::Tick(int type)
|
||||
|
||||
PROXY_DEBUG("Processed %s", ToStr(packet).c_str());
|
||||
|
||||
RefreshPreviewWindow();
|
||||
if(packet == eReplayProxy_ReplayLog)
|
||||
RefreshPreviewWindow();
|
||||
|
||||
if(CheckError(packet, packet))
|
||||
return false;
|
||||
|
||||
@@ -460,12 +460,12 @@ public:
|
||||
const SDFile &GetStructuredFile() { return m_StructuredFile; }
|
||||
IMPLEMENT_FUNCTION_PROXIED(void, FetchStructuredFile);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(const rdcarray<ResourceDescription> &, GetResources);
|
||||
IMPLEMENT_FUNCTION_PROXIED(rdcarray<ResourceDescription>, GetResources);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(rdcarray<ResourceId>, GetBuffers);
|
||||
IMPLEMENT_FUNCTION_PROXIED(rdcarray<BufferDescription>, GetBuffers);
|
||||
IMPLEMENT_FUNCTION_PROXIED(BufferDescription, GetBuffer, ResourceId id);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(rdcarray<ResourceId>, GetTextures);
|
||||
IMPLEMENT_FUNCTION_PROXIED(rdcarray<TextureDescription>, GetTextures);
|
||||
IMPLEMENT_FUNCTION_PROXIED(TextureDescription, GetTexture, ResourceId id);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(APIProperties, GetAPIProperties);
|
||||
@@ -715,8 +715,6 @@ private:
|
||||
|
||||
SDFile m_StructuredFile;
|
||||
|
||||
rdcarray<ResourceDescription> m_Resources;
|
||||
|
||||
D3D11Pipe::State m_D3D11PipelineState;
|
||||
D3D12Pipe::State m_D3D12PipelineState;
|
||||
GLPipe::State m_GLPipelineState;
|
||||
|
||||
@@ -111,10 +111,20 @@ public:
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
void GetCounterBuffers(rdcarray<ResourceId> &ret)
|
||||
void GetCounterBuffers(rdcarray<BufferDescription> &ret)
|
||||
{
|
||||
for(auto pair : m_CounterBufferToUAV)
|
||||
ret.push_back(pair.first);
|
||||
{
|
||||
BufferDescription buf;
|
||||
|
||||
// no original ID for this one
|
||||
buf.resourceId = pair.first;
|
||||
buf.length = 4;
|
||||
buf.gpuAddress = 0;
|
||||
buf.creationFlags = BufferCategory::ReadWrite;
|
||||
|
||||
ret.push_back(buf);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t GetStructCount(ID3D11UnorderedAccessView *uav);
|
||||
|
||||
@@ -1338,16 +1338,16 @@ ReplayStatus WrappedID3D11Device::ReadLogInitialisation(RDCFile *rdc, bool store
|
||||
SetupDrawcallPointers(m_Drawcalls, GetReplay()->WriteFrameRecord().drawcallList);
|
||||
|
||||
// propagate any UAV names onto counter buffers
|
||||
rdcarray<ResourceId> counterBuffers;
|
||||
rdcarray<BufferDescription> counterBuffers;
|
||||
GetDebugManager()->GetCounterBuffers(counterBuffers);
|
||||
|
||||
for(ResourceId buffId : counterBuffers)
|
||||
for(const BufferDescription &b : counterBuffers)
|
||||
{
|
||||
ID3D11UnorderedAccessView *uav = GetDebugManager()->GetCounterBufferUAV(buffId);
|
||||
ID3D11UnorderedAccessView *uav = GetDebugManager()->GetCounterBufferUAV(b.resourceId);
|
||||
ResourceId uavId = GetResourceManager()->GetOriginalID(GetIDForResource(uav));
|
||||
|
||||
ResourceDescription &uavDesc = GetReplay()->GetResourceDesc(uavId);
|
||||
ResourceDescription &bufDesc = GetReplay()->GetResourceDesc(buffId);
|
||||
ResourceDescription &bufDesc = GetReplay()->GetResourceDesc(b.resourceId);
|
||||
|
||||
if(uavDesc.autogeneratedName)
|
||||
{
|
||||
|
||||
@@ -255,6 +255,195 @@ void D3D11Replay::DestroyResources()
|
||||
SAFE_RELEASE(m_pFactory);
|
||||
}
|
||||
|
||||
rdcarray<ShaderEntryPoint> D3D11Replay::GetShaderEntryPoints(ResourceId shader)
|
||||
{
|
||||
auto it = WrappedShader::m_ShaderList.find(shader);
|
||||
|
||||
if(it == WrappedShader::m_ShaderList.end())
|
||||
return {};
|
||||
|
||||
ShaderReflection &ret = it->second->GetDetails();
|
||||
|
||||
return {{"main", ret.stage}};
|
||||
}
|
||||
|
||||
ShaderReflection *D3D11Replay::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
{
|
||||
auto it = WrappedShader::m_ShaderList.find(shader);
|
||||
|
||||
if(it == WrappedShader::m_ShaderList.end())
|
||||
return NULL;
|
||||
|
||||
ShaderReflection &ret = it->second->GetDetails();
|
||||
|
||||
return &ret;
|
||||
}
|
||||
|
||||
rdcarray<rdcstr> D3D11Replay::GetDisassemblyTargets()
|
||||
{
|
||||
return {DXBCDisassemblyTarget};
|
||||
}
|
||||
|
||||
rdcstr D3D11Replay::DisassembleShader(ResourceId pipeline, const ShaderReflection *refl,
|
||||
const rdcstr &target)
|
||||
{
|
||||
auto it =
|
||||
WrappedShader::m_ShaderList.find(m_pDevice->GetResourceManager()->GetLiveID(refl->resourceId));
|
||||
|
||||
if(it == WrappedShader::m_ShaderList.end())
|
||||
return "; Invalid Shader Specified";
|
||||
|
||||
DXBC::DXBCContainer *dxbc = it->second->GetDXBC();
|
||||
|
||||
if(target == DXBCDisassemblyTarget || target.empty())
|
||||
return dxbc->GetDisassembly();
|
||||
|
||||
return StringFormat::Fmt("; Invalid disassembly target %s", target.c_str());
|
||||
}
|
||||
|
||||
void D3D11Replay::FreeTargetResource(ResourceId id)
|
||||
{
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(id))
|
||||
{
|
||||
ID3D11DeviceChild *resource = m_pDevice->GetResourceManager()->GetLiveResource(id);
|
||||
|
||||
SAFE_RELEASE(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void D3D11Replay::FreeCustomShader(ResourceId id)
|
||||
{
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(id))
|
||||
{
|
||||
ID3D11DeviceChild *resource = m_pDevice->GetResourceManager()->GetLiveResource(id);
|
||||
|
||||
SAFE_RELEASE(resource);
|
||||
}
|
||||
}
|
||||
|
||||
rdcarray<EventUsage> D3D11Replay::GetUsage(ResourceId id)
|
||||
{
|
||||
return m_pDevice->GetImmediateContext()->GetUsage(id);
|
||||
}
|
||||
|
||||
rdcarray<DebugMessage> D3D11Replay::GetDebugMessages()
|
||||
{
|
||||
return m_pDevice->GetDebugMessages();
|
||||
}
|
||||
|
||||
rdcarray<GPUDevice> D3D11Replay::GetAvailableGPUs()
|
||||
{
|
||||
rdcarray<GPUDevice> ret;
|
||||
|
||||
for(UINT i = 0; i < 10; i++)
|
||||
{
|
||||
IDXGIAdapter *adapter = NULL;
|
||||
|
||||
HRESULT hr = m_pFactory->EnumAdapters(i, &adapter);
|
||||
|
||||
if(SUCCEEDED(hr) && adapter)
|
||||
{
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
adapter->GetDesc(&desc);
|
||||
|
||||
GPUDevice dev;
|
||||
dev.vendor = GPUVendorFromPCIVendor(desc.VendorId);
|
||||
dev.deviceID = desc.DeviceId;
|
||||
dev.driver = ""; // D3D doesn't have multiple drivers per API
|
||||
dev.name = StringFormat::Wide2UTF8(desc.Description);
|
||||
dev.apis = {GraphicsAPI::D3D11};
|
||||
|
||||
// don't add duplicate devices even if they get enumerated. Don't add WARP, we'll do that
|
||||
// manually since it's inconsistently enumerated
|
||||
if(ret.indexOf(dev) == -1 && dev.vendor != GPUVendor::Software)
|
||||
ret.push_back(dev);
|
||||
}
|
||||
|
||||
SAFE_RELEASE(adapter);
|
||||
}
|
||||
|
||||
{
|
||||
GPUDevice dev;
|
||||
dev.vendor = GPUVendor::Software;
|
||||
dev.deviceID = 0;
|
||||
dev.driver = ""; // D3D doesn't have multiple drivers per API
|
||||
dev.name = "WARP Rasterizer";
|
||||
dev.apis = {GraphicsAPI::D3D11};
|
||||
ret.push_back(dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
APIProperties D3D11Replay::GetAPIProperties()
|
||||
{
|
||||
APIProperties ret = m_pDevice->APIProps;
|
||||
|
||||
ret.pipelineType = GraphicsAPI::D3D11;
|
||||
ret.localRenderer = GraphicsAPI::D3D11;
|
||||
ret.vendor = m_DriverInfo.vendor;
|
||||
ret.degraded = m_WARP;
|
||||
ret.shadersMutable = false;
|
||||
ret.shaderDebugging = true;
|
||||
ret.pixelHistory = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ResourceDescription &D3D11Replay::GetResourceDesc(ResourceId id)
|
||||
{
|
||||
auto it = m_ResourceIdx.find(id);
|
||||
if(it == m_ResourceIdx.end())
|
||||
{
|
||||
m_ResourceIdx[id] = m_Resources.size();
|
||||
m_Resources.push_back(ResourceDescription());
|
||||
m_Resources.back().resourceId = id;
|
||||
return m_Resources.back();
|
||||
}
|
||||
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
rdcarray<ResourceDescription> D3D11Replay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
BufferDescription D3D11Replay::GetBuffer(ResourceId id)
|
||||
{
|
||||
BufferDescription ret = {};
|
||||
ret.resourceId = ResourceId();
|
||||
|
||||
auto it = WrappedID3D11Buffer::m_BufferList.find(id);
|
||||
|
||||
if(it == WrappedID3D11Buffer::m_BufferList.end())
|
||||
return ret;
|
||||
|
||||
WrappedID3D11Buffer *d3dbuf = it->second.m_Buffer;
|
||||
|
||||
rdcstr str = GetDebugName(d3dbuf);
|
||||
|
||||
ret.resourceId = m_pDevice->GetResourceManager()->GetOriginalID(it->first);
|
||||
|
||||
D3D11_BUFFER_DESC desc;
|
||||
it->second.m_Buffer->GetDesc(&desc);
|
||||
|
||||
ret.length = desc.ByteWidth;
|
||||
|
||||
ret.creationFlags = BufferCategory::NoFlags;
|
||||
if(desc.BindFlags & D3D11_BIND_VERTEX_BUFFER)
|
||||
ret.creationFlags |= BufferCategory::Vertex;
|
||||
if(desc.BindFlags & D3D11_BIND_INDEX_BUFFER)
|
||||
ret.creationFlags |= BufferCategory::Index;
|
||||
if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS)
|
||||
ret.creationFlags |= BufferCategory::ReadWrite;
|
||||
if(desc.MiscFlags & D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS)
|
||||
ret.creationFlags |= BufferCategory::Indirect;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
TextureDescription D3D11Replay::GetTexture(ResourceId id)
|
||||
{
|
||||
TextureDescription tex = {};
|
||||
@@ -431,164 +620,9 @@ TextureDescription D3D11Replay::GetTexture(ResourceId id)
|
||||
return tex;
|
||||
}
|
||||
|
||||
rdcarray<ShaderEntryPoint> D3D11Replay::GetShaderEntryPoints(ResourceId shader)
|
||||
rdcarray<BufferDescription> D3D11Replay::GetBuffers()
|
||||
{
|
||||
auto it = WrappedShader::m_ShaderList.find(shader);
|
||||
|
||||
if(it == WrappedShader::m_ShaderList.end())
|
||||
return {};
|
||||
|
||||
ShaderReflection &ret = it->second->GetDetails();
|
||||
|
||||
return {{"main", ret.stage}};
|
||||
}
|
||||
|
||||
ShaderReflection *D3D11Replay::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
{
|
||||
auto it = WrappedShader::m_ShaderList.find(shader);
|
||||
|
||||
if(it == WrappedShader::m_ShaderList.end())
|
||||
return NULL;
|
||||
|
||||
ShaderReflection &ret = it->second->GetDetails();
|
||||
|
||||
return &ret;
|
||||
}
|
||||
|
||||
rdcarray<rdcstr> D3D11Replay::GetDisassemblyTargets()
|
||||
{
|
||||
return {DXBCDisassemblyTarget};
|
||||
}
|
||||
|
||||
rdcstr D3D11Replay::DisassembleShader(ResourceId pipeline, const ShaderReflection *refl,
|
||||
const rdcstr &target)
|
||||
{
|
||||
auto it =
|
||||
WrappedShader::m_ShaderList.find(m_pDevice->GetResourceManager()->GetLiveID(refl->resourceId));
|
||||
|
||||
if(it == WrappedShader::m_ShaderList.end())
|
||||
return "; Invalid Shader Specified";
|
||||
|
||||
DXBC::DXBCContainer *dxbc = it->second->GetDXBC();
|
||||
|
||||
if(target == DXBCDisassemblyTarget || target.empty())
|
||||
return dxbc->GetDisassembly();
|
||||
|
||||
return StringFormat::Fmt("; Invalid disassembly target %s", target.c_str());
|
||||
}
|
||||
|
||||
void D3D11Replay::FreeTargetResource(ResourceId id)
|
||||
{
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(id))
|
||||
{
|
||||
ID3D11DeviceChild *resource = m_pDevice->GetResourceManager()->GetLiveResource(id);
|
||||
|
||||
SAFE_RELEASE(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void D3D11Replay::FreeCustomShader(ResourceId id)
|
||||
{
|
||||
if(m_pDevice->GetResourceManager()->HasLiveResource(id))
|
||||
{
|
||||
ID3D11DeviceChild *resource = m_pDevice->GetResourceManager()->GetLiveResource(id);
|
||||
|
||||
SAFE_RELEASE(resource);
|
||||
}
|
||||
}
|
||||
|
||||
rdcarray<EventUsage> D3D11Replay::GetUsage(ResourceId id)
|
||||
{
|
||||
return m_pDevice->GetImmediateContext()->GetUsage(id);
|
||||
}
|
||||
|
||||
rdcarray<DebugMessage> D3D11Replay::GetDebugMessages()
|
||||
{
|
||||
return m_pDevice->GetDebugMessages();
|
||||
}
|
||||
|
||||
rdcarray<GPUDevice> D3D11Replay::GetAvailableGPUs()
|
||||
{
|
||||
rdcarray<GPUDevice> ret;
|
||||
|
||||
for(UINT i = 0; i < 10; i++)
|
||||
{
|
||||
IDXGIAdapter *adapter = NULL;
|
||||
|
||||
HRESULT hr = m_pFactory->EnumAdapters(i, &adapter);
|
||||
|
||||
if(SUCCEEDED(hr) && adapter)
|
||||
{
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
adapter->GetDesc(&desc);
|
||||
|
||||
GPUDevice dev;
|
||||
dev.vendor = GPUVendorFromPCIVendor(desc.VendorId);
|
||||
dev.deviceID = desc.DeviceId;
|
||||
dev.driver = ""; // D3D doesn't have multiple drivers per API
|
||||
dev.name = StringFormat::Wide2UTF8(desc.Description);
|
||||
dev.apis = {GraphicsAPI::D3D11};
|
||||
|
||||
// don't add duplicate devices even if they get enumerated. Don't add WARP, we'll do that
|
||||
// manually since it's inconsistently enumerated
|
||||
if(ret.indexOf(dev) == -1 && dev.vendor != GPUVendor::Software)
|
||||
ret.push_back(dev);
|
||||
}
|
||||
|
||||
SAFE_RELEASE(adapter);
|
||||
}
|
||||
|
||||
{
|
||||
GPUDevice dev;
|
||||
dev.vendor = GPUVendor::Software;
|
||||
dev.deviceID = 0;
|
||||
dev.driver = ""; // D3D doesn't have multiple drivers per API
|
||||
dev.name = "WARP Rasterizer";
|
||||
dev.apis = {GraphicsAPI::D3D11};
|
||||
ret.push_back(dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
APIProperties D3D11Replay::GetAPIProperties()
|
||||
{
|
||||
APIProperties ret = m_pDevice->APIProps;
|
||||
|
||||
ret.pipelineType = GraphicsAPI::D3D11;
|
||||
ret.localRenderer = GraphicsAPI::D3D11;
|
||||
ret.vendor = m_DriverInfo.vendor;
|
||||
ret.degraded = m_WARP;
|
||||
ret.shadersMutable = false;
|
||||
ret.shaderDebugging = true;
|
||||
ret.pixelHistory = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ResourceDescription &D3D11Replay::GetResourceDesc(ResourceId id)
|
||||
{
|
||||
auto it = m_ResourceIdx.find(id);
|
||||
if(it == m_ResourceIdx.end())
|
||||
{
|
||||
m_ResourceIdx[id] = m_Resources.size();
|
||||
m_Resources.push_back(ResourceDescription());
|
||||
m_Resources.back().resourceId = id;
|
||||
return m_Resources.back();
|
||||
}
|
||||
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const rdcarray<ResourceDescription> &D3D11Replay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> D3D11Replay::GetBuffers()
|
||||
{
|
||||
rdcarray<ResourceId> ret;
|
||||
rdcarray<BufferDescription> ret;
|
||||
|
||||
ret.reserve(WrappedID3D11Buffer::m_BufferList.size());
|
||||
|
||||
@@ -599,7 +633,7 @@ rdcarray<ResourceId> D3D11Replay::GetBuffers()
|
||||
if(m_pDevice->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
ret.push_back(it->first);
|
||||
ret.push_back(GetBuffer(it->first));
|
||||
}
|
||||
|
||||
GetDebugManager()->GetCounterBuffers(ret);
|
||||
@@ -607,53 +641,9 @@ rdcarray<ResourceId> D3D11Replay::GetBuffers()
|
||||
return ret;
|
||||
}
|
||||
|
||||
BufferDescription D3D11Replay::GetBuffer(ResourceId id)
|
||||
rdcarray<TextureDescription> D3D11Replay::GetTextures()
|
||||
{
|
||||
BufferDescription ret = {};
|
||||
ret.resourceId = ResourceId();
|
||||
|
||||
if(GetDebugManager()->GetCounterBufferUAV(id))
|
||||
{
|
||||
// no original ID for this one
|
||||
ret.resourceId = id;
|
||||
ret.length = 4;
|
||||
ret.gpuAddress = 0;
|
||||
ret.creationFlags = BufferCategory::ReadWrite;
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto it = WrappedID3D11Buffer::m_BufferList.find(id);
|
||||
|
||||
if(it == WrappedID3D11Buffer::m_BufferList.end())
|
||||
return ret;
|
||||
|
||||
WrappedID3D11Buffer *d3dbuf = it->second.m_Buffer;
|
||||
|
||||
rdcstr str = GetDebugName(d3dbuf);
|
||||
|
||||
ret.resourceId = m_pDevice->GetResourceManager()->GetOriginalID(it->first);
|
||||
|
||||
D3D11_BUFFER_DESC desc;
|
||||
it->second.m_Buffer->GetDesc(&desc);
|
||||
|
||||
ret.length = desc.ByteWidth;
|
||||
|
||||
ret.creationFlags = BufferCategory::NoFlags;
|
||||
if(desc.BindFlags & D3D11_BIND_VERTEX_BUFFER)
|
||||
ret.creationFlags |= BufferCategory::Vertex;
|
||||
if(desc.BindFlags & D3D11_BIND_INDEX_BUFFER)
|
||||
ret.creationFlags |= BufferCategory::Index;
|
||||
if(desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS)
|
||||
ret.creationFlags |= BufferCategory::ReadWrite;
|
||||
if(desc.MiscFlags & D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS)
|
||||
ret.creationFlags |= BufferCategory::Indirect;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> D3D11Replay::GetTextures()
|
||||
{
|
||||
rdcarray<ResourceId> ret;
|
||||
rdcarray<TextureDescription> ret;
|
||||
|
||||
ret.reserve(WrappedID3D11Texture1D::m_TextureList.size() +
|
||||
WrappedID3D11Texture2D1::m_TextureList.size() +
|
||||
@@ -666,7 +656,7 @@ rdcarray<ResourceId> D3D11Replay::GetTextures()
|
||||
if(m_pDevice->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
ret.push_back(it->first);
|
||||
ret.push_back(GetTexture(it->first));
|
||||
}
|
||||
|
||||
for(auto it = WrappedID3D11Texture2D1::m_TextureList.begin();
|
||||
@@ -676,7 +666,7 @@ rdcarray<ResourceId> D3D11Replay::GetTextures()
|
||||
if(m_pDevice->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
ret.push_back(it->first);
|
||||
ret.push_back(GetTexture(it->first));
|
||||
}
|
||||
|
||||
for(auto it = WrappedID3D11Texture3D1::m_TextureList.begin();
|
||||
@@ -686,7 +676,7 @@ rdcarray<ResourceId> D3D11Replay::GetTextures()
|
||||
if(m_pDevice->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
ret.push_back(it->first);
|
||||
ret.push_back(GetTexture(it->first));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -117,12 +117,12 @@ public:
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const rdcarray<ResourceDescription> &GetResources();
|
||||
rdcarray<ResourceDescription> GetResources();
|
||||
|
||||
rdcarray<ResourceId> GetBuffers();
|
||||
rdcarray<BufferDescription> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
rdcarray<ResourceId> GetTextures();
|
||||
rdcarray<TextureDescription> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
rdcarray<DebugMessage> GetDebugMessages();
|
||||
|
||||
@@ -304,31 +304,31 @@ ResourceDescription &D3D12Replay::GetResourceDesc(ResourceId id)
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const rdcarray<ResourceDescription> &D3D12Replay::GetResources()
|
||||
rdcarray<ResourceDescription> D3D12Replay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> D3D12Replay::GetBuffers()
|
||||
rdcarray<BufferDescription> D3D12Replay::GetBuffers()
|
||||
{
|
||||
rdcarray<ResourceId> ret;
|
||||
rdcarray<BufferDescription> ret;
|
||||
|
||||
for(auto it = m_pDevice->GetResourceList().begin(); it != m_pDevice->GetResourceList().end(); it++)
|
||||
if(it->second->GetDesc().Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
|
||||
ret.push_back(it->first);
|
||||
ret.push_back(GetBuffer(it->first));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> D3D12Replay::GetTextures()
|
||||
rdcarray<TextureDescription> D3D12Replay::GetTextures()
|
||||
{
|
||||
rdcarray<ResourceId> ret;
|
||||
rdcarray<TextureDescription> ret;
|
||||
|
||||
for(auto it = m_pDevice->GetResourceList().begin(); it != m_pDevice->GetResourceList().end(); it++)
|
||||
{
|
||||
if(it->second->GetDesc().Dimension != D3D12_RESOURCE_DIMENSION_BUFFER &&
|
||||
m_pDevice->GetResourceManager()->GetOriginalID(it->first) != it->first)
|
||||
ret.push_back(it->first);
|
||||
ret.push_back(GetTexture(it->first));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -70,12 +70,12 @@ public:
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const rdcarray<ResourceDescription> &GetResources();
|
||||
rdcarray<ResourceDescription> GetResources();
|
||||
|
||||
rdcarray<ResourceId> GetBuffers();
|
||||
rdcarray<BufferDescription> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
rdcarray<ResourceId> GetTextures();
|
||||
rdcarray<TextureDescription> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
rdcarray<DebugMessage> GetDebugMessages();
|
||||
|
||||
@@ -196,22 +196,6 @@ APIProperties GLReplay::GetAPIProperties()
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> GLReplay::GetBuffers()
|
||||
{
|
||||
rdcarray<ResourceId> ret;
|
||||
|
||||
for(auto it = m_pDriver->m_Buffers.begin(); it != m_pDriver->m_Buffers.end(); ++it)
|
||||
{
|
||||
// skip buffers that aren't from the log
|
||||
if(m_pDriver->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
ret.push_back(it->first);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ResourceDescription &GLReplay::GetResourceDesc(ResourceId id)
|
||||
{
|
||||
auto it = m_ResourceIdx.find(id);
|
||||
@@ -226,32 +210,11 @@ ResourceDescription &GLReplay::GetResourceDesc(ResourceId id)
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const rdcarray<ResourceDescription> &GLReplay::GetResources()
|
||||
rdcarray<ResourceDescription> GLReplay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> GLReplay::GetTextures()
|
||||
{
|
||||
rdcarray<ResourceId> ret;
|
||||
ret.reserve(m_pDriver->m_Textures.size());
|
||||
|
||||
for(auto it = m_pDriver->m_Textures.begin(); it != m_pDriver->m_Textures.end(); ++it)
|
||||
{
|
||||
auto &res = m_pDriver->m_Textures[it->first];
|
||||
|
||||
// skip textures that aren't from the log (except the 'default backbuffer' textures)
|
||||
if(!(res.creationFlags & TextureCategory::SwapBuffer) &&
|
||||
m_pDriver->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
ret.push_back(it->first);
|
||||
CacheTexture(it->first);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GLReplay::SetReplayData(GLWindowingData data)
|
||||
{
|
||||
m_ReplayCtx = data;
|
||||
@@ -407,18 +370,6 @@ bool GLReplay::IsRenderOutput(ResourceId id)
|
||||
return false;
|
||||
}
|
||||
|
||||
TextureDescription GLReplay::GetTexture(ResourceId id)
|
||||
{
|
||||
auto it = m_CachedTextures.find(id);
|
||||
if(it == m_CachedTextures.end())
|
||||
{
|
||||
CacheTexture(id);
|
||||
return m_CachedTextures[id];
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void GLReplay::CacheTexture(ResourceId id)
|
||||
{
|
||||
if(m_CachedTextures.find(id) != m_CachedTextures.end())
|
||||
@@ -729,6 +680,55 @@ BufferDescription GLReplay::GetBuffer(ResourceId id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
TextureDescription GLReplay::GetTexture(ResourceId id)
|
||||
{
|
||||
auto it = m_CachedTextures.find(id);
|
||||
if(it == m_CachedTextures.end())
|
||||
{
|
||||
CacheTexture(id);
|
||||
return m_CachedTextures[id];
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
rdcarray<BufferDescription> GLReplay::GetBuffers()
|
||||
{
|
||||
rdcarray<BufferDescription> ret;
|
||||
|
||||
for(auto it = m_pDriver->m_Buffers.begin(); it != m_pDriver->m_Buffers.end(); ++it)
|
||||
{
|
||||
// skip buffers that aren't from the log
|
||||
if(m_pDriver->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
ret.push_back(GetBuffer(it->first));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcarray<TextureDescription> GLReplay::GetTextures()
|
||||
{
|
||||
rdcarray<TextureDescription> ret;
|
||||
ret.reserve(m_pDriver->m_Textures.size());
|
||||
|
||||
for(auto it = m_pDriver->m_Textures.begin(); it != m_pDriver->m_Textures.end(); ++it)
|
||||
{
|
||||
auto &res = m_pDriver->m_Textures[it->first];
|
||||
|
||||
// skip textures that aren't from the log (except the 'default backbuffer' textures)
|
||||
if(!(res.creationFlags & TextureCategory::SwapBuffer) &&
|
||||
m_pDriver->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
CacheTexture(it->first);
|
||||
ret.push_back(m_CachedTextures[it->first]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcarray<DebugMessage> GLReplay::GetDebugMessages()
|
||||
{
|
||||
return m_pDriver->GetDebugMessages();
|
||||
|
||||
@@ -117,12 +117,12 @@ public:
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const rdcarray<ResourceDescription> &GetResources();
|
||||
rdcarray<ResourceDescription> GetResources();
|
||||
|
||||
rdcarray<ResourceId> GetBuffers();
|
||||
rdcarray<BufferDescription> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
rdcarray<ResourceId> GetTextures();
|
||||
rdcarray<TextureDescription> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
rdcarray<ShaderEntryPoint> GetShaderEntryPoints(ResourceId shader);
|
||||
|
||||
@@ -287,14 +287,14 @@ ResourceDescription &VulkanReplay::GetResourceDesc(ResourceId id)
|
||||
return m_Resources[it->second];
|
||||
}
|
||||
|
||||
const rdcarray<ResourceDescription> &VulkanReplay::GetResources()
|
||||
rdcarray<ResourceDescription> VulkanReplay::GetResources()
|
||||
{
|
||||
return m_Resources;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> VulkanReplay::GetTextures()
|
||||
rdcarray<TextureDescription> VulkanReplay::GetTextures()
|
||||
{
|
||||
rdcarray<ResourceId> texs;
|
||||
rdcarray<TextureDescription> texs;
|
||||
|
||||
for(auto it = m_pDriver->m_ImageStates.begin(); it != m_pDriver->m_ImageStates.end(); ++it)
|
||||
{
|
||||
@@ -302,15 +302,15 @@ rdcarray<ResourceId> VulkanReplay::GetTextures()
|
||||
if(m_pDriver->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
texs.push_back(it->first);
|
||||
texs.push_back(GetTexture(it->first));
|
||||
}
|
||||
|
||||
return texs;
|
||||
}
|
||||
|
||||
rdcarray<ResourceId> VulkanReplay::GetBuffers()
|
||||
rdcarray<BufferDescription> VulkanReplay::GetBuffers()
|
||||
{
|
||||
rdcarray<ResourceId> bufs;
|
||||
rdcarray<BufferDescription> bufs;
|
||||
|
||||
for(auto it = m_pDriver->m_CreationInfo.m_Buffer.begin();
|
||||
it != m_pDriver->m_CreationInfo.m_Buffer.end(); ++it)
|
||||
@@ -319,7 +319,7 @@ rdcarray<ResourceId> VulkanReplay::GetBuffers()
|
||||
if(m_pDriver->GetResourceManager()->GetOriginalID(it->first) == it->first)
|
||||
continue;
|
||||
|
||||
bufs.push_back(it->first);
|
||||
bufs.push_back(GetBuffer(it->first));
|
||||
}
|
||||
|
||||
return bufs;
|
||||
|
||||
@@ -260,12 +260,12 @@ public:
|
||||
APIProperties GetAPIProperties();
|
||||
|
||||
ResourceDescription &GetResourceDesc(ResourceId id);
|
||||
const rdcarray<ResourceDescription> &GetResources();
|
||||
rdcarray<ResourceDescription> GetResources();
|
||||
|
||||
rdcarray<ResourceId> GetBuffers();
|
||||
rdcarray<BufferDescription> GetBuffers();
|
||||
BufferDescription GetBuffer(ResourceId id);
|
||||
|
||||
rdcarray<ResourceId> GetTextures();
|
||||
rdcarray<TextureDescription> GetTextures();
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
rdcarray<ShaderEntryPoint> GetShaderEntryPoints(ResourceId shader);
|
||||
|
||||
@@ -2056,24 +2056,8 @@ ReplayStatus ReplayController::PostCreateInit(IReplayDriver *device, RDCFile *rd
|
||||
// fetch GCN ISA targets
|
||||
GCNISA::GetTargets(m_APIProps.pipelineType, m_GCNTargets);
|
||||
|
||||
{
|
||||
rdcarray<ResourceId> ids = m_pDevice->GetBuffers();
|
||||
|
||||
m_Buffers.resize(ids.size());
|
||||
|
||||
for(size_t i = 0; i < ids.size(); i++)
|
||||
m_Buffers[i] = m_pDevice->GetBuffer(ids[i]);
|
||||
}
|
||||
|
||||
{
|
||||
rdcarray<ResourceId> ids = m_pDevice->GetTextures();
|
||||
|
||||
m_Textures.resize(ids.size());
|
||||
|
||||
for(size_t i = 0; i < ids.size(); i++)
|
||||
m_Textures[i] = m_pDevice->GetTexture(ids[i]);
|
||||
}
|
||||
|
||||
m_Buffers = m_pDevice->GetBuffers();
|
||||
m_Textures = m_pDevice->GetTextures();
|
||||
m_Resources = m_pDevice->GetResources();
|
||||
|
||||
m_FrameRecord = m_pDevice->GetFrameRecord();
|
||||
|
||||
@@ -114,12 +114,12 @@ public:
|
||||
|
||||
virtual APIProperties GetAPIProperties() = 0;
|
||||
|
||||
virtual const rdcarray<ResourceDescription> &GetResources() = 0;
|
||||
virtual rdcarray<ResourceDescription> GetResources() = 0;
|
||||
|
||||
virtual rdcarray<ResourceId> GetBuffers() = 0;
|
||||
virtual rdcarray<BufferDescription> GetBuffers() = 0;
|
||||
virtual BufferDescription GetBuffer(ResourceId id) = 0;
|
||||
|
||||
virtual rdcarray<ResourceId> GetTextures() = 0;
|
||||
virtual rdcarray<TextureDescription> GetTextures() = 0;
|
||||
virtual TextureDescription GetTexture(ResourceId id) = 0;
|
||||
|
||||
virtual rdcarray<DebugMessage> GetDebugMessages() = 0;
|
||||
|
||||
Reference in New Issue
Block a user