A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
// SPDX-FileCopyrightText: 2025 Jorrit Rouwe
// SPDX-License-Identifier: MIT
#include <Jolt/Jolt.h>
#ifdef JPH_USE_MTL
#include <Jolt/Compute/MTL/ComputeShaderMTL.h>
JPH_NAMESPACE_BEGIN
ComputeShaderMTL::ComputeShaderMTL(id<MTLComputePipelineState> inPipelineState, MTLComputePipelineReflection *inReflection, uint32 inGroupSizeX, uint32 inGroupSizeY, uint32 inGroupSizeZ) :
ComputeShader(inGroupSizeX, inGroupSizeY, inGroupSizeZ),
mPipelineState(inPipelineState)
{
for (id<MTLBinding> binding in inReflection.bindings)
{
const char *name = [binding.name UTF8String];
uint index = uint(binding.index);
mNameToBindingIndex[name] = index;
}
}
uint ComputeShaderMTL::NameToBindingIndex(const char *inName) const
{
UnorderedMap<String, uint>::const_iterator it = mNameToBindingIndex.find(inName);
JPH_ASSERT(it != mNameToBindingIndex.end());
return it->second;
}
JPH_NAMESPACE_END
#endif // JPH_USE_MTL