コード例 #1
0
ファイル: Program.cs プロジェクト: videolan/libvlcsharp
 static void ReleaseTextures()
 {
     if (_sharedHandle != null)
     {
         CloseHandle(_sharedHandle);
         _sharedHandle = null;
     }
     if (_textureVLC != null)
     {
         var count = _textureVLC->Release();
         Debug.Assert(count == 0);
         _textureVLC = null;
     }
     if (_textureShaderInput != null)
     {
         var count = _textureShaderInput->Release();
         Debug.Assert(count == 0);
         _textureShaderInput = null;
     }
     if (_textureRenderTarget != null)
     {
         var count = _textureRenderTarget->Release();
         Debug.Assert(count == 0);
         _textureRenderTarget = null;
     }
     if (_texture != null)
     {
         var count = _texture->Release();
         Debug.Assert(count == 0);
         _texture = null;
     }
 }
    public D3D11_RENDER_TARGET_VIEW_DESC1(ID3D11Texture2D *pTex2D, D3D11_RTV_DIMENSION viewDimension, DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, uint mipSlice = 0, uint firstArraySlice = 0, uint arraySize = unchecked ((uint)-1), uint planeSlice = 0)
    {
        ViewDimension = viewDimension;

        if ((DXGI_FORMAT_UNKNOWN == format) || ((unchecked ((uint)-1) == arraySize) && ((D3D11_RTV_DIMENSION_TEXTURE2DARRAY == viewDimension) || (D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY == viewDimension))))
        {
            D3D11_TEXTURE2D_DESC TexDesc;
            pTex2D->GetDesc(&TexDesc);

            if (DXGI_FORMAT_UNKNOWN == format)
            {
                format = TexDesc.Format;
            }

            if (unchecked ((uint)-1) == arraySize)
            {
                arraySize = TexDesc.ArraySize - firstArraySlice;
            }
        }

        Format    = format;
        Anonymous = default;

        switch (viewDimension)
        {
        case D3D11_RTV_DIMENSION_TEXTURE2D:
        {
            Anonymous.Texture2D.MipSlice   = mipSlice;
            Anonymous.Texture2D.PlaneSlice = planeSlice;
            break;
        }

        case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
        {
            Anonymous.Texture2DArray.MipSlice        = mipSlice;
            Anonymous.Texture2DArray.FirstArraySlice = firstArraySlice;
            Anonymous.Texture2DArray.ArraySize       = arraySize;
            Anonymous.Texture2DArray.PlaneSlice      = planeSlice;
            break;
        }

        case D3D11_RTV_DIMENSION_TEXTURE2DMS:
        {
            break;
        }

        case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
        {
            Anonymous.Texture2DMSArray.FirstArraySlice = firstArraySlice;
            Anonymous.Texture2DMSArray.ArraySize       = arraySize;
            break;
        }

        default:
        {
            break;
        }
        }
    }
コード例 #3
0
        public D3D11_DEPTH_STENCIL_VIEW_DESC(ID3D11Texture2D *pTex2D, D3D11_DSV_DIMENSION viewDimension, DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, [NativeTypeName("UINT")] uint mipSlice = 0, [NativeTypeName("UINT")] uint firstArraySlice = 0, [NativeTypeName("UINT")] uint arraySize = unchecked ((uint)-1), [NativeTypeName("UINT")] uint flags = 0)
        {
            ViewDimension = viewDimension;
            Flags         = flags;

            if ((DXGI_FORMAT_UNKNOWN == format) || ((unchecked ((uint)-1) == arraySize) && ((D3D11_DSV_DIMENSION_TEXTURE2DARRAY == viewDimension) || (D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY == viewDimension))))
            {
                D3D11_TEXTURE2D_DESC TexDesc;
                pTex2D->GetDesc(&TexDesc);

                if (DXGI_FORMAT_UNKNOWN == format)
                {
                    format = TexDesc.Format;
                }

                if (unchecked ((uint)-1 == arraySize))
                {
                    arraySize = TexDesc.ArraySize - firstArraySlice;
                }
            }

            Format    = format;
            Anonymous = default;

            switch (viewDimension)
            {
            case D3D11_DSV_DIMENSION_TEXTURE2D:
            {
                Anonymous.Texture2D.MipSlice = mipSlice;
                break;
            }

            case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
            {
                Anonymous.Texture2DArray.MipSlice        = mipSlice;
                Anonymous.Texture2DArray.FirstArraySlice = firstArraySlice;
                Anonymous.Texture2DArray.ArraySize       = arraySize;
                break;
            }

            case D3D11_DSV_DIMENSION_TEXTURE2DMS:
            {
                break;
            }

            case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
            {
                Anonymous.Texture2DMSArray.FirstArraySlice = firstArraySlice;
                Anonymous.Texture2DMSArray.ArraySize       = arraySize;
                break;
            }

            default:
            {
                break;
            }
            }
        }
コード例 #4
0
        public D3D11_VIEWPORT(ID3D11Texture2D *pTex2D, ID3D11RenderTargetView *pRTView, [NativeTypeName("FLOAT")] float topLeftX = 0.0f, [NativeTypeName("FLOAT")] float topLeftY = 0.0f, [NativeTypeName("FLOAT")] float minDepth = D3D11_MIN_DEPTH, [NativeTypeName("FLOAT")] float maxDepth = D3D11_MAX_DEPTH)
        {
            D3D11_TEXTURE2D_DESC TexDesc;

            pTex2D->GetDesc(&TexDesc);

            D3D11_RENDER_TARGET_VIEW_DESC RTVDesc;

            pRTView->GetDesc(&RTVDesc);

            uint MipSlice = 0;

            switch (RTVDesc.ViewDimension)
            {
            case D3D11_RTV_DIMENSION_TEXTURE2D:
            {
                MipSlice = RTVDesc.Anonymous.Texture2D.MipSlice;
                break;
            }

            case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
            {
                MipSlice = RTVDesc.Anonymous.Texture2DArray.MipSlice;
                break;
            }

            case D3D11_RTV_DIMENSION_TEXTURE2DMS:
            case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
            {
                break;
            }

            default:
            {
                break;
            }
            }

            var SubResourceWidth  = TexDesc.Width / (1u << unchecked ((int)MipSlice));
            var SubResourceHeight = TexDesc.Height / (1u << unchecked ((int)MipSlice));

            TopLeftX = topLeftX;
            TopLeftY = topLeftY;
            Width    = ((SubResourceWidth != 0) ? SubResourceWidth : 1) - topLeftX;
            Height   = ((SubResourceHeight != 0) ? SubResourceHeight : 1) - topLeftY;
            MinDepth = minDepth;
            MaxDepth = maxDepth;
        }
コード例 #5
0
 public void DecryptionBlt([NativeTypeName("ID3D11CryptoSession *")] ID3D11CryptoSession *pCryptoSession, [NativeTypeName("ID3D11Texture2D *")] ID3D11Texture2D *pSrcSurface, [NativeTypeName("ID3D11Texture2D *")] ID3D11Texture2D *pDstSurface, [NativeTypeName("D3D11_ENCRYPTED_BLOCK_INFO *")] D3D11_ENCRYPTED_BLOCK_INFO *pEncryptedBlockInfo, [NativeTypeName("UINT")] uint ContentKeySize, [NativeTypeName("const void *")] void *pContentKey, [NativeTypeName("UINT")] uint IVSize, [NativeTypeName("void *")] void *pIV)
 {
     ((delegate * unmanaged <ID3D11VideoContext2 *, ID3D11CryptoSession *, ID3D11Texture2D *, ID3D11Texture2D *, D3D11_ENCRYPTED_BLOCK_INFO *, uint, void *, uint, void *, void>)(lpVtbl[56]))((ID3D11VideoContext2 *)Unsafe.AsPointer(ref this), pCryptoSession, pSrcSurface, pDstSurface, pEncryptedBlockInfo, ContentKeySize, pContentKey, IVSize, pIV);
 }
コード例 #6
0
 public void EncryptionBlt([NativeTypeName("ID3D11CryptoSession *")] ID3D11CryptoSession *pCryptoSession, [NativeTypeName("ID3D11Texture2D *")] ID3D11Texture2D *pSrcSurface, [NativeTypeName("ID3D11Texture2D *")] ID3D11Texture2D *pDstSurface, [NativeTypeName("UINT")] uint IVSize, [NativeTypeName("void *")] void *pIV)
 {
     ((delegate * unmanaged <ID3D11VideoContext2 *, ID3D11CryptoSession *, ID3D11Texture2D *, ID3D11Texture2D *, uint, void *, void>)(lpVtbl[55]))((ID3D11VideoContext2 *)Unsafe.AsPointer(ref this), pCryptoSession, pSrcSurface, pDstSurface, IVSize, pIV);
 }
コード例 #7
0
        public D3D11_SHADER_RESOURCE_VIEW_DESC(ID3D11Texture2D *pTex2D, D3D_SRV_DIMENSION viewDimension, DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, [NativeTypeName("UINT")] uint mostDetailedMip = 0, [NativeTypeName("UINT")] uint mipLevels = unchecked ((uint)-1), [NativeTypeName("UINT")] uint firstArraySlice = 0, [NativeTypeName("UINT")] uint arraySize = unchecked ((uint)-1))
        {
            ViewDimension = viewDimension;

            if ((DXGI_FORMAT_UNKNOWN == format) || ((unchecked ((uint)-1) == mipLevels) && (D3D11_SRV_DIMENSION_TEXTURE2DMS != viewDimension) && (D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY != viewDimension)) || ((unchecked ((uint)-1) == arraySize) && ((D3D11_SRV_DIMENSION_TEXTURE2DARRAY == viewDimension) || (D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY == viewDimension) || (D3D11_SRV_DIMENSION_TEXTURECUBEARRAY == viewDimension))))
            {
                D3D11_TEXTURE2D_DESC TexDesc;
                pTex2D->GetDesc(&TexDesc);

                if (DXGI_FORMAT_UNKNOWN == format)
                {
                    format = TexDesc.Format;
                }

                if (unchecked ((uint)-1) == mipLevels)
                {
                    mipLevels = TexDesc.MipLevels - mostDetailedMip;
                }

                if (unchecked ((uint)-1) == arraySize)
                {
                    arraySize = TexDesc.ArraySize - firstArraySlice;
                    if (D3D11_SRV_DIMENSION_TEXTURECUBEARRAY == viewDimension)
                    {
                        arraySize /= 6;
                    }
                }
            }

            Format    = format;
            Anonymous = default;

            switch (viewDimension)
            {
            case D3D11_SRV_DIMENSION_TEXTURE2D:
            {
                Anonymous.Texture2D.MostDetailedMip = mostDetailedMip;
                Anonymous.Texture2D.MipLevels       = mipLevels;
                break;
            }

            case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
            {
                Anonymous.Texture2DArray.MostDetailedMip = mostDetailedMip;
                Anonymous.Texture2DArray.MipLevels       = mipLevels;
                Anonymous.Texture2DArray.FirstArraySlice = firstArraySlice;
                Anonymous.Texture2DArray.ArraySize       = arraySize;
                break;
            }

            case D3D11_SRV_DIMENSION_TEXTURE2DMS:
            {
                break;
            }

            case D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY:
            {
                Anonymous.Texture2DMSArray.FirstArraySlice = firstArraySlice;
                Anonymous.Texture2DMSArray.ArraySize       = arraySize;
                break;
            }

            case D3D11_SRV_DIMENSION_TEXTURECUBE:
            {
                Anonymous.TextureCube.MostDetailedMip = mostDetailedMip;
                Anonymous.TextureCube.MipLevels       = mipLevels;
                break;
            }

            case D3D11_SRV_DIMENSION_TEXTURECUBEARRAY:
            {
                Anonymous.TextureCubeArray.MostDetailedMip  = mostDetailedMip;
                Anonymous.TextureCubeArray.MipLevels        = mipLevels;
                Anonymous.TextureCubeArray.First2DArrayFace = firstArraySlice;
                Anonymous.TextureCubeArray.NumCubes         = arraySize;
                break;
            }

            default:
            {
                break;
            }
            }
        }
コード例 #8
0
        public override void OnInit()
        {
            Guid             iid;
            IDXGIFactory1 *  factory    = null;
            IDXGIAdapter *   adapter    = null;
            ID3D11Texture2D *backBuffer = null;

            try
            {
                iid = IID_IDXGIFactory1;
                ThrowIfFailed(nameof(CreateDXGIFactory1), CreateDXGIFactory1(&iid, (void **)&factory));

                if (UseWarpDevice)
                {
                    throw new NotImplementedException("WARP Device not supported for D3D11.");
                }
                else
                {
                    adapter = GetHardwareAdapter(factory);
                }

                fixed(ID3D11Device **device = &_device)
                fixed(ID3D11DeviceContext **immediateContext = &_immediateContext)
                {
                    var featureLevel = D3D_FEATURE_LEVEL_11_0;

                    ThrowIfFailed(nameof(D3D11CreateDevice), D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_HARDWARE, Software: IntPtr.Zero, Flags: 0, &featureLevel, FeatureLevels: 1, D3D11_SDK_VERSION, device, pFeatureLevel: null, immediateContext));
                }

                // Describe and create the swap chain.
                var swapChainDesc = new DXGI_SWAP_CHAIN_DESC {
                    BufferDesc = new DXGI_MODE_DESC {
                        Width  = Width,
                        Height = Height,
                        Format = DXGI_FORMAT_R8G8B8A8_UNORM,
                    },
                    SampleDesc = new DXGI_SAMPLE_DESC {
                        Count = 1
                    },
                    BufferUsage  = DXGI_USAGE_RENDER_TARGET_OUTPUT,
                    BufferCount  = FrameCount,
                    OutputWindow = Win32Application.Hwnd,
                    Windowed     = TRUE,
                    SwapEffect   = DXGI_SWAP_EFFECT_DISCARD,
                };

                fixed(IDXGISwapChain **swapChain = &_swapChain)
                {
                    ThrowIfFailed(nameof(IDXGIFactory1.CreateSwapChain), factory->CreateSwapChain(
                                      (IUnknown *)_device,
                                      &swapChainDesc,
                                      swapChain
                                      ));
                }

                // This sample does not support fullscreen transitions.
                ThrowIfFailed(nameof(IDXGIFactory.MakeWindowAssociation), factory->MakeWindowAssociation(Win32Application.Hwnd, DXGI_MWA_NO_ALT_ENTER));

                fixed(ID3D11RenderTargetView **renderTarget = &_renderTarget)
                {
                    iid = IID_ID3D11Texture2D;

                    ThrowIfFailed(nameof(IDXGISwapChain.GetBuffer), _swapChain->GetBuffer(0, &iid, (void **)&backBuffer));
                    ThrowIfFailed(nameof(ID3D11Device.CreateRenderTargetView), _device->CreateRenderTargetView((ID3D11Resource *)backBuffer, null, renderTarget));

                    _immediateContext->OMSetRenderTargets(1, renderTarget, pDepthStencilView: null);
                }

                var vp = new D3D11_VIEWPORT {
                    Width    = Width,
                    Height   = Height,
                    MinDepth = 0.0f,
                    MaxDepth = 1.0f,
                    TopLeftX = 0,
                    TopLeftY = 0,
                };
                _immediateContext->RSSetViewports(1, &vp);
            }
            finally
            {
                if (backBuffer != null)
                {
                    _ = backBuffer->Release();
                }

                if (adapter != null)
                {
                    _ = adapter->Release();
                }

                if (factory != null)
                {
                    _ = factory->Release();
                }
            }
        }
コード例 #9
0
        public override void OnInit()
        {
            Guid             iid;
            IDXGIFactory1 *  factory          = null;
            IDXGIAdapter *   adapter          = null;
            ID3D11Texture2D *backBuffer       = null;
            ID3DBlob *       vertexShaderBlob = null;
            ID3DBlob *       pixelShaderBlob  = null;

            try
            {
                iid = IID_IDXGIFactory1;
                ThrowIfFailed(nameof(CreateDXGIFactory1), CreateDXGIFactory1(&iid, (void **)&factory));

                if (UseWarpDevice)
                {
                    throw new NotImplementedException("WARP Device not supported for D3D11.");
                }
                else
                {
                    adapter = GetHardwareAdapter(factory);
                }

                fixed(ID3D11Device **device = &_device)
                fixed(ID3D11DeviceContext **immediateContext = &_immediateContext)
                {
                    var featureLevel = D3D_FEATURE_LEVEL_11_0;

                    ThrowIfFailed(nameof(D3D11CreateDevice), D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_HARDWARE, Software: IntPtr.Zero, Flags: 0, &featureLevel, FeatureLevels: 1, D3D11_SDK_VERSION, device, pFeatureLevel: null, immediateContext));
                }

                // Describe and create the swap chain.
                var swapChainDesc = new DXGI_SWAP_CHAIN_DESC {
                    BufferDesc = new DXGI_MODE_DESC {
                        Width  = Width,
                        Height = Height,
                        Format = DXGI_FORMAT_R8G8B8A8_UNORM,
                    },
                    SampleDesc = new DXGI_SAMPLE_DESC {
                        Count = 1
                    },
                    BufferUsage  = DXGI_USAGE_RENDER_TARGET_OUTPUT,
                    BufferCount  = FrameCount,
                    OutputWindow = Win32Application.Hwnd,
                    Windowed     = TRUE,
                    SwapEffect   = DXGI_SWAP_EFFECT_DISCARD,
                };

                fixed(IDXGISwapChain **swapChain = &_swapChain)
                {
                    ThrowIfFailed(nameof(IDXGIFactory1.CreateSwapChain), factory->CreateSwapChain(
                                      (IUnknown *)_device,
                                      &swapChainDesc,
                                      swapChain
                                      ));
                }

                // This sample does not support fullscreen transitions.
                ThrowIfFailed(nameof(IDXGIFactory.MakeWindowAssociation), factory->MakeWindowAssociation(Win32Application.Hwnd, DXGI_MWA_NO_ALT_ENTER));

                fixed(ID3D11RenderTargetView **renderTarget = &_renderTarget)
                {
                    iid = IID_ID3D11Texture2D;

                    ThrowIfFailed(nameof(IDXGISwapChain.GetBuffer), _swapChain->GetBuffer(0, &iid, (void **)&backBuffer));
                    ThrowIfFailed(nameof(ID3D11Device.CreateRenderTargetView), _device->CreateRenderTargetView((ID3D11Resource *)backBuffer, null, renderTarget));

                    _immediateContext->OMSetRenderTargets(1, renderTarget, pDepthStencilView: null);
                }

                var vp = new D3D11_VIEWPORT {
                    Width    = Width,
                    Height   = Height,
                    MinDepth = 0.0f,
                    MaxDepth = 1.0f,
                    TopLeftX = 0,
                    TopLeftY = 0,
                };
                _immediateContext->RSSetViewports(1, &vp);

                var compileFlags = 0u;

                fixed(char *fileName = GetAssetFullPath(@"D3D11\Assets\Shaders\HelloTriangle.hlsl"))
                fixed(ID3D11VertexShader **vertexShader = &_vertexShader)
                fixed(ID3D11PixelShader **pixelShader   = &_pixelShader)
                {
                    var entryPoint = 0x00006E69614D5356;    // VSMain
                    var target     = 0x0000305F345F7376;    // vs_4_0

                    ThrowIfFailed(nameof(D3DCompileFromFile), D3DCompileFromFile((ushort *)fileName, null, null, (sbyte *)&entryPoint, (sbyte *)&target, compileFlags, 0, &vertexShaderBlob, null));

                    ThrowIfFailed(nameof(ID3D11Device.CreateVertexShader), _device->CreateVertexShader(vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), pClassLinkage: null, vertexShader));

                    entryPoint = 0x00006E69614D5350;        // PSMain
                    target     = 0x0000305F345F7370;        // ps_4_0
                    ThrowIfFailed(nameof(D3DCompileFromFile), D3DCompileFromFile((ushort *)fileName, null, null, (sbyte *)&entryPoint, (sbyte *)&target, compileFlags, 0, &pixelShaderBlob, null));

                    ThrowIfFailed(nameof(ID3D11Device.CreatePixelShader), _device->CreatePixelShader(pixelShaderBlob->GetBufferPointer(), pixelShaderBlob->GetBufferSize(), pClassLinkage: null, pixelShader));
                }

                var inputElementDescs = stackalloc D3D11_INPUT_ELEMENT_DESC[2];
                {
                    var semanticName0 = stackalloc sbyte[9];
                    {
                        ((ulong *)semanticName0)[0] = 0x4E4F495449534F50;      // POSITION
                    }
                    inputElementDescs[0] = new D3D11_INPUT_ELEMENT_DESC {
                        SemanticName         = semanticName0,
                        SemanticIndex        = 0,
                        Format               = DXGI_FORMAT_R32G32B32_FLOAT,
                        InputSlot            = 0,
                        AlignedByteOffset    = 0,
                        InputSlotClass       = D3D11_INPUT_PER_VERTEX_DATA,
                        InstanceDataStepRate = 0
                    };

                    var semanticName1 = 0x000000524F4C4F43;                     // COLOR
                    inputElementDescs[1] = new D3D11_INPUT_ELEMENT_DESC {
                        SemanticName         = (sbyte *)&semanticName1,
                        SemanticIndex        = 0,
                        Format               = DXGI_FORMAT_R32G32B32A32_FLOAT,
                        InputSlot            = 0,
                        AlignedByteOffset    = 12,
                        InputSlotClass       = D3D11_INPUT_PER_VERTEX_DATA,
                        InstanceDataStepRate = 0
                    };
                }

                fixed(ID3D11InputLayout **inputLayout = &_inputLayout)
                {
                    ThrowIfFailed(nameof(ID3D11Device.CreateInputLayout), _device->CreateInputLayout(inputElementDescs, NumElements: 2, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), inputLayout));
                }

                _immediateContext->IASetInputLayout(_inputLayout);

                var triangleVertices = stackalloc Vertex[3];
                {
                    triangleVertices[0] = new Vertex {
                        Position = new Vector3(0.0f, 0.25f * AspectRatio, 0.0f),
                        Color    = new Vector4(1.0f, 0.0f, 0.0f, 1.0f)
                    };
                    triangleVertices[1] = new Vertex {
                        Position = new Vector3(0.25f, -0.25f * AspectRatio, 0.0f),
                        Color    = new Vector4(0.0f, 1.0f, 0.0f, 1.0f)
                    };
                    triangleVertices[2] = new Vertex {
                        Position = new Vector3(-0.25f, -0.25f * AspectRatio, 0.0f),
                        Color    = new Vector4(0.0f, 0.0f, 1.0f, 1.0f)
                    };
                }

                var vertexBufferSize = (uint)sizeof(Vertex) * 3;

                var vertexBufferDesc = new D3D11_BUFFER_DESC {
                    ByteWidth = vertexBufferSize,
                    Usage     = D3D11_USAGE_DEFAULT,
                    BindFlags = (uint)D3D11_BIND_VERTEX_BUFFER
                };

                var vertexBufferData = new D3D11_SUBRESOURCE_DATA {
                    pSysMem = triangleVertices
                };

                fixed(ID3D11Buffer **vertexBuffer = &_vertexBuffer)
                {
                    ThrowIfFailed(nameof(ID3D11Device.CreateBuffer), _device->CreateBuffer(&vertexBufferDesc, &vertexBufferData, vertexBuffer));

                    var stride = (uint)sizeof(Vertex);
                    var offset = 0u;

                    _immediateContext->IASetVertexBuffers(0, 1, vertexBuffer, &stride, &offset);
                }

                _immediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
            }
            finally
            {
                if (pixelShaderBlob != null)
                {
                    _ = pixelShaderBlob->Release();
                }

                if (vertexShaderBlob != null)
                {
                    _ = vertexShaderBlob->Release();
                }

                if (backBuffer != null)
                {
                    _ = backBuffer->Release();
                }

                if (adapter != null)
                {
                    _ = adapter->Release();
                }

                if (factory != null)
                {
                    _ = factory->Release();
                }
            }
        }