d3d:d3d12:texture
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン最新のリビジョン両方とも次のリビジョン | ||
d3d:d3d12:texture [2015/09/20 20:27] – [例] oga | d3d:d3d12:texture [2015/09/20 20:39] – [例] oga | ||
---|---|---|---|
行 23: | 行 23: | ||
===== 例 ===== | ===== 例 ===== | ||
+ | |||
+ | Texture 用 Resource 作成。 | ||
<code cpp> | <code cpp> | ||
行 42: | 行 44: | ||
iD3DDevice-> | iD3DDevice-> | ||
+ | </ | ||
+ | Footprint 取得。 | ||
+ | |||
+ | <code cpp> | ||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT | D3D12_PLACED_SUBRESOURCE_FOOTPRINT | ||
UINT64 | UINT64 | ||
iD3DDevice-> | iD3DDevice-> | ||
</ | </ | ||
+ | |||
+ | Upload 用 Buffer 作成 | ||
<code cpp> | <code cpp> | ||
行 67: | 行 75: | ||
</ | </ | ||
+ | Upload Buffer への書き込み。 | ||
+ | <code cpp> | ||
+ | void* ptr= nullptr; | ||
+ | iUploadBuffer-> | ||
+ | memcpy( reinterpret_cast< | ||
+ | </ | ||
+ | |||
+ | Copy コマンド作成 | ||
+ | |||
+ | <code cpp> | ||
+ | D3D12_TEXTURE_COPY_LOCATION | ||
+ | memset( &dest, 0, sizeof(dest) ); | ||
+ | dest.pResource= iTexture; | ||
+ | dest.Type= D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; | ||
+ | dest.SubresourceIndex= 0; | ||
+ | |||
+ | D3D12_TEXTURE_COPY_LOCATION | ||
+ | memset( &src, 0, sizeof(src) ); | ||
+ | src.pResource= iUploadBuffer; | ||
+ | src.Type= D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; | ||
+ | src.PlacedFootprint= footprint; | ||
+ | |||
+ | ID3D12GraphicsCommandList* | ||
+ | iCommandList-> | ||
+ | </ | ||
+ | |||
+ | ResourceBarrier 挿入 | ||
+ | |||
+ | <code cpp> | ||
+ | D3D12_RESOURCE_BARRIER | ||
+ | memset( & | ||
+ | barrier.Type= D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; | ||
+ | barrier.Transition.pResource= iTexture; | ||
+ | barrier.Transition.Subresource= D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; | ||
+ | barrier.Transition.StateBefore= D3D12_RESOURCE_STATE_COPY_DEST; | ||
+ | barrier.Transition.StateAfter= D3D12_RESOURCE_STATE_GENERIC_READ; | ||
+ | |||
+ | iCommandList-> | ||
+ | </ | ||
d3d/d3d12/texture.txt · 最終更新: 2015/09/20 20:45 by oga