Пример #1
0
        private void UpdateBackBuffer()
        {
            IDirect3DSurface             surface = HolographicFrame.GetRenderingParameters(HolographicFrame.CurrentPrediction.CameraPoses[0]).Direct3D11BackBuffer;
            IDirect3DDxgiInterfaceAccess surfaceDxgiInterfaceAccess = surface as IDirect3DDxgiInterfaceAccess;
            IntPtr resource = surfaceDxgiInterfaceAccess.GetInterface(ID3D11Resource);

            if (backBuffer == null || backBuffer.NativeResource.NativePointer != resource)
            {
                // Clean up references to previous resources.
                backBuffer?.Dispose();
                LeftEyeBuffer?.Dispose();
                RightEyeBuffer?.Dispose();

                // This can change every frame as the system moves to the next buffer in the
                // swap chain. This mode of operation will occur when certain rendering modes
                // are activated.
                Texture2D d3DBackBuffer = new Texture2D(resource);

                backBuffer = new Texture(GraphicsDevice).InitializeFromImpl(d3DBackBuffer, false);

                LeftEyeBuffer = backBuffer.ToTextureView(new TextureViewDescription()
                {
                    ArraySlice = 0, Type = ViewType.Single
                });
                RightEyeBuffer = backBuffer.ToTextureView(new TextureViewDescription()
                {
                    ArraySlice = 1, Type = ViewType.Single
                });
            }

            Description.BackBufferFormat = backBuffer.Format;
            Description.BackBufferWidth  = backBuffer.Width;
            Description.BackBufferHeight = backBuffer.Height;
        }
Пример #2
0
        internal static IDXGISurface CreateDXGISurface(IDirect3DSurface direct3DSurface)
        {
            IDirect3DDxgiInterfaceAccess dxgiSurfaceInterfaceAccess = (IDirect3DDxgiInterfaceAccess)direct3DSurface;
            IntPtr surface = dxgiSurfaceInterfaceAccess.GetInterface(ID3D11Resource);

            return(new IDXGISurface(surface));
        }
Пример #3
0
        public static IDXGIDevice CreateDXGIDevice(IDirect3DDevice direct3DDevice)
        {
            IDirect3DDxgiInterfaceAccess dxgiDeviceInterfaceAccess = (IDirect3DDxgiInterfaceAccess)direct3DDevice;
            IntPtr device = dxgiDeviceInterfaceAccess.GetInterface(ID3D11Resource);

            return(new IDXGIDevice(device));
        }
Пример #4
0
    public static IDXGISurface GetDXGISurface(object direct3DSurface)
    {
        IDirect3DDxgiInterfaceAccess dxgiSurfaceInterfaceAccess = (IDirect3DDxgiInterfaceAccess)direct3DSurface;

        return(dxgiSurfaceInterfaceAccess.GetInterface <IDXGISurface>());
    }