mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 21:10:42 +00:00
MTLComputePipelineDescriptor
Pipeline Descriptor Correction
This commit is contained in:
committed by
Jake Turner
parent
115d27a028
commit
e6b8b380d4
@@ -387,6 +387,27 @@ void DoSerialise(SerialiserType &ser, RDMTL::ComputePassSampleBufferAttachmentDe
|
||||
SERIALISE_MEMBER(endOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, RDMTL::ComputePipelineDescriptor &el)
|
||||
{
|
||||
SERIALISE_MEMBER(label);
|
||||
SERIALISE_MEMBER(computeFunction);
|
||||
SERIALISE_MEMBER(threadGroupSizeIsMultipleOfThreadExecution);
|
||||
SERIALISE_MEMBER(maxTotalThreadsPerThreadgroup);
|
||||
SERIALISE_MEMBER(maxCallStackDepth);
|
||||
SERIALISE_MEMBER(stageInputDescriptor);
|
||||
SERIALISE_MEMBER(buffers);
|
||||
SERIALISE_MEMBER(supportIndirectCommandBuffers);
|
||||
// TODO: when WrappedMTLDynamicLibrary exists
|
||||
// SERIALISE_MEMBER(preloadedLibraries);
|
||||
// Deprecated
|
||||
// SERIALISE_MEMBER(insertLibraries);
|
||||
SERIALISE_MEMBER(linkedFunctions);
|
||||
SERIALISE_MEMBER(supportAddingBinaryFunctions);
|
||||
// TODO: when WrappedMTLBinaryArchive exists
|
||||
// SERIALISE_MEMBER(binaryArchives);
|
||||
}
|
||||
|
||||
INSTANTIATE_SERIALISE_TYPE(NS::String *);
|
||||
INSTANTIATE_SERIALISE_TYPE(NS::Range)
|
||||
INSTANTIATE_SERIALISE_TYPE(MTL::TextureSwizzleChannels);
|
||||
@@ -414,3 +435,4 @@ INSTANTIATE_SERIALISE_TYPE(RDMTL::RenderPassDepthAttachmentDescriptor);
|
||||
INSTANTIATE_SERIALISE_TYPE(RDMTL::RenderPassStencilAttachmentDescriptor);
|
||||
INSTANTIATE_SERIALISE_TYPE(RDMTL::RenderPassDescriptor);
|
||||
INSTANTIATE_SERIALISE_TYPE(RDMTL::ComputePassSampleBufferAttachmentDescriptor);
|
||||
INSTANTIATE_SERIALISE_TYPE(RDMTL::ComputePipelineDescriptor);
|
||||
|
||||
@@ -681,4 +681,54 @@ void ComputePassSampleBufferAttachmentDescriptor::CopyTo(
|
||||
objc->setEndOfEncoderSampleIndex(endOfEncoderSampleIndex);
|
||||
}
|
||||
|
||||
ComputePipelineDescriptor::ComputePipelineDescriptor(MTL::ComputePipelineDescriptor *objc)
|
||||
: computeFunction(GetWrapped(objc->computeFunction())),
|
||||
threadGroupSizeIsMultipleOfThreadExecution(
|
||||
objc->threadGroupSizeIsMultipleOfThreadExecutionWidth()),
|
||||
maxTotalThreadsPerThreadgroup(objc->maxTotalThreadsPerThreadgroup()),
|
||||
maxCallStackDepth(objc->maxCallStackDepth()),
|
||||
stageInputDescriptor(objc->stageInputDescriptor()),
|
||||
supportIndirectCommandBuffers(objc->supportIndirectCommandBuffers()),
|
||||
linkedFunctions(objc->linkedFunctions()),
|
||||
supportAddingBinaryFunctions(objc->supportAddingBinaryFunctions())
|
||||
{
|
||||
if(objc->label())
|
||||
label.assign(objc->label()->utf8String());
|
||||
GETOBJCARRAY(PipelineBufferDescriptor, MAX_COMPUTE_PASS_BUFFER_ATTACHMENTS, buffers, ValidData);
|
||||
// TODO: when WrappedMTLDynamicLibrary exists
|
||||
// GETWRAPPEDNSARRAY(DynamicLibrary, preloadedLibraries)
|
||||
// Deprecated
|
||||
// GETWRAPPEDNSARRAY(DynamicLibrary, insertLibraries)
|
||||
// GETWRAPPEDNSARRAY(DynamicLibrary, linkedFunctions)
|
||||
// TODO: when WrappedMTLBinaryArchive exists
|
||||
// GETWRAPPEDNSARRAY(BinaryArchive, binaryArchives);
|
||||
}
|
||||
|
||||
ComputePipelineDescriptor::operator MTL::ComputePipelineDescriptor *()
|
||||
{
|
||||
MTL::ComputePipelineDescriptor *objc = MTL::ComputePipelineDescriptor::alloc()->init();
|
||||
if(label.length() > 0)
|
||||
{
|
||||
objc->setLabel(NS::String::string(label.data(), NS::UTF8StringEncoding));
|
||||
}
|
||||
objc->setComputeFunction(Unwrap(computeFunction));
|
||||
objc->setThreadGroupSizeIsMultipleOfThreadExecutionWidth(threadGroupSizeIsMultipleOfThreadExecution);
|
||||
objc->setMaxTotalThreadsPerThreadgroup(maxTotalThreadsPerThreadgroup);
|
||||
objc->setMaxCallStackDepth(maxCallStackDepth);
|
||||
stageInputDescriptor.CopyTo(objc->stageInputDescriptor());
|
||||
objc->setSupportIndirectCommandBuffers(supportIndirectCommandBuffers);
|
||||
linkedFunctions.CopyTo(objc->linkedFunctions());
|
||||
objc->setSupportAddingBinaryFunctions(supportAddingBinaryFunctions);
|
||||
COPYTOOBJCARRAY(PipelineBufferDescriptor, buffers);
|
||||
// TODO: when WrappedMTLDynamicLibrary exists
|
||||
// objc->setPreloadedLibraries(CreateUnwrappedNSArray<MTL::DynamicLibrary *>(preloadedLibraries));
|
||||
// Deprecated
|
||||
// objc->setInsertLibraries(CreateUnwrappedNSArray<MTL::DynamicLibrary *>(insertLibraries));
|
||||
// objc->setLinkedFunctions(CreateUnwrappedNSArray<MTL::DynamicLibrary *>(linkedFunctions));
|
||||
// TODO: when WrappedMTLBinaryArchive exists
|
||||
// objc->setBinaryArchives(CreateUnwrappedNSArray<MTL::BinaryArchive *>(binaryArchives));
|
||||
// GETWRAPPEDNSARRAY(BinaryArchive, binaryArchives);
|
||||
return objc;
|
||||
}
|
||||
|
||||
} // namespace RDMTL
|
||||
|
||||
@@ -487,6 +487,31 @@ struct ComputePassSampleBufferAttachmentDescriptor
|
||||
NS::UInteger endOfEncoderSampleIndex = MTLCounterDontSample;
|
||||
};
|
||||
|
||||
// MTLComputePipelineDescriptor : based on the interface defined in
|
||||
// Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLComputePipeline.h
|
||||
struct ComputePipelineDescriptor
|
||||
{
|
||||
ComputePipelineDescriptor() = default;
|
||||
ComputePipelineDescriptor(MTL::ComputePipelineDescriptor *objc);
|
||||
explicit operator MTL::ComputePipelineDescriptor *();
|
||||
rdcstr label;
|
||||
WrappedMTLFunction *computeFunction = NULL;
|
||||
bool threadGroupSizeIsMultipleOfThreadExecution = false;
|
||||
NS::UInteger maxTotalThreadsPerThreadgroup = 0;
|
||||
NS::UInteger maxCallStackDepth = 1;
|
||||
StageInputOutputDescriptor stageInputDescriptor;
|
||||
rdcarray<RDMTL::PipelineBufferDescriptor> buffers;
|
||||
bool supportIndirectCommandBuffers = false;
|
||||
// TODO: when WrappedMTLDynamicLibrary exists
|
||||
// rdcarray<WrappedMTLDynamicLibrary*> preloadedLibraries;
|
||||
// Deprecated
|
||||
// rdcarray<WrappedMTLDynamicLibrary*> insertLibraries;
|
||||
RDMTL::LinkedFunctions linkedFunctions;
|
||||
bool supportAddingBinaryFunctions = false;
|
||||
// TODO: when WrappedMTLBinaryArchive exists
|
||||
// rdcarray<WrappedMTLBinaryArchive*> binaryArchives;
|
||||
};
|
||||
|
||||
} // namespace RDMTL
|
||||
|
||||
template <>
|
||||
@@ -525,3 +550,4 @@ RDMTL_DECLARE_REFLECTION_STRUCT(RenderPassStencilAttachmentDescriptor);
|
||||
RDMTL_DECLARE_REFLECTION_STRUCT(RenderPassSampleBufferAttachmentDescriptor);
|
||||
RDMTL_DECLARE_REFLECTION_STRUCT(RenderPassDescriptor);
|
||||
RDMTL_DECLARE_REFLECTION_STRUCT(ComputePassSampleBufferAttachmentDescriptor);
|
||||
RDMTL_DECLARE_REFLECTION_STRUCT(ComputePipelineDescriptor);
|
||||
|
||||
Reference in New Issue
Block a user