| 352 | } |
| 353 | |
| 354 | void CommandListWrapper::resolveTexture(ITexture* dest, const TextureSubresourceSet& dstSubresources, ITexture* src, const TextureSubresourceSet& srcSubresources) |
| 355 | { |
| 356 | if (!requireOpenState()) |
| 357 | return; |
| 358 | |
| 359 | if (!requireType(CommandQueue::Graphics, "resolveTexture")) |
| 360 | return; |
| 361 | |
| 362 | bool anyErrors = false; |
| 363 | |
| 364 | if (!dest) |
| 365 | { |
| 366 | error("resolveTexture: dest is NULL"); |
| 367 | anyErrors = true; |
| 368 | } |
| 369 | |
| 370 | if (!src) |
| 371 | { |
| 372 | error("resolveTexture: src is NULL"); |
| 373 | anyErrors = true; |
| 374 | } |
| 375 | |
| 376 | if (anyErrors) |
| 377 | return; |
| 378 | |
| 379 | const TextureDesc& dstDesc = dest->getDesc(); |
| 380 | const TextureDesc& srcDesc = src->getDesc(); |
| 381 | |
| 382 | TextureSubresourceSet dstSR = dstSubresources.resolve(dstDesc, false); |
| 383 | TextureSubresourceSet srcSR = srcSubresources.resolve(srcDesc, false); |
| 384 | |
| 385 | if (dstSR.numArraySlices != srcSR.numArraySlices || dstSR.numMipLevels != srcSR.numMipLevels) |
| 386 | { |
| 387 | error("resolveTexture: source and destination subresource sets must resolve to sets of the same size"); |
| 388 | anyErrors = true; |
| 389 | } |
| 390 | |
| 391 | const uint32_t srcMipWidth = std::max(srcDesc.width >> srcSR.baseMipLevel, 1u); |
| 392 | const uint32_t srcMipHeight = std::max(srcDesc.height >> srcSR.baseMipLevel, 1u); |
| 393 | const uint32_t dstMipWidth = std::max(dstDesc.width >> dstSR.baseMipLevel, 1u); |
| 394 | const uint32_t dstMipHeight = std::max(dstDesc.height >> dstSR.baseMipLevel, 1u); |
| 395 | if (srcMipWidth != dstMipWidth || srcMipHeight != dstMipHeight) |
| 396 | { |
| 397 | error("resolveTexture: referenced mip levels of source and destination textures must have the same dimensions"); |
| 398 | anyErrors = true; |
| 399 | } |
| 400 | |
| 401 | if (dstDesc.sampleCount != 1) |
| 402 | { |
| 403 | error("resolveTexture: destination texture must not be multi-sampled"); |
| 404 | anyErrors = true; |
| 405 | } |
| 406 | |
| 407 | if (srcDesc.sampleCount <= 1) |
| 408 | { |
| 409 | error("resolveTexture: source texture must be multi-sampled"); |
| 410 | anyErrors = true; |
| 411 | } |