Exemplo n.º 1
0
        public void Recreate(GraphicsAdapter adapter, GraphicsProfile[] profile, DeviceCreationFlags deviceCreationFlags, WindowHandle windowHandle)
        {
            if (adapter == null)
            {
                throw new ArgumentNullException("adapter");
            }
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }

            Adapter     = adapter;
            IsDebugMode = (deviceCreationFlags & DeviceCreationFlags.Debug) != 0;

            // Initialize this instance
            InitializePlatformDevice(profile, deviceCreationFlags, windowHandle);

            // Create a new graphics device
            Features = new GraphicsDeviceFeatures(this);

            InitializePostFeatures();

            SamplerStates = new SamplerStateFactory(this);

            var defaultPipelineStateDescription = new PipelineStateDescription();

            defaultPipelineStateDescription.SetDefaults();
            AdjustDefaultPipelineStateDescription(ref defaultPipelineStateDescription);
            DefaultPipelineState = PipelineState.New(this, ref defaultPipelineStateDescription);
        }
Exemplo n.º 2
0
        public void Recreate(GraphicsAdapter adapter, GraphicsProfile[] profile, DeviceCreationFlags deviceCreationFlags, WindowHandle windowHandle)
        {
            if (adapter == null)
            {
                throw new ArgumentNullException("adapter");
            }
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }

            Adapter     = adapter;
            IsDebugMode = (deviceCreationFlags & DeviceCreationFlags.Debug) != 0;

            // Initialize this instance
            InitializePlatformDevice(profile, deviceCreationFlags, windowHandle);

            InitializeFactories();

            // Create a new graphics device
            Features = new GraphicsDeviceFeatures(this);

            SamplerStates      = new SamplerStateFactory(this);
            BlendStates        = new BlendStateFactory(this);
            RasterizerStates   = new RasterizerStateFactory(this);
            DepthStencilStates = new DepthStencilStateFactory(this);

            currentState = null;
            allocatedStates.Clear();
            currentStateIndex = -1;
            PushState();

            Begin();
            ClearState();
            End();
        }