创建流式资源Creating streaming resources

创建资源时通过指定标志即可创建流式资源,指明该资源为流式资源。Streaming resources are created by specifying a flag when you create a resource, indicating that the resource is a streaming resource.

对何时创建作为流式资源的资源的限制在流式资源创建参数中进行了描述。Restrictions on when you can create a resource as a streaming resource are described in Streaming resource creation parameters.

创建资源时,在图形系统中对非流式资源的存储进行分配,例如对 2D 纹理数组的分配。A non-streaming resource's storage is allocated in the graphics system when the resource is created, such as allocation for an array of 2D textures.

创建流式资源时,图形系统不会为资源内容分配存储。When a streaming resource is created, the graphics system doesn't allocate the storage for the resource contents. 相反,应用程序创建流式资源时,图形系统仅为磁贴图面区域预留地址空间,然后允许应用程序控制磁贴映射。Instead, when an application creates a streaming resource, the graphics system makes an address space reservation for the tiled surface's area only, and then allows the mapping of the tiles to be controlled by the application. 磁贴“映射”只是内存中的物理位置,其中资源中的逻辑磁贴会指向此位置(或者对未映射磁贴来说为 NULL)。The "mapping" of a tile is simply the physical location in memory that a logical tile in a resource points to (or NULL for an unmapped tile).

不要将此概念与映射 Direct3D 资源以实现 CPU 访问混淆,虽然两者使用同一个名称,但是完全独立的。Don't confuse this concept with the notion of mapping a Direct3D resource for CPU access, which despite using the same name is completely independent. 在知道一个图面的所有磁贴无需一次映射完的情况下,你将能够定义并根据需要更改每个磁贴的映射,从而有效利用可用内存量。You will be able to define and change the mapping of each tile individually as needed, knowing that all tiles for a surface don't need to be mapped at a time, thereby making effective use of the amount of memory available.

本部分中的内容In this section

主题Topic 描述Description

到磁贴池中的映射Mappings are into a tile pool

作为流式资源创建资源时,构成资源的磁贴来自于磁贴池中各位置处的指针。When a resource is created as a streaming resource, the tiles that make up the resource come from pointing at locations in a tile pool. 磁贴池是内存池(由一个或多个分配在后台提供支持 - 对应用程序不可见)。A tile pool is a pool of memory (backed by one or more allocations behind the scenes - unseen by the application).

流式处理资源的创建参数Streaming resource creation parameters

您可以创建为流式资源的 Direct3D 资源类型存在某些限制。There are some constraints on the type of Direct3D resources that you can create as a streaming resource.

磁贴池创建参数Tile pool creation parameters

创建缓冲区时,使用此部分中的参数定义磁贴池。Use the parameters in this section to define tile pools when creating a buffer.

流式处理资源的跨进程和设备共享Streaming resource cross-process and device sharing

磁贴池可与传统资源等其他进程共享。Tile pools can be shared with other processes just like traditional resources. 涉及无法跨设备和进程共享磁贴池的流式资源。Streaming resources that reference tile pools can't be shared across devices and processes.

可对流式处理资源的操作Operations available on streaming resources

此部分列出了可对流式资源执行的操作。This section lists operations that you can perform on streaming resources.

可对磁贴池的操作Operations available on tile pools

可对磁贴池执行的操作包括调整磁贴池的大小、提供资源(为整个磁贴池临时向系统给予内存)以及回收资源。Operations on tile pools include resizing a tile pool, offering resources (yielding memory temporarily to the system for the entire tile pool), and reclaiming resources.

如何平铺流式处理资源的区域How a streaming resource's area is tiled

创建流式资源时,尺寸、格式元素大小以及 mipmap 和/或数组切片的数量(如适用)决定了支持整个图面区域所需的磁贴数量。When you create a streaming resource, the dimensions, format element size, and number of mipmaps and/or array slices (if applicable) determine the number of tiles that are required to back the entire surface area.

 

相关主题Related topics

流式资源Streaming resources