From 721c8c1f55797059c1fb3cf37c41d574c24cc26f Mon Sep 17 00:00:00 2001 From: Yuefeng Geng Date: Tue, 14 Jan 2025 11:00:38 +0800 Subject: [PATCH] Enable hdr 10 --- src/tests/test_path_tracing_hdr.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tests/test_path_tracing_hdr.cpp b/src/tests/test_path_tracing_hdr.cpp index 46d955463..d8b616a1e 100644 --- a/src/tests/test_path_tracing_hdr.cpp +++ b/src/tests/test_path_tracing_hdr.cpp @@ -30,11 +30,11 @@ int main(int argc, char *argv[]) { log_level_verbose(); Context context{argv[0]}; - // if (argc <= 1) { - // LUISA_INFO("Usage: {} . : cuda, dx, cpu, metal", argv[0]); - // exit(1); - // } - Device device = context.create_device("dx"); + if (argc <= 1) { + LUISA_INFO("Usage: {} . : cuda, dx, cpu, metal", argv[0]); + exit(1); + } + Device device = context.create_device(argv[1]); // load the Cornell Box scene tinyobj::ObjReaderConfig obj_reader_config; @@ -351,7 +351,7 @@ int main(int argc, char *argv[]) { float scale = 1.0f; if (device.backend_name() == "dx") { - constexpr bool use_hdr10 = false; + constexpr bool use_hdr10 = true; constexpr PixelStorage hdr_storage = use_hdr10 ? PixelStorage::R10G10B10A2 : PixelStorage::HALF4; constexpr DXHDRExt::ColorSpace hdr_color_space = use_hdr10 ? DXHDRExt::ColorSpace::RGB_FULL_G2084_NONE_P2020 : DXHDRExt::ColorSpace::RGB_FULL_G10_NONE_P709; auto dx_hdr_ext = device.extension(); @@ -366,6 +366,7 @@ int main(int argc, char *argv[]) { dx_hdr_ext->set_color_space(swap_chain, dx_hdr_ext->device_support_hdr() ? hdr_color_space : DXHDRExt::ColorSpace::RGB_FULL_G22_NONE_P709); if (dx_hdr_ext->device_support_hdr()) { auto display_data = dx_hdr_ext->get_display_data(window.native_handle()); + LUISA_INFO("Display data: \nbits_per_color: {}\ncolor_space: {}\nred_primary: {}\ngreen_primary: {}\nblue_primary: {}\nwhite_point: {}\nmin_luminance: {}\nmax_luminance: {}\nmax_full_frame_luminance: {}", display_data.bits_per_color, luisa::to_string(display_data.color_space), display_data.red_primary, display_data.green_primary, display_data.blue_primary, display_data.white_point, display_data.min_luminance, display_data.max_luminance, display_data.max_full_frame_luminance); white_point = make_float3(display_data.max_full_frame_luminance / 80.0f); use_aces = true; }