Closed EvgeniyaMalikova closed 2 years ago
Hi, sorry for the late replay. There were many changes in the project. Can you please tell me if your issue has been resolved?
I just did a fresh checkout (3/15/2022), and I see the same problem reported by the other individual above.
% c++ --version c++ (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compile failure with the code in the current github repo: [ 25%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/hello_vulkan.cpp.o In file included from nvpro/vk_raytracing_tutorial_KHR/ray_tracingadvance/hello_vulkan.cpp:31: nvpro/vk_raytracing_tutorial_KHR/ray_tracingadvance/hello_vulkan.h:90:3: error: braces around scalar initializer for type 'float' }; ^ make[2]: *** [ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/build.make:151: ray_tracingadvance/CMakeFiles/vk_ray_tracing__advance_KHR.dir/hello_vulkan.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:552: ray_tracingadvance/CMakeFiles/vk_ray_tracing__advance_KHR.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
The CMake rules either need to ensure a later C++ spec in order for the initializers for the light direction and spotlight cutoff values to be initialized by cos() and deg2rad(), or the code needs to be changed to avoid that entirely and use a pre-computed constant for the short-term. See lines 86 and 87 below:
From vk_raytracing_tutorial_KHR/ray_tracing__advance/hello_vulkan.h: 80 // Information pushed at each draw call 81 PushConstantRaster m_pcRaster{ 82 {1}, // Identity matrix 83 {10.f, 15.f, 8.f}, // light position 84 0, // instance Id 85 {1, 0, 0}, // lightDirection; 86 {cos(deg2rad(12.5f))}, // lightSpotCutoff; 87 {cos(deg2rad(17.5f))}, // lightSpotOuterCutoff; 88 100.f, // light intensity 89 0 // light type 90 };
If I manually edit out the function calls and replace them with floating point constants, compilation proceeds without error: 80 // Information pushed at each draw call 81 PushConstantRaster m_pcRaster{ 82 {1}, // Identity matrix 83 {10.f, 15.f, 8.f}, // light position 84 0, // instance Id 85 {1, 0, 0}, // lightDirection; 86 0.976f, // {cos(deg2rad(12.5f))}, // lightSpotCutoff; 87 0.995f, // {cos(deg2rad(17.5f))}, // lightSpotOuterCutoff; 88 100.f, // light intensity 89 0 // light type 90 };
% make Consolidate compiler generated dependencies of target glfw [ 5%] Built target glfw Consolidate compiler generated dependencies of target imgui [ 6%] Built target imgui Consolidate compiler generated dependencies of target nvpro_core [ 21%] Built target nvpro_core Consolidate compiler generated dependencies of target vk_ray_tracingadvance_KHR [ 21%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/hello_vulkan.cpp.o [ 22%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/main.cpp.o [ 22%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/offscreen.cpp.o [ 22%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/raytrace.cpp.o [ 23%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/home/johns/graphics/vulkan/nvpro/nvpro_core/nvp/perproject_globals.cpp.o [ 23%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/home/johns/graphics/vulkan/nvpro/nvpro_core/nvvk/nsight_aftermath_vk.cpp.o [ 23%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracing__advance_KHR.dir/__/common/obj_loader.cpp.o .....
Best regards, John Stone
Thanks for reporting this and for the suggested fix. We have tried with multiple compilers, but we missed this one. Fixed in 61fc360 Note: cos(deg2rad(17.5f)) == 0.9537 in Rad
Glad I could help. Ah, typo on my cell phone calculator for that coefficient :-)
Dear All, I am trying to compile Vulkan ray-tracing samples (vk_raytracing_tutorial_KHR) on Ubuntu and constantly receive an error like the below for ray_tracing__advance tutorial (gcc version 8.4):
[ 27%] Building CXX object ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/hello_vulkan.cpp.o In file included from ../vk_raytracing_tutorial_KHR/ray_tracing__advance/hello_vulkan.cpp:31: .../vk_raytracing_tutorial_KHR/ray_tracingadvance/hello_vulkan.h:90:3: error: braces around scalar initializer for type ‘float’ }; ^ make[2]: *** [ray_tracingadvance/CMakeFiles/vk_ray_tracingadvance_KHR.dir/build.make:138: ray_tracingadvance/CMakeFiles/vk_ray_tracing__advance_KHR.dir/hello_vulkan.cpp.o] Error 1
The problem seems to be in PushConstantRaster m_pcRaster (https://github.com/nvpro-samples/vk_raytracing_tutorial_KHR/issues/new?permalink=https%3A%2F%2Fgithub.com%2Fnvpro-samples%2Fvk_raytracing_tutorial_KHR%2Fblob%2F596b641a5687307ee9f58193472e8b620ce84189%2Fray_tracing__advance%2Fhello_vulkan.h%23L81), that is // Push constant structure for the raster struct PushConstantRaster { mat4 modelMatrix; // matrix of the instance vec3 lightPosition; uint objIndex; vec3 lightDirection; float lightSpotCutoff; float lightSpotOuterCutoff; float lightIntensity; int lightType; int frame; };