Ejemplo n.º 1
0
        public GpuDevice(GpuAdapter adapter)
        {
            //set member to null
            mVertexShader = null;
            mPixelShader  = null;
            mInputLayout  = null;

            //set the adapter
            Adapter = adapter;

#if DEBUG
            //creation flag, we use debug flag
            var creationFlags = SharpDX.Direct3D11.DeviceCreationFlags.Debug;
#else
            var creationFlags = SharpDX.Direct3D11.DeviceCreationFlags.None;
#endif
            //fetuares level: 11_0, 12_0
            var fetuares = new SharpDX.Direct3D.FeatureLevel[2]
            {
                SharpDX.Direct3D.FeatureLevel.Level_11_0,
                SharpDX.Direct3D.FeatureLevel.Level_12_0
            };

            //create device with current adapter
            mDevice           = new SharpDX.Direct3D11.Device(Adapter.Adapter, creationFlags, fetuares);
            mImmediateContext = Device.ImmediateContext;

            LogEmitter.Apply(LogLevel.Information, "[Initialize Graphics Device with {0}]", adapter.Description);
            LogEmitter.Apply(LogLevel.Information, "[Graphics Device Feature Level = {0}]", Device.FeatureLevel);
        }
Ejemplo n.º 2
0
        public void SetPixelShader(GpuPixelShader pixelShader)
        {
            //set pixel shader
            mPixelShader = pixelShader;

            //set pixel shader Direct3D instance to pipeline
            ImmediateContext.PixelShader.SetShader(mPixelShader.PixelShader, null, 0);
        }
Ejemplo n.º 3
0
        public void Reset()
        {
            //clear all state and reset it

            mVertexShader = null;
            mPixelShader  = null;
            mInputLayout  = null;

            ImmediateContext.ClearState();
        }