public void Create(IMgCommandBuffer setupCmdBuffer, IMgSwapchainCollection swapchainCollection, MgGraphicsDeviceCreateInfo createInfo) { if (setupCmdBuffer == null) { throw new ArgumentNullException(nameof(setupCmdBuffer)); } if (createInfo == null) { throw new ArgumentNullException(nameof(createInfo)); } if (swapchainCollection == null) { throw new ArgumentNullException(nameof(swapchainCollection)); } Setup(); // Check if device supports requested sample count for color and depth frame buffer if ( (mProperties.Limits.FramebufferColorSampleCounts < createInfo.Samples) || (mProperties.Limits.FramebufferDepthSampleCounts < createInfo.Samples)) { throw new ArgumentOutOfRangeException("createInfo.Samples", "MgDefaultDepthStencilBuffer : This physical device cannot fulfil the requested sample count for BOTH color and depth frame buffer"); } ReleaseUnmanagedResources(); mDeviceCreated = false; CreateDepthStencil(setupCmdBuffer, createInfo); CreateRenderpass(createInfo); swapchainCollection.Create(setupCmdBuffer, createInfo.Width, createInfo.Height); mFramebuffers.Create(swapchainCollection, mRenderpass, mDepthStencilImageView, createInfo.Width, createInfo.Height); Scissor = new MgRect2D { Extent = new MgExtent2D { Width = createInfo.Width, Height = createInfo.Height }, Offset = new MgOffset2D { X = 0, Y = 0 }, }; // initialize viewport CurrentViewport = new MgViewport { Width = createInfo.Width, Height = createInfo.Height, X = 0, Y = 0, MinDepth = 0f, MaxDepth = 1f, }; mDeviceCreated = true; }
public void Create(IMgCommandBuffer setupCmdBuffer, IMgSwapchainCollection swapchainCollection, MgGraphicsDeviceCreateInfo createInfo) { if (createInfo == null) { throw new ArgumentNullException(nameof(createInfo)); } if (setupCmdBuffer == null) { throw new ArgumentNullException(nameof(setupCmdBuffer)); } if (swapchainCollection == null) { throw new ArgumentNullException(nameof(swapchainCollection)); } ReleaseUnmanagedResources(); mDeviceCreated = false; SetupContext(createInfo); SetupRenderpass(createInfo); // MANDATORY swapchainCollection.Create(setupCmdBuffer, createInfo.Width, createInfo.Height); SetupSwapchain(swapchainCollection, createInfo); mFramebuffers.Create(swapchainCollection, mRenderpass, mView, createInfo.Width, createInfo.Height); Scissor = new MgRect2D { Extent = new MgExtent2D { Width = createInfo.Width, Height = createInfo.Height }, Offset = new MgOffset2D { X = 0, Y = 0 }, }; // initialize viewport CurrentViewport = new MgViewport { Width = createInfo.Width, Height = createInfo.Height, X = 0, Y = 0, MinDepth = 0f, MaxDepth = 1f, }; mDeviceCreated = true; }