| 512 | auto dstSlice = nvrhi::TextureSlice().setWidth(width).setHeight(height); |
| 513 | commandList->copyTexture(textureResources.bc, dstSlice, textureResources.blocks, srcSlice); |
| 514 | } |
| 515 | |
| 516 | bool ComputeBlockCompressedImageError( |
| 517 | ntc::IContext* context, |
| 518 | GraphicsImageDifferencePass& compareImagesPass, |
| 519 | nvrhi::IDevice* device, |
| 520 | nvrhi::ICommandList* commandList, |
| 521 | GraphicsResourcesForTexture const& textureResources, |
| 522 | uint32_t width, |
| 523 | uint32_t height, |
| 524 | int mipLevel, |
| 525 | bool reuseCompressedData, |
| 526 | bool useAlphaThreshold, |
| 527 | float alphaThreshold, |
| 528 | bool useMSLE, |
| 529 | float* outOverallMSE, |
| 530 | float* outOverallPSNR, |
| 531 | int channels = 4) |
| 532 | { |
| 533 | // Obtain the pass descriptor from NTC |
| 534 | ntc::MakeImageDifferenceComputePassParameters params; |
| 535 | params.extent.width = width; |
| 536 | params.extent.height = height; |
| 537 | params.useAlphaThreshold = useAlphaThreshold; |
| 538 | params.alphaThreshold = alphaThreshold; |
| 539 | params.useMSLE = useMSLE; |
| 540 | ntc::ComputePassDesc computePass{}; |
| 541 | ntc::Status ntcStatus = context->MakeImageDifferenceComputePass(params, &computePass); |
| 542 | CHECK_NTC_RESULT("MakeImageDifferenceComputePass"); |
| 543 | |
| 544 | // Record the command list |
| 545 | commandList->open(); |
| 546 | |
| 547 | if (!reuseCompressedData) |
| 548 | { |
| 549 | CopyBlocksIntoBCTexture(commandList, textureResources, width, height); |
| 550 | } |
| 551 | |
| 552 | if (!compareImagesPass.ExecuteComputePass(commandList, computePass, |
| 553 | textureResources.bc, 0, textureResources.color, mipLevel, 0)) |
| 554 | { |
| 555 | commandList->close(); |
| 556 | return false; |
| 557 | } |
| 558 | |
| 559 | commandList->close(); |
| 560 | |
| 561 | // Execute the command list and read the outputs |
| 562 | device->executeCommandList(commandList); |
| 563 | device->waitForIdle(); |
| 564 | |
| 565 | if (!compareImagesPass.ReadResults()) |
| 566 | return false; |
| 567 | |
| 568 | if (!compareImagesPass.GetQueryResult(0, nullptr, outOverallMSE, outOverallPSNR, channels)) |
| 569 | return false; |
| 570 | |
| 571 | return true; |
no test coverage detected