다음을 통해 공유


ID3D11DeviceContext2::UpdateTileMappings 메서드(d3d11_2.h)

타일 풀의 메모리 위치에 타일 리소스의 타일 위치 매핑을 업데이트.

구문

HRESULT UpdateTileMappings(
  [in]           ID3D11Resource                        *pTiledResource,
  [in]           UINT                                  NumTiledResourceRegions,
  [in, optional] const D3D11_TILED_RESOURCE_COORDINATE *pTiledResourceRegionStartCoordinates,
  [in, optional] const D3D11_TILE_REGION_SIZE          *pTiledResourceRegionSizes,
  [in, optional] ID3D11Buffer                          *pTilePool,
  [in]           UINT                                  NumRanges,
  [in, optional] const UINT                            *pRangeFlags,
  [in, optional] const UINT                            *pTilePoolStartOffsets,
  [in, optional] const UINT                            *pRangeTileCounts,
  [in]           UINT                                  Flags
);

매개 변수

[in] pTiledResource

형식: ID3D11Resource*

타일화된 리소스에 대한 포인터입니다.

[in] NumTiledResourceRegions

형식: UINT

타일화된 리소스 지역의 수입니다.

[in, optional] pTiledResourceRegionStartCoordinates

형식: const D3D11_TILED_RESOURCE_COORDINATE*

타일식 리소스 영역의 시작 좌표를 설명하는 D3D11_TILED_RESOURCE_COORDINATE 구조체의 배열입니다. NumTiledResourceRegions 매개 변수는 배열의 D3D11_TILED_RESOURCE_COORDINATE 구조체 수를 지정합니다.

[in, optional] pTiledResourceRegionSizes

형식: const D3D11_TILE_REGION_SIZE*

타일식 리소스 영역의 크기를 설명하는 D3D11_TILE_REGION_SIZE 구조체의 배열입니다. NumTiledResourceRegions 매개 변수는 배열의 D3D11_TILE_REGION_SIZE 구조체 수를 지정합니다.

[in, optional] pTilePool

형식: ID3D11Buffer*

타일 풀에 대한 포인터입니다.

[in] NumRanges

형식: UINT

타일 풀 범위의 수입니다.

[in, optional] pRangeFlags

형식: const UINT*

각 타일 풀 범위를 설명하는 D3D11_TILE_RANGE_FLAG 값의 배열입니다. NumRanges 매개 변수는 배열의 값 수를 지정합니다.

[in, optional] pTilePoolStartOffsets

형식: const UINT*

타일 풀에 대한 오프셋 배열입니다. 이는 타일(바이트 아님)으로 계산되는 0 기반 타일 오프셋입니다.

[in, optional] pRangeTileCounts

형식: const UINT*

타일 배열입니다.

각 타일 풀 범위의 타일 수를 지정하는 값의 배열입니다. NumRanges 매개 변수는 배열의 값 수를 지정합니다.

[in] Flags

형식: UINT

비트 OR 연산을 사용하여 결합된 D3D11_TILE_MAPPING_FLAGS 값의 조합입니다.

반환 값

형식: HRESULT

성공하면 S_OK 반환합니다. 그렇지 않으면 다음 중 하나를 반환합니다.

  • 잘못된 플래그와 같은 다양한 조건으로 인해 호출이 삭제되는 경우 E_INVALIDARG 반환합니다. 디버그 계층에서 오류가 발생합니다.
  • 호출로 인해 드라이버가 새 페이지 테이블 매핑을 위한 공간을 할당해야 하지만 메모리가 부족한 경우 E_OUTOFMEMORY 반환합니다. 명령 목록에서 호출되고 명령 목록이 실행될 때 메모리가 부족하면 디바이스가 제거됩니다. 앱은 명령 목록 내의 타일형 리소스에서 기존 매핑을 변경하는 업데이트 호출만 수행하여 이러한 상황을 방지할 수 있습니다(따라서 드라이버는 페이지 테이블 메모리를 할당할 필요가 없고 매핑만 변경).
  • 비디오 카드 시스템에서 물리적으로 제거되었거나 비디오 카드 대한 드라이버 업그레이드가 발생한 경우 DXGI_ERROR_DEVICE_REMOVED 반환합니다.

설명

UpdateTileMappings에 대한 단일 호출에서 하나 이상의 리소스 타일 범위를 하나 이상의 타일 풀 타일 범위에 매핑할 수 있습니다.

다음과 같은 방법으로 UpdateTileMappings 의 매개 변수를 구성하여 업데이트를 수행할 수 있습니다.

  • 매핑이 업데이트되는 타일형 리소스입니다. D3D11_RESOURCE_MISC_TILED 플래그를 사용하여 만든 리소스입니다. 매핑은 리소스를 처음 만들 때 모든 NULL에서 시작됩니다.
  • 매핑이 업데이트되는 타일 리소스의 타일 영역 집합입니다. UpdateTileMappings를 한 번 호출하여 더 편리한 경우뿐만 아니라 API 호출 오버헤드를 조금 더 사용하여 여러 매핑 또는 여러 호출을 업데이트할 수 있습니다. NumTiledResourceRegions 는 각 지역의 시작 위치를 식별하고 확장하는 각 배열인 pTiledResourceRegionStartCoordinatespTiledResourceRegionSize 의 지역 수를 지정합니다. NumTiledResourceRegions가 1인 경우 편의상 지역을 설명하는 배열 중 하나 또는 둘 다 NULL일 수 있습니다. pTiledResourceRegionStartCoordinates의 NULL은 시작 좌표가 모두 0이고 pTiledResourceRegionSizes의 NULL은 모든 mipmap, 배열 조각 또는 둘 다를 포함하여 타일이 있는 전체 리소스에 대한 전체 타일 집합인 기본 영역을 식별합니다. pTiledResourceRegionStartCoordinates가 NULL이 아니고 pTiledResourceRegionSizes가 NULL인 경우 지역 크기는 모든 지역에 대해 기본적으로 1 타일로 설정됩니다. 이렇게 하면 pTiledResourceRegionSizes 배열을 모두 1로 보내지 않고도 pTiledResourceRegionStartCoordinates의 위치 배열을 제공하여 서로 다른 위치에서 각각 개별 타일 집합에 대한 매핑을 쉽게 정의할 수 있습니다.

    업데이트는 첫 번째 지역에서 마지막 지역까지 적용됩니다. 따라서 지역이 단일 호출에서 겹치는 경우 목록의 뒷부분에 있는 업데이트는 이전 업데이트와 겹치는 영역을 덮어씁니다.

  • 타일 매핑이 진행될 수 있는 메모리를 제공하는 타일 풀입니다. 타일식 리소스는 한 번에 단일 타일 풀을 가리킬 수 있습니다. 새 타일 풀을 지정하는 경우(타일 풀을 마지막으로 지정한 시간과 처음 또는 다른 경우) 바둑판식 리소스에 대한 모든 기존 타일 매핑이 지워지고 현재 UpdateTileMappings 호출의 새 매핑 집합이 새 타일 풀에 적용됩니다. 타일 풀이 지정되지 않았거나 이전 UpdateTileMappings 호출과 동일한 타일 풀이 제공된 경우 UpdateTileMappings 호출은 기존 매핑에 새 매핑을 추가합니다(겹치는 경우 덮어쓰기). UpdateTileMappings가 NULL 매핑만 정의하는 경우 타일 풀은 관련이 없으므로 지정할 필요가 없습니다. 그러나 타일 풀을 지정하는 경우 타일 풀을 제공할 때 이전에 설명한 것과 동일한 동작을 사용합니다.
  • 매핑이 진행되는 타일 범위 집합입니다. 지정된 각 타일 범위는 몇 가지 유형의 범위 중 하나를 지정할 수 있습니다. 타일 풀의 타일 범위(기본값), 타일 풀의 단일 타일에 매핑할 타일 수(타일 공유), 타일이 있는 리소스에서 건너뛰고 그대로 둘 타일 매핑 수, 또는 NULL에 매핑할 타일 풀의 타일 수입니다. NumRanges 는 타일 범위의 수를 지정합니다. 여기서 모든 범위에서 식별된 총 타일은 앞에서 설명한 타일 리소스의 타일 영역의 총 타일 수와 일치해야 합니다. 매핑은 타일 범위 집합을 순차적으로 탐색하는 동안 타일 영역의 타일을 순차적으로 반복하여 정의합니다( x, 상자 영역의 경우 y, z 순서). 타일 영역의 분석은 타일 범위의 분석과 일치할 필요는 없지만 지정된 각 타일에 매핑이 지정되도록 양쪽의 총 타일 수는 같아야 합니다.

    pRangeFlags, pTilePoolStartOffsetspRangeTileCounts 는 타일 범위를 설명하는 NumRanges 크기의 모든 배열입니다. pRangeFlags가 NULL이면 모든 범위는 타일 풀의 순차적 타일입니다. 그렇지 않으면 각 범위 i에 대해 pRangeFlags[i]는 해당 타일 범위의 매핑이 작동하는 방식을 식별합니다.

    • pRangeFlags[i]가 0이면 해당 범위는 타일 풀에서 순차적 타일을 정의하며, 타일 수는 pRangeTileCounts[i]이고 시작 위치인 pTilePoolStartOffsets[i]입니다. NumRanges가 1인 경우 pRangeTileCounts는 NULL일 수 있으며 기본적으로 모든 타일 영역에 지정된 총 타일 수로 설정됩니다.
    • pRangeFlags[i]가 D3D11_TILE_RANGE_REUSE_SINGLE_TILE 경우 pTilePoolStartOffsets[i]는 매핑할 타일 풀의 단일 타일을 식별하고, pRangeTileCounts[i]는 해당 타일 풀 위치에 매핑할 타일 영역의 타일 수를 지정합니다. NumRanges가 1인 경우 pRangeTileCounts는 NULL일 수 있으며 기본적으로 모든 타일 영역에 지정된 총 타일 수로 설정됩니다.
    • pRangeFlags[i]가 D3D11_TILE_RANGE_NULL 경우 pRangeTileCounts[i]는 NULL에 매핑할 타일 영역의 타일 수를 지정합니다. NumRanges가 1인 경우 pRangeTileCounts는 NULL일 수 있으며 기본적으로 모든 타일 영역에 지정된 총 타일 수로 설정됩니다. pTilePoolStartOffsets[i]는 NULL 매핑에 대해 무시됩니다.
    • pRangeFlags[i]가 D3D11_TILE_RANGE_SKIP 경우 pRangeTileCounts[i]는 타일 영역에서 건너뛰고 기존 매핑을 변경하지 않고 유지할 타일 수를 지정합니다. 타일 영역이 타일 매핑 영역을 업데이트하도록 편리하게 경계하는 경우 유용할 수 있습니다. 단, 이전에 매핑된 것과 동일하게 유지해야 하는 몇 가지 예외가 있습니다. pTilePoolStartOffsets[i]는 SKIP 매핑에 대해 무시됩니다.
  • 전체 옵션에 대한 플래그 매개 변수입니다.D3D11_TILE_MAPPING_NO_OVERWRITE 호출자가 이전에 실행 중일 수 있는 디바이스에 이전에 제출한 명령이 업데이트되는 타일 영역을 참조하지 않는다는 것을 의미합니다. 이렇게 하면 디바이스가 타일 매핑 업데이트를 수행하기 위해 이전에 제출한 작업을 플러시할 필요가 없습니다. 앱이 아직 미해결 명령으로 참조되고 있는 타일 리소스의 위치에 대한 타일 매핑을 업데이트하여 이 약속을 위반하는 경우 일부 아키텍처에서 상당한 속도 저하가 발생할 가능성이 있는 정의되지 않은 렌더링 동작 결과입니다. 이는 하드웨어에서 페이지 테이블인 타일 매핑 데이터 구조 자체에 적용되는 경우를 제외하고 Direct3D API의 다른 곳에 존재하는 "덮어쓰지 않음" 개념과 같습니다. 이 플래그가 없을 경우 후속 Direct3D 명령을 진행하기 전에 이 UpdateTileMappings 호출에 지정된 타일 매핑 업데이트를 완료해야 합니다.
앱이 RenderTargetView 또는 DepthStencilView를 통해 렌더링할 타일 매핑이 바둑판식 리소스에서 변경된 경우 렌더링되는 영역 내에서 변경된 타일(매핑 여부)인 고정 함수 Clear API를 사용하여 앱이 지워야 합니다. 이러한 상황에서 앱이 명확하지 않은 경우 앱은 타일화된 리소스에서 읽을 때 정의되지 않은 값을 받습니다.
참고 Direct3D 11.2에서 하드웨어는 깊이 전용 형식에서 ClearView 를 지원할 수 있습니다. 자세한 내용은 D3D11_FEATURE_DATA_D3D11_OPTIONS1 참조하세요.
 
앱이 매핑이 변경된 바둑판식 리소스에 있는 영역의 기존 메모리 콘텐츠를 보존해야 하는 경우, 앱은 먼저 타일 매핑이 변경된 내용을 복사하여 임시 화면(예: CopyTiles 사용, 필수 지우기 발급, 콘텐츠 다시 복사)을 저장할 수 있습니다.

타일이 동시에 여러 타일 리소스에 매핑되고 타일 내용이 타일 리소스 중 하나를 통해 모든 수단(렌더링, 복사 등)에 의해 조작되었다고 가정합니다. 그런 다음, 다른 타일 리소스를 통해 동일한 타일을 렌더링하는 경우 앞에서 설명한 대로 먼저 타일을 지워야 합니다.

타일형 리소스에 대한 자세한 내용은 타일형 리소스를 참조하세요.

다음은 일반적인 UpdateTileMappings 사례의 몇 가지 예입니다.

예제

전체 표면의 NULL 매핑 지우기:

// - No-overwrite is specified, assuming it is known nothing else the GPU could be doing is referencing the previous mappings
// - NULL for pTiledResourceRegionStatCoordinates and pTiledResourceRegionSizes defaults to the entire resource
// - NULL for pTilePoolStartOffsets since it isn't needed for mapping tiles to NULL
// - NULL for pRangeTileCounts when NumRanges is 1 defaults to the same number of tiles as the tiled resource region (which is
//   the entire surface in this case)
//
// UINT RangeFlags = D3D11_TILE_MAPPING_NULL;
// pDeviceContext2->UpdateTileMappings(pTiledResource,1,NULL,NULL,NULL,1,&RangeFlags,NULL,NULL,D3D11_TILE_MAPPING_NO_OVERWRITE);

타일 영역을 단일 타일에 매핑:

// - This maps a 2x3 tile region at tile offset (1,1) in a Tiled Resource to tile [12] in a Tile Pool
// 
// D3D11_TILED_RESOURCE_COORDINATE TRC;
// TRC.X = 1;
// TRC.Y = 1;
// TRC.Z = 0;
// TRC.Subresource = 0;
//
// D3D11_TILE_REGION_SIZE TRS;
// TRS.bUseBox = TRUE;
// TRS.Width = 2;
// TRS.Height = 3; 
// TRS.Depth = 1;
// TRS.NumTiles = TRS.Width * TRS.Height * TRS.Depth;
// 
// UINT RangeFlags = D3D11_TILE_MAPPING_REUSE_SINGLE_TILE;
// UINT StartOffset = 12;
// pDeviceContext2->UpdateTileMappings(pTiledResource,1,&TRC,&TRS,pTilePool,1,&RangeFlags,&StartOffset,
//                                     NULL,D3D11_TILE_MAPPING_NO_OVERWRITE);

연결되지 않은 개별 타일 집합에 대한 매핑 정의:

// - This can also be accomplished in multiple calls.  Using a single call to define multiple
//   a single call to define multiple mapping updates can reduce CPU call overhead slightly,
//   at the cost of having to pass arrays as parameters.
// - Passing NULL for pTiledResourceRegionSizes defaults to each region in the Tiled Resource
//   being a single tile.  So all that is needed are the coordinates of each one.
// - Passing NULL for Range Flags defaults to no flags (since none are needed in this case)
// - Passing NULL for pRangeTileCounts defaults to each range in the Tile Pool being size 1.
//   So all that is needed are the start offsets for each tile in the Tile Pool
//
// D3D11_TILED_RESOURCE_COORDINATE TRC[3];
// UINT StartOffsets[3];
// UINT NumSingleTiles = 3;
//
// TRC[0].X = 1;
// TRC[0].Y = 1; 
// TRC[0].Subresource = 0;
// StartOffsets[0] = 1;
//
// TRC[1].X = 4;
// TRC[1].Y = 7; 
// TRC[1].Subresource = 0;
// StartOffsets[1] = 4;
//
// TRC[2].X = 2;
// TRC[2].Y = 3; 
// TRC[2].Subresource = 0;
// StartOffsets[2] = 7;
//
// pDeviceContext2->UpdateTileMappings(pTiledResource,NumSingleTiles,&TRC,NULL,pTilePool,NumSingleTiles,NULL,StartOffsets,
//                                     NULL,D3D11_TILE_MAPPING_NO_OVERWRITE);

복잡한 예제 - 일부 건너뛰기, 일부 NULL 매핑을 사용하여 지역에 대한 매핑 정의:

// - This complex example hard codes the parameter arrays, whereas in practice the 
//   application would likely configure the parameters programatically or in a data driven way.
// - Suppose we have 3 regions in a Tiled Resource to configure mappings for, 2x3 at coordinate (1,1),
//   3x3 at coordinate (4,7), and 7x1 at coordinate (20,30)
// - The tiles in the regions are walked from first to last, in X then Y then Z order,
//   while stepping forward through the specified Tile Ranges to determine each mapping.
//   In this example, 22 tile mappings need to be defined.
// - Suppose we want the first 3 tiles to be mapped to a contiguous range in the Tile Pool starting at
//   tile pool location [9], the next 8 to be skipped (left unchanged), the next 2 to map to NULL, 
//   the next 5 to share a single tile (tile pool location [17]) and the remaining 
//   4 tiles to each map to to unique tile pool locations, [2], [9], [4] and [17]:
//
// D3D11_TILED_RESOURCE_COORDINATE TRC[3];
// D3D11_TILE_REGION_SIZE TRS[3];
// UINT NumRegions = 3;
// 
// TRC[0].X = 1;
// TRC[0].Y = 1; 
// TRC[0].Subresource = 0;
// TRS[0].bUseBox = TRUE;
// TRS[0].Width = 2;
// TRS[0].Height = 3; 
// TRS[0].NumTiles = TRS[0].Width * TRS[0].Height;
//
// TRC[1].X = 4;
// TRC[1].Y = 7; 
// TRC[1].Subresource = 0;
// TRS[1].bUseBox = TRUE;
// TRS[1].Width = 3;
// TRS[1].Height = 3; 
// TRS[1].NumTiles = TRS[1].Width * TRS[1].Height;
//
// TRC[2].X = 20;
// TRC[2].Y = 30; 
// TRC[2].Subresource = 0;
// TRS[2].bUseBox = TRUE;
// TRS[2].Width = 7;
// TRS[2].Height = 1; 
// TRS[2].NumTiles = TRS[2].Width * TRS[2].Height;
//
// UINT NumRanges = 8;
// UINT RangeFlags[8];
// UINT TilePoolStartOffsets[8];
// UINT RangeTileCounts[8];
//
// RangeFlags[0] = 0;
// TilePoolStartOffsets[0] = 9;
// RangeTileCounts[0] = 3;
//
// RangeFlags[1] = D3D11_TILE_MAPPING_SKIP;
// TilePoolStartOffsets[1] = 0; // offset is ignored for skip mappings
// RangeTileCounts[1] = 8;
//
// RangeFlags[2] = D3D11_TILE_MAPPING_NULL;
// TilePoolStartOffsets[2] = 0; // offset is ignored for NULL mappings
// RangeTileCounts[2] = 2;
//
// RangeFlags[3] = D3D11_TILE_MAPPING_REUSE_SINGLE_TILE;
// TilePoolStartOffsets[3] = 17; 
// RangeTileCounts[3] = 5;
//
// RangeFlags[4] = 0;
// TilePoolStartOffsets[4] = 2; 
// RangeTileCounts[4] = 1;
//
// RangeFlags[5] = 0;
// TilePoolStartOffsets[5] = 9; 
// RangeTileCounts[5] = 1;
//
// RangeFlags[6] = 0;
// TilePoolStartOffsets[6] = 4; 
// RangeTileCounts[6] = 1;
//
// RangeFlags[7] = 0;
// TilePoolStartOffsets[7] = 17; 
// RangeTileCounts[7] = 1;
//
// pDeviceContext2->UpdateTileMappings(pTiledResource,NumRegions,TRC,TRS,pTilePool,NumRanges,RangeFlags,
//                                     TilePoolStartOffsets,RangeTileCounts,D3D11_TILE_MAPPING_NO_OVERWRITE);

CopyTileMappings

// CopyTileMappings helps with tasks such as shifting mappings around within/across Tiled Resources, e.g. scrolling tiles.
// The source and dest region can overlap - the result of the copy in this case is as if the source was saved to a temp and then
// from there written to the dest, though the implementation may be able to do better. 
//
// The Flags field allows D3D11_TILE_MAPPING_NO_OVERWRITE to be specified, means the caller promises that previously 
//      submitted commands to the device that may still be executing do not reference any of the tile region being updated.
//      This allows the device to avoid having to flush previously submitted work in order to do the tile mapping 
//      update.  If the application violates this promise by updating tile mappings for locations in Tiled Resouces 
//      still being referenced by outstanding commands, undefined rendering behavior results, including the potential 
//      for significant slowdowns on some architectures.  This is like the "no overwrite" concept that exists 
//      elsewhere in the API, except applied to Tile Mapping data structure itself (which in hardware is a page table).
//      The absence of this flag requires that tile mapping updates specified by this call must be completed before any
//      subsequent D3D command can proceed.
//
// Return Values:
//
// Returns S_OK or E_INVALIDARG or E_OUTOFMEMORY.  The latter can happen if the call results in the driver having to 
// allocate space for new page table mappings but running out of memory.
//
// If out of memory occurs when this is called in a commandlist and the commandlist is being executed, the device will be removed.
// Applications can avoid this situation by only doing update calls that change existing mappings from Tiled Resources 
// within commandlists (so drivers will not have to allocate page table memory, only change the mapping).
//
// Various other basic conditions such as invalid flags or passing in non Tiled Resources result in call being dropped 
// with E_INVALIDARG.
// 
// Validation remarks:
//
// The dest and the source regions must each entirely fit in their resource or behavior is undefined 
// (debug layer will emit an error).

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows 8.1 [데스크톱 앱 | UWP 앱]
지원되는 최소 서버 Windows Server 2012 R2 [데스크톱 앱 | UWP 앱]
대상 플랫폼 Windows
헤더 d3d11_2.h
라이브러리 D3D11.lib

추가 정보

ID3D11DeviceContext2