public MTLResourceLayout(ref ResourceLayoutDescription description, MTLGraphicsDevice gd) : base(ref description) { ResourceLayoutElementDescription[] elements = description.Elements; #if !VALIDATE_USAGE ResourceKinds = new ResourceKind[elements.Length]; for (int i = 0; i < elements.Length; i++) { ResourceKinds[i] = elements[i].Kind; } #endif _bindingInfosByVdIndex = new ResourceBindingInfo[elements.Length]; uint bufferIndex = 0; uint texIndex = 0; uint samplerIndex = 0; for (int i = 0; i < _bindingInfosByVdIndex.Length; i++) { uint slot; switch (elements[i].Kind) { case ResourceKind.UniformBuffer: slot = bufferIndex++; break; case ResourceKind.StructuredBufferReadOnly: slot = bufferIndex++; break; case ResourceKind.StructuredBufferReadWrite: slot = bufferIndex++; break; case ResourceKind.TextureReadOnly: slot = texIndex++; break; case ResourceKind.TextureReadWrite: slot = texIndex++; break; case ResourceKind.Sampler: slot = samplerIndex++; break; default: throw Illegal.Value <ResourceKind>(); } _bindingInfosByVdIndex[i] = new ResourceBindingInfo(slot, elements[i].Stages, elements[i].Kind); } BufferCount = bufferIndex; TextureCount = texIndex; SamplerCount = samplerIndex; }
internal BackendInfoMetal(MTLGraphicsDevice gd) { _gd = gd; _featureSet = new ReadOnlyCollection <MTLFeatureSet>(_gd.MetalFeatures.ToArray()); }
public MTLResourceSet(ref ResourceSetDescription description, MTLGraphicsDevice gd) : base(ref description) { Resources = Util.ShallowClone(description.BoundResources); Layout = Util.AssertSubtype <ResourceLayout, MTLResourceLayout>(description.Layout); }