ingowald / optix7course

Apache License 2.0
452 stars 80 forks source link

error: the global scope has no "saturate" #35

Closed habeascorpse closed 1 year ago

habeascorpse commented 1 year ago

This occur when i try to make:

Consolidate compiler generated dependencies of target gdt [ 2%] Built target gdt Consolidate compiler generated dependencies of target ex01_helloOptix [ 5%] Built target ex01_helloOptix [ 6%] Building NVCC ptx file example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx /home/cgti/dev/optix7course/common/gdt/gdt/gdt.h(129): error: the global scope has no "saturate"

1 error detected in the compilation of "/home/cgti/dev/optix7course/example02_pipelineAndRayGen/devicePrograms.cu". CMake Error at cuda_compile_ptx_1_generated_devicePrograms.cu.ptx.Release.cmake:272 (message): Error generating file /home/cgti/dev/optix7course/build/example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx

make[2]: [example02_pipelineAndRayGen/CMakeFiles/ex02_pipelineAndRayGen.dir/build.make:377: example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx] Error 1 make[1]: [CMakeFiles/Makefile2:407: example02_pipelineAndRayGen/CMakeFiles/ex02_pipelineAndRayGen.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

xKnopix commented 1 year ago

A working Solution: Bevor creating the Cmake Project go to ".\optix7course-master\common\gdt\gdt\gdt.h" and remove using ::saturate;

(line 130) After you removed this line you can run cmake and open the sln file. Note: in OptiX 7.7.0 is no method "optixModuleCreateFromPTX" that means you have to Replace it with "optixModuleCreate" in the SampleRender.cpp for all examples provided. Then you should be able to run the Project.

Note: I am new to Optix so I dont know wether it affects something when you change optixModuleCreateFromPTX to optixModuleCreate... same for removing "using ::saturate;" :(

ingowald commented 1 year ago

Hm. Interesting. I had the exact same error report for another project where I had copied the same header files as used in this one.... and had always wondered where this came from. Apparently it's compiler-specific as to whether a compiler reports this as an error or not: the function isn't actually used, so apparently some compilers (in particular, the ones I use :-/) will just ignore that 'using' statement, so I have never run into that. But as it's not used, it's safe to just remove that, which is why xKnopix's soltion works. I'll just remove it - it's not used.

ingowald commented 1 year ago

fixed in latest master. please let me know if there's other stuff similar to that that needs fixing - as said, it doesn't happen on linux so i'm flying blind here. And thx a lot for reporting this - every dead bug is a good bug!