public QueryManager(CommandList commandList, GraphicsResourceAllocator allocator) { this.commandList = commandList; this.allocator = allocator; Profiler.GpuTimestampFrequencyRatio = commandList.GraphicsDevice.TimestampFrequency / 1000.0; }
public ResourceGroupAllocator(GraphicsResourceAllocator allocator, CommandList commandList) { this.allocator = allocator; this.commandList = commandList; this.graphicsDevice = commandList.GraphicsDevice; SetupNextDescriptorPool(); }
/// <summary> /// Initializes a new instance of the <see cref="RenderContext" /> class. /// </summary> /// <param name="services">The services.</param> /// <param name="allocator">The allocator.</param> /// <exception cref="System.ArgumentNullException">services</exception> internal RenderContext(IServiceRegistry services, GraphicsResourceAllocator allocator = null) { if (services == null) throw new ArgumentNullException("services"); Services = services; Effects = services.GetSafeServiceAs<EffectSystem>(); this.allocator = allocator ?? new GraphicsResourceAllocator(Services).DisposeBy(this); GraphicsDevice = services.GetSafeServiceAs<IGraphicsDeviceService>().GraphicsDevice; }
/// <summary> /// Initializes a new instance of the <see cref="RenderContext" /> class. /// </summary> /// <param name="services">The services.</param> /// <param name="allocator">The allocator.</param> /// <exception cref="System.ArgumentNullException">services</exception> internal RenderContext(IServiceRegistry services, GraphicsResourceAllocator allocator = null) { if (services == null) { throw new ArgumentNullException("services"); } Services = services; Effects = services.GetSafeServiceAs <EffectSystem>(); this.allocator = allocator ?? new GraphicsResourceAllocator(Services).DisposeBy(this); GraphicsDevice = services.GetSafeServiceAs <IGraphicsDeviceService>().GraphicsDevice; }
/// <summary> /// Initializes a new instance of the <see cref="ImageEffectContext" /> class. /// </summary> /// <param name="serviceRegistry">The service registry.</param> /// <param name="allocator">The allocator.</param> /// <exception cref="System.ArgumentNullException">serviceRegistry</exception> public ImageEffectContext(IServiceRegistry serviceRegistry, GraphicsResourceAllocator allocator = null) { if (serviceRegistry == null) { throw new ArgumentNullException("serviceRegistry"); } Services = serviceRegistry; Effects = serviceRegistry.GetSafeServiceAs <EffectSystem>(); this.allocator = allocator ?? new GraphicsResourceAllocator(Services).DisposeBy(this); GraphicsDevice = serviceRegistry.GetSafeServiceAs <IGraphicsDeviceService>().GraphicsDevice; Parameters = new ParameterCollection(); }
/// <summary> /// Initializes a new instance of the <see cref="RenderContext" /> class. /// </summary> /// <param name="services">The services.</param> /// <param name="allocator">The allocator.</param> /// <exception cref="System.ArgumentNullException">services</exception> private RenderContext(IServiceRegistry services, GraphicsResourceAllocator allocator = null) { if (services == null) { throw new ArgumentNullException("services"); } Services = services; Effects = services.GetSafeServiceAs <EffectSystem>(); this.allocator = allocator ?? new GraphicsResourceAllocator(Services).DisposeBy(this); GraphicsDevice = services.GetSafeServiceAs <IGraphicsDeviceService>().GraphicsDevice; parametersStack = new Stack <ParameterCollection>(); PushParameters(new ParameterCollection()); }
internal BufferPool(GraphicsResourceAllocator allocator, GraphicsDevice graphicsDevice, int size) { constantBufferAlignment = graphicsDevice.ConstantBufferDataPlacementAlignment; if (size % constantBufferAlignment != 0) throw new ArgumentException($"size needs to be a multiple of constant buffer alignment ({constantBufferAlignment})", nameof(size)); this.allocator = allocator; Size = size; if (!useBufferOffsets) Data = Marshal.AllocHGlobal(size); Reset(); }
public static BufferPool New(GraphicsResourceAllocator allocator, GraphicsDevice graphicsDevice, int size) { return new BufferPool(allocator, graphicsDevice, size); }
/// <summary> /// Gets a <see cref="Texture" /> output for the specified description. /// </summary> /// <param name="allocator">The allocator.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="format">Describes the format to use.</param> /// <param name="mipCount">Number of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.</param> /// <param name="flags">Sets the texture flags (for unordered access...etc.)</param> /// <param name="arraySize">Size of the texture 2D array, default to 1.</param> /// <returns>A new instance of <see cref="Texture" /> class.</returns> /// <msdn-id>ff476521</msdn-id> /// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged> /// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short> public static Texture GetTemporaryTexture2D(this GraphicsResourceAllocator allocator, int width, int height, PixelFormat format, MipMapCount mipCount, TextureFlags flags = TextureFlags.RenderTarget | TextureFlags.ShaderResource, int arraySize = 1) { return(allocator.GetTemporaryTexture(TextureDescription.New2D(width, height, mipCount, format, flags, arraySize))); }
/// <summary> /// Gets a <see cref="Texture" /> output for the specified description. /// </summary> /// <param name="allocator">The allocator.</param> /// <param name="description">The description.</param> /// <returns>A new instance of <see cref="Texture" /> class.</returns> public static Texture GetTemporaryTexture2D(this GraphicsResourceAllocator allocator, TextureDescription description) { return(allocator.GetTemporaryTexture(description)); }
public GraphicsContext(GraphicsDevice graphicsDevice, GraphicsResourceAllocator allocator = null, CommandList commandList = null) { CommandList = commandList ?? graphicsDevice.InternalMainCommandList ?? CommandList.New(graphicsDevice); Allocator = allocator ?? new GraphicsResourceAllocator(graphicsDevice).DisposeBy(graphicsDevice); ResourceGroupAllocator = new ResourceGroupAllocator(Allocator, CommandList); }