private void PlatformConstruct( GraphicsDevice graphicsDevice, ResourceUploadBatch uploadBatch, PixelFormat pixelFormat, int width, int height, TextureMipMapData[] mipMapData) { var textureDescriptor = MTLTextureDescriptor.CreateTexture2DDescriptor( pixelFormat.ToMTLPixelFormat(), (nuint)width, (nuint)height, true); // Ignored, because we'll set the mip level count explicitly below. textureDescriptor.Usage = MTLTextureUsage.ShaderRead; textureDescriptor.MipmapLevelCount = (nuint)mipMapData.Length; _originalPixelFormat = pixelFormat; DeviceTexture = AddDisposable(graphicsDevice.Device.CreateTexture(textureDescriptor)); for (var i = 0; i < mipMapData.Length; i++) { SetData( i, mipMapData[i].Data, mipMapData[i].BytesPerRow); } }
private void PlatformConstruct <T>( GraphicsDevice graphicsDevice, ResourceUploadBatch uploadBatch, T[] data, uint dataSizeInBytes) where T : struct { DeviceBuffer = AddDisposable(graphicsDevice.Device.CreateBuffer( data, MTLResourceOptions.CpuCacheModeDefault)); }