protonscr

DX12<->VKD3D API inconsistency in ID3D12Device::GetResourceTiling method

vkd3dclosed
HansKristian-Work/vkd3d-proton#1105 · opened 2022-05-28 by dbarkar · updated 2022-05-31 · 3 comments · github
Ddbarkar 2022-05-28 github

The following code snippet

auto reservedTexDesc = CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8_UINT, 1, 1, 1, 1);
reservedTexDesc.Layout = D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE;
reservedTexDesc.Flags = D3D12_RESOURCE_FLAG_NONE;

CComPtr<ID3D12Resource> spDummyReservedTex;
m_device.CreateReservedResource(&reservedTexDesc, initialState, nullptr, IID_PPV_ARGS(&spDummyReservedTex));

D3D12_TILE_SHAPE tileShape = {};
m_device.GetResourceTiling(spDummyReservedTex, nullptr, nullptr, &tileShape, nullptr, 0, nullptr);

returns tileShape={256,256,1} for native DirectX and tileShape={0,0,0} for VKD3D.

I suppose it should return memory_requirements->formatProperties.imageGranularity.

Ddoitsujin maintainer 2022-05-30 github

Which D3D12 driver is this on?

Ddbarkar 2022-05-30 github

I'm using NVIDIA driver v512.95 on Windows 11 21H2

HHansKristian-Work maintainer 2022-05-31 github

All Windows drivers violate the docs here:

Specifies a D3D12_TILE_SHAPE structure that GetResourceTiling fills with info about the tile shape. This is info about how pixels fit in the tiles, independent of tiled resource's dimensions, not including packed mipmaps. If the entire tiled resource is packed, this parameter is meaningless because the tiled resource has no defined layout for packed mipmaps. In this situation, GetResourceTiling sets the members of D3D12_TILE_SHAPE to zeros.

We implemented that behavior, but the PR proves the docs don't match implementations.

Nothing extracted yet.