public VulkanExample ( IMgGraphicsConfiguration configuration, IMgSwapchainCollection swapchains, IMgGraphicsDevice graphicsDevice, IMgPresentationLayer presentationLayer, ITriangleDemoShaderPath shaderPath ) { mConfiguration = configuration; mSwapchains = swapchains; mGraphicsDevice = graphicsDevice; mPresentationLayer = presentationLayer; mTrianglePath = shaderPath; mWidth = 1280U; mHeight = 720U; try { mConfiguration.Initialize(mWidth, mHeight); InitSwapchain(mWidth, mHeight); Prepare(); } catch (Exception ex) { throw ex; } }
public MgSwapchainCollection(IMgPresentationSurface layer, IMgGraphicsConfiguration graphicsConfiguration, IMgImageTools imageTools) { mLayer = layer; mGraphicsConfiguration = graphicsConfiguration; mImageTools = imageTools; Format = MgFormat.UNDEFINED; }
public MgDefaultGraphicsDevice(IMgGraphicsConfiguration configuration, IMgImageTools imageTools) { mGraphicsConfiguration = configuration; // SHOULD BE HIDDEN mFramebuffers = new MgFramebufferCollection(mGraphicsConfiguration); mImageTools = imageTools; }
public void ReleaseUnmanagedResources(IMgGraphicsConfiguration configuration) { if (mStaticStorage != null) { mStaticStorage.Storage.Destroy(configuration.Device, null); } }
public GltfModelLoader( IMgGraphicsConfiguration config, MgOptimizedStorageBuilder builder ) { mConfiguration = config; mBuilder = builder; }
private bool InitialiseMg() { try { // SINGLETONS HERE var localDevice = MTLDevice.SystemDefault; if (localDevice == null) { Console.WriteLine("Metal is not supported on this device"); return(false); } // APPLICATION HERE mContainer.Register <SpinningCube>(Lifestyle.Singleton); RegisterMagnesiumSingletons(localDevice); RegisterMagnesiumMappings(); // RESOLVE HERE mDriver = mContainer.GetInstance <MgDriverContext>(); var err = mDriver.Initialize( new Magnesium.MgApplicationInfo { ApplicationName = "MetalSample", EngineName = "Magnesium", ApplicationVersion = 1, EngineVersion = 1, ApiVersion = Magnesium.MgApplicationInfo.GenerateApiVersion(1, 0, 17), }, Magnesium.MgInstanceExtensionOptions.ALL ); if (err != Result.SUCCESS) { throw new InvalidOperationException("Metal is not supported on this device : " + err); } mGraphicsConfiguration = mContainer.GetInstance <IMgGraphicsConfiguration>(); mApplication = mContainer.GetInstance <SpinningCube>(); // BIND TO VIEW mApplicationView.Delegate = this; mApplicationView.Device = localDevice; return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } }
public MgOptimizedStorageBuilder( IMgGraphicsConfiguration config, IMgOptimizedStoragePartitioner segmenter, IMgOptimizedStoragePartitionVerifier verifier ) { mConfiguration = config; mSplitter = segmenter; mVerifier = verifier; }
public GltfSceneLoader( IMgGraphicsConfiguration config, MgOptimizedStorageBuilder builder, IPbrEffectPath pbrEffectPath ) { mConfiguration = config; mBuilder = builder; mPbrEffectPath = pbrEffectPath; }
public MgPresentationLayer ( IMgGraphicsConfiguration graphicsConfiguration, IMgSwapchainCollection collection, IMgPresentationBarrierEntrypoint barrier ) { mGraphicsConfiguration = graphicsConfiguration; mCollection = collection; mBarrier = barrier; }
public MgGraphicsConfigurationManager( IMgGraphicsConfiguration configuration, IMgSwapchainCollection swapchains, IMgGraphicsDevice graphicsDevice, IMgPresentationLayer presentationLayer ) { mConfiguration = configuration; mSwapchains = swapchains; mGraphicsDevice = graphicsDevice; mPresentationLayer = presentationLayer; }
public MgOptimizedStoragePartitionVerifier(IMgGraphicsConfiguration configuration) { mConfiguration = configuration; mPackingOrder = new MgBufferUsageFlagBits[] { MgBufferUsageFlagBits.INDEX_BUFFER_BIT , MgBufferUsageFlagBits.UNIFORM_BUFFER_BIT , MgBufferUsageFlagBits.INDIRECT_BUFFER_BIT , MgBufferUsageFlagBits.STORAGE_BUFFER_BIT , MgBufferUsageFlagBits.STORAGE_TEXEL_BUFFER_BIT , MgBufferUsageFlagBits.TRANSFER_DST_BIT , MgBufferUsageFlagBits.TRANSFER_SRC_BIT , MgBufferUsageFlagBits.UNIFORM_TEXEL_BUFFER_BIT , MgBufferUsageFlagBits.VERTEX_BUFFER_BIT }; }
public OpenTKGraphicsDevice( INativeWindow window, IMgGraphicsConfiguration configuration, IGLFramebufferHelperSelector selector, IGLExtensionLookup extensions, IMgGraphicsDeviceLogger logger, IGLRenderer queueRenderer, IGLBackbufferContext bbContext ) { mGraphicsConfiguration = configuration; mView = new GLNullImageView(); mWindow = window; mExtensions = extensions; mLogger = logger; mSelector = selector; mQueueRenderer = queueRenderer; mBBContext = bbContext; // SHOULD BE HIDDEN mFramebuffers = new MgFramebufferCollection(mGraphicsConfiguration); }
public SpinningCube( IMgGraphicsConfiguration configuration, IMgSwapchainCollection swapchains, IMgGraphicsDevice graphicsDevice, IMgPresentationLayer presentationLayer ) { mConfiguration = configuration; mSwapchains = swapchains; mGraphicsDevice = graphicsDevice; mPresentationLayer = presentationLayer; mWidth = 640; mHeight = 480; mConfiguration.Initialize(mWidth, mHeight); SetupGraphicsDevice(); InitializeMesh(); InitializeUniforms(); InitializeRenderCommandBuffers(); InitializeGraphicsPipeline(); }
public KTXTextureManager(IMgTextureGenerator optimizer, IMgGraphicsConfiguration configuration) { mTextureOptimizer = optimizer; mGraphicsConfiguration = configuration; }
public void Prepare(IMgGraphicsConfiguration configuration, IMgGraphicsDevice screen) { var loader = new Loader(); var dataLoader = new DataLoader(); var device = configuration.Device; using (var fs = File.Open("Data/Triangle.gltf", FileMode.Open)) { // load model file var model = glTFLoader.Interface.LoadModel(fs); // load meta data var metaData = loader.LoadMetaData(model); // load data var data = dataLoader.LoadData(".", model); var staticRequest = new MgStorageBlockAllocationRequest(); // allocate partitions for static data // mesh var meshLocations = AllocateMeshes(staticRequest, metaData.Meshes, metaData.Accessors, metaData.BufferViews); var meshPrimitives = ExtractMeshPrimitives(metaData.Materials, out MgtfMaterial[] sceneMaterials, metaData.Meshes, meshLocations); // images var images = ExamineImages(data.Images, data.Buffers); // initialize static data storage var staticCreateInfo = new MgOptimizedStorageCreateInfo { Allocations = staticRequest.ToArray(), }; mStaticStorage = mBuilder.Build(staticCreateInfo); // build static artifacts // render target // descriptor set layout + pipeline layout var pass = new ScenePass { RenderTarget = screen, Effects = new[] { new ScenePassEffect { Factory = mPbrFactory, EffectLayout = mPbrFactory.CreateEffectLayout(configuration.Device), } } }; pass.Initialize( configuration.Device, meshPrimitives, sceneMaterials); // allocate dynamic data var dynamicRequest = new MgStorageBlockAllocationRequest(); var limits = new MgPhysicalDeviceLimits(); var worldData = AllocateWorldData(dynamicRequest, limits.MaxUniformBufferRange); var storageIndices = AllocateMaterials(sceneMaterials, dynamicRequest, limits); // per instance data // build dynamic artifacts // semaphores // fences // descriptor sets // initialize dynamic data storage // copy data across // buffers // images // map dynamic data // build command buffers } }
public void ReleaseManagedResources(IMgGraphicsConfiguration configuration) { }
public AmtGraphicsDevice(MTKView view, IMgGraphicsConfiguration config) { mApplicationView = view; mConfiguration = config; mFramebuffers = new MgFramebufferCollection(config); }
public MgFramebufferCollection(IMgGraphicsConfiguration configuration) { mGraphicsConfiguration = configuration; }
public void Update(IMgGraphicsConfiguration configuration) { }
public MgLinearImageOptimizer(IMgGraphicsConfiguration configuration, IMgImageTools imageTools) { mGraphicsConfiguration = configuration; mImageTools = imageTools; }
public MgStagingBufferOptimizer(IMgGraphicsConfiguration configuration, IMgImageTools imageTools) { mGraphicsConfiguration = configuration; mImageTools = imageTools; }