Sign in to follow this  
GoodFun

DirectX 10 Texture Array question

Recommended Posts

Hi there, I am looking for some insight on how texture arrays work in DirectX 10. Mostly I'm interested in the transfer of the texture from main RAM to the video card. I'm wondering if the whole texture array is always being transfered or if the transfer happens on demand when a shader actually accesses part of a texture array. Also, if at that point only that part of the texture array is being transfered or if the whole array gets transfered. I guess the question can be expanded to multiple textures in a scene... if a texture is on a polygon that doesn't get rendered, I assume the texture won't get transfered to the graphics card... well, anyone that can share some insight on how textures are being selected for transfer to the graphics card would be greatly welcome Thanks Marcel

Share this post


Link to post
Share on other sites
Quote:
Original post by GoodFun
Hi there,

I am looking for some insight on how texture arrays work in DirectX 10. Mostly I'm interested in the transfer of the texture from main RAM to the video card. I'm wondering if the whole texture array is always being transfered or if the transfer happens on demand when a shader actually accesses part of a texture array. Also, if at that point only that part of the texture array is being transfered or if the whole array gets transfered.

I guess the question can be expanded to multiple textures in a scene... if a texture is on a polygon that doesn't get rendered, I assume the texture won't get transfered to the graphics card...

well, anyone that can share some insight on how textures are being selected for transfer to the graphics card would be greatly welcome

Thanks
Marcel


I don't see your point, the texture except for the system-memory one are already in graphics memory at the time you create them.
What you pass to the shader is a ShaderResourceView that points at the resource/resources, the shader does not upload any texture at all.

Share this post


Link to post
Share on other sites
that is not entirely accurate as I am creating 12 gigs of textures which are stored in system memory and are being swapped in / out of the graphics card as needed. So there has to be some sort of system that takes care of this and so far I haven't been able to find any kind of information on it.

Share this post


Link to post
Share on other sites
DXGI implements a system called "GPU virtualization" which acts as a scheduling and paging system for textures and other buffers.

If I remember correctly, the algorithm for paging out resources - that is, moving to system memory - is LRU (least recently used). This means that when you cause the system to try to allocate new buffers on the GPU and the GPU memory can't accommodate your request, the system sorts the existing GPU resources based on when they were last used, and pages out those that haven't been used in the longest time until it frees enough memory for the new allocation.

Conversely, when a paged-out resource is needed on GPU, the system will again free memory starting from the oldest resources, and copies the needed resource back to the GPU memory.

As to when the resource is marked as needed, this depends on the graphics driver. It might be the point when the resource is bound via a view, or the point where it is actually used for drawing ops, or something else.

The driver/hardware has an internal command queue which they (internally) examine for a list of needed resources to draw, and I would guess the paging is executed during this examination.

New in DXGI (hence, D3D10) as compared to D3D9 is that this GPU resource pool is internally shared between all applications and the eviction will consider all resources instead of just those of the given application.

Note that if you use more GPU memory within one frame than is actually available, this will introduce a considerable performance bottleneck as stuff has to be continuously uploaded (and some cases, downloaded) via the graphics bus.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this