1 Reply Latest reply on Aug 16, 2016 10:32 AM by kingofthebongo

    Tiled Resources

    kingofthebongo

      Hi,

       

      Can somebody explain how the tile mapping works in the tiled resources.

       

      I have R280X card and a big texture 16384x16384 with 7 mip levels.

       

      The format of the texture is DXGI_FORMAT_R8G8B8A8_UNORM

       

      UpdateTileMappings takes around 15 seconds to finish. The operating system is Windows 10 10586

      R280X reports that it is Tier1 hardware so I cannot have null tiles, since DX 11 Debug layer complains.

       

      These are the parameters

       

      D3D11_TEXTURE2D_DESC d = {};

       

                 d.Width         = 16384;

                  d.Height        = 16384;

                  d.MipLevels     = 7;

                  d.ArraySize     = 1;

                  d.SampleDesc.Count = 1;

                  d.Format = DXGI_FORMAT_R8G8B8A8_UNORM;

                  d.MiscFlags     = D3D11_RESOURCE_MISC_TILED;

                  d.BindFlags     = D3D11_BIND_SHADER_RESOURCE;

       

      This is the call to the function

       

      void map_to_null_tile(ID3D11DeviceContext2* ctx, tiled_texture* t, uint32_t total_tile_count)

          {

              uint32_t range_flag              = D3D11_TILE_RANGE_REUSE_SINGLE_TILE;

              uint32_t tile_pool_start_offsets = 0;

              uint32_t range_tile_counts       = 1;

       

       

              //map region 0 to the null tile

              d3d11::helpers::update_tile_mappings

              (

                  ctx,

                  t->m_resource.get(),

                  1,

                  nullptr,

                  nullptr,

                  t->m_tile_pool.get(),

                  1,

                  &range_flag,

                  &tile_pool_start_offsets,

                  nullptr,

                  D3D11_TILE_MAPPING_NO_OVERWRITE

              );

       

       

              ctx->TiledResourceBarrier(NULL, t->m_resource.get());

       

       

              D3D11_TILED_RESOURCE_COORDINATE  region = {};

              D3D11_TILE_REGION_SIZE           region_size = {};

       

       

              auto size = 128 * 128 * sizeof(uint32_t);

              std::unique_ptr< uint8_t[] > tile_data(new uint8_t[size]);

       

       

              std::memset(&tile_data[0], 0xbf, size);

       

       

              region_size.NumTiles = 1;

       

       

              ctx->UpdateTiles(

                  t->m_resource.get(),

                  &region,

                  &region_size,

                  &tile_data[0],

                  D3D11_TILE_COPY_NO_OVERWRITE);

       

       

       

       

              ctx->TiledResourceBarrier(NULL, t->m_resource.get());

          }

       

      If somebody wants to do a repro i can supply full source code.

       

      1st this is quite slow and is not usable. For example on NVidia 970 this does not show up at all

      2.Updating tiles in general is extremely slow. I get 20-30ms updates for 20 tiles, which is around 20 * 64kb memory, which is not much to transfer accross the pci bus.

       

      If possible to outline tactics to update tiles faster and in general how this system works on Windows 10, since unless i do something wrong it is not very usable.

       

       

      So in general i need some explanation what the driver does behind the scenes. I have noticed that DXGI_FORMAT_BC1_UNORM_SRGB works much faster, but probably this is related to the fact, that the memory used is much lower.

        • Re: Tiled Resources
          kingofthebongo

          Hi , more update on this.

           

          I have noticed that if I have tiles map to null, instead of mapped to single file. UpdateTileMappings works much faster.

           

          But then DX11 complains that there are NULL mapped tiles in my resource on this Tier1 hardware.

           

          So again, if there is some way to update tile mappings to point to single time in less than 20-30ms will be fine