Exemple #1
0
        internal void Initialize(DeviceContext context = null)
        {
            MyRenderProxy.Assert(m_deviceContext == null, "Initialize is called to already initialized object. Whether initialization has been performed or not, check by the method 'IsInitialized()'");

            if (context == null)
            {
                context      = new DeviceContext(MyRender11.Device);
                m_isDeferred = true;
            }
            else
            {
                m_isDeferred = false;
            }

            m_deviceContext = context;
            m_vertexShaderStage.Init(m_deviceContext, m_deviceContext.VertexShader, m_statistics);
            m_geometryShaderStage.Init(m_deviceContext, m_deviceContext.GeometryShader, m_statistics);
            m_pixelShaderStage.Init(m_deviceContext, m_deviceContext.PixelShader, m_statistics);
            m_computeShaderStage.Init(m_deviceContext, m_deviceContext.ComputeShader, m_statistics);

            m_state.Init(m_deviceContext, m_statistics);

            if (m_annotations == null)
            {
                m_annotations = m_deviceContext.QueryInterface <SharpDX.Direct3D11.UserDefinedAnnotation>();
            }

            m_statistics.Clear();
        }
        public static Bitmap1 LoadBitmap(SharpDX.Direct3D11.DeviceContext device, string filename)
        {
            var props = new BitmapProperties1
            {
                PixelFormat =
                    new SharpDX.Direct2D1.PixelFormat(Format.R8G8B8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied)
            };

            return(Bitmap1.FromWicBitmap(device.QueryInterface <SharpDX.Direct2D1.DeviceContext>(), LoadBitmapSource(device, filename), props));
        }