MCPcopy Create free account
hub / github.com/3Shain/dxmt / TextureCopyCommand

Method TextureCopyCommand

src/d3d11/d3d11_context_impl.cpp:312–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310 bool Invalid = true;
311
312 TextureCopyCommand(
313 BlitObject &Dst_, UINT DstSubresource, UINT DstX, UINT DstY, UINT DstZ, BlitObject &Src_, UINT SrcSubresource,
314 const D3D11_BOX *pSrcBox
315 ) :
316 pSrc(Src_.pResource),
317 pDst(Dst_.pResource),
318 SrcSubresource(SrcSubresource),
319 DstSubresource(DstSubresource),
320 SrcFormat(Src_.FormatDescription),
321 DstFormat(Dst_.FormatDescription) {
322 if (Dst_.Dimension != Src_.Dimension)
323 return;
324
325 if (SrcFormat.PixelFormat == WMTPixelFormatInvalid)
326 return;
327 if (DstFormat.PixelFormat == WMTPixelFormatInvalid)
328 return;
329
330 switch (Dst_.Dimension) {
331 default: {
332 return;
333 }
334 case D3D11_RESOURCE_DIMENSION_TEXTURE1D: {
335 D3D11_TEXTURE1D_DESC &dst_desc = Dst_.Texture1DDesc;
336 D3D11_TEXTURE1D_DESC &src_desc = Src_.Texture1DDesc;
337
338 Src.Format = src_desc.Format;
339 Src.MipLevel = SrcSubresource % src_desc.MipLevels;
340 Src.ArraySlice = SrcSubresource / src_desc.MipLevels;
341 Src.Width = std::max(1u, src_desc.Width >> Src.MipLevel);
342 Src.Height = 1;
343 Src.Depth = 1;
344
345 Dst.Format = dst_desc.Format;
346 Dst.MipLevel = DstSubresource % dst_desc.MipLevels;
347 Dst.ArraySlice = DstSubresource / dst_desc.MipLevels;
348 Dst.Width = std::max(1u, dst_desc.Width >> Dst.MipLevel);
349 Dst.Height = 1;
350 Dst.Depth = 1;
351 break;
352 }
353 case D3D11_RESOURCE_DIMENSION_TEXTURE2D: {
354 D3D11_TEXTURE2D_DESC1 &dst_desc = Dst_.Texture2DDesc;
355 D3D11_TEXTURE2D_DESC1 &src_desc = Src_.Texture2DDesc;
356
357 Src.Format = src_desc.Format;
358 Src.MipLevel = SrcSubresource % src_desc.MipLevels;
359 Src.ArraySlice = SrcSubresource / src_desc.MipLevels;
360 Src.Width = std::max(1u, src_desc.Width >> Src.MipLevel);
361 Src.Height = std::max(1u, src_desc.Height >> Src.MipLevel);
362 Src.Depth = 1;
363
364 Dst.Format = dst_desc.Format;
365 Dst.MipLevel = DstSubresource % dst_desc.MipLevels;
366 Dst.ArraySlice = DstSubresource / dst_desc.MipLevels;
367 Dst.Width = std::max(1u, dst_desc.Width >> Dst.MipLevel);
368 Dst.Height = std::max(1u, dst_desc.Height >> Dst.MipLevel);
369 Dst.Depth = 1;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected