Add a stubbed out query for pulling descriptor contents out of a store

This commit is contained in:
baldurk
2024-01-18 16:19:47 +00:00
parent 7ef216ad35
commit b94e6ff90c
20 changed files with 324 additions and 0 deletions
+3
View File
@@ -412,6 +412,9 @@ TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderChangeStats)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ResourceBindStats)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, SamplerBindStats)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ConstantBindStats)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, Descriptor)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, DescriptorRange)
TEMPLATE_ARRAY_INSTANTIATE(rdcarray, SamplerDescriptor)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, Attachment)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, BindingElement)
TEMPLATE_NAMESPACE_ARRAY_INSTANTIATE(rdcarray, VKPipe, DescriptorBinding)
+34
View File
@@ -630,6 +630,40 @@ It is an :class:`AlphaMapping` that controls what behaviour to use.
DECLARE_REFLECTION_STRUCT(TextureSave);
DOCUMENT("A range of sized descriptors.");
struct DescriptorRange
{
DOCUMENT("");
DescriptorRange() = default;
DescriptorRange(const DescriptorRange &) = default;
DescriptorRange &operator=(const DescriptorRange &) = default;
DOCUMENT("The offset in the descriptor storage where the descriptor range starts.");
uint32_t offset = 0;
DOCUMENT("The size of each descriptor in the range.");
uint32_t descriptorSize = 1;
DOCUMENT("The number of descriptors in this range.");
uint32_t count = 1;
DOCUMENT("");
bool operator==(const DescriptorRange &o) const
{
return offset == o.offset && descriptorSize == o.descriptorSize && count == o.count;
}
bool operator<(const DescriptorRange &o) const
{
if(!(offset == o.offset))
return offset < o.offset;
if(!(descriptorSize == o.descriptorSize))
return descriptorSize < o.descriptorSize;
if(!(count == o.count))
return count < o.count;
return false;
}
};
DECLARE_REFLECTION_STRUCT(DescriptorRange);
// dependent structs for TargetControlMessage
DOCUMENT("Information about the a new capture created by the target.");
struct NewCaptureData
+22
View File
@@ -566,6 +566,28 @@ capture's API.
)");
virtual const PipeState &GetPipelineState() = 0;
DOCUMENT(R"(Retrieve the contents of a number of descriptors in a descriptor store. Multiple
ranges within the store can be queried at once, and are returned in a contiguous array.
:param ResourceId descriptorStore: The descriptor store to be queried from.
:param List[DescriptorRange] ranges: The descriptor ranges to query.
:return: The contents of the descriptors specified.
:rtype: List[Descriptor]
)");
virtual rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges) = 0;
DOCUMENT(R"(Retrieve the contents of a number of sampler descriptors in a descriptor store.
Multiple ranges within the store can be queried at once, and are returned in a contiguous array.
:param ResourceId descriptorStore: The descriptor store to be queried from.
:param List[DescriptorRange] ranges: The descriptor ranges to query.
:return: The contents of the descriptors specified.
:rtype: List[SamplerDescriptor]
)");
virtual rdcarray<SamplerDescriptor> GetSamplerDescriptors(
ResourceId descriptorStore, const rdcarray<DescriptorRange> &ranges) = 0;
DOCUMENT(R"(Retrieve the list of possible disassembly targets for :meth:`DisassembleShader`. The
values are implementation dependent but will always include a default target first which is the
native disassembly of the shader. Further options may be available for additional diassembly views
+20
View File
@@ -259,6 +259,26 @@ public:
return ret;
}
void SavePipelineState(uint32_t eventId) {}
rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<Descriptor> ret;
ret.resize(count);
return ret;
}
rdcarray<SamplerDescriptor> GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<SamplerDescriptor> ret;
ret.resize(count);
return ret;
}
DriverInformation GetDriverInfo()
{
DriverInformation ret = {};
+72
View File
@@ -97,6 +97,9 @@ rdcstr DoStringise(const ReplayProxyPacket &el)
STRINGISE_ENUM_NAMED(eReplayProxy_ContinueDebug, "ContinueDebug");
STRINGISE_ENUM_NAMED(eReplayProxy_FreeDebugger, "FreeDebugger");
STRINGISE_ENUM_NAMED(eReplayProxy_GetDescriptors, "GetDescriptors");
STRINGISE_ENUM_NAMED(eReplayProxy_GetSamplerDescriptors, "GetSamplerDescriptors");
}
END_ENUM_STRINGISE();
}
@@ -1836,6 +1839,73 @@ void ReplayProxy::SavePipelineState(uint32_t eventId)
PROXY_FUNCTION(SavePipelineState, eventId);
}
template <typename ParamSerialiser, typename ReturnSerialiser>
rdcarray<Descriptor> ReplayProxy::Proxied_GetDescriptors(ParamSerialiser &paramser,
ReturnSerialiser &retser,
ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
const ReplayProxyPacket expectedPacket = eReplayProxy_GetDescriptors;
ReplayProxyPacket packet = eReplayProxy_GetDescriptors;
rdcarray<Descriptor> ret;
{
BEGIN_PARAMS();
SERIALISE_ELEMENT(descriptorStore);
SERIALISE_ELEMENT(ranges);
END_PARAMS();
}
{
REMOTE_EXECUTION();
if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored)
ret = m_Remote->GetDescriptors(descriptorStore, ranges);
}
SERIALISE_RETURN(ret);
return ret;
}
rdcarray<Descriptor> ReplayProxy::GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
PROXY_FUNCTION(GetDescriptors, descriptorStore, ranges);
}
template <typename ParamSerialiser, typename ReturnSerialiser>
rdcarray<SamplerDescriptor> ReplayProxy::Proxied_GetSamplerDescriptors(
ParamSerialiser &paramser, ReturnSerialiser &retser, ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
const ReplayProxyPacket expectedPacket = eReplayProxy_GetSamplerDescriptors;
ReplayProxyPacket packet = eReplayProxy_GetSamplerDescriptors;
rdcarray<SamplerDescriptor> ret;
{
BEGIN_PARAMS();
SERIALISE_ELEMENT(descriptorStore);
SERIALISE_ELEMENT(ranges);
END_PARAMS();
}
{
REMOTE_EXECUTION();
if(paramser.IsReading() && !paramser.IsErrored() && !m_IsErrored)
ret = m_Remote->GetSamplerDescriptors(descriptorStore, ranges);
}
SERIALISE_RETURN(ret);
return ret;
}
rdcarray<SamplerDescriptor> ReplayProxy::GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
PROXY_FUNCTION(GetSamplerDescriptors, descriptorStore, ranges);
}
template <typename ParamSerialiser, typename ReturnSerialiser>
void ReplayProxy::Proxied_ReplayLog(ParamSerialiser &paramser, ReturnSerialiser &retser,
uint32_t endEventID, ReplayLogType replayType)
@@ -2906,6 +2976,8 @@ bool ReplayProxy::Tick(int type)
break;
}
case eReplayProxy_SavePipelineState: SavePipelineState(0); break;
case eReplayProxy_GetDescriptors: GetDescriptors(ResourceId(), {}); break;
case eReplayProxy_GetSamplerDescriptors: GetSamplerDescriptors(ResourceId(), {}); break;
case eReplayProxy_GetUsage: GetUsage(ResourceId()); break;
case eReplayProxy_GetLiveID: GetLiveID(ResourceId()); break;
case eReplayProxy_GetFrameRecord: GetFrameRecord(); break;
+7
View File
@@ -105,6 +105,9 @@ enum ReplayProxyPacket
eReplayProxy_FreeDebugger,
eReplayProxy_FatalErrorCheck,
eReplayProxy_GetDescriptors,
eReplayProxy_GetSamplerDescriptors,
};
DECLARE_REFLECTION_ENUM(ReplayProxyPacket);
@@ -478,6 +481,10 @@ public:
IMPLEMENT_FUNCTION_PROXIED(void, SavePipelineState, uint32_t eventId);
IMPLEMENT_FUNCTION_PROXIED(void, ReplayLog, uint32_t endEventID, ReplayLogType replayType);
IMPLEMENT_FUNCTION_PROXIED(rdcarray<Descriptor>, GetDescriptors, ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
IMPLEMENT_FUNCTION_PROXIED(rdcarray<SamplerDescriptor>, GetSamplerDescriptors,
ResourceId descriptorStore, const rdcarray<DescriptorRange> &ranges);
IMPLEMENT_FUNCTION_PROXIED(rdcarray<uint32_t>, GetPassEvents, uint32_t eventId);
+22
View File
@@ -1664,6 +1664,28 @@ void D3D11Replay::SavePipelineState(uint32_t eventId)
ret.predication.isPassing = rs->PredicationWouldPass();
}
rdcarray<Descriptor> D3D11Replay::GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<Descriptor> ret;
ret.resize(count);
return ret;
}
rdcarray<SamplerDescriptor> D3D11Replay::GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<SamplerDescriptor> ret;
ret.resize(count);
return ret;
}
RDResult D3D11Replay::ReadLogInitialisation(RDCFile *rdc, bool storeStructuredBuffers)
{
return m_pDevice->ReadLogInitialisation(rdc, storeStructuredBuffers);
+4
View File
@@ -182,6 +182,10 @@ public:
}
ShaderDebugging &GetShaderDebuggingData() { return m_ShaderDebug; }
void SavePipelineState(uint32_t eventId);
rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
rdcarray<SamplerDescriptor> GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
void FreeTargetResource(ResourceId id);
void FreeCustomShader(ResourceId id);
+22
View File
@@ -2068,6 +2068,28 @@ void D3D12Replay::SavePipelineState(uint32_t eventId)
}
}
rdcarray<Descriptor> D3D12Replay::GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<Descriptor> ret;
ret.resize(count);
return ret;
}
rdcarray<SamplerDescriptor> D3D12Replay::GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<SamplerDescriptor> ret;
ret.resize(count);
return ret;
}
void D3D12Replay::RenderHighlightBox(float w, float h, float scale)
{
OutputWindow &outw = m_OutputWindows[m_CurrentOutputWindow];
+4
View File
@@ -138,6 +138,10 @@ public:
m_D3D12PipelineState = d3d12;
}
void SavePipelineState(uint32_t eventId);
rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
rdcarray<SamplerDescriptor> GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
void FreeTargetResource(ResourceId id);
void FreeCustomShader(ResourceId id);
+22
View File
@@ -2120,6 +2120,28 @@ void GLReplay::SavePipelineState(uint32_t eventId)
pipe.hints.polySmoothingEnabled = rs.Enabled[GLRenderState::eEnabled_PolySmooth];
}
rdcarray<Descriptor> GLReplay::GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<Descriptor> ret;
ret.resize(count);
return ret;
}
rdcarray<SamplerDescriptor> GLReplay::GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<SamplerDescriptor> ret;
ret.resize(count);
return ret;
}
void GLReplay::OpenGLFillCBufferVariables(ResourceId shader, GLuint prog, bool bufferBacked,
rdcstr prefix, const rdcarray<ShaderConstant> &variables,
rdcarray<ShaderVariable> &outvars,
+4
View File
@@ -160,6 +160,10 @@ public:
m_GLPipelineState = gl;
}
void SavePipelineState(uint32_t eventId);
rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
rdcarray<SamplerDescriptor> GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
void FreeTargetResource(ResourceId id);
RDResult ReadLogInitialisation(RDCFile *rdc, bool storeStructuredBuffers);
+22
View File
@@ -2364,6 +2364,28 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
}
}
rdcarray<Descriptor> VulkanReplay::GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<Descriptor> ret;
ret.resize(count);
return ret;
}
rdcarray<SamplerDescriptor> VulkanReplay::GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<SamplerDescriptor> ret;
ret.resize(count);
return ret;
}
void VulkanReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, ShaderStage stage,
rdcstr entryPoint, uint32_t cbufSlot,
rdcarray<ShaderVariable> &outvars, const bytebuf &data)
+4
View File
@@ -349,6 +349,10 @@ public:
m_VulkanPipelineState = vk;
}
void SavePipelineState(uint32_t eventId);
rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
rdcarray<SamplerDescriptor> GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
void FreeTargetResource(ResourceId id);
RDResult ReadLogInitialisation(RDCFile *rdc, bool storeStructuredBuffers);
+22
View File
@@ -143,6 +143,28 @@ void DummyDriver::SavePipelineState(uint32_t eventId)
{
}
rdcarray<Descriptor> DummyDriver::GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<Descriptor> ret;
ret.resize(count);
return ret;
}
rdcarray<SamplerDescriptor> DummyDriver::GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
size_t count = 0;
for(const DescriptorRange &r : ranges)
count += r.count;
rdcarray<SamplerDescriptor> ret;
ret.resize(count);
return ret;
}
FrameRecord DummyDriver::GetFrameRecord()
{
return m_FrameRecord;
+4
View File
@@ -60,6 +60,10 @@ public:
void SetPipelineStates(D3D11Pipe::State *d3d11, D3D12Pipe::State *d3d12, GLPipe::State *gl,
VKPipe::State *vk);
void SavePipelineState(uint32_t eventId);
rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
rdcarray<SamplerDescriptor> GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
FrameRecord GetFrameRecord();
+11
View File
@@ -1054,6 +1054,16 @@ void DoSerialise(SerialiserType &ser, ColorBlend &el)
SIZE_CHECK(32);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, DescriptorRange &el)
{
SERIALISE_MEMBER(offset);
SERIALISE_MEMBER(descriptorSize);
SERIALISE_MEMBER(count);
SIZE_CHECK(12);
}
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, Descriptor &el)
{
@@ -2542,6 +2552,7 @@ INSTANTIATE_SERIALISE_TYPE(CounterValue)
INSTANTIATE_SERIALISE_TYPE(GPUDevice)
INSTANTIATE_SERIALISE_TYPE(ReplayOptions)
INSTANTIATE_SERIALISE_TYPE(DebugPixelInputs)
INSTANTIATE_SERIALISE_TYPE(DescriptorRange)
INSTANTIATE_SERIALISE_TYPE(Descriptor)
INSTANTIATE_SERIALISE_TYPE(SamplerDescriptor)
INSTANTIATE_SERIALISE_TYPE(D3D11Pipe::Layout)
+16
View File
@@ -123,6 +123,22 @@ const PipeState &ReplayController::GetPipelineState()
return m_PipeState;
}
rdcarray<Descriptor> ReplayController::GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges)
{
CHECK_REPLAY_THREAD();
return m_pDevice->GetDescriptors(m_pDevice->GetLiveID(descriptorStore), ranges);
}
rdcarray<SamplerDescriptor> ReplayController::GetSamplerDescriptors(
ResourceId descriptorStore, const rdcarray<DescriptorRange> &ranges)
{
CHECK_REPLAY_THREAD();
return m_pDevice->GetSamplerDescriptors(m_pDevice->GetLiveID(descriptorStore), ranges);
}
rdcarray<rdcstr> ReplayController::GetDisassemblyTargets(bool withPipeline)
{
CHECK_REPLAY_THREAD();
+4
View File
@@ -150,6 +150,10 @@ public:
const GLPipe::State *GetGLPipelineState();
const VKPipe::State *GetVulkanPipelineState();
const PipeState &GetPipelineState();
rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
rdcarray<SamplerDescriptor> GetSamplerDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges);
rdcarray<rdcstr> GetDisassemblyTargets(bool withPipeline);
rdcstr DisassembleShader(ResourceId pipeline, const ShaderReflection *refl, const rdcstr &target);
+5
View File
@@ -162,6 +162,11 @@ public:
GLPipe::State *gl, VKPipe::State *vk) = 0;
virtual void SavePipelineState(uint32_t eventId) = 0;
virtual rdcarray<Descriptor> GetDescriptors(ResourceId descriptorStore,
const rdcarray<DescriptorRange> &ranges) = 0;
virtual rdcarray<SamplerDescriptor> GetSamplerDescriptors(
ResourceId descriptorStore, const rdcarray<DescriptorRange> &ranges) = 0;
virtual FrameRecord GetFrameRecord() = 0;
virtual RDResult ReadLogInitialisation(RDCFile *rdc, bool storeStructuredBuffers) = 0;