Пример #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();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GraphicsDevice" /> class using the default GraphicsAdapter
        /// and the Level10 <see cref="GraphicsProfile" />.
        /// </summary>
        /// <param name="device">The device.</param>
        private GraphicsDevice(GraphicsDevice device)
        {
            RootDevice           = device;
            Adapter              = device.Adapter;
            creationFlags        = device.creationFlags;
            Features             = device.Features;
            sharedDataPerDevice  = device.sharedDataPerDevice;
            InputLayoutManager   = device.InputLayoutManager;
            nativeDevice         = device.NativeDevice;
            nativeDeviceContext  = new SharpDX.Direct3D11.DeviceContext(NativeDevice).DisposeBy(this);
            nativeDeviceProfiler = SharpDX.ComObject.QueryInterfaceOrNull <UserDefinedAnnotation>(nativeDeviceContext.NativePointer);
            isDeferred           = true;
            IsDebugMode          = device.IsDebugMode;
            if (IsDebugMode)
            {
                GraphicsResourceBase.SetDebugName(device, nativeDeviceContext, "DeferredContext");
            }
            NeedWorkAroundForUpdateSubResource = !Features.HasDriverCommandLists;

            primitiveQuad = new PrimitiveQuad(this).DisposeBy(this);

            InitializeStages();
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GraphicsDevice" /> class using the default GraphicsAdapter
        /// and the Level10 <see cref="GraphicsProfile" />.
        /// </summary>
        /// <param name="device">The device.</param>
        private GraphicsDevice(GraphicsDevice device)
        {
            RootDevice = device;
            Adapter = device.Adapter;
            creationFlags = device.creationFlags;
            Features = device.Features;
            sharedDataPerDevice = device.sharedDataPerDevice;
            InputLayoutManager = device.InputLayoutManager;
            nativeDevice = device.NativeDevice;
            nativeDeviceContext = new SharpDX.Direct3D11.DeviceContext(NativeDevice).DisposeBy(this);
            nativeDeviceProfiler = SharpDX.ComObject.QueryInterfaceOrNull<UserDefinedAnnotation>(nativeDeviceContext.NativePointer);
            isDeferred = true;
            IsDebugMode = device.IsDebugMode;
            if (IsDebugMode)
            {
                GraphicsResourceBase.SetDebugName(device, nativeDeviceContext, "DeferredContext");
            }
            NeedWorkAroundForUpdateSubResource = !Features.HasDriverCommandLists;

            primitiveQuad = new PrimitiveQuad(this).DisposeBy(this);

            InitializeStages();
        }
Пример #4
0
 public void Init(DeviceContext context)
 {
     m_annotation = context.QueryInterface <SharpDX.Direct3D11.UserDefinedAnnotation>();
 }