diff --git a/Sources/GateEngine/System/Rendering/Platforms/Metal/MetalRenderer.swift b/Sources/GateEngine/System/Rendering/Platforms/Metal/MetalRenderer.swift index 3ba07f04..50d2322d 100644 --- a/Sources/GateEngine/System/Rendering/Platforms/Metal/MetalRenderer.swift +++ b/Sources/GateEngine/System/Rendering/Platforms/Metal/MetalRenderer.swift @@ -24,9 +24,11 @@ class MetalRenderer: RendererBackend { struct ShaderKey: Hashable { let vshID: VertexShader.ID let fshID: FragmentShader.ID - init(vsh: VertexShader, fsh: FragmentShader) { + let attributes: ContiguousArray + init(vsh: VertexShader, fsh: FragmentShader, attributes: ContiguousArray) { self.vshID = vsh.id self.fshID = fsh.id + self.attributes = attributes } } struct MetalShader { @@ -332,13 +334,13 @@ extension MetalRenderer { geometries: [MetalGeometry], flags: DrawFlags ) -> MetalShader { - let key = ShaderKey(vsh: vsh, fsh: fsh) + let attributes = MetalGeometry.shaderAttributes(from: geometries) + let key = ShaderKey(vsh: vsh, fsh: fsh, attributes: attributes) if let existing = _shaders[key] { return existing } do { let generator = MSLCodeGenerator() - let attributes = MetalGeometry.shaderAttributes(from: geometries) let source = try generator.generateShaderCode( vertexShader: vsh, fragmentShader: fsh,