Advertisement

What is the impact of MipLevels in D3D12_RESOURCE_DESC?

Started by April 07, 2018 08:52 AM
3 comments, last by NikiTo 6 years, 9 months ago

AMD forces me to use MipLevels in order to can read from a heap previously used as RTV. Intel's integrated GPU works fine with MipLevels = 1 inside the D3D12_RESOURCE_DESC. For AMD I have to set it to 0(or 2). MSDN says 0 means max levels. With MipLevels = 1, AMD is rendering fine to the RTV, but reading from the RTV it shows the image reordered.

Is setting MipLevels to something other than 1 going to cost me too much memory or execution time during rendering to RTVs, because I really don't need mipmaps at all(not for the 99% of my app)?

(I use the same 2D D3D12_RESOURCE_DESC for both the SRV and RTV sharing the same heap. Using 1 for MipLevels in that D3D12_RESOURCE_DESC gives me results like in the photos attached below. Using 0 or 2 makes AMD read fine from the RTV. I wish I could sort this somehow, but in the last two days I've tried almost anything to sort this problem, and this is the only way it works on my machine.)

adapter A.png

adapter B.png

2 hours ago, NikiTo said:

AMD forces me to use MipLevels in order to can read from a heap previously used as RTV. Intel's integrated GPU works fine with MipLevels = 1 inside the D3D12_RESOURCE_DESC. For AMD I have to set it to 0(or 2). MSDN says 0 means max levels. With MipLevels = 1, AMD is rendering fine to the RTV, but reading from the RTV it shows the image reordered.

This looks like it's unrelated to miplevels and your actual problem is due to invoking undefined behaviour somewhere else. How are you reading from the image? Are you issuing the appropriate barrier between SRV and RTV usage? Does the validation layer report any errors?

Advertisement

You said you have an SRV and RTV sharing the same heap. Does that mean you created an SRV resource, and an RTV resource, as placed resources on the same heap, and are aliasing between them? That is definitely undefined behavior.

You're allowed to re-use memory from a heap using placement, but not allowed to inherit the contents. On some generations of hardware, this can cause flat out faults on the GPU instead of just garbled contents.

The correct thing to do is use one resource, with a resource barrier between RTV and SRV usage.

Thank you, all!
I am so glad you helped me to use RTVs without mips!

@SoldierOfLight I was doing exactly that sharing heap thing. Now I use just a single committed resource as you told me to do, and it works correctly for MipLevels of 1 on both adapters.

Thank you again for solving my 3 days struggle!

This topic is closed to new replies.

Advertisement