| 310 | } |
| 311 | |
| 312 | bool CopyTextureSetDataIntoGraphicsTextures( |
| 313 | ntc::IContext* context, |
| 314 | ntc::ITextureSet* textureSet, |
| 315 | ntc::TextureDataPage page, |
| 316 | bool allMipLevels, |
| 317 | bool onlyBlockCompressedFormats, |
| 318 | GraphicsResourcesForTextureSet const& graphicsResources) |
| 319 | { |
| 320 | for (int textureIndex = 0; textureIndex < textureSet->GetTextureCount(); ++textureIndex) |
| 321 | { |
| 322 | ntc::ITextureMetadata* textureMetadata = textureSet->GetTexture(textureIndex); |
| 323 | ntc::BlockCompressedFormat const bcFormat = textureMetadata->GetBlockCompressedFormat(); |
| 324 | if (onlyBlockCompressedFormats && bcFormat == ntc::BlockCompressedFormat::None) |
| 325 | continue; |
| 326 | |
| 327 | GraphicsResourcesForTexture const& textureResources = graphicsResources.perTexture[textureIndex]; |
| 328 | |
| 329 | int mipLevels = allMipLevels ? textureResources.color->getDesc().mipLevels : 1; |
| 330 | |
| 331 | for (int mipLevel = 0; mipLevel < mipLevels; ++mipLevel) |
| 332 | { |
| 333 | ntc::ReadChannelsIntoTextureParameters params; |
| 334 | params.page = page; |
| 335 | params.mipLevel = mipLevel; |
| 336 | params.firstChannel = textureMetadata->GetFirstChannel(); |
| 337 | params.numChannels = textureMetadata->GetNumChannels(); |
| 338 | params.texture = textureResources.sharedTexture; |
| 339 | params.textureMipLevel = mipLevel; |
| 340 | params.dstRgbColorSpace = textureMetadata->GetRgbColorSpace(); |
| 341 | params.dstAlphaColorSpace = textureMetadata->GetAlphaColorSpace(); |
| 342 | params.useDithering = true; |
| 343 | |
| 344 | ntc::Status ntcStatus = textureSet->ReadChannelsIntoTexture(params); |
| 345 | |
| 346 | CHECK_NTC_RESULT("ReadChannelsIntoTexture") |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | return true; |
| 351 | } |
| 352 | |
| 353 | bool SaveGraphicsStagingTextures( |
| 354 | ntc::ITextureSetMetadata* metadata, |