| 1622 | return false; |
| 1623 | } |
| 1624 | |
| 1625 | OptixDecompressor optixDecompressor(context, metadata.Get(), inputStream.Get()); |
| 1626 | const char* errorMessage = optixDecompressor.prepareDecompression(); |
| 1627 | if( errorMessage ) |
| 1628 | { |
| 1629 | fprintf(stderr, "Error. OptiX decompression preparation: %s\n", errorMessage); |
| 1630 | return false; |
| 1631 | } |
| 1632 | |
| 1633 | // Decompress the mip levels separately |
| 1634 | float timeInMilliseconds = 0.0f; |
| 1635 | ntc::TextureSetDesc textureSetDesc = textureSet->GetDesc(); |
| 1636 | for (int mipLevel = 0; mipLevel < textureSetDesc.mips; mipLevel++) |
| 1637 | { |
| 1638 | half* outputImage = reinterpret_cast<half*>(textureSet->GetOutputMipSliceDevicePointer(mipLevel)); |
| 1639 | float mipLevelTime = 0.0f; |
| 1640 | const char* errorMessage = optixDecompressor.DecompressMipLevel(outputImage, mipLevel, mipLevelTime); |
| 1641 | if( errorMessage ) |
| 1642 | { |
| 1643 | fprintf(stderr, "Error. OptiX decompression mip level %d: %s\n", mipLevel, errorMessage); |
| 1644 | return false; |
| 1645 | } |
| 1646 | timeInMilliseconds += mipLevelTime; |
| 1647 | } |
| 1648 | printf("OptiX decompression time: %.3f ms\n", timeInMilliseconds); |
| 1649 | |
| 1650 | return true; |
| 1651 | #endif |
| 1652 | |
| 1653 | return false; |
| 1654 | } |
| 1655 | |
| 1656 | donut::app::DeviceCreationParameters GetGraphicsDeviceParameters(nvrhi::GraphicsAPI graphicsApi) |
| 1657 | { |
| 1658 | donut::app::DeviceCreationParameters deviceParams; |
| 1659 | deviceParams.infoLogSeverity = donut::log::Severity::None; |
| 1660 | deviceParams.adapterIndex = g_options.adapterIndex; |
| 1661 | deviceParams.enableDebugRuntime = g_options.debug; |
| 1662 | deviceParams.enableNvrhiValidationLayer = g_options.debug; |
| 1663 | deviceParams.headlessDevice = true; |
| 1664 | |
| 1665 | SetNtcGraphicsDeviceParameters(deviceParams, graphicsApi, true, g_options.enableCoopVec, nullptr); |
| 1666 | |
| 1667 | return deviceParams; |
| 1668 | } |
| 1669 | |
| 1670 | void DescribeTextureSet(ntc::ITextureSetMetadata* textureSet) |
| 1671 | { |
| 1672 | ntc::TextureSetDesc const& desc = textureSet->GetDesc(); |
| 1673 | printf("Dimensions: %dx%d, %d channels, %d mip level(s)\n", desc.width, desc.height, desc.channels, desc.mips); |
| 1674 | |
| 1675 | ntc::LatentShape const& latentShape = textureSet->GetLatentShape(); |
| 1676 | printf("Base compression rate: --bitsPerPixel %.3f\n", ntc::GetLatentShapeBitsPerPixel(latentShape)); |
| 1677 | printf("Latent shape: --gridSizeScale %d --numFeatures %d\n", |
| 1678 | latentShape.gridSizeScale, latentShape.numFeatures); |
| 1679 | printf("Inference weights: Int8 [%c], FP8 [%c]\n", |
| 1680 | textureSet->IsInferenceWeightTypeSupported(ntc::InferenceWeightType::GenericInt8) ? 'Y' : 'N', |
| 1681 | textureSet->IsInferenceWeightTypeSupported(ntc::InferenceWeightType::GenericFP8) ? 'Y' : 'N'); |