Remove GetLiveID entirely

This commit is contained in:
baldurk committed 2026-01-05 22:51:39 +00:00
1 parent 83919d9306
commit 43cde7debd
36 files changed
+374 -633

No files matched your search

-1
View File
@@ -294,7 +294,6 @@ public:
rdcarray<uint32_t> GetPassEvents(uint32_t eventId) { return rdcarray<uint32_t>(); }
rdcarray<EventUsage> GetUsage(ResourceId id) { return rdcarray<EventUsage>(); }
bool IsRenderOutput(ResourceId id) { return false; }
ResourceId GetLiveID(ResourceId id) { return id; }
rdcarray<GPUCounter> EnumerateCounters() { return {}; }
CounterDescription DescribeCounter(GPUCounter counterID)
{
+10 -70
View File
@@ -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 <typename ParamSerialiser, typename ReturnSerialiser>
ResourceId ReplayProxy::Proxied_GetLiveID(ParamSerialiser &paramser, 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 <typename ParamSerialiser, typename ReturnSerialiser>
rdcarray<CounterResult> ReplayProxy::Proxied_FetchCounters(ParamSerialiser &paramser,
ReturnSerialiser &retser,
@@ -1317,8 +1271,7 @@ rdcstr ReplayProxy::Proxied_DisassembleShader(ParamSerialiser &paramser, 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 &paramser, ReturnSeria
m_Remote->ReplaceResource(from, to);
}
if(paramser.IsWriting())
m_LiveIDs.clear();
SERIALISE_RETURN_VOID();
}
@@ -1546,9 +1496,6 @@ void ReplayProxy::Proxied_RemoveReplacement(ParamSerialiser &paramser, ReturnSer
m_Remote->RemoveReplacement(id);
}
if(paramser.IsWriting())
m_LiveIDs.clear();
SERIALISE_RETURN_VOID();
}
@@ -1865,12 +1812,11 @@ void ReplayProxy::Proxied_SavePipelineState(ParamSerialiser &paramser, 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 &paramser, 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 &paramser, 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 &paramser, 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;
-5
View File
@@ -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<GPUCounter>, EnumerateCounters);
IMPLEMENT_FUNCTION_PROXIED(CounterDescription, DescribeCounter, GPUCounter counterID);
IMPLEMENT_FUNCTION_PROXIED(rdcarray<CounterResult>, FetchCounters,
@@ -657,8 +654,6 @@ private:
// should not be treated as proxied.
std::set<ResourceId> m_LocalTextures;
std::map<ResourceId, ResourceId> m_LiveIDs;
struct ShaderReflKey
{
ShaderReflKey() {}
-15
View File
@@ -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<Configuration>::GetUnreplacedID(ResourceId id)
return id;
}
template <typename Configuration>
ResourceId ResourceManager<Configuration>::GetLiveID(ResourceId id)
{
if(id == ResourceId())
return id;
auto it = m_Replacements.find(id);
if(it != m_Replacements.end())
return it->second;
return id;
}
+1 -2
View File
@@ -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;
}
+1 -12
View File
@@ -338,8 +338,7 @@ rdcarray<rdcstr> 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<uint32_t> 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])
{
-2
View File
@@ -225,8 +225,6 @@ public:
void InitPostVSBuffers(uint32_t eventId);
void InitPostVSBuffers(const rdcarray<uint32_t> &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,
+2 -2
View File
@@ -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
+3 -7
View File
@@ -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);
}
}
+4 -15
View File
@@ -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<EventUsage> 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;
}
-1
View File
@@ -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]);
+6 -45
View File
@@ -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;
+3 -5
View File
@@ -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)
{
+2 -10
View File
@@ -200,13 +200,6 @@ rdcarray<WindowingSystem> GLReplay::GetSupportedWindowSystems()
return ret;
}
ResourceId GLReplay::GetLiveID(ResourceId id)
{
if(!m_pDriver->GetResourceManager()->HasLiveResource(id))
return ResourceId();
return m_pDriver->GetResourceManager()->GetLiveID(id);
}
rdcarray<GPUDevice> GLReplay::GetAvailableGPUs()
{
// GL doesn't support multiple GPUs, return an empty list
@@ -811,8 +804,7 @@ rdcarray<rdcstr> 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;
}
-2
View File
@@ -256,8 +256,6 @@ public:
void InitPostVSBuffers(uint32_t eventId);
void InitPostVSBuffers(const rdcarray<uint32_t> &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,
+7 -11
View File
@@ -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;
@@ -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));
}
}
@@ -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);
@@ -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;
@@ -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);
}
}
+165 -170
View File
@@ -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;
-4
View File
@@ -720,11 +720,7 @@ bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarray<VkWriteDescri
uint32_t arrayIdx = slot - writes.back().dstArrayElement;
ResourceId resId = slots[slot].resource;
if(rm->HasLiveResource(resId))
resId = rm->GetLiveID(resId);
ResourceId sampId = slots[slot].sampler;
if(rm->HasLiveResource(sampId))
sampId = rm->GetLiveID(sampId);
switch(descType)
{
+5 -11
View File
@@ -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());
+5 -8
View File
@@ -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");
-2
View File
@@ -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);
+2 -12
View File
@@ -273,15 +273,6 @@ rdcarray<uint32_t> 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<DebugMessage> 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())
-2
View File
@@ -389,8 +389,6 @@ public:
bool IsOutputWindowVisible(uint64_t id);
void FlipOutputWindow(uint64_t id);
ResourceId GetLiveID(ResourceId id);
rdcarray<GPUCounter> EnumerateCounters();
CounterDescription DescribeCounter(GPUCounter counterID);
rdcarray<CounterResult> FetchCounters(const rdcarray<GPUCounter> &counters);
+7 -11
View File
@@ -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);
@@ -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])
{
@@ -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);
@@ -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);
-5
View File
@@ -216,11 +216,6 @@ void DummyDriver::InitPostVSBuffers(const rdcarray<uint32_t> &passEvents)
{
}
ResourceId DummyDriver::GetLiveID(ResourceId id)
{
return id;
}
MeshFormat DummyDriver::GetPostVSBuffers(uint32_t eventId, uint32_t instID, uint32_t viewID,
MeshDataStage stage)
{
-2
View File
@@ -82,8 +82,6 @@ public:
void InitPostVSBuffers(uint32_t eventId);
void InitPostVSBuffers(const rdcarray<uint32_t> &passEvents);
ResourceId GetLiveID(ResourceId id);
MeshFormat GetPostVSBuffers(uint32_t eventId, uint32_t instID, uint32_t viewID,
MeshDataStage stage);
+18 -42
View File
@@ -129,7 +129,7 @@ rdcarray<Descriptor> ReplayController::GetDescriptors(ResourceId descriptorStore
{
CHECK_REPLAY_THREAD();
return m_pDevice->GetDescriptors(m_pDevice->GetLiveID(descriptorStore), ranges);
return m_pDevice->GetDescriptors(descriptorStore, ranges);
}
const rdcarray<DescriptorAccess> &ReplayController::GetDescriptorAccess()
@@ -144,7 +144,7 @@ rdcarray<DescriptorLogicalLocation> ReplayController::GetDescriptorLocations(
{
CHECK_REPLAY_THREAD();
return m_pDevice->GetDescriptorLocations(m_pDevice->GetLiveID(descriptorStore), ranges);
return m_pDevice->GetDescriptorLocations(descriptorStore, ranges);
}
rdcarray<SamplerDescriptor> ReplayController::GetSamplerDescriptors(
@@ -152,7 +152,7 @@ rdcarray<SamplerDescriptor> ReplayController::GetSamplerDescriptors(
{
CHECK_REPLAY_THREAD();
return m_pDevice->GetSamplerDescriptors(m_pDevice->GetLiveID(descriptorStore), ranges);
return m_pDevice->GetSamplerDescriptors(descriptorStore, ranges);
}
rdcarray<rdcstr> 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<ShaderEntryPoint> 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<EventUsage> 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<PixelModification> ReplayController::PixelHistory(ResourceId target, ui
}
}
ResourceId id = m_pDevice->GetLiveID(target);
ResourceId id = target;
if(id == ResourceId())
return ret;
@@ -1584,7 +1568,7 @@ rdcarray<PixelModification> 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<PixelValue, PixelValue> 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<uint32_t> ReplayController::GetHistogram(ResourceId textureId, const Su
rdcarray<uint32_t> 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<ShaderVariable> ReplayController::GetCBufferVariableContents(
bytebuf data;
if(buffer != ResourceId())
{
buffer = m_pDevice->GetLiveID(buffer);
if(buffer != ResourceId())
{
if(length > 0)
@@ -1763,9 +1744,6 @@ rdcarray<ShaderVariable> ReplayController::GetCBufferVariableContents(
rdcarray<ShaderVariable> 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));
}
-2
View File
@@ -183,8 +183,6 @@ public:
virtual void InitPostVSBuffers(uint32_t eventId) = 0;
virtual void InitPostVSBuffers(const rdcarray<uint32_t> &passEvents) = 0;
virtual ResourceId GetLiveID(ResourceId id) = 0;
virtual MeshFormat GetPostVSBuffers(uint32_t eventId, uint32_t instID, uint32_t viewID,
MeshDataStage stage) = 0;
+14 -18
View File
@@ -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<uint32_t, uint32_t> 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<MeshFormat> secondaryDraws;