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