0 Replies Latest reply on Dec 21, 2016 8:50 AM by benualdo

    [DX12] Problem when clearing a sub-mipmap of a render target

    benualdo

      Hello,

       

      I am currently porting an existing cross-platform game engine to DirectX12 and I am doing  a lot of basic tests for our HW abstraction layer.

       

      I noticed a problem that only happens on AMD cards with DirectX12, when clearing a mipmap of a render target that is other than the mipmap 0. (Checked with D3D Debug Device enabled and meticulously verified the resource transitions between the PixelShaderResource and the RenderTarget states but to me it seems to be all correct)

       

      In this  test  :

      - in the 1st row, I just try to clear each mip level of a 64x64 texture with a different color

      - in the 2nd row I propagate mip 0 to the other mip levels by drawing fullscreen quads (in order to check if my RenderTargetViews were correctly configured and, who knows, that could be useful someday)

       

      All the render targets are then displayed onto the backbuffer using the same shader.

       

      On an NVIDIA 1070 card, I have what I expected :

       

      x64_GfxRenderer_DX12_r_NV.png

       

      But on my other PC with an AMD 270X card here is what I got:
      (rem: the quads are displayed with alpha blending enabled, thus the corrupted parts not cleared by the "clear" command are 0x00000000 transparent black)

      x64_GfxRenderer_DX12_r_AMD.png

      The 1st row that performs the clear is not correct but the 2nd row that draw quads is correct.

       

      I tried to investigate using GPA and (as a far I can trust a GPU profiling tool when it comes to debugging graphics corruptions), it looks like the render is correct when rendering to the render target view

       

      gpaclearmip1.png

      But it is corrupted when used as a shader resource
      gpamip1resource.png

      I do not have access to many PCs with Windows 10 and different gfx cards, but the bug is present on all (two) PCs with AMD cards.

      As the problem seems to be related to clear and resource transitions, I dont have many things I think I can do to workaround this bug (maybe exept replacing clears to mip > 0 with fullscreen quads )

       

      Thanks