示例#1
0
        public static void Run()
        {
            var factory = new Factory1();
            // 0: Intel 1: Nvidia 2: CPU
            var adapter = factory.Adapters1[1];
            var device  = new D3DDevice(adapter);

            var gpuName = adapter.Description.Description;

            var _64MB  = new byte[64 * 1024 * 1024];
            var buffer = new DXDynamicVertexBuffer(device);

            for (int i = 64; i <= 2048; i += 64)
            {
                buffer.Reset(_64MB);
                var result = MessageBox.Show(i + " MB! Flush?", "Memory Test - " + gpuName, MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Yes)
                {
                    device.ImmediateContext.Flush();
                }
                else if (result == DialogResult.No)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }

            buffer.Dispose();
            device.Dispose();
            adapter.Dispose();
            factory.Dispose();
        }
示例#2
0
 public void Dispose()
 {
     __session?.Dispose();
     __framePool?.Dispose();
     __swapChain?.Dispose();
     __d3dDevice?.Dispose();
 }
 public void Dispose()
 {
     session?.Dispose();
     framePool?.Dispose();
     swapChain?.Dispose();
     d3dDevice?.Dispose();
 }
示例#4
0
        private bool disposedValue = false; // Для определения избыточных вызовов

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: освободить управляемое состояние (управляемые объекты).
                    inputLayout.Dispose();
                    inputSignature.Dispose();
                    triangleVertexBuffer.Dispose();
                    vertexShader.Dispose();
                    pixelShader.Dispose();
                    renderTargetView.Dispose();
                    swapChain.Dispose();
                    d3dDevice.Dispose();
                    d3dDeviceContext.Dispose();
                    renderForm.Dispose();
                    triangleVertexBuffer.Dispose();
                }

                // TODO: освободить неуправляемые ресурсы (неуправляемые объекты) и переопределить ниже метод завершения.
                // TODO: задать большим полям значение NULL.
                disposedValue = true;
            }
        }
 private void DisposeDirectXResources()
 {
     _textFormat.Dispose();
     _dwFactory.Dispose();
     _renderTarget.Dispose();
     _renderTargetView.Dispose();
     _d2DFactory.Dispose();
     _swapChain.Dispose();
     _d3DDeviceContext.Dispose();
     _d3DDevice.Dispose();
 }
示例#6
0
        private void ReleaseDevice()
        {
            // Display D3D11 ref counting info
            //ClearState();
            NativeDevice.ImmediateContext.Flush();
            NativeDevice.ImmediateContext.Dispose();

            if (IsDebugMode)
            {
                var deviceDebug = new SharpDX.Direct3D11.DeviceDebug(NativeDevice);
                deviceDebug.ReportLiveDeviceObjects(SharpDX.Direct3D11.ReportingLevel.Detail);
            }

            nativeDevice.Dispose();
        }
示例#7
0
        public override void Dispose()
        {
            if (dx11Device != null)
            {
                dx11Device.Dispose();
            }
            if (dx11Factory != null)
            {
                dx11Factory.Dispose();
            }
            if (dx11Output != null)
            {
                dx11Output.Dispose();
            }
            if (dx11DuplicatedOutput != null)
            {
                dx11DuplicatedOutput.Dispose();
            }
            if (dx11ScreenTexture != null)
            {
                dx11ScreenTexture.Dispose();
            }
            if (dx11ScreenResource != null)
            {
                dx11ScreenResource.Dispose();
            }
            if (dx11ScreenSurface != null)
            {
                dx11ScreenSurface.Dispose();
            }

            if (screenShot != null)
            {
                screenShot.Dispose();
            }

            dx11Device           = null;
            dx11Factory          = null;
            dx11Output           = null;
            dx11DuplicatedOutput = null;
            dx11ScreenTexture    = null;
            dx11ScreenResource   = null;
            dx11ScreenSurface    = null;
            screenShot           = null;

            bmpData = null;
            GC.SuppressFinalize(this);
        }
示例#8
0
        private void ReleaseDevice()
        {
            // Display D3D11 ref counting info
            NativeDevice.ImmediateContext.ClearState();
            NativeDevice.ImmediateContext.Flush();

            if (IsDebugMode)
            {
                var debugDevice = NativeDevice.QueryInterfaceOrNull <SharpDX.Direct3D11.DeviceDebug>();
                if (debugDevice != null)
                {
                    debugDevice.ReportLiveDeviceObjects(SharpDX.Direct3D11.ReportingLevel.Detail);
                    debugDevice.Dispose();
                }
            }

            nativeDevice.Dispose();
            nativeDevice = null;
        }
示例#9
0
        private void ReleaseDevice()
        {
            // Display D3D11 ref counting info
            ClearState();
            NativeDevice.ImmediateContext.Flush();
            NativeDevice.ImmediateContext.Dispose();

            if (IsDebugMode)
            {
                var deviceDebug = new SharpDX.Direct3D11.DeviceDebug(NativeDevice);
                deviceDebug.ReportLiveDeviceObjects(SharpDX.Direct3D11.ReportingLevel.Detail);
            }

            currentInputLayout          = null;
            currentEffectInputSignature = null;
            currentVertexArrayObject    = null;
            currentVertexArrayLayout    = null;
            nativeDevice.Dispose();
        }
 public void Dispose()
 {
     device.Dispose();
 }
示例#11
0
 public void Dispose()
 {
     _session?.Dispose();
     _framePool?.Dispose();
     _d3dDevice?.Dispose();
 }