-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make texture compression work in release builds when no Direct3d hardware device is found. #11
Conversation
DeviceResources comes directly from the VS templates, so I didn't want to fork it. bool gpuCompressionSuccessful = false;
try
{
DX::DeviceResources deviceResources;
deviceResources.CreateDeviceResources();
ComPtr<ID3D11Device> device(deviceResources.GetD3DDevice());
DirectX::ScratchImage compressedImage;
if (device != nullptr)
{
if (SUCCEEDED(DirectX::Compress(device.Get(), image.GetImages(), image.GetImageCount(), image.GetMetadata(), compressionFormat, DirectX::TEX_COMPRESS_DEFAULT, 0, compressedImage)))
{
gpuCompressionSuccessful = true;
}
}
}
catch (std::exception e)
{
// Failed to initialize device - GPU is not available
}
if (!gpuCompressionSuccessful)
{
// Try software compression
if (FAILED(DirectX::Compress(image.GetImages(), image.GetImageCount(), image.GetMetadata(), compressionFormat, DirectX::TEX_COMPRESS_DEFAULT, 0, compressedImage)))
{
throw GLTFException("Failed to compress data using software compression");
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider not changing DeviceResources, but changing our use of it instead
…ssue microsoft#10." This reverts commit 5cc40ab.
2a7bf4a
to
aa30e2d
Compare
Ping, does this look ok? |
Thank you so much Erik! |
…ware device is found. (microsoft#11) * Use the WARP software fallback in release builds too. Fixes issue microsoft#10. * Revert "Use the WARP software fallback in release builds too. Fixes issue microsoft#10." This reverts commit 5cc40ab. * Handle lack of GPU device in GLTFTextureCompressionUtils. Fixes issue microsoft#10.
* Make texture compression work in release builds when no Direct3d hardware device is found. (#11) * Use the WARP software fallback in release builds too. Fixes issue #10. * Revert "Use the WARP software fallback in release builds too. Fixes issue #10." This reverts commit 5cc40ab. * Handle lack of GPU device in GLTFTextureCompressionUtils. Fixes issue #10. * Update all NuGet packages to latest and fix breaking changes (#13) * Update all NuGet packages to latest and fix breaking changes * Update README.md Removes version from Microsoft.glTF.CPP link * Add share-materials flag to WindowsMRAssetConverter. - Pack textures only once. - Pass the flag to merger (to avoid adding the same materials again). * Avoid adding duplicated information when sharing materials. * Fix incorrect assumption in shared materials merger. Lower LODs may use fewer textures due to features being removed, even if they use the same images/textures for all that remains. Because of this the material indices need to be adjusted for the lower LODs to be correct. * Hopefully more robust material comparison. * Use camelCase, rename packTextures -> processTextures. * Fixup casing. * No need for parser state.
No description provided.