Skip to content

Commit

Permalink
minor update to nvtt flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Jan 6, 2025
1 parent fa06e7e commit e68c5d9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/backends/cuda/extensions/cuda_texture_compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,30 @@ inline void compress_image(CUdeviceptr src,
}();
auto format = [target] {
switch (target) {
case PixelFormat::BC1UNorm: return nvtt::Format_BC1;
case PixelFormat::BC2UNorm: return nvtt::Format_BC2;
case PixelFormat::BC3UNorm: return nvtt::Format_BC3;
case PixelFormat::BC4UNorm: return nvtt::Format_BC4;
case PixelFormat::BC5UNorm: return nvtt::Format_BC5;
case PixelFormat::BC6HUF16: return nvtt::Format_BC6U;
case PixelFormat::BC7UNorm: return nvtt::Format_BC7;
default: break;
}
LUISA_ERROR_WITH_LOCATION("Unsupported pixel format.");
}();
auto quality = [target] {
switch (target) {
case PixelFormat::BC1UNorm: [[fallthrough]];
case PixelFormat::BC2UNorm: [[fallthrough]];
case PixelFormat::BC3UNorm: return nvtt::Quality_Highest;
default: break;
}
return nvtt::Quality_Normal;
}();
nvtt::GPUInputBuffer buffer{&image, value_type};
nvtt::EncodeSettings settings{
.format = format,
.quality = nvtt::Quality_Normal,
.quality = quality,
.encode_flags = nvtt::EncodeFlags_UseGPU | nvtt::EncodeFlags_OutputToGPUMem,
};
nvtt::nvtt_encode(buffer, reinterpret_cast<void *>(dst), settings);
Expand Down

0 comments on commit e68c5d9

Please sign in to comment.