sample code to use tiled resource technology in d3d11.2?

Started by
0 comments, last by w359405949 6 years, 7 months ago
 

i got a strange result in calling UpdateTileMapping and UpdateTiles every frame like this which as same as the Mars Tiled Resource Sample do:

void CalledEveryFrame()
{
    vector<D3D11_TILED_RESOURCE_COORDINATE> coordinates; // 4 diffrent coordinates
    vector<D3D11_TIL_REGION_SIZE> regions; // 4 as same. but only set the NumTiles=1
    vector<UINT> offsets(4, 0);
    vector<UINT> rangeFlags(4, 0);
    vector<UINT> rangeTileCounts(4, 1);

    deviceContext->UpdateTileMappings(myMiscTexture, 4, coordinates.data(), 
        regions.data(), myMiscBuffer, 4, rangFlags.data(), offsets.data(). 
        rangeTileCounts.data(), D3D11_TILE_MAPPING_NO_OVERWRITE);

    map<int, vector<float>> myTileData; // 4 with different data.
    for (int index = 0; index < coordinates.size(); index++)
    {
         D3D11_TILED_RESOURCE_COORDINATE coord = coordinate[index];
         D3D11_TILE_REGION_SIZE region = regions[index];
         deviceContext->UpdateTiles(myMiscTexture, &coord, &region, myTileData[index].data(), D3D11_TILE_COPY_NO_OVERWRITE);
    }
}

i alway got 4 same TileData show in different coordinate.

if i copy the code above with another 4 coordinate like this:

void CalledEveryFrame()
{
    UpdateTileMappings(coordinates);
    for(coordinates)        
    {
        UpdateTiles(TileData);
    }

    UpdateTileMappings(coordinates2);
    for(coordinates2)
    {
        UpdateTiles(TileData2);
    }
}

i alway got 8 same TileData showing, why?

This topic is closed to new replies.

Advertisement