Skip to content

Commit

Permalink
Merge pull request #1 from AntarticCoder/address-map
Browse files Browse the repository at this point in the history
Implement new address map for buffers
  • Loading branch information
AntarticCoder authored Jul 31, 2024
2 parents 4dea75c + abcf618 commit 043deba
Show file tree
Hide file tree
Showing 14 changed files with 658 additions and 502 deletions.
30 changes: 20 additions & 10 deletions MoltenVK/MoltenVK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
014702732A5857600040D02D /* MVKCmdAccelerationStructure.mm in Sources */ = {isa = PBXBuildFile; fileRef = 014702722A5857600040D02D /* MVKCmdAccelerationStructure.mm */; };
014702742A5857600040D02D /* MVKCmdAccelerationStructure.mm in Sources */ = {isa = PBXBuildFile; fileRef = 014702722A5857600040D02D /* MVKCmdAccelerationStructure.mm */; };
014702752A5857600040D02D /* MVKCmdAccelerationStructure.mm in Sources */ = {isa = PBXBuildFile; fileRef = 014702722A5857600040D02D /* MVKCmdAccelerationStructure.mm */; };
0147027B2A5B0C010040D02D /* MVKMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0147027A2A5AF1310040D02D /* MVKMap.h */; };
0147027C2A5B0C010040D02D /* MVKMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0147027A2A5AF1310040D02D /* MVKMap.h */; };
0147027D2A5B0C020040D02D /* MVKMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0147027A2A5AF1310040D02D /* MVKMap.h */; };
0197951B2A56F8AF00C6CAD0 /* MVKAccelerationStructure.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0197951A2A56F8AF00C6CAD0 /* MVKAccelerationStructure.mm */; };
0197951C2A56F8AF00C6CAD0 /* MVKAccelerationStructure.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0197951A2A56F8AF00C6CAD0 /* MVKAccelerationStructure.mm */; };
0197951D2A56F8AF00C6CAD0 /* MVKAccelerationStructure.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0197951A2A56F8AF00C6CAD0 /* MVKAccelerationStructure.mm */; };
1155DEB12C50C1BC009D70F8 /* MVKAddressMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1155DEAF2C50C1BC009D70F8 /* MVKAddressMap.h */; };
1155DEB22C50C1BC009D70F8 /* MVKAddressMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1155DEAF2C50C1BC009D70F8 /* MVKAddressMap.h */; };
1155DEB32C50C1BC009D70F8 /* MVKAddressMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1155DEAF2C50C1BC009D70F8 /* MVKAddressMap.h */; };
1155DEB42C50C1BC009D70F8 /* MVKAddressMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1155DEAF2C50C1BC009D70F8 /* MVKAddressMap.h */; };
1155DEB52C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1155DEB02C50C1BC009D70F8 /* MVKAddressMap.cpp */; };
1155DEB62C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1155DEB02C50C1BC009D70F8 /* MVKAddressMap.cpp */; };
1155DEB72C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1155DEB02C50C1BC009D70F8 /* MVKAddressMap.cpp */; };
1155DEB82C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1155DEB02C50C1BC009D70F8 /* MVKAddressMap.cpp */; };
2FEA0A4124902F9F00EEF3AD /* MVKExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = A909F65A213B190600FCD6BE /* MVKExtensions.h */; };
2FEA0A4224902F9F00EEF3AD /* vk_mvk_moltenvk.h in Headers */ = {isa = PBXBuildFile; fileRef = A94FB7691C7DFB4800632CA3 /* vk_mvk_moltenvk.h */; };
2FEA0A4324902F9F00EEF3AD /* mvk_datatypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A94FB7671C7DFB4800632CA3 /* mvk_datatypes.h */; };
Expand Down Expand Up @@ -665,10 +670,10 @@
/* Begin PBXFileReference section */
014702702A5855F70040D02D /* MVKCmdAccelerationStructure.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVKCmdAccelerationStructure.h; sourceTree = "<group>"; };
014702722A5857600040D02D /* MVKCmdAccelerationStructure.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCmdAccelerationStructure.mm; sourceTree = "<group>"; };
0147027A2A5AF1310040D02D /* MVKMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVKMap.h; sourceTree = "<group>"; };
0147027E2A5B0C9A0040D02D /* MVKMapAllocator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVKMapAllocator.h; sourceTree = "<group>"; };
019795132A5304D600C6CAD0 /* MVKAccelerationStructure.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVKAccelerationStructure.h; sourceTree = "<group>"; };
0197951A2A56F8AF00C6CAD0 /* MVKAccelerationStructure.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKAccelerationStructure.mm; sourceTree = "<group>"; };
1155DEAF2C50C1BC009D70F8 /* MVKAddressMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKAddressMap.h; sourceTree = "<group>"; };
1155DEB02C50C1BC009D70F8 /* MVKAddressMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MVKAddressMap.cpp; sourceTree = "<group>"; };
2FEA0ABA24902F9F00EEF3AD /* libMoltenVK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMoltenVK.a; sourceTree = BUILT_PRODUCTS_DIR; };
45003E6F214AD4C900E989CB /* MVKExtensions.def */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = MVKExtensions.def; sourceTree = "<group>"; };
4536382D2508A4C6000EFFD3 /* MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MTLRenderPassStencilAttachmentDescriptor+MoltenVK.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1045,6 +1050,8 @@
A98149401FB6A3F7005F00B4 /* Utility */ = {
isa = PBXGroup;
children = (
1155DEB02C50C1BC009D70F8 /* MVKAddressMap.cpp */,
1155DEAF2C50C1BC009D70F8 /* MVKAddressMap.h */,
A98149421FB6A3F7005F00B4 /* MVKBaseObject.h */,
A98149411FB6A3F7005F00B4 /* MVKBaseObject.mm */,
A9D7104E25CDE05E00E38106 /* MVKBitArray.h */,
Expand All @@ -1060,8 +1067,6 @@
A98149441FB6A3F7005F00B4 /* MVKFoundation.h */,
A9AB95292B3EDFCC00C4E967 /* MVKInflectionMap.h */,
A9F0429E1FB4CF82009FCCB8 /* MVKLogging.h */,
0147027A2A5AF1310040D02D /* MVKMap.h */,
0147027E2A5B0C9A0040D02D /* MVKMapAllocator.h */,
A98149461FB6A3F7005F00B4 /* MVKObjectPool.h */,
A9F3D9DB24732A4D00745190 /* MVKSmallVector.h */,
A9F3D9D924732A4C00745190 /* MVKSmallVectorAllocator.h */,
Expand Down Expand Up @@ -1223,6 +1228,7 @@
2FEA0A6224902F9F00EEF3AD /* MVKMTLBufferAllocation.h in Headers */,
2FEA0A6324902F9F00EEF3AD /* MVKObjectPool.h in Headers */,
2FEA0A6424902F9F00EEF3AD /* MVKSwapchain.h in Headers */,
1155DEB32C50C1BC009D70F8 /* MVKAddressMap.h in Headers */,
2FEA0A6524902F9F00EEF3AD /* MVKGPUCapture.h in Headers */,
2FEA0A6624902F9F00EEF3AD /* MVKBuffer.h in Headers */,
2FEA0A6724902F9F00EEF3AD /* MVKCommonEnvironment.h in Headers */,
Expand All @@ -1239,7 +1245,6 @@
2FEA0A7224902F9F00EEF3AD /* MVKCmdDraw.h in Headers */,
A9B3D73C29F9B3B100745CD4 /* mvk_deprecated_api.h in Headers */,
2FEA0A7324902F9F00EEF3AD /* MVKCommandBuffer.h in Headers */,
0147027C2A5B0C010040D02D /* MVKMap.h in Headers */,
2FEA0A7424902F9F00EEF3AD /* MTLRenderPassDescriptor+MoltenVK.h in Headers */,
2FEA0A7524902F9F00EEF3AD /* MVKCmdDebug.h in Headers */,
2FEA0A7624902F9F00EEF3AD /* MVKWatermarkTextureContent.h in Headers */,
Expand Down Expand Up @@ -1303,9 +1308,9 @@
A94FB80C1C7DFB4800632CA3 /* MVKShaderModule.h in Headers */,
A9AB952B2B3EDFCC00C4E967 /* MVKInflectionMap.h in Headers */,
A99C91042295FAC600A061DA /* MVKVulkanAPIObject.h in Headers */,
0147027B2A5B0C010040D02D /* MVKMap.h in Headers */,
A94FB7C01C7DFB4800632CA3 /* MVKCmdQueries.h in Headers */,
A9B3D73B29F9B3B100745CD4 /* mvk_deprecated_api.h in Headers */,
1155DEB22C50C1BC009D70F8 /* MVKAddressMap.h in Headers */,
A94FB7CC1C7DFB4800632CA3 /* MVKCommand.h in Headers */,
A981494F1FB6A3F7005F00B4 /* MVKBaseObject.h in Headers */,
A9C96DD01DDC20C20053187F /* MVKMTLBufferAllocation.h in Headers */,
Expand Down Expand Up @@ -1384,9 +1389,9 @@
A99C91052295FAC600A061DA /* MVKVulkanAPIObject.h in Headers */,
A9AB952D2B3EDFCC00C4E967 /* MVKInflectionMap.h in Headers */,
A94FB7C11C7DFB4800632CA3 /* MVKCmdQueries.h in Headers */,
0147027D2A5B0C020040D02D /* MVKMap.h in Headers */,
A94FB7CD1C7DFB4800632CA3 /* MVKCommand.h in Headers */,
A9B3D73D29F9B3B100745CD4 /* mvk_deprecated_api.h in Headers */,
1155DEB12C50C1BC009D70F8 /* MVKAddressMap.h in Headers */,
A98149501FB6A3F7005F00B4 /* MVKBaseObject.h in Headers */,
A9C96DD11DDC20C20053187F /* MVKMTLBufferAllocation.h in Headers */,
A98149581FB6A3F7005F00B4 /* MVKObjectPool.h in Headers */,
Expand Down Expand Up @@ -1507,6 +1512,7 @@
DCFD7F0F2A45BC6E007BBBF7 /* MVKCmdPipeline.h in Headers */,
DCFD7F102A45BC6E007BBBF7 /* MVKSmallVectorAllocator.h in Headers */,
DCFD7F112A45BC6E007BBBF7 /* MVKPipeline.h in Headers */,
1155DEB42C50C1BC009D70F8 /* MVKAddressMap.h in Headers */,
DCFD7F122A45BC6E007BBBF7 /* MVKImage.h in Headers */,
DCFD7F132A45BC6E007BBBF7 /* MVKBlockObserver.h in Headers */,
DCFD7F142A45BC6E007BBBF7 /* MVKCmdTransfer.h in Headers */,
Expand Down Expand Up @@ -2097,6 +2103,7 @@
2FEA0A9324902F9F00EEF3AD /* MVKImage.mm in Sources */,
2FEA0A9424902F9F00EEF3AD /* MVKCommandPool.mm in Sources */,
2FEA0A9524902F9F00EEF3AD /* MVKCmdDraw.mm in Sources */,
1155DEB72C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */,
2FEA0A9624902F9F00EEF3AD /* MVKCommandBuffer.mm in Sources */,
2FEA0A9724902F9F00EEF3AD /* MVKCmdRendering.mm in Sources */,
2FEA0A9824902F9F00EEF3AD /* MVKBuffer.mm in Sources */,
Expand Down Expand Up @@ -2200,6 +2207,7 @@
A9C96DD21DDC20C20053187F /* MVKMTLBufferAllocation.mm in Sources */,
A9E53DE92100B197002781DD /* CAMetalLayer+MoltenVK.mm in Sources */,
A9096E5E1F81E16300DFBEA6 /* MVKCmdDispatch.mm in Sources */,
1155DEB62C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */,
A99C90F0229455B300A061DA /* MVKCmdDebug.mm in Sources */,
45E3A40D2166B923005E3E38 /* MTLRenderPipelineColorAttachmentDescriptor+MoltenVK.m in Sources */,
);
Expand Down Expand Up @@ -2263,6 +2271,7 @@
A9C96DD31DDC20C20053187F /* MVKMTLBufferAllocation.mm in Sources */,
A9E53DEA2100B197002781DD /* CAMetalLayer+MoltenVK.mm in Sources */,
A9096E5F1F81E16300DFBEA6 /* MVKCmdDispatch.mm in Sources */,
1155DEB52C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */,
A99C90F1229455B300A061DA /* MVKCmdDebug.mm in Sources */,
45E3A40E2166B923005E3E38 /* MTLRenderPipelineColorAttachmentDescriptor+MoltenVK.m in Sources */,
);
Expand Down Expand Up @@ -2318,6 +2327,7 @@
DCFD7F372A45BC6E007BBBF7 /* MVKInstance.mm in Sources */,
DCFD7F382A45BC6E007BBBF7 /* MVKDeviceMemory.mm in Sources */,
DCFD7F392A45BC6E007BBBF7 /* MVKImage.mm in Sources */,
1155DEB82C50C1BC009D70F8 /* MVKAddressMap.cpp in Sources */,
DCFD7F3A2A45BC6E007BBBF7 /* MVKCommandPool.mm in Sources */,
DCFD7F3B2A45BC6E007BBBF7 /* MVKCmdDraw.mm in Sources */,
DCFD7F3C2A45BC6E007BBBF7 /* MVKCommandBuffer.mm in Sources */,
Expand Down
13 changes: 9 additions & 4 deletions MoltenVK/MoltenVK/Commands/MVKCmdAccelerationStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "MVKDevice.h"
#include "MVKCommand.h"
#include "MVKSmallVector.h"

#import <Metal/Metal.h>
#import <Metal/MTLAccelerationStructure.h>
Expand All @@ -37,13 +38,17 @@ class MVKCmdBuildAccelerationStructure : public MVKCommand {
const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos);

void encode(MVKCommandEncoder* cmdEncoder) override;
protected:
struct MVKAccelerationStructureBuildInfo
{
VkAccelerationStructureBuildGeometryInfoKHR info;
MVKSmallVector<VkAccelerationStructureGeometryKHR, 3> geometries;
MVKSmallVector<VkAccelerationStructureBuildRangeInfoKHR, 3> ranges;
};
protected:
MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;

MVKDevice* _mvkDevice;
uint32_t _infoCount;
VkAccelerationStructureBuildGeometryInfoKHR* _geometryInfos;
VkAccelerationStructureBuildRangeInfoKHR const* _buildRangeInfos;
MVKSmallVector<MVKAccelerationStructureBuildInfo, 1> _buildInfos;
};

#pragma mark -
Expand Down
Loading

0 comments on commit 043deba

Please sign in to comment.