public AmtDevice(IMTLDevice systemDefault, IAmtDeviceQuery mQuery, IAmtMetalLibraryLoader generator, AmtQueue queue) { this.mDevice = systemDefault; this.mQuery = mQuery; this.mGenerator = generator; mQueue = queue; }
public AmtGraphicsPipeline(IAmtMetalLibraryLoader generator, IMTLDevice device, MgGraphicsPipelineCreateInfo info) { var layout = (AmtPipelineLayout)info.Layout; if (layout == null) { throw new ArgumentException(nameof(info.Layout)); } Layout = layout; if (info.VertexInputState == null) { throw new ArgumentNullException(nameof(info.VertexInputState)); } if (info.InputAssemblyState == null) { throw new ArgumentNullException(nameof(info.InputAssemblyState)); } if (info.RasterizationState == null) { throw new ArgumentNullException(nameof(info.RasterizationState)); } // TODO : WHY DO I NEED RENDERPASS HERE if (info.RenderPass == null) { throw new ArgumentNullException(nameof(info.RenderPass)); } RenderPass = (AmtRenderPass)info.RenderPass; CompatibilityProfile = RenderPass.Profile; InitializeShaderFunctions(generator, device, info.Stages); InitializeVertexDescriptor(info.VertexInputState); InitiailizeDepthStateDescriptor(info.DepthStencilState); InitializeRasterization(info.RasterizationState); InitializationInputAssembly(info.InputAssemblyState); InitializeColorBlending(info.ColorBlendState); InitializeDynamicStates(info.DynamicState); InitializeResources(info.VertexInputState); InitializeViewportAndScissor(info.ViewportState); InitializeMultisampleInfo(info.MultisampleState); GeneratePipelineStates(device); }
private void InitializeShaderFunctions(IAmtMetalLibraryLoader generator, IMTLDevice device, MgPipelineShaderStageCreateInfo[] stages) { IMTLFunction frag = null; IMTLFunction vert = null; foreach (var stage in stages) { IMTLFunction shaderFunc = null; var module = (AmtShaderModule)stage.Module; Debug.Assert(module != null); // LIBRARY : can't store function unless name matches if (module.Library != null) { shaderFunc = module.Library.CreateFunction(stage.Name); } else { using (var ms = new MemoryStream()) { module.Info.Code.CopyTo(ms, (int)module.Info.CodeSize.ToUInt32()); ms.Seek(0, SeekOrigin.Begin); module.Library = generator.LoadLibrary(device, ms); } } shaderFunc = module.Library.CreateFunction(stage.Name); Debug.Assert(shaderFunc != null); if (stage.Stage == MgShaderStageFlagBits.VERTEX_BIT) { vert = shaderFunc; } else if (stage.Stage == MgShaderStageFlagBits.FRAGMENT_BIT) { frag = shaderFunc; } } VertexFunction = vert; FragmentFunction = frag; }
public AmtEntrypoint(IAmtDeviceQuery query, IAmtMetalLibraryLoader generator, IMTLDevice localDevice) { mQuery = query; mLocalDevice = localDevice; mGenerator = generator; }