/// <summary> /// Initializes a new instance of the <see cref="GraphicsDevice" /> class. /// </summary> /// <param name="adapter">The graphics adapter.</param> /// <param name="profile">The graphics profile.</param> /// <param name="deviceCreationFlags">The device creation flags.</param> /// <param name="windowHandle">The window handle.</param> protected GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile[] profile, DeviceCreationFlags deviceCreationFlags, WindowHandle windowHandle) { // Create shared data sharedDataPerDevice = new Dictionary <object, IDisposable>(); Recreate(adapter, profile, deviceCreationFlags, windowHandle); // Helpers PrimitiveQuad = new PrimitiveQuad(this); }
/// <summary> /// Initializes a new instance of the <see cref="GraphicsDevice" /> class. /// </summary> /// <param name="adapter">The graphics adapter.</param> /// <param name="profile">The graphics profile.</param> /// <param name="deviceCreationFlags">The device creation flags.</param> /// <param name="windowHandle">The window handle.</param> protected GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile[] profile, DeviceCreationFlags deviceCreationFlags, WindowHandle windowHandle) { RootDevice = this; // Setup IsDeferred to false for the main device isDeferred = false; // Create shared data sharedDataPerDevice = new Dictionary <object, IDisposable>(); Recreate(adapter, profile, deviceCreationFlags, windowHandle); // Helpers primitiveQuad = new PrimitiveQuad(this); }
/// <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(); }
/// <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(); }