+ D3D12_SUBRESOURCE_TILING tilings_alt[17]; + D3D12_PACKED_MIP_INFO packed_mip_info; + D3D12_SUBRESOURCE_TILING tilings[17]; + UINT num_resource_tiles, num_tilings;
17 is a bit of a magic constant. The usual naming convention for "num_resource_tiles" and "num_tilings" would be "resource_tile_count" and "tiling_count".
+ { D3D12_RESOURCE_DIMENSION_TEXTURE2D, DXGI_FORMAT_R8_UNORM,»··· 512, 512, 1, 1, 4, 1, 1, 256, 256, 1, D3D12_TILED_RESOURCES_TIER_1 },
Stray tab above.
+ /* If num_tilings is NULL, tilings_alt is ignored. */ + memset(tilings, 0, sizeof(tilings)); + memset(tilings_alt, 0, sizeof(tilings_alt)); + ID3D12Device_GetResourceTiling(context.device, resource, NULL, NULL, NULL, NULL, 0, tilings_alt); + ok(memcmp(tilings, tilings_alt, sizeof(tilings_alt)) == 0, "Mismatch.\n");
It seems like we don't really need "tilings_alt". I'm also not sure what the test really proves; if we wanted to prove that the ID3D12Device_GetResourceTiling() call doesn't touch "tilings_alt" above, it would seem more useful to initialise it with something other than zeroes.
+ /* Tiled tier is not included in feature support yet so as not to break future bisections. */ + no_tier_3 = is_amd_windows_device(context.device) || is_radv_device(context.device);
I'm not quite sure what issue this is trying to solve, but this doesn't seem quite proper.
+ if (d3d12_resource_is_texture(resource_impl)) + { + FIXME("Not implemented for textures.\n"); + return; + } + + d3d12_resource_get_tiling(device, resource_impl, total_tile_count, packed_mip_info, standard_tile_shape, + sub_resource_tiling_count, first_sub_resource_tiling, sub_resource_tilings);
Any reason we couldn't check the resource type in d3d12_resource_get_tiling()?
+static bool d3d12_resource_init_tiles(struct d3d12_resource *resource, struct d3d12_device *device) +{ + struct vkd3d_subresource_tile_info *tile_info; + unsigned int subresource_count; + + subresource_count = d3d12_resource_desc_get_sub_resource_count(&resource->desc); + + if (!d3d12_resource_is_buffer(resource)) + return true; + + if (!(resource->tiles.subresources = vkd3d_calloc(subresource_count, sizeof(*resource->tiles.subresources)))) + { + ERR("Failed to allocate subresource info array.\n"); + return false; + } + + if (d3d12_resource_is_buffer(resource)) + { + tile_info = &resource->tiles.subresources[0]; + tile_info->offset = 0; + tile_info->extent.width = align(resource->desc.Width, D3D12_TILE_SIZE) / D3D12_TILE_SIZE; + tile_info->extent.height = 1; + tile_info->extent.depth = 1; + tile_info->count = tile_info->extent.width; + + resource->tiles.tile_extent.width = D3D12_TILE_SIZE; + resource->tiles.tile_extent.height = 1; + resource->tiles.tile_extent.depth = 1; + resource->tiles.total_count = tile_info->extent.width; + resource->tiles.subresource_count = 1; + resource->tiles.standard_mip_count = 1; + } + else + { + vkd3d_unreachable(); + } + + return true; }
The structure here seems odd. We don't need the first "if (!d3d12_resource_is_buffer(resource))" check if we just move the vkd3d_calloc() call into the "if (d3d12_resource_is_buffer(resource))" block, and the else block is just superfluous.
@@ -36619,6 +36619,12 @@ static void test_get_resource_tiling(void) continue; } + if (tests[i].dim != D3D12_RESOURCE_DIMENSION_BUFFER) + { + skip("Tiled textures not supported.\n"); + continue; + }
Ideally we'd just use todo_if() instead of skip(); skip() is intended for functionality that may legitimately be missing, while insufficiencies in vkd3d should be marked with todo.