internal void Clear() { m_deviceContext.ClearState(); m_inputLayout = null; m_primitiveTopology = PrimitiveTopology.Undefined; m_indexBufferRef = null; m_indexBufferFormat = 0; m_indexBufferOffset = 0; for (int i = 0; i < m_vertexBuffers.Length; i++) m_vertexBuffers[i] = null; for (int i = 0; i < m_vertexBuffersStrides.Length; i++) m_vertexBuffersStrides[i] = 0; m_blendState = null; m_stencilRef = 0; m_depthStencilState = null; m_rtvsCount = 0; for (int i = 0; i < m_rtvs.Length; i++) m_rtvs[i] = null; m_dsv = null; m_rasterizerState = null; m_scissorLeftTop = new Vector2I(-1, -1); m_scissorRightBottom = new Vector2I(-1, -1); m_viewport = default(RawViewportF); m_targetBuffer = null; m_targetOffsets = 0; m_statistics.ClearStates++; }
public Tuple <D3D11.Texture2D, D3D11.RenderTargetView, D3D11.Texture2D, D3D11.DepthStencilView, SDM.RawViewportF, Size2, DpiScaling> OnRenderLoop_CreateViewResources(EngineDevice device) { // Get the pixel size of the screen Size2 viewSize = GetTargetRenderPixelSize(); // Create the SwapChain and associate it with the SwapChainBackgroundPanel using (SharpDX.ComObject targetWindowCom = new SharpDX.ComObject(m_targetWindow)) { m_swapChain = GraphicsHelper.CreateSwapChainForCoreWindow(device, targetWindowCom, viewSize.Width, viewSize.Height, m_renderLoop.ViewConfiguration); } // Get the backbuffer from the SwapChain m_backBuffer = D3D11.Texture2D.FromSwapChain <D3D11.Texture2D>(m_swapChain, 0); // Define the render target (in case of multisample an own render target) D3D11.Texture2D backBufferForRenderloop = null; if (m_renderLoop.ViewConfiguration.AntialiasingEnabled) { m_backBufferMultisampled = GraphicsHelper.CreateRenderTargetTexture(device, viewSize.Width, viewSize.Height, m_renderLoop.ViewConfiguration); m_renderTargetView = new D3D11.RenderTargetView(device.DeviceD3D11_1, m_backBufferMultisampled); backBufferForRenderloop = m_backBufferMultisampled; } else { m_renderTargetView = new D3D11.RenderTargetView(device.DeviceD3D11_1, m_backBuffer); backBufferForRenderloop = m_backBuffer; } //Create the depth buffer m_depthBuffer = GraphicsHelper.CreateDepthBufferTexture(device, viewSize.Width, viewSize.Height, m_renderLoop.ViewConfiguration); m_renderTargetDepth = new D3D11.DepthStencilView(device.DeviceD3D11_1, m_depthBuffer); //Define the viewport for rendering SharpDX.Mathematics.Interop.RawViewportF viewPort = GraphicsHelper.CreateDefaultViewport(viewSize.Width, viewSize.Height); m_lastRefreshTargetSize = new Size(viewSize.Width, viewSize.Height); return(Tuple.Create(backBufferForRenderloop, m_renderTargetView, m_depthBuffer, m_renderTargetDepth, viewPort, viewSize, m_dpiScaling)); }
internal void SetViewport(RawViewportF viewport) { if (viewport.X != m_viewport.X || viewport.Y != m_viewport.Y || viewport.Width != m_viewport.Width || viewport.Height != m_viewport.Height || viewport.MinDepth != m_viewport.MinDepth || viewport.MaxDepth != m_viewport.MaxDepth) { m_viewport = viewport; m_deviceContext.Rasterizer.SetViewport(viewport); m_statistics.SetViewports++; } }
internal void SetViewport(SharpDX.Mathematics.Interop.RawViewportF viewport) { m_state.SetViewport(viewport); CheckErrors(); }