├── .gitignore ├── .gitmodules ├── 3rdparty ├── RprSupport │ ├── bin │ │ └── x64 │ │ │ └── RprSupport64.dll │ ├── include │ │ └── RprSupport.h │ └── lib │ │ └── x64 │ │ └── RprSupport64.lib ├── embree │ ├── bin │ │ └── x64 │ │ │ ├── benchmark.exe │ │ │ ├── embree.dll │ │ │ └── tbb.dll │ ├── include │ │ └── embree2 │ │ │ ├── rtcore.h │ │ │ ├── rtcore.isph │ │ │ ├── rtcore_geometry.h │ │ │ ├── rtcore_geometry.isph │ │ │ ├── rtcore_geometry_user.h │ │ │ ├── rtcore_geometry_user.isph │ │ │ ├── rtcore_ray.h │ │ │ ├── rtcore_ray.isph │ │ │ ├── rtcore_scene.h │ │ │ └── rtcore_scene.isph │ └── lib │ │ └── x64 │ │ ├── embree.lib │ │ ├── libembree.2.dylib │ │ ├── libtbb.dylib │ │ └── libtbbmalloc.dylib ├── glew │ ├── bin │ │ └── x64 │ │ │ └── glew32.dll │ ├── include │ │ └── GL │ │ │ ├── glew.h │ │ │ ├── glxew.h │ │ │ └── wglew.h │ └── lib │ │ └── x64 │ │ └── glew.lib ├── glfw │ ├── bin │ │ └── x64 │ │ │ └── glfw3.dll │ ├── include │ │ └── GLFW │ │ │ ├── glfw3.h │ │ │ └── glfw3native.h │ └── lib │ │ └── x64 │ │ ├── glfw3.lib │ │ └── libglfw3.a ├── oiio │ ├── bin │ │ └── x64 │ │ │ ├── OpenImageIO.dll │ │ │ └── OpenImageIOD.dll │ ├── include │ │ ├── OpenEXR │ │ │ ├── Iex.h │ │ │ ├── IexBaseExc.h │ │ │ ├── IexErrnoExc.h │ │ │ ├── IexExport.h │ │ │ ├── IexForward.h │ │ │ ├── IexMacros.h │ │ │ ├── IexMathExc.h │ │ │ ├── IexMathFloatExc.h │ │ │ ├── IexMathFpu.h │ │ │ ├── IexMathIeeeExc.h │ │ │ ├── IexNamespace.h │ │ │ ├── IexThrowErrnoExc.h │ │ │ ├── IlmBaseConfig.h │ │ │ ├── ImathBox.h │ │ │ ├── ImathBoxAlgo.h │ │ │ ├── ImathColor.h │ │ │ ├── ImathColorAlgo.h │ │ │ ├── ImathEuler.h │ │ │ ├── ImathExc.h │ │ │ ├── ImathExport.h │ │ │ ├── ImathForward.h │ │ │ ├── ImathFrame.h │ │ │ ├── ImathFrustum.h │ │ │ ├── ImathFrustumTest.h │ │ │ ├── ImathFun.h │ │ │ ├── ImathGL.h │ │ │ ├── ImathGLU.h │ │ │ ├── ImathHalfLimits.h │ │ │ ├── ImathInt64.h │ │ │ ├── ImathInterval.h │ │ │ ├── ImathLimits.h │ │ │ ├── ImathLine.h │ │ │ ├── ImathLineAlgo.h │ │ │ ├── ImathMath.h │ │ │ ├── ImathMatrix.h │ │ │ ├── ImathMatrixAlgo.h │ │ │ ├── ImathNamespace.h │ │ │ ├── ImathPlane.h │ │ │ ├── ImathPlatform.h │ │ │ ├── ImathQuat.h │ │ │ ├── ImathRandom.h │ │ │ ├── ImathRoots.h │ │ │ ├── ImathShear.h │ │ │ ├── ImathSphere.h │ │ │ ├── ImathVec.h │ │ │ └── ImathVecAlgo.h │ │ └── OpenImageIO │ │ │ ├── SHA1.h │ │ │ ├── argparse.h │ │ │ ├── array_view.h │ │ │ ├── color.h │ │ │ ├── dassert.h │ │ │ ├── errorhandler.h │ │ │ ├── export.h │ │ │ ├── filesystem.h │ │ │ ├── filter.h │ │ │ ├── fmath.h │ │ │ ├── hash.h │ │ │ ├── image_view.h │ │ │ ├── imagebuf.h │ │ │ ├── imagebufalgo.h │ │ │ ├── imagebufalgo_util.h │ │ │ ├── imagecache.h │ │ │ ├── imageio.h │ │ │ ├── oiioversion.h │ │ │ ├── oiioversion.h.in │ │ │ ├── optparser.h │ │ │ ├── osdep.h │ │ │ ├── paramlist.h │ │ │ ├── plugin.h │ │ │ ├── pugiconfig.hpp │ │ │ ├── pugixml.cpp │ │ │ ├── pugixml.hpp │ │ │ ├── refcnt.h │ │ │ ├── strided_ptr.h │ │ │ ├── string_ref.h │ │ │ ├── string_view.h │ │ │ ├── strutil.h │ │ │ ├── sysutil.h │ │ │ ├── texture.h │ │ │ ├── thread.h │ │ │ ├── timer.h │ │ │ ├── tinyformat.h │ │ │ ├── typedesc.h │ │ │ ├── unittest.h │ │ │ ├── unordered_map_concurrent.h │ │ │ ├── ustring.h │ │ │ ├── varyingref.h │ │ │ └── version.h │ └── lib │ │ └── x64 │ │ ├── OpenImageIO.lib │ │ ├── OpenImageIOD.lib │ │ ├── libOpenImageIO.1.5.2.dylib │ │ ├── libOpenImageIO.1.5.dylib │ │ ├── libOpenImageIO.dylib │ │ ├── libOpenImageIO_Util.1.5.2.dylib │ │ ├── libOpenImageIO_Util.1.5.dylib │ │ └── libOpenImageIO_Util.dylib └── tinyobjloader │ └── include │ └── tiny_obj_loader.h ├── Baikal ├── CMakeLists.txt ├── Controllers │ ├── clw_scene_controller.cpp │ ├── clw_scene_controller.h │ ├── scene_controller.cpp │ ├── scene_controller.h │ └── scene_controller.inl ├── Estimators │ ├── estimator.h │ ├── path_tracing_estimator.cpp │ └── path_tracing_estimator.h ├── Kernels │ └── CL │ │ ├── bxdf.cl │ │ ├── bxdf_flags.cl │ │ ├── bxdf_uberv2.cl │ │ ├── bxdf_uberv2_bricks.cl │ │ ├── common.cl │ │ ├── denoise.cl │ │ ├── disney.cl │ │ ├── fill_aovs_uberv2.cl │ │ ├── integrator_bdpt.cl │ │ ├── isect.cl │ │ ├── light.cl │ │ ├── monte_carlo_renderer.cl │ │ ├── normalmap.cl │ │ ├── path.cl │ │ ├── path_tracing_estimator.cl │ │ ├── path_tracing_estimator_uberv2.cl │ │ ├── payload.cl │ │ ├── ray.cl │ │ ├── sampling.cl │ │ ├── scene.cl │ │ ├── sh.cl │ │ ├── texture.cl │ │ ├── utils.cl │ │ ├── vertex.cl │ │ ├── volumetrics.cl │ │ └── wavelet_denoise.cl ├── Output │ ├── clwoutput.h │ └── output.h ├── PostEffects │ ├── AreaMap33.h │ ├── bilateral_denoiser.h │ ├── clw_post_effect.h │ ├── post_effect.h │ └── wavelet_denoiser.h ├── RenderFactory │ ├── clw_render_factory.cpp │ ├── clw_render_factory.h │ └── render_factory.h ├── Renderers │ ├── adaptive_renderer.cpp │ ├── adaptive_renderer.h │ ├── monte_carlo_renderer.cpp │ ├── monte_carlo_renderer.h │ └── renderer.h ├── SceneGraph │ ├── Collector │ │ ├── collector.cpp │ │ └── collector.h │ ├── camera.cpp │ ├── camera.h │ ├── clwscene.h │ ├── inputmap.h │ ├── inputmaps.h │ ├── iterator.h │ ├── light.cpp │ ├── light.h │ ├── material.cpp │ ├── material.h │ ├── scene1.cpp │ ├── scene1.h │ ├── scene_object.cpp │ ├── scene_object.h │ ├── shape.cpp │ ├── shape.h │ ├── texture.cpp │ ├── texture.h │ ├── uberv2material.cpp │ └── uberv2material.h ├── Utils │ ├── cl_inputmap_generator.cpp │ ├── cl_inputmap_generator.h │ ├── cl_program.cpp │ ├── cl_program.h │ ├── cl_program_manager.cpp │ ├── cl_program_manager.h │ ├── cl_uberv2_generator.cpp │ ├── cl_uberv2_generator.h │ ├── clw_class.h │ ├── cmd_parser.cpp │ ├── cmd_parser.h │ ├── distribution1d.cpp │ ├── distribution1d.h │ ├── eLut.h │ ├── half.cpp │ ├── half.h │ ├── log.h │ ├── mkpath.cpp │ ├── mkpath.h │ ├── sh.cpp │ ├── sh.h │ ├── shproject.cpp │ ├── shproject.h │ ├── sobol.h │ ├── toFloat.h │ └── version.h ├── XML │ ├── tinyxml2.cpp │ └── tinyxml2.h └── imgui.ini ├── BaikalDataGenerator ├── CMakeLists.txt └── Source │ ├── app_config.h │ ├── cmd_line_parser.cpp │ ├── cmd_line_parser.h │ ├── data_generator.cpp │ ├── data_generator.h │ ├── data_generator_impl.cpp │ ├── data_generator_impl.h │ ├── devices.cpp │ ├── devices.h │ ├── filesystem.h │ ├── logging.cpp │ ├── logging.h │ ├── main.cpp │ ├── object_loader.cpp │ ├── object_loader.h │ └── utils.h ├── BaikalIO ├── CMakeLists.txt ├── file_utils.cpp ├── file_utils.h ├── image_io.cpp ├── image_io.h ├── material_io.cpp ├── material_io.h ├── scene_binary_io.cpp ├── scene_binary_io.h ├── scene_fbx_io.cpp ├── scene_io.cpp ├── scene_io.h ├── scene_obj_io.cpp └── scene_test_io.cpp ├── BaikalStandalone ├── Application │ ├── app_utils.cpp │ ├── app_utils.h │ ├── application.cpp │ ├── application.h │ ├── cl_render.cpp │ ├── cl_render.h │ ├── gl_render.cpp │ ├── gl_render.h │ ├── graph_scheme.cpp │ ├── graph_scheme.h │ ├── material_explorer.cpp │ ├── material_explorer.h │ ├── scene_load_utils.cpp │ ├── scene_load_utils.h │ ├── uber_node.cpp │ ├── uber_node.h │ ├── uber_tree.cpp │ └── uber_tree.h ├── CMakeLists.txt ├── ImGUI │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_impl_glfw_gl3.cpp │ ├── imgui_impl_glfw_gl3.h │ ├── imgui_internal.h │ ├── stb_rect_pack.h │ ├── stb_textedit.h │ └── stb_truetype.h ├── Kernels │ └── GLSL │ │ ├── simple.fsh │ │ └── simple.vsh ├── Utils │ ├── config_manager.cpp │ ├── config_manager.h │ ├── shader_manager.cpp │ └── shader_manager.h ├── cache │ └── placeholder.txt └── main.cpp ├── BaikalTest ├── CMakeLists.txt ├── OutputImages │ └── placeholder.txt ├── ReferenceImages │ └── placeholder.txt ├── aov.h ├── basic.h ├── cache │ └── placeholder.txt ├── camera.h ├── input_maps.h ├── internal.h ├── light.h ├── main.cpp ├── material.h ├── test_scenes.h └── uberv2.h ├── CMakeLists.txt ├── Doc └── Images │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.png │ └── 5.jpg ├── Gtest ├── CMakeLists.txt ├── include │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump └── src │ ├── gtest-all.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc ├── LICENSE.txt ├── README.md ├── Resources ├── CornellBox │ ├── orig.mtl │ └── orig.objm └── Textures │ ├── AreaMap33.dds │ ├── sky.hdr │ ├── studio015.hdr │ ├── test_albedo1.jpg │ ├── test_albedo2.jpg │ ├── test_albedo3.jpg │ ├── test_bump.jpg │ └── test_normal.jpg ├── Rpr ├── CMakeLists.txt ├── Export.cpp ├── Export.h ├── RadeonProRender.cpp ├── RadeonProRender.def ├── RadeonProRender.h ├── RadeonProRender_CL.h ├── RadeonProRender_GL.h ├── Utils │ ├── config_manager.cpp │ └── config_manager.h ├── Wrap.cpp └── WrapObject │ ├── CameraObject.cpp │ ├── CameraObject.h │ ├── ContextObject.cpp │ ├── ContextObject.h │ ├── Exception.h │ ├── FramebufferObject.cpp │ ├── FramebufferObject.h │ ├── LightObject.cpp │ ├── LightObject.h │ ├── MatSysObject.cpp │ ├── MatSysObject.h │ ├── Materials │ ├── ArithmeticMaterialObject.cpp │ ├── ArithmeticMaterialObject.h │ ├── ImageMaterialObject.cpp │ ├── ImageMaterialObject.h │ ├── MaterialObject.cpp │ ├── MaterialObject.h │ ├── TextureMaterialObject.cpp │ ├── TextureMaterialObject.h │ ├── UberMaterialObject.cpp │ ├── UberMaterialObject.h │ ├── UnsupportedMaterialObject.cpp │ └── UnsupportedMaterialObject.h │ ├── SceneObject.cpp │ ├── SceneObject.h │ ├── ShapeObject.cpp │ ├── ShapeObject.h │ └── WrapObject.h ├── RprSupport ├── CMakeLists.txt ├── RprSupport.cpp └── RprSupport.def ├── RprTest ├── CMakeLists.txt ├── OutputImages │ └── placeholder.txt ├── ReferenceImages │ └── placeholder.txt ├── aov.h ├── arithmetic.h ├── basic.h ├── cache │ └── placeholder.txt ├── camera.h ├── light.h ├── main.cpp └── material.h ├── Tools ├── Jenkins │ └── build_test.jenkinsfile ├── MaterialConverter │ ├── BaikalOld │ │ └── SceneGraph │ │ │ ├── IO │ │ │ ├── image_io.cpp │ │ │ ├── image_io.h │ │ │ ├── material_io.cpp │ │ │ └── material_io.h │ │ │ ├── iterator.h │ │ │ ├── material.cpp │ │ │ ├── material.h │ │ │ ├── scene_object.h │ │ │ ├── texture.cpp │ │ │ └── texture.h │ ├── CMakeLists.txt │ ├── README.md │ ├── main.cpp │ ├── material_converter.cpp │ └── material_converter.h ├── deploy │ ├── LICENSE.txt │ └── README.md └── scripts │ ├── baikal_stringify.py │ └── stringify.py └── cmake ├── FindFBX_SDK.cmake ├── FindGLEW.cmake ├── FindGLFW3.cmake └── FindOIIO.cmake /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.opendb 3 | *.sln 4 | *.vcxproj 5 | *.filters 6 | *.obj 7 | *.lastbuildstate 8 | *.tlog 9 | *.user 10 | *.ini 11 | *.log 12 | *.pdb 13 | *.lib 14 | *.exe 15 | *.ilk 16 | *.dll 17 | *.exp 18 | *.db 19 | *.jpg 20 | *.cache 21 | *.mtl 22 | */OutputImages/* 23 | */ReferenceImages/* 24 | */cache/*.bin 25 | 26 | build/ 27 | 28 | .vs/ 29 | CMakeSettings.json 30 | CppProperties.json -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "RadeonRays"] 2 | path = RadeonRays 3 | url = https://github.com/GPUOpen-LibrariesAndSDKs/RadeonRays_SDK.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /3rdparty/RprSupport/bin/x64/RprSupport64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/RprSupport/bin/x64/RprSupport64.dll -------------------------------------------------------------------------------- /3rdparty/RprSupport/lib/x64/RprSupport64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/RprSupport/lib/x64/RprSupport64.lib -------------------------------------------------------------------------------- /3rdparty/embree/bin/x64/benchmark.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/embree/bin/x64/benchmark.exe -------------------------------------------------------------------------------- /3rdparty/embree/bin/x64/embree.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/embree/bin/x64/embree.dll -------------------------------------------------------------------------------- /3rdparty/embree/bin/x64/tbb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/embree/bin/x64/tbb.dll -------------------------------------------------------------------------------- /3rdparty/embree/lib/x64/embree.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/embree/lib/x64/embree.lib -------------------------------------------------------------------------------- /3rdparty/embree/lib/x64/libembree.2.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/embree/lib/x64/libembree.2.dylib -------------------------------------------------------------------------------- /3rdparty/embree/lib/x64/libtbb.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/embree/lib/x64/libtbb.dylib -------------------------------------------------------------------------------- /3rdparty/embree/lib/x64/libtbbmalloc.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/embree/lib/x64/libtbbmalloc.dylib -------------------------------------------------------------------------------- /3rdparty/glew/bin/x64/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/glew/bin/x64/glew32.dll -------------------------------------------------------------------------------- /3rdparty/glew/lib/x64/glew.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/glew/lib/x64/glew.lib -------------------------------------------------------------------------------- /3rdparty/glfw/bin/x64/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/glfw/bin/x64/glfw3.dll -------------------------------------------------------------------------------- /3rdparty/glfw/lib/x64/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/glfw/lib/x64/glfw3.lib -------------------------------------------------------------------------------- /3rdparty/glfw/lib/x64/libglfw3.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/glfw/lib/x64/libglfw3.a -------------------------------------------------------------------------------- /3rdparty/oiio/bin/x64/OpenImageIO.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/oiio/bin/x64/OpenImageIO.dll -------------------------------------------------------------------------------- /3rdparty/oiio/bin/x64/OpenImageIOD.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/oiio/bin/x64/OpenImageIOD.dll -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/Iex.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | #ifndef INCLUDED_IEX_H 38 | #define INCLUDED_IEX_H 39 | 40 | 41 | //-------------------------------- 42 | // 43 | // Exception handling 44 | // 45 | //-------------------------------- 46 | 47 | 48 | #include "IexMacros.h" 49 | #include "IexBaseExc.h" 50 | #include "IexMathExc.h" 51 | #include "IexThrowErrnoExc.h" 52 | 53 | // Note that we do not include file IexErrnoExc.h here. That file 54 | // defines over 150 classes and significantly slows down compilation. 55 | // If you throw ErrnoExc exceptions using the throwErrnoExc() function, 56 | // you don't need IexErrnoExc.h. You have to include IexErrnoExc.h 57 | // only if you want to catch specific subclasses of ErrnoExc. 58 | 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/IexExport.h: -------------------------------------------------------------------------------- 1 | #ifndef IEXEXPORT_H 2 | #define IEXEXPORT_H 3 | 4 | /////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Copyright (c) 2012, Industrial Light & Magic, a division of Lucas 7 | // Digital Ltd. LLC 8 | // 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without 12 | // modification, are permitted provided that the following conditions are 13 | // met: 14 | // * Redistributions of source code must retain the above copyright 15 | // notice, this list of conditions and the following disclaimer. 16 | // * Redistributions in binary form must reproduce the above 17 | // copyright notice, this list of conditions and the following disclaimer 18 | // in the documentation and/or other materials provided with the 19 | // distribution. 20 | // * Neither the name of Industrial Light & Magic nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | /////////////////////////////////////////////////////////////////////////// 37 | 38 | #if defined(OPENEXR_DLL) 39 | #if defined(IEX_EXPORTS) 40 | #define IEX_EXPORT __declspec(dllexport) 41 | #else 42 | #define IEX_EXPORT __declspec(dllimport) 43 | #endif 44 | #define IEX_EXPORT_CONST 45 | #else 46 | #define IEX_EXPORT 47 | #define IEX_EXPORT_CONST const 48 | #endif 49 | 50 | #endif // #ifndef IEXEXPORT_H 51 | 52 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/IexMathExc.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | #ifndef INCLUDED_IEXMATHEXC_H 38 | #define INCLUDED_IEXMATHEXC_H 39 | 40 | #include "IexBaseExc.h" 41 | 42 | IEX_INTERNAL_NAMESPACE_HEADER_ENTER 43 | 44 | //--------------------------------------------------------- 45 | // Exception classess which correspond to specific floating 46 | // point exceptions. 47 | //--------------------------------------------------------- 48 | 49 | DEFINE_EXC (OverflowExc, MathExc) // Overflow 50 | DEFINE_EXC (UnderflowExc, MathExc) // Underflow 51 | DEFINE_EXC (DivzeroExc, MathExc) // Division by zero 52 | DEFINE_EXC (InexactExc, MathExc) // Inexact result 53 | DEFINE_EXC (InvalidFpOpExc, MathExc) // Invalid operation 54 | 55 | IEX_INTERNAL_NAMESPACE_HEADER_EXIT 56 | 57 | #endif // INCLUDED_IEXMATHEXC_H 58 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/IexMathIeeeExc.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_IEXMATHIEEE_EXC_H 2 | #define INCLUDED_IEXMATHIEEE_EXC_H 3 | 4 | /////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Copyright (c) 1997, Industrial Light & Magic, a division of Lucas 7 | // Digital Ltd. LLC 8 | // 9 | // All rights reserved. 10 | // 11 | // Redistribution and use in source and binary forms, with or without 12 | // modification, are permitted provided that the following conditions are 13 | // met: 14 | // * Redistributions of source code must retain the above copyright 15 | // notice, this list of conditions and the following disclaimer. 16 | // * Redistributions in binary form must reproduce the above 17 | // copyright notice, this list of conditions and the following disclaimer 18 | // in the documentation and/or other materials provided with the 19 | // distribution. 20 | // * Neither the name of Industrial Light & Magic nor the names of 21 | // its contributors may be used to endorse or promote products derived 22 | // from this software without specific prior written permission. 23 | // 24 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | // 36 | /////////////////////////////////////////////////////////////////////////// 37 | 38 | 39 | //--------------------------------------------------------------------------- 40 | // 41 | // Names for the loating point exceptions defined by IEEE standard 754 42 | // 43 | //--------------------------------------------------------------------------- 44 | 45 | #include "IexNamespace.h" 46 | 47 | IEX_INTERNAL_NAMESPACE_HEADER_ENTER 48 | 49 | 50 | enum IeeeExcType 51 | { 52 | IEEE_OVERFLOW = 1, 53 | IEEE_UNDERFLOW = 2, 54 | IEEE_DIVZERO = 4, 55 | IEEE_INEXACT = 8, 56 | IEEE_INVALID = 16 57 | }; 58 | 59 | 60 | IEX_INTERNAL_NAMESPACE_HEADER_EXIT 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/IlmBaseConfig.h: -------------------------------------------------------------------------------- 1 | // Hand-crafted version of config/IlmBaseConfig.h for Windows 2 | // 3 | // Define and set to 1 if the target system has POSIX thread support 4 | // and you want IlmBase to use it for multithreaded file I/O. 5 | // 6 | 7 | #undef HAVE_PTHREAD 8 | 9 | // 10 | // Define and set to 1 if the target system supports POSIX semaphores 11 | // and you want OpenEXR to use them; otherwise, OpenEXR will use its 12 | // own semaphore implementation. 13 | // 14 | 15 | #undef HAVE_POSIX_SEMAPHORES 16 | 17 | #define ILMBASE_INTERNAL_NAMESPACE_CUSTOM 1 18 | #define IMATH_INTERNAL_NAMESPACE Imath_2_1 19 | #define IEX_INTERNAL_NAMESPACE Iex_2_1 20 | #define ILMTHREAD_INTERNAL_NAMESPACE IlmThread_2_1 21 | #define IMATH_NAMESPACE Imath 22 | #define IEX_NAMESPACE Iex 23 | #define ILMTHREAD_NAMESPACE IlmThread 24 | #define ILMBASE_VERSION_STRING "2.1.0" 25 | #define ILMBASE_PACKAGE_STRING "IlmBase 2.1.0" 26 | #define ILMBASE_VERSION_MAJOR 2 27 | #define ILMBASE_VERSION_MINOR 1 28 | #define ILMBASE_VERSION_PATCH 0 29 | 30 | // Version as a single hex number, e.g. 0x01000300 == 1.0.3 31 | #define ILMBASE_VERSION_HEX ((ILMBASE_VERSION_MAJOR << 24) | \ 32 | (ILMBASE_VERSION_MINOR << 16) | \ 33 | (ILMBASE_VERSION_PATCH << 8)) 34 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/ImathExport.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2012, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | #if defined(OPENEXR_DLL) 36 | #if defined(IMATH_EXPORTS) 37 | #define IMATH_EXPORT __declspec(dllexport) 38 | #define IMATH_EXPORT_CONST extern __declspec(dllexport) 39 | #else 40 | #define IMATH_EXPORT __declspec(dllimport) 41 | #define IMATH_EXPORT_CONST extern __declspec(dllimport) 42 | #endif 43 | #else 44 | #define IMATH_EXPORT 45 | #define IMATH_EXPORT_CONST extern const 46 | #endif 47 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/ImathForward.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2012, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | #ifndef INCLUDED_IMATHFORWARD_H 36 | #define INCLUDED_IMATHFORWARD_H 37 | 38 | #include "ImathNamespace.h" 39 | 40 | IMATH_INTERNAL_NAMESPACE_HEADER_ENTER 41 | 42 | // 43 | // Basic template type declarations. 44 | // 45 | 46 | template class Box; 47 | template class Color3; 48 | template class Color4; 49 | template class Euler; 50 | template class Frustum; 51 | template class FrustumTest; 52 | template class Interval; 53 | template class Line3; 54 | template class Matrix33; 55 | template class Matrix44; 56 | template class Plane3; 57 | template class Quat; 58 | template class Shear6; 59 | template class Sphere3; 60 | template class TMatrix; 61 | template class TMatrixBase; 62 | template class TMatrixData; 63 | template class Vec2; 64 | template class Vec3; 65 | template class Vec4; 66 | 67 | class Rand32; 68 | class Rand48; 69 | 70 | IMATH_INTERNAL_NAMESPACE_HEADER_EXIT 71 | 72 | #endif // INCLUDED_IMATHFORWARD_H 73 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/ImathGLU.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | #ifndef INCLUDED_IMATHGLU_H 38 | #define INCLUDED_IMATHGLU_H 39 | 40 | #include 41 | #include 42 | 43 | #include "ImathVec.h" 44 | 45 | inline 46 | void 47 | gluLookAt(const IMATH_INTERNAL_NAMESPACE::V3f &pos, const IMATH_INTERNAL_NAMESPACE::V3f &interest, const IMATH_INTERNAL_NAMESPACE::V3f &up) 48 | { 49 | gluLookAt(pos.x, pos.y, pos.z, 50 | interest.x, interest.y, interest.z, 51 | up.x, up.y, up.z); 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/ImathHalfLimits.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | 37 | #ifndef INCLUDED_IMATHHALFLIMITS_H 38 | #define INCLUDED_IMATHHALFLIMITS_H 39 | 40 | //-------------------------------------------------- 41 | // 42 | // Imath-style limits for class half. 43 | // 44 | //-------------------------------------------------- 45 | 46 | #include "ImathLimits.h" 47 | #include "ImathNamespace.h" 48 | 49 | #include "half.h" 50 | 51 | IMATH_INTERNAL_NAMESPACE_HEADER_ENTER 52 | 53 | 54 | template <> 55 | struct limits 56 | { 57 | static float min() {return -HALF_MAX;} 58 | static float max() {return HALF_MAX;} 59 | static float smallest() {return HALF_MIN;} 60 | static float epsilon() {return HALF_EPSILON;} 61 | static bool isIntegral() {return false;} 62 | static bool isSigned() {return true;} 63 | }; 64 | 65 | 66 | IMATH_INTERNAL_NAMESPACE_HEADER_EXIT 67 | 68 | #endif // INCLUDED_IMATHHALFLIMITS_H 69 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenEXR/ImathInt64.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2006-2012, Industrial Light & Magic, a division of Lucas 4 | // Digital Ltd. LLC 5 | // 6 | // All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions are 10 | // met: 11 | // * Redistributions of source code must retain the above copyright 12 | // notice, this list of conditions and the following disclaimer. 13 | // * Redistributions in binary form must reproduce the above 14 | // copyright notice, this list of conditions and the following disclaimer 15 | // in the documentation and/or other materials provided with the 16 | // distribution. 17 | // * Neither the name of Industrial Light & Magic nor the names of 18 | // its contributors may be used to endorse or promote products derived 19 | // from this software without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | #ifndef INCLUDED_IMATH_INT64_H 37 | #define INCLUDED_IMATH_INT64_H 38 | 39 | //---------------------------------------------------------------------------- 40 | // 41 | // Int64 -- unsigned 64-bit integers 42 | // 43 | //---------------------------------------------------------------------------- 44 | 45 | #include "ImathNamespace.h" 46 | #include 47 | 48 | IMATH_INTERNAL_NAMESPACE_HEADER_ENTER 49 | 50 | 51 | #if (defined _WIN32 || defined _WIN64) && _MSC_VER >= 1300 52 | typedef unsigned __int64 Int64; 53 | #elif ULONG_MAX == 18446744073709551615LU 54 | typedef long unsigned int Int64; 55 | #else 56 | typedef long long unsigned int Int64; 57 | #endif 58 | 59 | 60 | IMATH_INTERNAL_NAMESPACE_HEADER_EXIT 61 | 62 | #endif // INCLUDED_IMATH_INT64_H 63 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenImageIO/osdep.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2009 Larry Gritz and the other authors and contributors. 3 | All Rights Reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of the software's owners nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | (This is the Modified BSD License) 29 | */ 30 | #ifndef OPENIMAGEIO_OSDEP_H 31 | #define OPENIMAGEIO_OSDEP_H 32 | 33 | #ifdef _WIN32 34 | # define WIN32_LEAN_AND_MEAN 35 | # define VC_EXTRALEAN 36 | # define NOMINMAX 37 | # include 38 | #endif 39 | 40 | #endif // OPENIMAGEIO_OSDEP_H 41 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenImageIO/pugiconfig.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * pugixml parser - version 1.2 3 | * -------------------------------------------------------- 4 | * Copyright (C) 2006-2012, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 5 | * Report bugs and download new versions at http://pugixml.org/ 6 | * 7 | * This library is distributed under the MIT License. See notice at the end 8 | * of this file. 9 | * 10 | * This work is based on the pugxml parser, which is: 11 | * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) 12 | */ 13 | 14 | #ifndef HEADER_PUGICONFIG_HPP 15 | #define HEADER_PUGICONFIG_HPP 16 | 17 | // Uncomment this to enable wchar_t mode 18 | // #define PUGIXML_WCHAR_MODE 19 | 20 | // Uncomment this to disable XPath 21 | // #define PUGIXML_NO_XPATH 22 | 23 | // Uncomment this to disable STL 24 | // #define PUGIXML_NO_STL 25 | 26 | // Uncomment this to disable exceptions 27 | // #define PUGIXML_NO_EXCEPTIONS 28 | 29 | // Set this to control attributes for public classes/functions, i.e.: 30 | // #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL 31 | // #define PUGIXML_CLASS __declspec(dllimport) // to import all classes from DLL 32 | // #define PUGIXML_FUNCTION __fastcall // to set calling conventions to all public functions to fastcall 33 | // In absence of PUGIXML_CLASS/PUGIXML_FUNCTION definitions PUGIXML_API is used instead 34 | 35 | // OIIO: use already defined OIIO_API 36 | #include "export.h" 37 | #define PUGIXML_API OIIO_API 38 | 39 | // Uncomment this to switch to header-only version 40 | #define PUGIXML_HEADER_ONLY 41 | #include "pugixml.cpp" 42 | 43 | // Tune these constants to adjust memory-related behavior 44 | // #define PUGIXML_MEMORY_PAGE_SIZE 32768 45 | // #define PUGIXML_MEMORY_OUTPUT_STACK 10240 46 | // #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096 47 | 48 | #endif 49 | 50 | /** 51 | * Copyright (c) 2006-2012 Arseny Kapoulkine 52 | * 53 | * Permission is hereby granted, free of charge, to any person 54 | * obtaining a copy of this software and associated documentation 55 | * files (the "Software"), to deal in the Software without 56 | * restriction, including without limitation the rights to use, 57 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 58 | * copies of the Software, and to permit persons to whom the 59 | * Software is furnished to do so, subject to the following 60 | * conditions: 61 | * 62 | * The above copyright notice and this permission notice shall be 63 | * included in all copies or substantial portions of the Software. 64 | * 65 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 66 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 67 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 68 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 69 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 70 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 71 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 72 | * OTHER DEALINGS IN THE SOFTWARE. 73 | */ 74 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenImageIO/string_ref.h: -------------------------------------------------------------------------------- 1 | // Back-compatible temporary inclusion of string_view.h 2 | 3 | #pragma once 4 | 5 | #include "string_view.h" 6 | 7 | 8 | -------------------------------------------------------------------------------- /3rdparty/oiio/include/OpenImageIO/version.h: -------------------------------------------------------------------------------- 1 | // DEPRECATED header OpenImageIO/version.h 2 | // For back compatibility, just include the new name, oiioversion.h. 3 | 4 | #include "oiioversion.h" 5 | -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/OpenImageIO.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/oiio/lib/x64/OpenImageIO.lib -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/OpenImageIOD.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/oiio/lib/x64/OpenImageIOD.lib -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/libOpenImageIO.1.5.2.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/oiio/lib/x64/libOpenImageIO.1.5.2.dylib -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/libOpenImageIO.1.5.dylib: -------------------------------------------------------------------------------- 1 | libOpenImageIO.1.5.2.dylib -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/libOpenImageIO.dylib: -------------------------------------------------------------------------------- 1 | libOpenImageIO.1.5.dylib -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/libOpenImageIO_Util.1.5.2.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/3rdparty/oiio/lib/x64/libOpenImageIO_Util.1.5.2.dylib -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/libOpenImageIO_Util.1.5.dylib: -------------------------------------------------------------------------------- 1 | libOpenImageIO_Util.1.5.2.dylib -------------------------------------------------------------------------------- /3rdparty/oiio/lib/x64/libOpenImageIO_Util.dylib: -------------------------------------------------------------------------------- 1 | libOpenImageIO_Util.1.5.dylib -------------------------------------------------------------------------------- /Baikal/Controllers/scene_controller.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace Baikal 4 | { 5 | static std::uint32_t g_next_id = 0; 6 | 7 | std::uint32_t GetNextControllerId() 8 | { 9 | return g_next_id++; 10 | } 11 | 12 | void ResetControllerId() 13 | { 14 | g_next_id = 0; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Baikal/Kernels/CL/bxdf_uberv2.cl: -------------------------------------------------------------------------------- 1 | #ifndef BXDF_UBERV2_CL 2 | #define BXDF_UBERV2_CL 3 | 4 | #include 5 | 6 | typedef struct _UberV2ShaderData 7 | { 8 | float4 diffuse_color; 9 | float4 reflection_color; 10 | float4 coating_color; 11 | float4 refraction_color; 12 | float4 emission_color; 13 | float4 sss_absorption_color; 14 | float4 sss_scatter_color; 15 | float4 sss_subsurface_color; 16 | float4 shading_normal; 17 | 18 | float reflection_roughness; 19 | float reflection_anisotropy; 20 | float reflection_anisotropy_rotation; 21 | float reflection_ior; 22 | 23 | float reflection_metalness; 24 | float coating_ior; 25 | float refraction_roughness; 26 | float refraction_ior; 27 | 28 | float transparency; 29 | float sss_absorption_distance; 30 | float sss_scatter_distance; 31 | float sss_scatter_direction; 32 | 33 | } UberV2ShaderData; 34 | 35 | bool UberV2IsTransmissive( 36 | // Layers 37 | int layers 38 | ) 39 | { 40 | return (layers & (kTransparencyLayer | kRefractionLayer)) != 0; 41 | } 42 | 43 | float4 GetUberV2EmissionColor( 44 | // Material offset 45 | int offset, 46 | // Geometry 47 | DifferentialGeometry const* dg, 48 | // Values for input maps 49 | GLOBAL InputMapData const* restrict input_map_values, 50 | // Material attributes 51 | GLOBAL int const* restrict material_attributes, 52 | // Texture args 53 | TEXTURE_ARG_LIST 54 | ) 55 | { 56 | return GetInputMapFloat4(material_attributes[offset+1], dg, input_map_values, TEXTURE_ARGS); 57 | } 58 | 59 | 60 | #include <../Baikal/Kernels/CL/bxdf_uberv2_bricks.cl> 61 | 62 | void UberV2_ApplyShadingNormal( 63 | // Geometry 64 | DifferentialGeometry* dg, 65 | // Prepared UberV2 shader inputs 66 | UberV2ShaderData const* shader_data 67 | ) 68 | { 69 | const int layers = dg->mat.layers; 70 | 71 | if ((layers & kShadingNormalLayer) == kShadingNormalLayer) 72 | { 73 | dg->n = normalize(shader_data->shading_normal.z * dg->n + shader_data->shading_normal.x * dg->dpdu + shader_data->shading_normal.y * dg->dpdv); 74 | dg->dpdv = normalize(cross(dg->n, dg->dpdu)); 75 | dg->dpdu = normalize(cross(dg->dpdv, dg->n)); 76 | } 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Baikal/Kernels/CL/common.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef COMMON_CL 23 | #define COMMON_CL 24 | 25 | #define PI 3.14159265358979323846f 26 | #define KERNEL __kernel 27 | #define GLOBAL __global 28 | 29 | #ifndef APPLE 30 | #define INLINE __attribute__((always_inline)) 31 | #endif 32 | 33 | #define HIT_MARKER 1 34 | #define MISS_MARKER -1 35 | #define INVALID_IDX -1 36 | 37 | #define CRAZY_LOW_THROUGHPUT 0.0f 38 | #define CRAZY_HIGH_RADIANCE 10.f 39 | #define CRAZY_HIGH_DISTANCE 1000000.f 40 | #define CRAZY_LOW_DISTANCE 0.001f 41 | #define CRAZY_HIGH_DISTANCE_IN_VOLUME 1000000.f 42 | #define REASONABLE_RADIANCE(x) (clamp((x), 0.f, CRAZY_HIGH_RADIANCE)) 43 | #define NON_BLACK(x) (length(x) > 0.f) 44 | 45 | #define MULTISCATTER 46 | 47 | #define RANDOM 1 48 | #define SOBOL 2 49 | #define CMJ 3 50 | 51 | #define SAMPLER CMJ 52 | 53 | #define CMJ_DIM 16 54 | 55 | #define BDPT_MAX_SUBPATH_LEN 3 56 | 57 | #ifdef BAIKAL_ATOMIC_RESOLVE 58 | #define ADD_FLOAT3(x,y) atomic_add_float3((x),(y)) 59 | #define ADD_FLOAT4(x,y) atomic_add_float4((x),(y)) 60 | #else 61 | #define ADD_FLOAT3(x,y) add_float3((x),(y)) 62 | #define ADD_FLOAT4(x,y) add_float4((x),(y)) 63 | #endif 64 | 65 | #define VISIBILITY_MASK_PRIMARY (0x1) 66 | #define VISIBILITY_MASK_SHADOW (0x1 << 15) 67 | #define VISIBILITY_MASK_ALL (0xffffffffu) 68 | #define VISIBILITY_MASK_NONE (0x0u) 69 | #define VISIBILITY_MASK_BOUNCE(i) (VISIBILITY_MASK_PRIMARY << (i)) 70 | #define VISIBILITY_MASK_BOUNCE_SHADOW(i) (VISIBILITY_MASK_SHADOW << (i)) 71 | 72 | #endif // COMMON_CL 73 | -------------------------------------------------------------------------------- /Baikal/Kernels/CL/isect.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef ISECT_CL 23 | #define ISECT_CL 24 | 25 | /// Intersection data returned by RadeonRays 26 | typedef struct _Intersection 27 | { 28 | // id of a shape 29 | int shapeid; 30 | // Primitive index 31 | int primid; 32 | // Padding elements 33 | int padding0; 34 | int padding1; 35 | 36 | // uv - hit barycentrics, w - ray distance 37 | float4 uvwt; 38 | } Intersection; 39 | 40 | float Intersection_GetDistance(__global Intersection const* isect) 41 | { 42 | return isect->uvwt.w; 43 | } 44 | 45 | float2 Intersection_GetBarycentrics(__global Intersection const* isect) 46 | { 47 | return isect->uvwt.xy; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /Baikal/Kernels/CL/ray.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef RAY_CL 23 | #define RAY_CL 24 | 25 | #include <../Baikal/Kernels/CL/common.cl> 26 | 27 | // Ray descriptor 28 | typedef struct 29 | { 30 | // xyz - origin, w - max range 31 | float4 o; 32 | // xyz - direction, w - time 33 | float4 d; 34 | // x - ray mask, y - activity flag 35 | int2 extra; 36 | // Padding 37 | float2 padding; 38 | } ray; 39 | 40 | // Set ray activity flag 41 | INLINE void Ray_SetInactive(GLOBAL ray* r) 42 | { 43 | r->extra.y = 0; 44 | } 45 | 46 | INLINE bool Ray_IsActive(GLOBAL ray* r) 47 | { 48 | return r->extra.y != 0; 49 | } 50 | 51 | // Set extra data for ray 52 | INLINE void Ray_SetExtra(GLOBAL ray* r, float2 extra) 53 | { 54 | r->padding = extra; 55 | } 56 | 57 | // Set mask 58 | INLINE void Ray_SetMask(GLOBAL ray* r, int mask) 59 | { 60 | r->extra.x = mask; 61 | } 62 | 63 | INLINE int Ray_GetMask(GLOBAL ray* r) 64 | { 65 | return r->extra.x; 66 | } 67 | 68 | // Get extra data for ray 69 | INLINE float2 Ray_GetExtra(GLOBAL ray const* r) 70 | { 71 | return r->padding; 72 | } 73 | 74 | // Initialize ray structure 75 | INLINE void Ray_Init(GLOBAL ray* r, float3 o, float3 d, float maxt, float time, int mask) 76 | { 77 | r->o.xyz = o; 78 | r->d.xyz = d; 79 | r->o.w = maxt; 80 | r->d.w = time; 81 | r->extra.x = mask; 82 | r->extra.y = 0xFFFFFFFF; 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /Baikal/Kernels/CL/vertex.cl: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef VERTEX_CL 23 | #define VERTEX_CL 24 | 25 | // Path vertex type 26 | enum PathVertexType 27 | { 28 | kCamera, 29 | kSurface, 30 | kVolume, 31 | kLight 32 | }; 33 | 34 | // Path vertex descriptor 35 | typedef struct _PathVertex 36 | { 37 | float3 position; 38 | float3 shading_normal; 39 | float3 geometric_normal; 40 | float2 uv; 41 | float pdf_forward; 42 | float pdf_backward; 43 | float3 flow; 44 | float3 unused; 45 | int type; 46 | int material_index; 47 | int flags; 48 | int padding; 49 | } PathVertex; 50 | 51 | // Initialize path vertex 52 | INLINE 53 | void PathVertex_Init( 54 | PathVertex* v, 55 | float3 p, 56 | float3 n, 57 | float3 ng, 58 | float2 uv, 59 | float pdf_fwd, 60 | float pdf_bwd, 61 | float3 flow, 62 | int type, 63 | int matidx 64 | ) 65 | { 66 | v->position = p; 67 | v->shading_normal = n; 68 | v->geometric_normal = ng; 69 | v->uv = uv; 70 | v->pdf_forward = pdf_fwd; 71 | v->pdf_backward = pdf_bwd; 72 | v->flow = flow; 73 | v->type = type; 74 | v->material_index = matidx; 75 | v->flags = 0; 76 | v->unused = 0.f; 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Baikal/Output/clwoutput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "output.h" 4 | #include "CLW.h" 5 | 6 | namespace Baikal 7 | { 8 | class ClwOutput : public Output 9 | { 10 | public: 11 | ClwOutput(CLWContext context, std::uint32_t w, std::uint32_t h) 12 | : Output(w, h) 13 | , m_context(context) 14 | , m_data(context.CreateBuffer(w*h, CL_MEM_READ_WRITE)) 15 | { 16 | } 17 | 18 | void GetData(RadeonRays::float3* data) const override 19 | { 20 | m_context.ReadBuffer(0, m_data, data, m_data.GetElementCount()).Wait(); 21 | } 22 | 23 | void GetData(RadeonRays::float3* data, /* offset in elems */ size_t offset, /* read elems */size_t elems_count) const override 24 | { 25 | m_context.ReadBuffer( 26 | 0, 27 | m_data, 28 | data, 29 | offset, 30 | elems_count).Wait(); 31 | } 32 | 33 | void Clear(RadeonRays::float3 const& val) override 34 | { 35 | m_context.FillBuffer(0, m_data, val, m_data.GetElementCount()).Wait(); 36 | } 37 | 38 | CLWBuffer data() const { return m_data; } 39 | 40 | private: 41 | CLWContext m_context; 42 | CLWBuffer m_data; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /Baikal/PostEffects/clw_post_effect.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "post_effect.h" 25 | 26 | #include "CLW.h" 27 | #include "Output/clwoutput.h" 28 | #include "Utils/clw_class.h" 29 | 30 | #include 31 | #include 32 | 33 | namespace Baikal 34 | { 35 | class CLProgramManager; 36 | /** 37 | \brief Post effects partial implementation based on CLW framework. 38 | */ 39 | class ClwPostEffect : public PostEffect, protected ClwClass 40 | { 41 | public: 42 | #ifdef BAIKAL_EMBED_KERNELS 43 | // Constructor, receives CLW context 44 | ClwPostEffect(CLWContext context, const CLProgramManager *program_manager, std::string const& name, 45 | std::string const& source, std::unordered_map const& headers); 46 | #else 47 | ClwPostEffect(CLWContext context, const CLProgramManager *program_manager, std::string const& file_name); 48 | #endif 49 | }; 50 | 51 | #ifdef BAIKAL_EMBED_KERNELS 52 | inline ClwPostEffect::ClwPostEffect(CLWContext context, const CLProgramManager *program_manager, std::string const& name, 53 | std::string const& source, std::unordered_map const& headers) 54 | : ClwClass(context, program_manager, name, source, headers) 55 | { 56 | } 57 | #else 58 | inline ClwPostEffect::ClwPostEffect(CLWContext context, const CLProgramManager *program_manager, std::string const& file_name) 59 | : ClwClass(context, program_manager, file_name) 60 | { 61 | } 62 | #endif 63 | } 64 | -------------------------------------------------------------------------------- /Baikal/RenderFactory/clw_render_factory.h: -------------------------------------------------------------------------------- 1 | 2 | /********************************************************************** 3 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | ********************************************************************/ 23 | #pragma once 24 | 25 | #include "render_factory.h" 26 | #include "radeon_rays_cl.h" 27 | #include "CLW.h" 28 | 29 | #include "SceneGraph/clwscene.h" 30 | #include "Utils/cl_program_manager.h" 31 | 32 | #include 33 | #include 34 | 35 | 36 | namespace Baikal 37 | { 38 | /** 39 | \brief RenderFactory class is in charge of render entities creation. 40 | 41 | \details RenderFactory makes sure renderer objects are compatible between 42 | each other since many of them might use either CPU or GPU implementation. 43 | Entities create via the same factory are known to be compatible. 44 | */ 45 | class ClwRenderFactory : public RenderFactory 46 | { 47 | public: 48 | ClwRenderFactory(CLWContext context, std::string const& cache_path=""); 49 | 50 | // Create a renderer of specified type 51 | std::unique_ptr 52 | CreateRenderer(RendererType type) const override; 53 | // Create an output of specified type 54 | std::unique_ptr 55 | CreateOutput(std::uint32_t w, std::uint32_t h) const override; 56 | // Create post effect of specified type 57 | std::unique_ptr 58 | CreatePostEffect(PostEffectType type) const override; 59 | 60 | std::unique_ptr> 61 | CreateSceneController() const override; 62 | 63 | private: 64 | CLWContext m_context; 65 | std::string m_cache_path; 66 | CLProgramManager m_program_manager; 67 | 68 | using RadeonRaysInstanceDelete = decltype(RadeonRays::IntersectionApi::Delete); 69 | 70 | std::shared_ptr m_intersector; 71 | }; 72 | } 73 | -------------------------------------------------------------------------------- /Baikal/RenderFactory/render_factory.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include 25 | 26 | #include "CLW.h" 27 | #include "Controllers/scene_controller.h" 28 | 29 | namespace Baikal 30 | { 31 | class Renderer; 32 | class Output; 33 | class PostEffect; 34 | 35 | /** 36 | \brief RenderFactory class is in charge of render entities creation. 37 | 38 | \details RenderFactory makes sure renderer objects are compatible between 39 | each other since many of them might use either CPU or GPU implementation. 40 | Entities create via the same factory are known to be compatible. 41 | */ 42 | template 43 | class RenderFactory 44 | { 45 | public: 46 | enum class RendererType 47 | { 48 | kUnidirectionalPathTracer 49 | }; 50 | 51 | enum class PostEffectType 52 | { 53 | kBilateralDenoiser, 54 | kWaveletDenoiser 55 | }; 56 | 57 | RenderFactory() = default; 58 | virtual ~RenderFactory() = default; 59 | 60 | virtual 61 | std::unique_ptr CreateRenderer(RendererType type) const = 0; 62 | 63 | virtual 64 | std::unique_ptr CreateOutput(std::uint32_t w, std::uint32_t h) const = 0; 65 | 66 | virtual 67 | std::unique_ptr CreatePostEffect(PostEffectType type) const = 0; 68 | 69 | virtual 70 | std::unique_ptr> CreateSceneController() const = 0; 71 | 72 | RenderFactory(RenderFactory const&) = delete; 73 | RenderFactory const& operator = (RenderFactory const&) = delete; 74 | }; 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /Baikal/SceneGraph/clwscene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CLW.h" 4 | //#include "math/float3.h" 5 | #include "SceneGraph/scene1.h" 6 | #include "radeon_rays.h" 7 | #include "SceneGraph/Collector/collector.h" 8 | 9 | 10 | namespace Baikal 11 | { 12 | using namespace RadeonRays; 13 | 14 | enum class CameraType 15 | { 16 | kPerspective, 17 | kPhysicalPerspective, 18 | kSpherical, 19 | kFisheye, 20 | kOrthographic 21 | }; 22 | 23 | struct ClwScene 24 | { 25 | #include "Kernels/CL/payload.cl" 26 | 27 | CLWBuffer vertices; 28 | CLWBuffer normals; 29 | CLWBuffer uvs; 30 | CLWBuffer indices; 31 | 32 | CLWBuffer shapes; 33 | CLWBuffer shapes_additional; 34 | 35 | CLWBuffer material_attributes; 36 | CLWBuffer lights; 37 | CLWBuffer volumes; 38 | CLWBuffer textures; 39 | CLWBuffer texturedata; 40 | 41 | CLWBuffer camera; 42 | CLWBuffer light_distributions; 43 | CLWBuffer input_map_data; 44 | 45 | std::unique_ptr material_bundle; 46 | std::unique_ptr volume_bundle; 47 | std::unique_ptr texture_bundle; 48 | std::unique_ptr input_map_leafs_bundle; 49 | std::unique_ptr input_map_bundle; 50 | 51 | int num_lights; 52 | int num_volumes; 53 | int envmapidx; 54 | int background_idx; 55 | int camera_volume_index; 56 | CameraType camera_type; 57 | 58 | std::vector isect_shapes; 59 | std::vector visible_shapes; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /Baikal/SceneGraph/scene_object.cpp: -------------------------------------------------------------------------------- 1 | #include "scene_object.h" 2 | #include 3 | 4 | namespace Baikal 5 | { 6 | static std::uint32_t g_next_id = 0; 7 | static int g_scene_controller_id = -1; 8 | 9 | SceneObject::SceneObject() 10 | : m_dirty(), m_id(g_next_id++) 11 | { 12 | } 13 | 14 | bool SceneObject::IsDirty() const 15 | { 16 | assert(g_scene_controller_id >= 0); 17 | 18 | return m_dirty[g_scene_controller_id]; 19 | 20 | } 21 | 22 | void SceneObject::SetDirty(bool dirty) const 23 | { 24 | if (dirty) 25 | { 26 | // Set all bits to 1 27 | m_dirty.set(); 28 | } 29 | else 30 | { 31 | assert(g_scene_controller_id >= 0); 32 | // Unset corresponging bit 33 | m_dirty.set(g_scene_controller_id, false); 34 | } 35 | } 36 | 37 | void SceneObject::ResetId() 38 | { 39 | g_next_id = 0; 40 | } 41 | 42 | void SceneObject::SetSceneControllerId(std::uint32_t controller_id) 43 | { 44 | assert(controller_id < kMaxDirtyBits); 45 | g_scene_controller_id = static_cast(controller_id); 46 | } 47 | 48 | void SceneObject::ResetSceneControllerId() 49 | { 50 | g_scene_controller_id = -1; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Baikal/SceneGraph/texture.cpp: -------------------------------------------------------------------------------- 1 | #include "texture.h" 2 | 3 | #include "Utils/half.h" 4 | 5 | namespace Baikal 6 | { 7 | RadeonRays::float3 Texture::ComputeAverageValue() const 8 | { 9 | auto avg = RadeonRays::float3(); 10 | 11 | switch (m_format) { 12 | case Format::kRgba8: 13 | { 14 | auto data = reinterpret_cast(m_data.get()); 15 | auto num_elements = m_size.x * m_size.y * m_size.z; 16 | 17 | 18 | for (auto i = 0; i < num_elements; ++i) 19 | { 20 | float r = data[4 * i] / 255.f; 21 | float g = data[4 * i + 1] / 255.f; 22 | float b = data[4 * i + 2] / 255.f; 23 | avg += RadeonRays::float3(r, g, b); 24 | } 25 | 26 | avg *= (1.f / num_elements); 27 | break; 28 | } 29 | case Format::kRgba16: 30 | { 31 | auto data = reinterpret_cast(m_data.get()); 32 | auto num_elements = m_size.x * m_size.y * m_size.z; 33 | 34 | for (auto i = 0; i < num_elements; ++i) 35 | { 36 | auto r = data[4 * i]; 37 | auto g = data[4 * i + 1]; 38 | auto b = data[4 * i + 2]; 39 | 40 | half hr, hg, hb; 41 | hr.setBits(r); 42 | hg.setBits(g); 43 | hb.setBits(b); 44 | 45 | avg += RadeonRays::float3(hr, hg, hb); 46 | } 47 | 48 | avg *= (1.f / num_elements); 49 | break; 50 | } 51 | case Format::kRgba32: 52 | { 53 | auto data = reinterpret_cast(m_data.get()); 54 | auto num_elements = m_size.x * m_size.y * m_size.z; 55 | 56 | for (auto i = 0; i < num_elements; ++i) 57 | { 58 | auto r = data[4 * i]; 59 | auto g = data[4 * i + 1]; 60 | auto b = data[4 * i + 2]; 61 | 62 | avg += RadeonRays::float3(r, g, b); 63 | } 64 | 65 | avg *= (1.f / num_elements); 66 | break; 67 | } 68 | default: 69 | break; 70 | } 71 | 72 | return avg; 73 | } 74 | 75 | namespace { 76 | struct TextureConcrete : public Texture { 77 | TextureConcrete() = default; 78 | TextureConcrete(char* data, RadeonRays::int3 size, Format format) : 79 | Texture(data, size, format) {} 80 | }; 81 | } 82 | 83 | Texture::Ptr Texture::Create() { 84 | return std::make_shared(); 85 | } 86 | 87 | Texture::Ptr Texture::Create(char* data, RadeonRays::int3 size, Format format) { 88 | return std::make_shared(data, size, format); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Baikal/Utils/cl_inputmap_generator.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include "SceneGraph/scene1.h" 29 | #include "SceneGraph/Collector/collector.h" 30 | #include "SceneGraph/clwscene.h" 31 | 32 | namespace Baikal 33 | { 34 | class UberV2Material; 35 | class CLInputMapGenerator 36 | { 37 | public: 38 | /** 39 | * @brief Generates source code for input maps. 40 | * 41 | * Code stored inside Generator object. 42 | * Makes lookups into leaf collectors to get parameters 43 | * Each input map will create single function that will output float4 value 44 | * 45 | * @param input_map_collector set of input maps for generation 46 | * @param input_map_leaf_collector list of leaf nodes that holds values 47 | */ 48 | void Generate(const Collector& input_map_collector, const Collector& input_map_leaf_collector); 49 | 50 | // Returns generated source 51 | const std::string& GetGeneratedSource() const 52 | { 53 | return m_source_code; 54 | } 55 | 56 | private: 57 | // Proceed single input, writes function header and function call 58 | void GenerateSingleInput(std::shared_ptr input, const Collector& input_map_leaf_collector); 59 | // Writes source code for single input map. Called recursively. 60 | void GenerateInputSource(std::shared_ptr input, const Collector& input_map_leaf_collector); 61 | std::string m_source_code; 62 | std::string m_read_functions; 63 | std::string m_float4_selector; 64 | std::string m_float_selector; 65 | std::set m_generated_inputs; 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /Baikal/Utils/cl_program_manager.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "CLWProgram.h" 31 | #include "CLWContext.h" 32 | #include "cl_program.h" 33 | 34 | 35 | namespace Baikal 36 | { 37 | class CLProgramManager 38 | { 39 | public: 40 | // Constructor 41 | explicit CLProgramManager(const std::string &cache_path); 42 | // Creates program from file and returns its id 43 | uint32_t CreateProgramFromFile(CLWContext context, const std::string &fname) const; 44 | // Creates program from source and returns its id 45 | uint32_t CreateProgramFromSource(CLWContext context, const std::string &name, const std::string &source) const; 46 | // Loads header from file into map of headers 47 | void LoadHeader(const std::string &header) const; 48 | // Adds header to map from source 49 | void AddHeader(const std::string &header, const std::string &source) const; 50 | // Reads header from disk and returns its source 51 | const std::string& ReadHeader(const std::string &header) const; 52 | // Returns compiled program 53 | CLWProgram GetProgram(uint32_t id, const std::string &opts) const; 54 | // Compiles program 55 | void CompileProgram(uint32_t id, const std::string &opts) const; 56 | 57 | private: 58 | mutable std::string m_cache_path; ///< Path to cache folder 59 | mutable std::map m_programs; ///< Cache of programs by id 60 | mutable std::map m_headers; ///< Headers map 61 | static uint32_t m_next_program_id; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /Baikal/Utils/cmd_parser.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #include "Utils/cmd_parser.h" 24 | #include 25 | 26 | namespace Baikal 27 | { 28 | 29 | CmdParser::CmdParser(int argc, char* argv[]) 30 | { 31 | if (argc < 0) 32 | { 33 | throw std::logic_error(std::string(__func__) + ": 'argc' can't be negative"); 34 | } 35 | if (!argv) 36 | { 37 | throw std::logic_error(std::string(__func__) + ": 'argv' is nulltpr"); 38 | } 39 | 40 | m_cmd_line = { argv, argv + argc }; 41 | } 42 | 43 | bool CmdParser::OptionExists(const std::string& option) const 44 | { 45 | return (std::find(m_cmd_line.begin(), m_cmd_line.end(), option) != m_cmd_line.end()); 46 | } 47 | 48 | const std::string* CmdParser::GetOptionValue(const std::string& option) const 49 | { 50 | auto it = std::find(m_cmd_line.begin(), m_cmd_line.end(), option); 51 | 52 | if ((it == m_cmd_line.end()) || (++it == m_cmd_line.end())) 53 | { 54 | return nullptr; 55 | } 56 | else 57 | { 58 | return &(*it); 59 | } 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /Baikal/Utils/distribution1d.cpp: -------------------------------------------------------------------------------- 1 | #include "distribution1d.h" 2 | #include "math/mathutils.h" 3 | 4 | #include 5 | #include 6 | 7 | namespace Baikal 8 | { 9 | Distribution1D::Distribution1D() 10 | : m_num_segments(0u) 11 | { 12 | } 13 | 14 | Distribution1D::Distribution1D(float const* values, std::uint32_t num_segments) 15 | { 16 | Set(values, num_segments); 17 | } 18 | 19 | void Distribution1D::Set(float const* values, std::uint32_t num_segments) 20 | { 21 | assert(num_segments > 0); 22 | m_num_segments = num_segments; 23 | m_func_values.resize(num_segments); 24 | m_cdf.resize(num_segments + 1); 25 | 26 | // Copy function values 27 | std::copy(values, values + num_segments, m_func_values.begin()); 28 | 29 | // Calculate CDF 30 | m_cdf[0] = 0.f; 31 | for (auto i = 1u; i < num_segments + 1; ++i) 32 | { 33 | m_cdf[i] = m_cdf[i - 1] + m_func_values[i - 1] / num_segments; 34 | } 35 | 36 | // Calculate normalizer 37 | m_func_sum = m_cdf[num_segments]; 38 | 39 | // Normalize CDF 40 | for (auto i = 0u; i < num_segments + 1; ++i) 41 | { 42 | m_cdf[i] /= m_func_sum; 43 | } 44 | } 45 | 46 | float Distribution1D::Sample1D(float u, float& pdf) const 47 | { 48 | assert(m_num_segments > 0); 49 | 50 | // Find the segment here u lies 51 | // this one is in [0, N-1] and we need to handle corner case: 52 | // for 0 it returns 0 index 53 | auto iter = std::lower_bound(m_cdf.cbegin(), m_cdf.cend(), u); 54 | 55 | // Find segment index : clamp it as last may be returned for 1 56 | auto segment_idx = std::max((std::uint32_t)std::distance(m_cdf.cbegin(), iter), 1u); 57 | 58 | assert(u >= m_cdf[segment_idx - 1] && u <= m_cdf[segment_idx]); 59 | 60 | // Find lerp coefficient 61 | float du = (u - m_cdf[segment_idx - 1]) / (m_cdf[segment_idx] - m_cdf[segment_idx - 1]); 62 | 63 | // Calc pdf 64 | pdf = m_func_values[segment_idx - 1] / m_func_sum; 65 | 66 | // Return corresponding value 67 | return (segment_idx - 1 + du) / m_num_segments; 68 | } 69 | 70 | float Distribution1D::pdf(float u) const 71 | { 72 | // Find the segment here u lies 73 | auto iter = std::lower_bound(m_cdf.cbegin(), m_cdf.cend(), u); 74 | 75 | // Find segment index : clamp it as last may be returned for 1 76 | auto segment_idx = std::max((std::uint32_t)std::distance(m_cdf.cbegin(), iter), 1u); 77 | 78 | // Calc pdf 79 | return m_func_values[segment_idx - 1] / m_func_sum; 80 | } 81 | } -------------------------------------------------------------------------------- /Baikal/Utils/distribution1d.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | namespace Baikal 28 | { 29 | ///< The class represents 1D piecewise constant distribution of random variable. 30 | ///< The PDF is proprtional to passed function defined at N points in [0,1] interval 31 | ///< Partially taken from Pharr & Humphreys, but a bug with lower bound fixed. 32 | ///< 33 | struct Distribution1D 34 | { 35 | public: 36 | // values are function values at equal spacing at numsegments points within [0,1] range 37 | Distribution1D(); 38 | Distribution1D(float const* values, std::uint32_t num_segments); 39 | 40 | void Set(float const* values, std::uint32_t num_segments); 41 | 42 | // Sample one value using this distribution 43 | // u is uniformely distributed random var 44 | float Sample1D(float u, float& pdf) const; 45 | 46 | // PDF 47 | float pdf(float u) const; 48 | 49 | // Function values 50 | std::vector m_func_values; 51 | // Cumulative distribution function 52 | std::vector m_cdf; 53 | // Number of segments 54 | std::uint32_t m_num_segments; 55 | // Integral of the function over the whole range (normalizer) 56 | float m_func_sum; 57 | }; 58 | } -------------------------------------------------------------------------------- /Baikal/Utils/half.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Baikal/Utils/half.cpp -------------------------------------------------------------------------------- /Baikal/Utils/log.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace Baikal 27 | { 28 | template 29 | inline 30 | void Log(Stream&) 31 | { 32 | } 33 | 34 | template 35 | inline 36 | void Log(Stream& stream, F&& f, U&&... u) 37 | { 38 | #ifdef ENABLE_LOG 39 | stream << std::forward(f); 40 | Log(stream, std::forward(u)...); 41 | #endif 42 | } 43 | 44 | template 45 | inline 46 | void LogInfo(F&& f, U&&... u) 47 | { 48 | Log(std::cout, std::forward(f), std::forward(u)...); 49 | } 50 | 51 | template 52 | inline 53 | void LogError(F&& f, U&&... u) 54 | { 55 | Log(std::cerr, std::forward(f), std::forward(u)...); 56 | } 57 | } -------------------------------------------------------------------------------- /Baikal/Utils/mkpath.cpp: -------------------------------------------------------------------------------- 1 | #include "Utils/mkpath.h" 2 | 3 | #ifdef _WIN32 4 | #include 5 | #else 6 | #include 7 | #endif 8 | 9 | #include 10 | 11 | namespace Baikal 12 | { 13 | static const std::string delimiters = "/\\"; 14 | 15 | int mkpath(const std::string& path) 16 | { 17 | int err = -1; 18 | 19 | size_t length = path.size(); 20 | if (length == 0) 21 | return 0; 22 | 23 | if (path.find_last_of(delimiters) == length - 1) 24 | --length; 25 | 26 | size_t idx = 0; 27 | while (idx < length) 28 | { 29 | idx = path.find_first_of(delimiters, idx + 1); 30 | auto p = path.substr(0, idx); 31 | 32 | // Only store the error of the creation to deepest level 33 | // The error of higher level can be ignored because 34 | // they can either be existed or a root path or something like . and .. 35 | #ifdef _WIN32 36 | err = _mkdir(p.c_str()); 37 | #else 38 | err = mkdir(p.c_str(), 0755); 39 | #endif 40 | } 41 | 42 | // ignore error if final directory existed 43 | if (err != 0 && errno == EEXIST) 44 | err = 0; 45 | 46 | return err; 47 | } 48 | 49 | int mkfilepath(const std::string& filepath) 50 | { 51 | size_t pos = filepath.find_last_of(delimiters); 52 | if (pos == std::string::npos) 53 | return 0; 54 | 55 | return mkpath(filepath.substr(0, pos)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Baikal/Utils/mkpath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace Baikal 6 | { 7 | int mkpath(const std::string& path); 8 | 9 | int mkfilepath(const std::string& filepath); 10 | } 11 | -------------------------------------------------------------------------------- /Baikal/Utils/sh.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef SH_H 23 | #define SH_H 24 | 25 | #include "math/mathutils.h" 26 | 27 | ///< In mathematics, spherical harmonics are the angular portion of a set of solutions to Laplace's equation. 28 | ///< Represented in a system of spherical coordinates, Laplace's spherical harmonics 29 | ///< Y_l_m are a specific set of spherical harmonics that forms an orthogonal system, first introduced by Pierre Simon de Laplace in 1782. 30 | ///< Spherical harmonics are important in many theoretical and practical applications, 31 | ///< particularly in the computation of atomic orbital electron configurations, 32 | ///< representation of gravitational fields, geoids, and the magnetic fields of planetary bodies and stars, 33 | ///< and characterization of the cosmic microwave background radiation. 34 | ///< In 3D computer graphics, spherical harmonics play a special role in a wide variety of topics including 35 | ///< indirect lighting (ambient occlusion, global illumination, precomputed radiance transfer, etc.) and modelling of 3D shapes. 36 | ///< 37 | 38 | ///< The function gives the total number of coefficients required for the term up to specified band 39 | inline int NumShTerms(int l) 40 | { 41 | return (l + 1)*(l + 1); 42 | } 43 | 44 | ///< The function flattens 2D (l,m) index into 1D to be used in array indexing 45 | inline int ShIndex(int l, int m) 46 | { 47 | return l*l + l + m; 48 | } 49 | 50 | 51 | ///< The function evaluates the value of Y_l_m(p) coefficient up to lmax band. 52 | ///< coeffs array should have at least NumShTerms(lmax) elements. 53 | void ShEvaluate(RadeonRays::float3 const&p, int lmax, float* out); 54 | 55 | 56 | ///< Apply convolution with dot(n,wi) term 57 | void ShConvolveCosTheta(int lmax, RadeonRays::float3 const* cin, RadeonRays::float3* cout); 58 | 59 | 60 | 61 | #endif // SH_H -------------------------------------------------------------------------------- /Baikal/Utils/shproject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef SHPROJECT_H 23 | #define SHPROJECT_H 24 | 25 | #include 26 | 27 | #include "math/mathutils.h" 28 | 29 | ///< The function projects latitude-longitude environment map to SH basis up to lmax band 30 | void ShProjectEnvironmentMap(RadeonRays::float3 const* envmap, int width, int height, int lmax, RadeonRays::float3* coeffs); 31 | 32 | ///< The function evaluates SH functions and dumps values to latitude-longitude map 33 | void ShEvaluateAndDump(int width, int height, int lmax, RadeonRays::float3 const* coeffs, RadeonRays::float3* envmap); 34 | 35 | #endif // SHPROJECT_H -------------------------------------------------------------------------------- /Baikal/Utils/version.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #define BAIKAL_VERSION "0_5_0" 25 | -------------------------------------------------------------------------------- /Baikal/imgui.ini: -------------------------------------------------------------------------------- 1 | [Debug] 2 | Pos=16,8 3 | Size=200,150 4 | Collapsed=0 5 | 6 | [Baikal settings] 7 | Pos=133,-66 8 | Size=380,580 9 | Collapsed=0 10 | 11 | -------------------------------------------------------------------------------- /BaikalDataGenerator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Library 2 | 3 | set(DATAGENERATOR_LIB_SOURCES 4 | Source/data_generator.h 5 | Source/data_generator.cpp 6 | Source/devices.h 7 | Source/devices.cpp 8 | Source/filesystem.h 9 | Source/data_generator_impl.h 10 | Source/data_generator_impl.cpp 11 | Source/utils.h 12 | ) 13 | 14 | add_library(BaikalDataGenerator SHARED ${DATAGENERATOR_LIB_SOURCES}) 15 | 16 | target_compile_features(BaikalDataGenerator PRIVATE cxx_std_17) 17 | 18 | target_compile_definitions(BaikalDataGenerator PRIVATE RPR_EXPORT_API) 19 | 20 | target_include_directories(BaikalDataGenerator 21 | PRIVATE . 22 | PRIVATE ${Baikal_SOURCE_DIR} 23 | PRIVATE ${Baikal_SOURCE_DIR}/Rpr 24 | PRIVATE ${Baikal_SOURCE_DIR}/RadeonRays/include 25 | ) 26 | 27 | target_link_libraries(BaikalDataGenerator PRIVATE RadeonProRender64 Baikal BaikalIO) 28 | if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") 29 | target_link_libraries(BaikalDataGenerator PRIVATE stdc++fs) 30 | endif() 31 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 32 | target_link_libraries(BaikalDataGenerator PRIVATE c++experimental) 33 | endif () 34 | 35 | set_target_properties(BaikalDataGenerator 36 | PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${Baikal_SOURCE_DIR}/BaikalDataGenerator) 37 | 38 | add_dependencies(BaikalDataGenerator ResourcesDir Copy3rdParty) 39 | 40 | if (WIN32) 41 | install(TARGETS BaikalDataGenerator RUNTIME DESTINATION bin) 42 | else () 43 | install(TARGETS BaikalDataGenerator LIBRARY DESTINATION lib) 44 | endif () 45 | 46 | 47 | # Application 48 | 49 | set(DATAGENERATOR_APP_SOURCES 50 | Source/app_config.h 51 | Source/cmd_line_parser.h 52 | Source/cmd_line_parser.cpp 53 | Source/devices.h 54 | Source/devices.cpp 55 | Source/filesystem.h 56 | Source/object_loader.h 57 | Source/object_loader.cpp 58 | Source/logging.h 59 | Source/logging.cpp 60 | Source/main.cpp 61 | ) 62 | 63 | add_executable(BaikalDataGeneratorApp ${DATAGENERATOR_APP_SOURCES}) 64 | 65 | target_compile_features(BaikalDataGeneratorApp PRIVATE cxx_std_17) 66 | 67 | target_include_directories(BaikalDataGeneratorApp 68 | PRIVATE ${Baikal_SOURCE_DIR} 69 | PRIVATE . 70 | ) 71 | 72 | target_link_libraries(BaikalDataGeneratorApp PRIVATE BaikalDataGenerator RadeonProRender64 Baikal) 73 | if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") 74 | target_link_libraries(BaikalDataGeneratorApp PRIVATE stdc++fs) 75 | endif() 76 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 77 | target_link_libraries(BaikalDataGeneratorApp PRIVATE c++experimental) 78 | endif () 79 | 80 | set_target_properties(BaikalDataGeneratorApp 81 | PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${Baikal_SOURCE_DIR}/BaikalDataGenerator) 82 | 83 | install(TARGETS BaikalDataGeneratorApp RUNTIME DESTINATION bin) 84 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/app_config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "filesystem.h" 4 | 5 | #include 6 | 7 | const int kDefaultStartOutputIndex = -1; 8 | 9 | struct AppConfig 10 | { 11 | std::filesystem::path scene_file; 12 | std::filesystem::path light_file; 13 | std::filesystem::path camera_file; 14 | std::filesystem::path spp_file; 15 | std::filesystem::path output_dir; 16 | unsigned width = 0; 17 | unsigned height = 0; 18 | unsigned split_num = 1; 19 | unsigned split_idx = 0; 20 | int start_output_idx = kDefaultStartOutputIndex; 21 | unsigned num_bounces = 5; 22 | unsigned device_idx = 0; 23 | bool gamma_correction = false; 24 | }; 25 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/cmd_line_parser.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #pragma once 24 | 25 | #include "app_config.h" 26 | 27 | #include 28 | 29 | #include 30 | 31 | 32 | class CmdLineParser 33 | { 34 | public: 35 | 36 | // 'argc' - number of the command line arguments 37 | // 'argv' - command line arguments string 38 | CmdLineParser(int argc, char* argv[]); 39 | 40 | // Generate AppConfig from internal string 41 | AppConfig Parse() const; 42 | 43 | // check whether device list is requested 44 | bool HasListDevicesOption() const; 45 | 46 | // check if there is '-help' option 47 | // returns true if there's a help option, false otherwise 48 | bool HasHelpOption() const; 49 | 50 | // print help option 51 | void ShowHelp() const; 52 | 53 | private: 54 | Baikal::CmdParser m_cmd_parser; 55 | }; -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/data_generator.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #pragma once 24 | 25 | #include "Rpr/RadeonProRender.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | struct DataGeneratorParams 32 | { 33 | rpr_scene scene; 34 | char const* scene_name; 35 | 36 | rpr_light* lights; 37 | unsigned lights_num; 38 | 39 | rpr_camera* cameras; 40 | unsigned cameras_num; 41 | unsigned cameras_start_output_idx; 42 | 43 | unsigned const* spp; 44 | unsigned spp_num; 45 | 46 | unsigned width; 47 | unsigned height; 48 | 49 | unsigned bounces_num; 50 | unsigned device_idx; 51 | 52 | unsigned gamma_correction; /* 0 or 1 */ 53 | 54 | char const* output_dir; 55 | 56 | void(*progress_callback)(unsigned /* start_idx */, 57 | unsigned /* current_idx */, 58 | unsigned /* end_idx */); 59 | }; 60 | 61 | enum DataGeneratorResult 62 | { 63 | kDataGeneratorSuccess = 0, 64 | kDataGeneratorBadParams, 65 | kDataGeneratorBadOutputDir, 66 | kDataGeneratorBadScene, 67 | kDataGeneratorBadSceneName, 68 | kDataGeneratorBadCameras, 69 | kDataGeneratorBadLights, 70 | kDataGeneratorBadSpp, 71 | kDataGeneratorBadImgSize, 72 | kDataGeneratorBadBouncesNum, 73 | kDataGeneratorBadDeviceIdx, 74 | kDataGeneratorUnknownError, 75 | }; 76 | 77 | RPR_API_ENTRY DataGeneratorResult bdgGenerateDataset(DataGeneratorParams const* params); 78 | 79 | #ifdef __cplusplus 80 | } // extern "C" 81 | #endif 82 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/devices.cpp: -------------------------------------------------------------------------------- 1 | #include "devices.h" 2 | 3 | std::vector GetDevices() 4 | { 5 | std::vector devices; 6 | 7 | std::vector platforms; 8 | CLWPlatform::CreateAllPlatforms(platforms); 9 | 10 | for (const auto& platform : platforms) 11 | { 12 | for (auto i = 0u; i < platform.GetDeviceCount(); i++) 13 | { 14 | if (platform.GetDevice(i).GetType() == CL_DEVICE_TYPE_GPU) 15 | { 16 | devices.push_back(platform.GetDevice(i)); 17 | } 18 | } 19 | } 20 | 21 | return devices; 22 | } 23 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/devices.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | 8 | std::vector GetDevices(); 9 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/filesystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if (defined(__GNUC__) && (__GNUC__ < 8)) 4 | #include 5 | #else 6 | #include 7 | #endif 8 | 9 | // Visual Studio 2015 and GCC 7 work-around ... 10 | // std::filesystem was incorporated into C++-17 (which is obviously after VS 11 | // 2015 was released). However, Microsoft implemented the draft standard in 12 | // the std::exerimental namespace. To avoid nasty ripple effects when the 13 | // compiler is updated, make it look like the standard here 14 | #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || (defined(__GNUC__) && (__GNUC__ < 8)) 15 | namespace std 16 | { 17 | namespace filesystem = experimental::filesystem::v1; 18 | } 19 | #endif -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/logging.cpp: -------------------------------------------------------------------------------- 1 | #include "logging.h" 2 | 3 | #include 4 | #include 5 | 6 | 7 | std::ostream& operator <<(std::ostream& lhs, Timestamp rhs) 8 | { 9 | auto utc_time = std::time(nullptr); 10 | auto* gm_time = std::gmtime(&utc_time); 11 | std::array time_string; 12 | std::strftime(time_string.data(), 13 | time_string.size(), 14 | rhs.format, 15 | gm_time); 16 | return lhs << time_string.data(); 17 | } 18 | 19 | KeyValueType KeyValue(char const* key, char const* value) 20 | { 21 | KeyValueType kv(key, value); 22 | return KeyValueType(key, value); 23 | } 24 | 25 | KeyValueStream operator<<(KeyValueStream lhs, KeyValueType const& rhs) 26 | { 27 | *lhs.stream << lhs.delimiter << '"' << rhs.key << '"' << ": " << '"' << rhs.value << '"'; 28 | lhs.delimiter = ", "; 29 | return lhs; 30 | } 31 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/logging.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | 7 | /** 8 | * I/O maninpulator. Inserts a formatted daytime into an std::ostream. 9 | * Replacement for std::put_time which is not yet supported by all compilers. 10 | */ 11 | struct Timestamp 12 | { 13 | Timestamp(char const* format = "%Y-%m-%d %H:%M:%S") 14 | : format(format) 15 | { } 16 | 17 | char const* format; 18 | }; 19 | 20 | std::ostream& operator <<(std::ostream& lhs, Timestamp rhs); 21 | 22 | // CEE is a JSON/XML structured log format. Search web for "cee format" for details 23 | #define DG_LOG(INSERTERS) \ 24 | std::cout << "[" << Timestamp() << "] @cee: {" << INSERTERS << "}" << std::endl; 25 | 26 | 27 | /** 28 | * I/O manipulator. Inserts a key string, expects a value as next string. 29 | * All inserted values are formatted using JSON notation. 30 | */ 31 | template 32 | struct KeyValueType 33 | { 34 | KeyValueType(char const* key, Value value) : key(key), value(std::move(value)) { } 35 | char const* key; 36 | Value value; 37 | }; 38 | 39 | template 40 | KeyValueType KeyValue(char const* key, Value const& value) 41 | { 42 | return KeyValueType(key, value); 43 | } 44 | 45 | KeyValueType KeyValue(char const* key, char const* value); 46 | 47 | struct KeyValueStream 48 | { 49 | explicit KeyValueStream(std::ostream& stream) : stream(&stream) { } 50 | std::ostream* stream; 51 | char const* delimiter = ""; 52 | }; 53 | 54 | template 55 | KeyValueStream operator<<(std::ostream& lhs, KeyValueType const& rhs) 56 | { 57 | KeyValueStream stream(lhs); 58 | return stream << rhs; 59 | } 60 | 61 | template 62 | KeyValueStream operator<<(KeyValueStream lhs, KeyValueType const& rhs) 63 | { 64 | *lhs.stream << lhs.delimiter << '"' << rhs.key << '"' << ": " << rhs.value; 65 | lhs.delimiter = ", "; 66 | return lhs; 67 | } 68 | 69 | KeyValueStream operator<<(KeyValueStream lhs, KeyValueType const& rhs); 70 | 71 | template 72 | std::ostream& operator<<(KeyValueStream lhs, T const& rhs) 73 | { 74 | *lhs.stream << rhs; 75 | return *lhs.stream; 76 | } 77 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/object_loader.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #pragma once 24 | 25 | #include "app_config.h" 26 | #include "data_generator.h" 27 | 28 | #include "Rpr/WrapObject/CameraObject.h" 29 | #include "Rpr/WrapObject/LightObject.h" 30 | #include "Rpr/WrapObject/SceneObject.h" 31 | 32 | #include 33 | 34 | #include 35 | 36 | struct Range 37 | { 38 | unsigned begin; // inclusive 39 | unsigned end; // exclusive 40 | }; 41 | 42 | class ObjectLoader 43 | { 44 | public: 45 | explicit ObjectLoader(const AppConfig& config); 46 | 47 | DataGeneratorParams GetDataGeneratorParams(); 48 | 49 | Range GetCamerasRange() const; 50 | private: 51 | void LoadScene(); 52 | void LoadCameras(); 53 | void LoadLights(); 54 | void LoadSpp(); 55 | 56 | AppConfig m_app_config; 57 | SceneObject m_scene; 58 | std::vector m_cameras; 59 | std::vector m_lights; 60 | std::vector m_spp; 61 | 62 | // DataGeneratorParams data cache 63 | std::string m_output_dir; 64 | std::string m_scene_name; 65 | std::vector m_rpr_cameras; 66 | std::vector m_rpr_lights; 67 | 68 | Range m_cameras_idx_range; 69 | }; 70 | -------------------------------------------------------------------------------- /BaikalDataGenerator/Source/utils.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | 28 | 29 | #define THROW_EX(insertions) \ 30 | { \ 31 | std::ostringstream stream; \ 32 | stream << std::string(__func__) << ": " << insertions; \ 33 | throw std::runtime_error(stream.str()); \ 34 | } 35 | -------------------------------------------------------------------------------- /BaikalIO/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | image_io.cpp 3 | image_io.h 4 | material_io.cpp 5 | material_io.h 6 | scene_binary_io.cpp 7 | scene_binary_io.h 8 | scene_io.cpp 9 | scene_io.h 10 | scene_test_io.cpp 11 | scene_obj_io.cpp 12 | ) 13 | 14 | if (UNIX AND NOT APPLE) 15 | list(APPEND SOURCES 16 | file_utils.cpp 17 | file_utils.h 18 | ) 19 | endif () 20 | 21 | if (BAIKAL_ENABLE_FBX) 22 | list(APPEND SOURCES scene_fbx_io.cpp) 23 | endif (BAIKAL_ENABLE_FBX) 24 | 25 | add_library(BaikalIO SHARED ${SOURCES}) 26 | 27 | target_compile_definitions(BaikalIO PRIVATE BAIKAL_EXPORT_API) 28 | target_compile_features(BaikalIO PRIVATE cxx_std_14) 29 | target_link_libraries(BaikalIO PUBLIC Baikal OpenImageIO::OpenImageIO) 30 | 31 | if (UNIX AND NOT APPLE) 32 | target_link_libraries(BaikalIO PUBLIC stdc++fs) 33 | endif () 34 | 35 | target_include_directories(BaikalIO PUBLIC "${Baikal_SOURCE_DIR}/BaikalIO" "${Baikal_SOURCE_DIR}/3rdparty/tinyobjloader/include") 36 | 37 | if (BAIKAL_ENABLE_FBX) 38 | target_link_libraries(BaikalIO PUBLIC fbxsdk::fbxsdk) 39 | endif (BAIKAL_ENABLE_FBX) 40 | 41 | add_dependencies(BaikalIO ResourcesDir Copy3rdParty) 42 | 43 | # Install target 44 | if (WIN32) 45 | install(TARGETS BaikalIO RUNTIME DESTINATION bin) 46 | else () 47 | install(TARGETS BaikalIO LIBRARY DESTINATION lib) 48 | endif () 49 | -------------------------------------------------------------------------------- /BaikalIO/file_utils.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace Baikal 4 | { 5 | bool FindFilenameFromCaseInsensitive(std::string const& req_filename, std::string & actual_filename, bool resolve_symlinks = true); 6 | } 7 | -------------------------------------------------------------------------------- /BaikalIO/image_io.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | /** 24 | \file image_io.h 25 | \author Dmitry Kozlov 26 | \version 1.0 27 | \brief 28 | */ 29 | #pragma once 30 | 31 | #include 32 | #include 33 | 34 | #include "SceneGraph/texture.h" 35 | 36 | #ifdef WIN32 37 | #ifdef BAIKAL_EXPORT_API 38 | #define BAIKAL_API_ENTRY __declspec(dllexport) 39 | #else 40 | #define BAIKAL_API_ENTRY __declspec(dllimport) 41 | #endif 42 | #else 43 | #define BAIKAL_API_ENTRY __attribute__((visibility ("default"))) 44 | #endif 45 | 46 | namespace Baikal 47 | { 48 | class Texture; 49 | 50 | /** 51 | \brief Interface for image loading and writing 52 | 53 | ImageIO is responsible for texture loading from disk and keeping track of image reuse. 54 | */ 55 | class BAIKAL_API_ENTRY ImageIo 56 | { 57 | public: 58 | // Create default image IO 59 | static std::unique_ptr CreateImageIo(); 60 | 61 | // Constructor 62 | ImageIo() = default; 63 | // Destructor 64 | virtual ~ImageIo() = default; 65 | 66 | // Load texture from file 67 | virtual Texture::Ptr LoadImage(std::string const& filename) const = 0; 68 | virtual void SaveImage(std::string const& filename, Texture::Ptr texture) const = 0; 69 | 70 | // Disallow copying 71 | ImageIo(ImageIo const&) = delete; 72 | ImageIo& operator = (ImageIo const&) = delete; 73 | }; 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /BaikalIO/scene_binary_io.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #include "scene_io.h" 23 | #include 24 | #include 25 | 26 | #define _USE_MATH_DEFINES 27 | #include 28 | 29 | namespace Baikal 30 | { 31 | // Create fake test IO 32 | class SceneBinaryIo : public SceneIo::Loader 33 | { 34 | public: 35 | SceneBinaryIo() : SceneIo::Loader("bin", this) 36 | {} 37 | // Load scene (this class uses filename to determine what scene to generate) 38 | Scene1::Ptr LoadScene(std::string const& filename, std::string const& basepath) const override; 39 | void SaveScene(Scene1 const& scene, std::string const& filename, std::string const& basepath) const override; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /BaikalStandalone/Application/gl_render.h: -------------------------------------------------------------------------------- 1 | 2 | /********************************************************************** 3 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | ********************************************************************/ 23 | #pragma once 24 | 25 | #include 26 | 27 | #ifdef __APPLE__ 28 | #include 29 | #define GLFW_INCLUDE_GLCOREARB 30 | #define GLFW_NO_GLU 31 | #include "GLFW/glfw3.h" 32 | #elif WIN32 33 | #define NOMINMAX 34 | #include 35 | #include "GL/glew.h" 36 | #include "GLFW/glfw3.h" 37 | #else 38 | #include 39 | #include 40 | #include 41 | #include "GLFW/glfw3.h" 42 | #endif 43 | 44 | #include "Utils/shader_manager.h" 45 | #include "Application/app_utils.h" 46 | 47 | namespace Baikal 48 | { 49 | class AppGlRender 50 | { 51 | public: 52 | AppGlRender(const AppSettings& settings); 53 | void Render(GLFWwindow* window); 54 | 55 | GLuint GetTexture() { return m_texture; }; 56 | private: 57 | std::unique_ptr m_shader_manager; 58 | GLuint m_vertex_buffer; 59 | GLuint m_index_buffer; 60 | GLuint m_texture; 61 | GLuint m_vao; 62 | int m_window_width; 63 | int m_window_height; 64 | }; 65 | } 66 | -------------------------------------------------------------------------------- /BaikalStandalone/Application/material_explorer.h: -------------------------------------------------------------------------------- 1 | 2 | /********************************************************************** 3 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | ********************************************************************/ 23 | 24 | #pragma once 25 | 26 | #include "ImGUI/imgui.h" 27 | #include "SceneGraph/uberv2material.h" 28 | #include "graph_scheme.h" 29 | 30 | class MaterialExplorer 31 | { 32 | public: 33 | using InputMap = Baikal::InputMap; 34 | using UberV2Material = Baikal::UberV2Material; 35 | using Ptr = std::shared_ptr; 36 | using LayerDesc = std::pair>; 37 | 38 | static Ptr Create(UberV2Material::Ptr material); 39 | 40 | bool DrawExplorer(ImVec2 win_size); 41 | 42 | protected: 43 | MaterialExplorer(UberV2Material::Ptr material); 44 | 45 | private: 46 | 47 | struct NodeLink 48 | { 49 | int input_id; 50 | int input_slot; 51 | int output_id; 52 | int output_slot; 53 | 54 | NodeLink(int input_id_, int input_slot_, int output_id_, int output_slot_); 55 | }; 56 | 57 | static std::vector GetUberLayersDesc(); 58 | 59 | UberV2Material::Ptr m_material; 60 | std::string m_selected_input; 61 | std::vector m_layers; 62 | GraphScheme::Ptr m_graph; 63 | }; -------------------------------------------------------------------------------- /BaikalStandalone/Application/scene_load_utils.h: -------------------------------------------------------------------------------- 1 | 2 | /********************************************************************** 3 | Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | ********************************************************************/ 23 | 24 | #pragma once 25 | 26 | #include 27 | #include "app_utils.h" 28 | 29 | namespace Baikal 30 | { 31 | class Scene1; 32 | } 33 | 34 | std::shared_ptr LoadScene(Baikal::AppSettings const& settings); 35 | -------------------------------------------------------------------------------- /BaikalStandalone/ImGUI/imgui_impl_glfw_gl3.h: -------------------------------------------------------------------------------- 1 | // ImGui GLFW binding with OpenGL3 + shaders 2 | // In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp. 3 | 4 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 5 | // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). 6 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 7 | // https://github.com/ocornut/imgui 8 | 9 | struct GLFWwindow; 10 | 11 | IMGUI_API bool ImGui_ImplGlfwGL3_Init(GLFWwindow* window, bool install_callbacks); 12 | IMGUI_API void ImGui_ImplGlfwGL3_Shutdown(); 13 | IMGUI_API void ImGui_ImplGlfwGL3_NewFrame(); 14 | 15 | // Use if you want to reset your rendering device without losing ImGui state. 16 | IMGUI_API void ImGui_ImplGlfwGL3_InvalidateDeviceObjects(); 17 | IMGUI_API bool ImGui_ImplGlfwGL3_CreateDeviceObjects(); 18 | 19 | // GLFW callbacks (installed by default if you enable 'install_callbacks' during initialization) 20 | // Provided here if you want to chain callbacks. 21 | // You can also handle inputs yourself and use those as a reference. 22 | IMGUI_API void ImGui_ImplGlfwGL3_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 23 | IMGUI_API void ImGui_ImplGlfwGL3_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 24 | IMGUI_API void ImGui_ImplGlfwGL3_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 25 | IMGUI_API void ImGui_ImplGlfwGL3_CharCallback(GLFWwindow* window, unsigned int c); 26 | -------------------------------------------------------------------------------- /BaikalStandalone/Kernels/GLSL/simple.fsh: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #version 330 24 | 25 | uniform sampler2D g_Texture; 26 | 27 | smooth in vec2 Texcoord; 28 | 29 | out vec4 OutputColor; 30 | 31 | void main() 32 | { 33 | OutputColor = texture(g_Texture, Texcoord); 34 | } 35 | -------------------------------------------------------------------------------- /BaikalStandalone/Kernels/GLSL/simple.vsh: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #version 330 24 | 25 | layout (location=0) in vec3 inPosition; 26 | layout (location=1) in vec2 inTexcoord; 27 | 28 | smooth out vec2 Texcoord; 29 | 30 | void main() 31 | { 32 | Texcoord = inTexcoord; 33 | gl_Position = vec4(inPosition, 1.0); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /BaikalStandalone/Utils/config_manager.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef CONFIG_MANAGER_H 23 | #define CONFIG_MANAGER_H 24 | 25 | #include "CLW.h" 26 | #include "RenderFactory/clw_render_factory.h" 27 | #include "Renderers/renderer.h" 28 | #include 29 | #include 30 | 31 | namespace Baikal 32 | { 33 | class Renderer; 34 | } 35 | 36 | class ConfigManager 37 | { 38 | public: 39 | 40 | enum DeviceType 41 | { 42 | kPrimary, 43 | kSecondary 44 | }; 45 | 46 | enum Mode 47 | { 48 | kUseAll, 49 | kUseGpus, 50 | kUseSingleGpu, 51 | kUseSingleCpu, 52 | kUseCpus 53 | }; 54 | 55 | struct Config 56 | { 57 | DeviceType type; 58 | std::unique_ptr renderer; 59 | std::unique_ptr> controller; 60 | std::unique_ptr> factory; 61 | CLWContext context; 62 | bool caninterop; 63 | 64 | Config() = default; 65 | 66 | Config(Config&& cfg) = default; 67 | 68 | ~Config() 69 | { 70 | } 71 | }; 72 | 73 | static void CreateConfigs( 74 | Mode mode, 75 | bool interop, 76 | std::vector& renderers, 77 | int initial_num_bounces, 78 | int req_platform_index = -1, 79 | int req_device_index = -1); 80 | 81 | private: 82 | 83 | }; 84 | 85 | #endif // CONFIG_MANAGER_H 86 | -------------------------------------------------------------------------------- /BaikalStandalone/Utils/shader_manager.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef SHADER_MANAGER_H 23 | #define SHADER_MANAGER_H 24 | 25 | #ifdef __APPLE__ 26 | #include 27 | #define GLFW_INCLUDE_GLCOREARB 28 | #define GLFW_NO_GLU 29 | #include "GLFW/glfw3.h" 30 | #elif WIN32 31 | #define NOMINMAX 32 | #include 33 | #include "GL/glew.h" 34 | #else 35 | #include 36 | #include 37 | #endif 38 | 39 | #include 40 | #include 41 | 42 | class ShaderManager 43 | { 44 | public: 45 | ShaderManager(); 46 | ~ShaderManager(); 47 | 48 | GLuint GetProgram(std::string const& name); 49 | 50 | private: 51 | GLuint CompileProgram(std::string const& name); 52 | 53 | ShaderManager(ShaderManager const&); 54 | ShaderManager& operator = (ShaderManager const&); 55 | 56 | std::map shadercache_; 57 | }; 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /BaikalStandalone/cache/placeholder.txt: -------------------------------------------------------------------------------- 1 | placeholder for output images -------------------------------------------------------------------------------- /BaikalStandalone/main.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #include "Application/application.h" 23 | 24 | int main(int argc, char * argv[]) 25 | { 26 | try 27 | { 28 | Baikal::Application app(argc, argv); 29 | app.Run(); 30 | 31 | } 32 | catch (CLWException& ex) 33 | { 34 | std::cerr << ex.what() << " (OpenCL error code: " 35 | << ex.errcode_ << ")" << std::endl; 36 | return -1; 37 | 38 | } 39 | catch (std::exception& ex) 40 | { 41 | std::cerr << ex.what() << std::endl; 42 | return -1; 43 | 44 | } 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /BaikalTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | aov.h 3 | basic.h 4 | camera.h 5 | input_maps.h 6 | internal.h 7 | light.h 8 | main.cpp 9 | material.h 10 | test_scenes.h 11 | uberv2.h) 12 | 13 | add_executable(BaikalTest ${SOURCES}) 14 | target_compile_features(BaikalTest PRIVATE cxx_std_14) 15 | 16 | target_include_directories(BaikalTest PRIVATE .) 17 | target_link_libraries(BaikalTest PRIVATE Baikal BaikalIO GTest) 18 | 19 | set_target_properties(BaikalTest 20 | PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${Baikal_SOURCE_DIR}/BaikalTest FOLDER Baikal) 21 | target_compile_definitions(BaikalTest PRIVATE _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1) 22 | 23 | # Add symbolic links to BaikalTest/OutputImages and BaikalTest/ReferenceImages directory 24 | set(BAIKALTEST_REFERENCEIMAGES_DIR ReferenceImages) 25 | FILE(TO_NATIVE_PATH ${Baikal_SOURCE_DIR}/BaikalTest/${BAIKALTEST_REFERENCEIMAGES_DIR} BAIKALTEST_REFERENCEIMAGES_SRC) 26 | FILE(TO_NATIVE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${BAIKALTEST_REFERENCEIMAGES_DIR} BAIKALTEST_REFERENCEIMAGES_DST) 27 | 28 | set(BAIKALTEST_OUTPUTIMAGES_DIR OutputImages) 29 | FILE(TO_NATIVE_PATH ${Baikal_SOURCE_DIR}/BaikalTest/${BAIKALTEST_OUTPUTIMAGES_DIR} BAIKALTEST_OUTPUTIMAGES_SRC) 30 | FILE(TO_NATIVE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${BAIKALTEST_OUTPUTIMAGES_DIR} BAIKALTEST_OUTPUTIMAGES_DST) 31 | 32 | if (WIN32) 33 | add_custom_target(BaikalTestImagesDir ALL 34 | COMMAND IF NOT EXIST ${BAIKALTEST_REFERENCEIMAGES_DST} mklink /D ${BAIKALTEST_REFERENCEIMAGES_DST} ${BAIKALTEST_REFERENCEIMAGES_SRC} 35 | COMMAND IF NOT EXIST ${BAIKALTEST_OUTPUTIMAGES_DST} mklink /D ${BAIKALTEST_OUTPUTIMAGES_DST} ${BAIKALTEST_OUTPUTIMAGES_SRC} 36 | ) 37 | else () 38 | add_custom_target(BaikalTestImagesDir ALL 39 | COMMAND ${CMAKE_COMMAND} -E create_symlink ${BAIKALTEST_REFERENCEIMAGES_SRC} ${BAIKALTEST_REFERENCEIMAGES_DST} 40 | COMMAND ${CMAKE_COMMAND} -E create_symlink ${BAIKALTEST_OUTPUTIMAGES_SRC} ${BAIKALTEST_OUTPUTIMAGES_DST} 41 | ) 42 | endif () 43 | 44 | add_dependencies(BaikalTest BaikalTestImagesDir ResourcesDir) 45 | 46 | # Install target 47 | install(TARGETS BaikalTest RUNTIME DESTINATION bin) 48 | install(DIRECTORY DESTINATION bin/${BAIKALTEST_REFERENCEIMAGES_DIR}) 49 | install(DIRECTORY DESTINATION bin/${BAIKALTEST_OUTPUTIMAGES_DIR}) 50 | -------------------------------------------------------------------------------- /BaikalTest/OutputImages/placeholder.txt: -------------------------------------------------------------------------------- 1 | placeholder for output images -------------------------------------------------------------------------------- /BaikalTest/ReferenceImages/placeholder.txt: -------------------------------------------------------------------------------- 1 | placeholder for output images -------------------------------------------------------------------------------- /BaikalTest/cache/placeholder.txt: -------------------------------------------------------------------------------- 1 | placeholder for output images -------------------------------------------------------------------------------- /BaikalTest/internal.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #include "gtest/gtest.h" 23 | 24 | #include "Utils/distribution1d.h" 25 | #include "math/mathutils.h" 26 | 27 | class InternalTest : public ::testing::Test 28 | { 29 | 30 | }; 31 | 32 | TEST_F(InternalTest, Distribuiton1D) 33 | { 34 | float vals[] = { 2, 4, 6, 8 }; 35 | Baikal::Distribution1D dist(vals, 4); 36 | 37 | int cnts[]{ 0, 0, 0, 0 }; 38 | 39 | for (auto i = 0u; i < 1000; ++i) 40 | { 41 | float pdf = 0.f; 42 | float v = dist.Sample1D(RadeonRays::rand_float(), pdf); 43 | 44 | int idx = std::min((int)(v * 4), 3); 45 | ++cnts[idx]; 46 | } 47 | 48 | cnts[0] += cnts[1]; 49 | } 50 | -------------------------------------------------------------------------------- /BaikalTest/main.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #include "gtest/gtest.h" 23 | 24 | #include "CLW.h" 25 | 26 | #include "internal.h" 27 | #include "basic.h" 28 | #include "camera.h" 29 | #include "light.h" 30 | #include "material.h" 31 | #include "aov.h" 32 | #include "test_scenes.h" 33 | 34 | #include "uberv2.h" 35 | #include "input_maps.h" 36 | 37 | int g_argc; 38 | char** g_argv; 39 | 40 | int main(int argc, char** argv) 41 | { 42 | ::testing::InitGoogleTest(&argc, argv); 43 | g_argc = argc; 44 | g_argv = argv; 45 | return RUN_ALL_TESTS(); 46 | } 47 | -------------------------------------------------------------------------------- /BaikalTest/uberv2.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "basic.h" 25 | #include "SceneGraph/light.h" 26 | #include "SceneGraph/shape.h" 27 | #include "SceneGraph/material.h" 28 | #include "image_io.h" 29 | 30 | #define _USE_MATH_DEFINES 31 | #include 32 | 33 | using namespace RadeonRays; 34 | 35 | class UberV2Test : public BasicTest 36 | { 37 | 38 | protected: 39 | 40 | void LoadTestScene() override 41 | { 42 | ASSERT_NO_THROW(m_output = m_factory->CreateOutput(1024, 1024)); 43 | m_output->Clear(RadeonRays::float3(0.0f)); 44 | ASSERT_NO_THROW(m_renderer->SetOutput(Baikal::Renderer::OutputType::kColor, m_output.get())); 45 | 46 | m_scene = Baikal::SceneIo::LoadScene("uberv2_test_spheres.test", ""); 47 | } 48 | }; 49 | 50 | TEST_F(UberV2Test, UberV2_Basic) 51 | { 52 | m_camera->LookAt( 53 | RadeonRays::float3(0.f, 0.f, 10.f), 54 | RadeonRays::float3(0.f, 0.f, 9.f), 55 | RadeonRays::float3(0.f, 1.f, 0.f)); 56 | 57 | ASSERT_NO_THROW(m_controller->CompileScene(m_scene)); 58 | 59 | auto& scene = m_controller->GetCachedScene(m_scene); 60 | 61 | for (auto i = 0u; i < kNumIterations; ++i) 62 | { 63 | ASSERT_NO_THROW(m_renderer->Render(scene)); 64 | } 65 | 66 | { 67 | std::ostringstream oss; 68 | oss << test_name() << ".png"; 69 | SaveOutput(oss.str()); 70 | ASSERT_TRUE(CompareToReference(oss.str())); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Doc/Images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Doc/Images/1.jpg -------------------------------------------------------------------------------- /Doc/Images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Doc/Images/2.jpg -------------------------------------------------------------------------------- /Doc/Images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Doc/Images/3.jpg -------------------------------------------------------------------------------- /Doc/Images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Doc/Images/4.png -------------------------------------------------------------------------------- /Doc/Images/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Doc/Images/5.jpg -------------------------------------------------------------------------------- /Gtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GTest) 2 | 3 | set(SOURCES 4 | src/gtest-all.cc 5 | src/gtest_main.cc) 6 | 7 | add_library(GTest STATIC ${SOURCES}) 8 | 9 | target_include_directories(GTest PUBLIC include) 10 | target_include_directories(GTest PRIVATE .) 11 | target_compile_definitions(GTest PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) 12 | target_link_libraries(GTest PUBLIC Threads::Threads) 13 | -------------------------------------------------------------------------------- /Gtest/include/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /Gtest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | 37 | // This line ensures that gtest.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gtest/gtest.h" 40 | 41 | // The following lines pull in the real gtest *.cc files. 42 | #include "src/gtest.cc" 43 | #include "src/gtest-death-test.cc" 44 | #include "src/gtest-filepath.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /Gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Resources/CornellBox/orig.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 8 3 | 4 | newmtl backWall 5 | Ns 7.843137 6 | Ka 0.000000 0.000000 0.000000 7 | Kd 0.580000 0.568000 0.544000 8 | Ks 0.000000 0.000000 0.000000 9 | Ni 1.000000 10 | d 1.000000 11 | illum 2 12 | 13 | newmtl ceiling 14 | Ns 7.843137 15 | Ka 0.000000 0.000000 0.000000 16 | Kd 0.580000 0.568000 0.544000 17 | Ks 0.000000 0.000000 0.000000 18 | Ni 1.000000 19 | d 1.000000 20 | illum 2 21 | 22 | newmtl floor 23 | Ns 7.843137 24 | Ka 0.000000 0.000000 0.000000 25 | Kd 0.580000 0.568000 0.544000 26 | Ks 0.000000 0.000000 0.000000 27 | Ni 1.000000 28 | d 1.000000 29 | illum 2 30 | 31 | newmtl leftWall 32 | Ns 7.843137 33 | Ka 0.000000 0.000000 0.000000 34 | Kd 0.504000 0.052000 0.040000 35 | Ks 0.000000 0.000000 0.000000 36 | Ni 1.000000 37 | d 1.000000 38 | illum 2 39 | 40 | newmtl light 41 | Ns 7.843137 42 | Ka 0.000000 0.000000 0.000000 43 | Kd 0.624000 0.624000 0.624000 44 | Ks 0.000000 0.000000 0.000000 45 | Ke 36 33 24 46 | Ni 1.000000 47 | d 1.000000 48 | illum 2 49 | 50 | newmtl rightWall 51 | Ns 7.843137 52 | Ka 0.000000 0.000000 0.000000 53 | Kd 0.112000 0.360000 0.072800 54 | Ks 0.000000 0.000000 0.000000 55 | Ni 1.000000 56 | d 1.000000 57 | illum 2 58 | 59 | newmtl shortBox 60 | Ns 7.843137 61 | Ka 0.000000 0.000000 0.000000 62 | Kd 0.580000 0.568000 0.544000 63 | Ks 0.000000 0.000000 0.000000 64 | Ni 1.000000 65 | d 1.000000 66 | illum 2 67 | 68 | newmtl tallBox 69 | Ns 7.843137 70 | Ka 0.000000 0.000000 0.000000 71 | Kd 0.580000 0.568000 0.544000 72 | Ks 0.000000 0.000000 0.000000 73 | Ni 1.000000 74 | d 1.000000 75 | illum 2 76 | -------------------------------------------------------------------------------- /Resources/Textures/AreaMap33.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/AreaMap33.dds -------------------------------------------------------------------------------- /Resources/Textures/sky.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/sky.hdr -------------------------------------------------------------------------------- /Resources/Textures/studio015.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/studio015.hdr -------------------------------------------------------------------------------- /Resources/Textures/test_albedo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/test_albedo1.jpg -------------------------------------------------------------------------------- /Resources/Textures/test_albedo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/test_albedo2.jpg -------------------------------------------------------------------------------- /Resources/Textures/test_albedo3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/test_albedo3.jpg -------------------------------------------------------------------------------- /Resources/Textures/test_bump.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/test_bump.jpg -------------------------------------------------------------------------------- /Resources/Textures/test_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/RadeonProRender-Baikal/2d5a5d0eb2092d75adf637bf6f381d7e9307e986/Resources/Textures/test_normal.jpg -------------------------------------------------------------------------------- /Rpr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | Export.cpp 3 | Export.h 4 | RadeonProRender.cpp 5 | RadeonProRender.h 6 | RadeonProRender_CL.h 7 | RadeonProRender_GL.h 8 | Wrap.cpp) 9 | 10 | set(WRAP_OBJECT_SOURCES 11 | WrapObject/CameraObject.cpp 12 | WrapObject/CameraObject.h 13 | WrapObject/ContextObject.cpp 14 | WrapObject/ContextObject.h 15 | WrapObject/Exception.h 16 | WrapObject/FramebufferObject.cpp 17 | WrapObject/FramebufferObject.h 18 | WrapObject/LightObject.cpp 19 | WrapObject/LightObject.h 20 | WrapObject/Materials/ArithmeticMaterialObject.cpp 21 | WrapObject/Materials/ArithmeticMaterialObject.h 22 | WrapObject/Materials/ImageMaterialObject.cpp 23 | WrapObject/Materials/ImageMaterialObject.h 24 | WrapObject/Materials/MaterialObject.cpp 25 | WrapObject/Materials/MaterialObject.h 26 | WrapObject/Materials/TextureMaterialObject.cpp 27 | WrapObject/Materials/TextureMaterialObject.h 28 | WrapObject/Materials/UberMaterialObject.cpp 29 | WrapObject/Materials/UberMaterialObject.h 30 | WrapObject/Materials/UnsupportedMaterialObject.cpp 31 | WrapObject/Materials/UnsupportedMaterialObject.h 32 | WrapObject/MatSysObject.cpp 33 | WrapObject/MatSysObject.h 34 | WrapObject/SceneObject.cpp 35 | WrapObject/SceneObject.h 36 | WrapObject/ShapeObject.cpp 37 | WrapObject/ShapeObject.h 38 | WrapObject/WrapObject.h) 39 | 40 | set(UTILS_SOURCES 41 | Utils/config_manager.cpp 42 | Utils/config_manager.h 43 | ) 44 | 45 | source_group("WrapObject" FILES ${WRAP_OBJECT_SOURCES}) 46 | source_group("Utils" FILES ${UTILS_SOURCES}) 47 | 48 | list(APPEND SOURCES ${WRAP_OBJECT_SOURCES} ${UTILS_SOURCES}) 49 | 50 | add_library(RadeonProRender64 SHARED ${SOURCES}) 51 | target_compile_definitions(RadeonProRender64 PRIVATE RPR_EXPORT_API) 52 | target_compile_features(RadeonProRender64 PRIVATE cxx_std_14) 53 | target_include_directories(RadeonProRender64 PUBLIC ${Baikal_SOURCE_DIR}/Rpr) 54 | target_link_libraries(RadeonProRender64 PUBLIC Baikal BaikalIO OpenGL::GL GLEW::GLEW) 55 | 56 | # Install target 57 | if (WIN32) 58 | target_compile_options(RadeonProRender64 PUBLIC /wd4251) 59 | install(TARGETS RadeonProRender64 RUNTIME DESTINATION bin) 60 | else () 61 | install(TARGETS RadeonProRender64 LIBRARY DESTINATION lib) 62 | endif () 63 | -------------------------------------------------------------------------------- /Rpr/Export.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | //methods to export baikal classes from RPR wrap 24 | 25 | #include "RadeonProRender.h" 26 | #include "SceneGraph/scene1.h" 27 | 28 | #include "WrapObject/SceneObject.h" 29 | 30 | Baikal::Scene1::Ptr ExportFromRpr(rpr_scene scene) 31 | { 32 | SceneObject* scene_obj = WrapObject::Cast(scene); 33 | 34 | return scene_obj ? scene_obj->GetScene() : nullptr; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Rpr/Export.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | 25 | #include "RadeonProRender.h" 26 | #include "SceneGraph/scene1.h" 27 | 28 | Baikal::Scene1::Ptr ExportFromRpr(rpr_scene scene); 29 | -------------------------------------------------------------------------------- /Rpr/RadeonProRender_CL.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * 3 | * Module Name FireRender_CL.h 4 | * Project FireRender Engine OpenGL Interop API 5 | * 6 | * Description Fire Render Engine OpenCL Interop header 7 | * 8 | * Copyright 2011 - 2013 Advanced Micro Devices, Inc. 9 | * 10 | * All rights reserved. This notice is intended as a precaution against 11 | * inadvertent publication and does not imply publication or any waiver 12 | * of confidentiality. The year included in the foregoing notice is the 13 | * year of creation of the work. 14 | * @author Dmitry Kozlov (dmitry.kozlov@amd.com) 15 | * @author Takahiro Harada (takahiro.harada@amd.com) 16 | * @bug No known bugs. 17 | * 18 | \*****************************************************************************/ 19 | #ifndef __RADEONPRORENDER_CL_H 20 | #define __RADEONPRORENDER_CL_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #include "RadeonProRender.h" 27 | 28 | /* rpr_context_properties */ 29 | #define RPR_CL_CONTEXT 0x3001 30 | #define RPR_CL_DEVICE 0x3002 31 | #define RPR_CL_COMMAND_QUEUE 0x3003 32 | 33 | /* rpr_framebuffer_properties */ 34 | #define RPR_CL_MEM_OBJECT 0x4001 35 | 36 | typedef void * rpr_cl_context; 37 | typedef void * rpr_cl_device; 38 | typedef void * rpr_cl_command_queue; 39 | typedef void * rpr_cl_mem; 40 | /***************compatibility part***************/ 41 | #define FR_CL_CONTEXT 0x3001 42 | #define FR_CL_DEVICE 0x3002 43 | #define FR_CL_COMMAND_QUEUE 0x3003 44 | #define FR_CL_MEM_OBJECT 0x4001 45 | typedef rpr_cl_context fr_cl_context; 46 | typedef rpr_cl_device fr_cl_device; 47 | typedef rpr_cl_command_queue fr_cl_command_queue; 48 | typedef rpr_cl_mem fr_cl_mem; 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /*__RADEONPRORENDER_CL_H */ 55 | -------------------------------------------------------------------------------- /Rpr/RadeonProRender_GL.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * 3 | * Module Name FireRender_GL.h 4 | * Project FireRender Engine OpenGL Interop API 5 | * 6 | * Description Fire Render Engine OpenGL Interop header 7 | * 8 | * Copyright 2011 - 2013 Advanced Micro Devices, Inc. 9 | * 10 | * All rights reserved. This notice is intended as a precaution against 11 | * inadvertent publication and does not imply publication or any waiver 12 | * of confidentiality. The year included in the foregoing notice is the 13 | * year of creation of the work. 14 | * @author Dmitry Kozlov (dmitry.kozlov@amd.com) 15 | * @author Takahiro Harada (takahiro.harada@amd.com) 16 | * @bug No known bugs. 17 | * 18 | \*****************************************************************************/ 19 | #ifndef __RADEONPRORENDER_GL_H 20 | #define __RADEONPRORENDER_GL_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #include "RadeonProRender.h" 27 | 28 | /* Error codes */ 29 | #define RPR_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 30 | 31 | /* rpr_context_properties */ 32 | #define RPR_GL_CONTEXT_KHR 0x2001 33 | #define RPR_EGL_DISPLAY_KHR 0x2002 34 | #define RPR_GLX_DISPLAY_KHR 0x2003 35 | #define RPR_WGL_HDC_KHR 0x2004 36 | #define RPR_CGL_SHAREGROUP_KHR 0x2005 37 | 38 | typedef unsigned int rpr_GLuint; 39 | typedef int rpr_GLint; 40 | typedef unsigned int rpr_GLenum; 41 | typedef rpr_uint rpr_gl_object_type; 42 | typedef rpr_uint rpr_gl_texture_info; 43 | typedef rpr_uint rpr_gl_platform_info; 44 | 45 | extern RPR_API_ENTRY rpr_int rprContextCreateFramebufferFromGLTexture2D(rpr_context context, rpr_GLenum target, rpr_GLint miplevel, rpr_GLuint texture, rpr_framebuffer * out_fb); 46 | /***************compatibility part***************/ 47 | #define FR_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 48 | #define FR_GL_CONTEXT_KHR 0x2001 49 | #define FR_EGL_DISPLAY_KHR 0x2002 50 | #define FR_GLX_DISPLAY_KHR 0x2003 51 | #define FR_WGL_HDC_KHR 0x2004 52 | #define FR_CGL_SHAREGROUP_KHR 0x2005 53 | typedef rpr_GLuint fr_GLuint; 54 | typedef rpr_GLint fr_GLint; 55 | typedef rpr_GLenum fr_GLenum; 56 | typedef rpr_gl_object_type fr_gl_object_type; 57 | typedef rpr_gl_texture_info fr_gl_texture_info; 58 | typedef rpr_gl_platform_info fr_gl_platform_info; 59 | extern RPR_API_ENTRY fr_int frContextCreateFramebufferFromGLTexture2D(fr_context context, fr_GLenum target, fr_GLint miplevel, fr_GLuint texture, fr_framebuffer * out_fb); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /*__RADEONPRORENDER_GL_H */ 66 | -------------------------------------------------------------------------------- /Rpr/Utils/config_manager.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #ifndef CONFIG_MANAGER_H 23 | #define CONFIG_MANAGER_H 24 | 25 | #include "CLW.h" 26 | #include "RenderFactory/clw_render_factory.h" 27 | #include "Renderers/renderer.h" 28 | #include "RadeonProRender.h" 29 | #include 30 | #include 31 | 32 | namespace Baikal 33 | { 34 | class Renderer; 35 | } 36 | 37 | class ConfigManager 38 | { 39 | public: 40 | 41 | enum DeviceType 42 | { 43 | kPrimary, 44 | kSecondary 45 | }; 46 | 47 | enum Mode 48 | { 49 | kUseAll, 50 | kUseGpus, 51 | kUseSingleGpu, 52 | kUseSingleCpu, 53 | kUseCpus 54 | }; 55 | 56 | struct Config 57 | { 58 | DeviceType type; 59 | std::unique_ptr renderer; 60 | std::unique_ptr> controller; 61 | std::unique_ptr> factory; 62 | CLWContext context; 63 | bool caninterop; 64 | 65 | Config() = default; 66 | 67 | Config(Config&& cfg) = default; 68 | 69 | ~Config() 70 | { 71 | } 72 | }; 73 | 74 | static void CreateConfigs( 75 | rpr_creation_flags flags, 76 | std::vector& configs, 77 | int initial_num_bounces); 78 | 79 | private: 80 | 81 | }; 82 | 83 | #endif // CONFIG_MANAGER_H 84 | -------------------------------------------------------------------------------- /Rpr/WrapObject/Exception.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | #include 24 | #include 25 | 26 | class Exception 27 | : public std::runtime_error 28 | { 29 | public: 30 | Exception(int error, char const* msg) 31 | : std::runtime_error(msg) 32 | , m_error(error){}; 33 | 34 | int m_error; 35 | }; 36 | -------------------------------------------------------------------------------- /Rpr/WrapObject/FramebufferObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "WrapObject.h" 25 | #include "Output/clwoutput.h" 26 | #include "Renderers/renderer.h" 27 | #include "RadeonProRender_GL.h" 28 | 29 | //this class represent rpr_context 30 | class FramebufferObject 31 | : public WrapObject 32 | { 33 | public: 34 | FramebufferObject(Baikal::Output* out); 35 | FramebufferObject(CLWContext context, CLWKernel copy_cernel, rpr_GLenum target, rpr_GLint miplevel, rpr_GLuint texture); 36 | virtual ~FramebufferObject(); 37 | 38 | //output 39 | void SetOutput(Baikal::Output* out) 40 | { 41 | delete m_output; 42 | m_output = out; 43 | } 44 | 45 | std::size_t Width(); 46 | std::size_t Height(); 47 | void GetData(void* out_data); 48 | 49 | void Clear(); 50 | void SaveToFile(const char* path); 51 | 52 | //if interop this will copy CL output data to GL texture 53 | void UpdateGlTex(); 54 | Baikal::Output* GetOutput() { return m_output; } 55 | private: 56 | Baikal::Output* m_output; 57 | std::size_t m_width; 58 | std::size_t m_height; 59 | CLWImage2D m_cl_interop_image; 60 | CLWContext m_context; 61 | CLWKernel m_copy_cernel; 62 | }; 63 | -------------------------------------------------------------------------------- /Rpr/WrapObject/MatSysObject.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #include "MatSysObject.h" 24 | #include "WrapObject/Materials/MaterialObject.h" 25 | 26 | MaterialObject* MatSysObject::CreateMaterial(rpr_material_node_type in_type) 27 | { 28 | return MaterialObject::CreateMaterial(in_type); 29 | } -------------------------------------------------------------------------------- /Rpr/WrapObject/MatSysObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "WrapObject.h" 25 | 26 | #include "RadeonProRender.h" 27 | 28 | class MaterialObject; 29 | 30 | //represent rpr_material_system 31 | class MatSysObject 32 | : public WrapObject 33 | { 34 | public: 35 | MaterialObject* CreateMaterial(rpr_material_node_type in_type); 36 | private: 37 | }; -------------------------------------------------------------------------------- /Rpr/WrapObject/Materials/ArithmeticMaterialObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "MaterialObject.h" 25 | #include "SceneGraph/inputmap.h" 26 | 27 | //represent RPR arithmetic with "op" RPR_MATERIAL_NODE_OP_MUL 28 | class ArithmeticMaterialObject 29 | : public MaterialObject 30 | { 31 | public: 32 | ArithmeticMaterialObject(MaterialObject::Type mat_type); 33 | 34 | void SetInputF(const std::string& input_name, const RadeonRays::float4& val) override; 35 | Baikal::Material::Ptr GetMaterial() override; 36 | Baikal::InputMap::Ptr GetInputMap(); 37 | 38 | protected: 39 | void Update(MaterialObject* mat) override; 40 | void SetInputMaterial(const std::string& input_name, MaterialObject* input) override; 41 | void SetInputTexture(const std::string& input_name, TextureMaterialObject* input) override; 42 | void SetInputU(const std::string& input_name, rpr_uint val) override; 43 | void SetInputMap(const std::string& input_name, Baikal::InputMap::Ptr input_map); 44 | 45 | private: 46 | Baikal::InputMap::Ptr m_input_map; 47 | }; 48 | -------------------------------------------------------------------------------- /Rpr/WrapObject/Materials/ImageMaterialObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "MaterialObject.h" 25 | 26 | //represent rpr_image 27 | class ImageMaterialObject 28 | : public MaterialObject 29 | { 30 | public: 31 | ImageMaterialObject(rpr_image_format const in_format, rpr_image_desc const * in_image_desc, void const * in_data); 32 | ImageMaterialObject(const std::string& in_path); 33 | 34 | virtual Baikal::Texture::Ptr GetTexture() override; 35 | private: 36 | Baikal::Texture::Ptr m_tex; 37 | }; 38 | -------------------------------------------------------------------------------- /Rpr/WrapObject/Materials/TextureMaterialObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "MaterialObject.h" 25 | 26 | //materials represented as Baikal::Texture 27 | class TextureMaterialObject 28 | : public MaterialObject 29 | { 30 | public: 31 | TextureMaterialObject(Type type); 32 | Baikal::Texture::Ptr GetTexture() override; 33 | 34 | //rprImageGetInfo: 35 | virtual rpr_image_desc GetImageDesc() const override; 36 | virtual char const* GetImageData() const override; 37 | virtual rpr_image_format GetImageFormat() const override; 38 | protected: 39 | 40 | virtual void SetInputTexture(const std::string& input_name, TextureMaterialObject* input) override; 41 | virtual void SetInputImage(const std::string& input_name, ImageMaterialObject* input) override; 42 | private: 43 | 44 | void CopyData(MaterialObject* in); 45 | 46 | Baikal::Texture::Ptr m_tex; 47 | }; 48 | -------------------------------------------------------------------------------- /Rpr/WrapObject/Materials/UberMaterialObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "MaterialObject.h" 25 | #include "SceneGraph/uberv2material.h" 26 | 27 | class UberMaterialObject : public MaterialObject 28 | { 29 | public: 30 | UberMaterialObject(); 31 | 32 | void SetInputF(const std::string& input_name, const RadeonRays::float4& val) override; 33 | void SetInputU(const std::string& input_name, rpr_uint val) override; 34 | 35 | Baikal::Material::Ptr GetMaterial() override; 36 | 37 | // Some UberV2 inputs from RPRX API now become parameters in Baikal API so we need to fill em 38 | void GetInput(int i, void* out, size_t* out_size) override; 39 | protected: 40 | void SetInputMaterial(const std::string& input_name, MaterialObject* input) override; 41 | void SetInputTexture(const std::string& input_name, TextureMaterialObject* input) override; 42 | 43 | private: 44 | Baikal::UberV2Material::Ptr m_mat; //ubermaterial material 45 | 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /Rpr/WrapObject/Materials/UnsupportedMaterialObject.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #include "UnsupportedMaterialObject.h" 23 | #include "WrapObject/Exception.h" 24 | 25 | #include 26 | 27 | using namespace Baikal; 28 | using namespace RadeonRays; 29 | 30 | UnsupportedMaterialObject::UnsupportedMaterialObject(MaterialObject::Type type) 31 | : MaterialObject(type) 32 | { 33 | 34 | } 35 | 36 | void UnsupportedMaterialObject::SetInputMaterial(const std::string& input_name, MaterialObject* input) 37 | { 38 | //trying to behave as SingleBxdfMaterialObject and ignore in case of failure 39 | std::cout << "Warning: ignoring unsupported material input name - " << input_name << std::endl; 40 | } 41 | 42 | void UnsupportedMaterialObject::SetInputTexture(const std::string& input_name, TextureMaterialObject* input) 43 | { 44 | //trying to behave as SingleBxdfMaterialObject and ignore in case of failure 45 | std::cout << "Warning: ignoring unsupported material input name - " << input_name << std::endl; 46 | } 47 | 48 | void UnsupportedMaterialObject::SetInputImage(const std::string& input_name, ImageMaterialObject* input) 49 | { 50 | //trying to behave as SingleBxdfMaterialObject and ignore in case of failure 51 | std::cout << "Warning: ignoring unsupported material input name - " << input_name << std::endl; 52 | } 53 | 54 | void UnsupportedMaterialObject::SetInputF(const std::string& input_name, const RadeonRays::float4& val) 55 | { 56 | //trying to behave as SingleBxdfMaterialObject and ignore in case of failure 57 | std::cout << "Warning: ignoring unsupported material input name - " << input_name << std::endl; 58 | } 59 | -------------------------------------------------------------------------------- /Rpr/WrapObject/Materials/UnsupportedMaterialObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "MaterialObject.h" 25 | 26 | //default variant of material 27 | class UnsupportedMaterialObject 28 | : public MaterialObject 29 | { 30 | public: 31 | UnsupportedMaterialObject(MaterialObject::Type mat_type); 32 | protected: 33 | //this call by SetInputMaterial based on input type 34 | void SetInputMaterial(const std::string& input_name, MaterialObject* input) override; 35 | void SetInputTexture(const std::string& input_name, TextureMaterialObject* input) override; 36 | void SetInputImage(const std::string& input_name, ImageMaterialObject* input) override; 37 | void SetInputF(const std::string& input_name, const RadeonRays::float4& val) override; 38 | private: 39 | }; -------------------------------------------------------------------------------- /Rpr/WrapObject/WrapObject.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | #pragma once 23 | 24 | #include "RadeonProRender.h" 25 | 26 | #include 27 | 28 | //base wrap class of Baikal scene nodes 29 | class RPR_API_ENTRY WrapObject 30 | { 31 | public: 32 | WrapObject() = default; 33 | virtual ~WrapObject() = default; 34 | 35 | template 36 | static T* Cast(void* obj) 37 | { 38 | WrapObject* base = static_cast(obj); 39 | return dynamic_cast(base); 40 | }; 41 | 42 | //name 43 | std::string GetName() { return m_name; } 44 | void SetName(const std::string& name) { m_name = name; } 45 | 46 | WrapObject(WrapObject&&) = default; 47 | WrapObject& operator= (WrapObject&&) = default; 48 | 49 | private: 50 | std::string m_name; 51 | }; 52 | -------------------------------------------------------------------------------- /RprSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES RprSupport.cpp) 2 | 3 | add_library(RprSupport64 SHARED ${SOURCES}) 4 | target_compile_definitions(RprSupport64 PRIVATE RPR_EXPORT_API) 5 | target_compile_features(RprSupport64 PRIVATE cxx_std_14) 6 | target_include_directories(RprSupport64 PUBLIC ${RprSupport_HEADER}) 7 | target_link_libraries(RprSupport64 PUBLIC RadeonProRender64) 8 | 9 | # Install target 10 | if (WIN32) 11 | install(TARGETS RprSupport64 RUNTIME DESTINATION bin) 12 | else () 13 | install(TARGETS RprSupport64 LIBRARY DESTINATION lib) 14 | endif () 15 | -------------------------------------------------------------------------------- /RprSupport/RprSupport.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | 3 | rprxCreateContext 4 | rprxCreateMaterial 5 | rprxMaterialDelete 6 | rprxMaterialSetParameterN 7 | rprxMaterialSetParameterU 8 | rprxMaterialSetParameterF 9 | rprxMaterialGetParameterType 10 | rprxMaterialGetParameterValue 11 | rprxMaterialCommit 12 | rprxShapeAttachMaterial 13 | rprxShapeDetachMaterial 14 | rprxMaterialAttachMaterial 15 | rprxMaterialDetachMaterial 16 | rprxDeleteContext 17 | rprxIsMaterialRprx 18 | rprxGetLog 19 | rprxShapeGetMaterial 20 | -------------------------------------------------------------------------------- /RprTest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | main.cpp 3 | aov.h 4 | arithmetic.h 5 | basic.h 6 | camera.h 7 | light.h 8 | material.h) 9 | 10 | add_executable(RprTest ${SOURCES}) 11 | target_compile_features(RprTest PRIVATE cxx_std_14) 12 | target_include_directories(RprTest PRIVATE .) 13 | target_link_libraries(RprTest PRIVATE GTest RprSupport64 RadeonProRender64) 14 | set_target_properties(RprTest 15 | PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${Baikal_SOURCE_DIR}/RprTest) 16 | 17 | # TODO: BaikalTest images and RprTest images directories have identical names 18 | if (0) 19 | # Add symbolic links to RprTest/OutputImages and RprTest/ReferenceImages directory 20 | set(RPRTEST_REFERENCEIMAGES_DIR ReferenceImages) 21 | file(TO_NATIVE_PATH ${Baikal_SOURCE_DIR}/RprTest/${RPRTEST_REFERENCEIMAGES_DIR} RPRTEST_REFERENCEIMAGES_SRC) 22 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/${RPRTEST_REFERENCEIMAGES_DIR} RPRTEST_REFERENCEIMAGES_DST) 23 | 24 | set(RPRTEST_OUTPUTIMAGES_DIR OutputImages) 25 | file(TO_NATIVE_PATH ${Baikal_SOURCE_DIR}/RprTest/${RPRTEST_OUTPUTIMAGES_DIR} RPRTEST_OUTPUTIMAGES_SRC) 26 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR}/${RPRTEST_OUTPUTIMAGES_DIR} RPRTEST_OUTPUTIMAGES_DST) 27 | 28 | if (WIN32) 29 | add_custom_target(RprTestImagesDir ALL 30 | COMMAND IF NOT EXIST ${RPRTEST_REFERENCEIMAGES_DST} mklink /D ${RPRTEST_REFERENCEIMAGES_DST} ${RPRTEST_REFERENCEIMAGES_SRC} 31 | COMMAND IF NOT EXIST ${RPRTEST_OUTPUTIMAGES_DST} mklink /D ${RPRTEST_OUTPUTIMAGES_DST} ${RPRTEST_OUTPUTIMAGES_SRC} 32 | ) 33 | else () 34 | add_custom_target(RprTestImagesDir ALL 35 | COMMAND ${CMAKE_COMMAND} -E create_symlink ${RPRTEST_REFERENCEIMAGES_SRC} ${RPRTEST_REFERENCEIMAGES_DST} 36 | COMMAND ${CMAKE_COMMAND} -E create_symlink ${RPRTEST_OUTPUTIMAGES_SRC} ${RPRTEST_OUTPUTIMAGES_DST} 37 | ) 38 | endif () 39 | 40 | add_dependencies(RprTest RprTestImagesDir ResourcesDir) 41 | endif () 42 | 43 | add_dependencies(RprTest ResourcesDir) 44 | 45 | # Install target 46 | install(TARGETS RprTest RUNTIME DESTINATION bin) 47 | install(DIRECTORY DESTINATION bin/${RPRTEST_REFERENCEIMAGES_DIR}) 48 | install(DIRECTORY DESTINATION bin/${RPRTEST_OUTPUTIMAGES_DIR}) 49 | -------------------------------------------------------------------------------- /RprTest/OutputImages/placeholder.txt: -------------------------------------------------------------------------------- 1 | placeholder for output images 2 | -------------------------------------------------------------------------------- /RprTest/ReferenceImages/placeholder.txt: -------------------------------------------------------------------------------- 1 | placeholder for reference images 2 | -------------------------------------------------------------------------------- /RprTest/cache/placeholder.txt: -------------------------------------------------------------------------------- 1 | placeholder for kernel cache -------------------------------------------------------------------------------- /RprTest/main.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #include "basic.h" 24 | #include "aov.h" 25 | #include "camera.h" 26 | #include "light.h" 27 | #include "material.h" 28 | #include "arithmetic.h" 29 | 30 | int g_argc; 31 | char** g_argv; 32 | 33 | int main(int argc, char** argv) 34 | { 35 | ::testing::InitGoogleTest(&argc, argv); 36 | g_argc = argc; 37 | g_argv = argv; 38 | return RUN_ALL_TESTS(); 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Tools/Jenkins/build_test.jenkinsfile: -------------------------------------------------------------------------------- 1 | rpr_baikal_cmake_pipeline() 2 | -------------------------------------------------------------------------------- /Tools/MaterialConverter/BaikalOld/SceneGraph/IO/image_io.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | /** 24 | \file image_io.h 25 | \author Dmitry Kozlov 26 | \version 1.0 27 | \brief 28 | */ 29 | #pragma once 30 | 31 | #include 32 | #include 33 | 34 | #include "BaikalOld/SceneGraph/texture.h" 35 | 36 | namespace BaikalOld 37 | { 38 | class Texture; 39 | 40 | /** 41 | \brief Interface for image loading and writing 42 | 43 | ImageIO is responsible for texture loading from disk and keeping track of image reuse. 44 | */ 45 | class ImageIo 46 | { 47 | public: 48 | // Create default image IO 49 | static std::unique_ptr CreateImageIo(); 50 | 51 | // Constructor 52 | ImageIo() = default; 53 | // Destructor 54 | virtual ~ImageIo() = default; 55 | 56 | // Load texture from file 57 | virtual Texture::Ptr LoadImage(std::string const& filename) const = 0; 58 | virtual void SaveImage(std::string const& filename, Texture::Ptr texture) const = 0; 59 | 60 | // Disallow copying 61 | ImageIo(ImageIo const&) = delete; 62 | ImageIo& operator = (ImageIo const&) = delete; 63 | }; 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Tools/MaterialConverter/BaikalOld/SceneGraph/texture.cpp: -------------------------------------------------------------------------------- 1 | #include "texture.h" 2 | 3 | #include "Utils/half.h" 4 | 5 | namespace BaikalOld 6 | { 7 | RadeonRays::float3 Texture::ComputeAverageValue() const 8 | { 9 | auto avg = RadeonRays::float3(); 10 | 11 | switch (m_format) { 12 | case Format::kRgba8: 13 | { 14 | auto data = reinterpret_cast(m_data.get()); 15 | auto num_elements = m_size.x * m_size.y; 16 | 17 | 18 | for (auto i = 0; i < num_elements; ++i) 19 | { 20 | float r = data[4 * i] / 255.f; 21 | float g = data[4 * i + 1] / 255.f; 22 | float b = data[4 * i + 2] / 255.f; 23 | avg += RadeonRays::float3(r, g, b); 24 | } 25 | 26 | avg *= (1.f / num_elements); 27 | break; 28 | } 29 | case Format::kRgba16: 30 | { 31 | auto data = reinterpret_cast(m_data.get()); 32 | auto num_elements = m_size.x * m_size.y; 33 | 34 | for (auto i = 0; i < num_elements; ++i) 35 | { 36 | auto r = data[4 * i]; 37 | auto g = data[4 * i + 1]; 38 | auto b = data[4 * i + 2]; 39 | 40 | half hr, hg, hb; 41 | hr.setBits(r); 42 | hg.setBits(g); 43 | hb.setBits(b); 44 | 45 | avg += RadeonRays::float3(hr, hg, hb); 46 | } 47 | 48 | avg *= (1.f / num_elements); 49 | break; 50 | } 51 | case Format::kRgba32: 52 | { 53 | auto data = reinterpret_cast(m_data.get()); 54 | auto num_elements = m_size.x * m_size.y; 55 | 56 | for (auto i = 0; i < num_elements; ++i) 57 | { 58 | auto r = data[4 * i]; 59 | auto g = data[4 * i + 1]; 60 | auto b = data[4 * i + 2]; 61 | 62 | avg += RadeonRays::float3(r, g, b); 63 | } 64 | 65 | avg *= (1.f / num_elements); 66 | break; 67 | } 68 | default: 69 | break; 70 | } 71 | 72 | return avg; 73 | } 74 | 75 | namespace { 76 | struct TextureConcrete: public Texture { 77 | TextureConcrete() = default; 78 | TextureConcrete(char* data, RadeonRays::int2 size, Format format) : 79 | Texture(data, size, format){} 80 | }; 81 | } 82 | 83 | Texture::Ptr Texture::Create() { 84 | return std::make_shared(); 85 | } 86 | 87 | Texture::Ptr Texture::Create(char* data, RadeonRays::int2 size, Format format) { 88 | return std::make_shared(data, size, format); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Tools/MaterialConverter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(BAIKAL_OLD_SOURCES 2 | BaikalOld/SceneGraph/iterator.h 3 | BaikalOld/SceneGraph/material.cpp 4 | BaikalOld/SceneGraph/material.h 5 | BaikalOld/SceneGraph/scene_object.h 6 | BaikalOld/SceneGraph/texture.cpp 7 | BaikalOld/SceneGraph/texture.h) 8 | 9 | SET(BAIKAL_OLD_IO_SOURCES 10 | BaikalOld/SceneGraph/IO/image_io.cpp 11 | BaikalOld/SceneGraph/IO/image_io.h 12 | BaikalOld/SceneGraph/IO/material_io.cpp 13 | BaikalOld/SceneGraph/IO/material_io.h) 14 | 15 | source_group("BaikalOld\\SceneGraph" FILES ${BAIKAL_OLD_SOURCES}) 16 | source_group("BaikalOld\\SceneGraph\\IO" FILES ${BAIKAL_OLD_IO_SOURCES}) 17 | 18 | SET(SOURCES 19 | material_converter.cpp 20 | material_converter.h 21 | main.cpp) 22 | 23 | add_executable(MaterialConverter ${SOURCES} ${BAIKAL_OLD_SOURCES} ${BAIKAL_OLD_IO_SOURCES}) 24 | target_compile_features(MaterialConverter PRIVATE cxx_std_14) 25 | target_include_directories(MaterialConverter PRIVATE .) 26 | target_link_libraries(MaterialConverter PUBLIC Baikal BaikalIO) 27 | -------------------------------------------------------------------------------- /Tools/MaterialConverter/README.md: -------------------------------------------------------------------------------- 1 | ## Material Converter 2 | This tool is intended to convert Baikal scene materials setup specified in `materials.xml` from the "old" version to the UberV2. 3 | ### Usage 4 | Run `MaterialConverter -p ` where `` is the folder that contains `mapping.xml` and `materials.xml` of the old Baikal version. 5 | ### Result 6 | Material Converter will create `/materials_new.xml` which is compatible with UberV2. 7 | -------------------------------------------------------------------------------- /Tools/MaterialConverter/material_converter.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ********************************************************************/ 22 | 23 | #pragma once 24 | 25 | #include "BaikalOld/SceneGraph/material.h" 26 | 27 | #include "SceneGraph/uberv2material.h" 28 | 29 | #include 30 | 31 | class MaterialConverter 32 | { 33 | public: 34 | static std::set TranslateMaterials(std::set const& old_materials); 35 | 36 | private: 37 | static Baikal::Texture::Format TranslateFormat(BaikalOld::Texture::Format old_format); 38 | static Baikal::InputMap::Ptr TranslateInput(BaikalOld::Material::Ptr old_mtl, std::string const& input_name); 39 | static Baikal::UberV2Material::Ptr TranslateSingleBxdfMaterial(BaikalOld::SingleBxdf::Ptr old_mtl); 40 | static Baikal::UberV2Material::Ptr MergeFresnelBlendMaterials(Baikal::UberV2Material::Ptr base, Baikal::UberV2Material::Ptr top, BaikalOld::Material::Ptr mtl); 41 | static Baikal::UberV2Material::Ptr MergeMixMaterials(Baikal::UberV2Material::Ptr base, Baikal::UberV2Material::Ptr top, BaikalOld::Material::Ptr mtl); 42 | static Baikal::UberV2Material::Ptr TranslateFresnelBlend(BaikalOld::MultiBxdf::Ptr mtl); 43 | static Baikal::UberV2Material::Ptr TranslateMix(BaikalOld::MultiBxdf::Ptr mtl); 44 | static Baikal::UberV2Material::Ptr TranslateMultiBxdfMaterial(BaikalOld::MultiBxdf::Ptr mtl); 45 | static Baikal::UberV2Material::Ptr TranslateMaterial(BaikalOld::Material::Ptr mtl); 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /Tools/deploy/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Tools/scripts/baikal_stringify.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import os 4 | import re 5 | 6 | def make_header_list_recursive(file, files_to_headers_map): 7 | header_list = [] 8 | file_includes = [incs for f, incs in files_to_headers_map if f == file] 9 | for i in file_includes[0]: 10 | header_list += make_header_list_recursive(i, files_to_headers_map) 11 | header_list += [i] 12 | # remove duplicates and save order 13 | return sorted(set(header_list), key=lambda x: header_list.index(x)) 14 | 15 | # generate variable name based on file and its type 16 | def filevarname(file, typest): 17 | return 'g_'+ file.replace(dir, '').replace(ext, '').replace('/', '_') + '_' + typest 18 | 19 | def print_file(filename, dir): 20 | fh = open(dir + filename) 21 | # include only new files 22 | header_list = [] 23 | for line in fh.readlines(): 24 | a = line.strip('\r\n') 25 | match = re.search('#include\s*<(.*/.+)>', a) 26 | if match: 27 | header_name = match.group(1) 28 | if header_name not in header_list: 29 | header_list.append(header_name) 30 | print('"' + a.replace('\\','\\\\').replace('"', '\\"') + ' \\n"\\') 31 | return header_list 32 | 33 | def stringify(filename, dir, typest): 34 | print('static const char ' + filevarname(filename, typest) +'[] = \\') 35 | header_list = print_file(filename, dir) 36 | print(';\n') 37 | return header_list 38 | 39 | argvs = sys.argv 40 | 41 | if len(argvs) == 4: 42 | dir = argvs[1] 43 | ext = argvs[2] 44 | typest = argvs[3] 45 | else: 46 | sys.error('Wrong argument count!') 47 | 48 | files = [] 49 | for root, directories, filenames in os.walk(dir): 50 | for filename in filenames: 51 | name = os.path.join(os.path.relpath(root, dir), filename) 52 | name = name.replace('\\', '/') 53 | name = name.replace('./', '') 54 | files.append(name) 55 | 56 | 57 | print('/* This is an auto-generated file. Do not edit manually! */\n') 58 | print('#pragma once\n') 59 | print('#include \n') 60 | 61 | # this will contain tuple(filename, include files) 62 | files_to_headers_map = [] 63 | for file in files: 64 | if file.find(ext) == -1: 65 | continue 66 | header_list = stringify(file, dir, typest) 67 | files_to_headers_map.append((dir + file, header_list)) 68 | 69 | for file, headers in files_to_headers_map: 70 | if not headers: 71 | continue 72 | print('static const std::unordered_map ' + filevarname(file, typest) + '_headers =\n{') 73 | for i in make_header_list_recursive(file, files_to_headers_map): 74 | print(' {"' + i + '", ' + filevarname(i, typest) + '},') 75 | print('};\n') 76 | -------------------------------------------------------------------------------- /Tools/scripts/stringify.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import os 4 | import re 5 | 6 | def printfile(filename, dir): 7 | 8 | fh = open(dir + "/" + filename) 9 | for line in fh.readlines(): 10 | a = line.strip('\r\n') 11 | inl = re.search("#include\s*<.*/(.+)>", a) 12 | if inl: 13 | printfile( inl.group(1), dir) 14 | else: 15 | print( '"' + a.replace("\\","\\\\").replace("\"", "\\\"") + ' \\n"\\' ) 16 | 17 | def stringify(filename, dir, varname, typest): 18 | print( 'static const char g_'+varname+"_"+typest+'[]= \\' ) 19 | printfile(filename, dir) 20 | print( ';' ) 21 | 22 | argvs = sys.argv 23 | 24 | if len(argvs) == 4: 25 | dir = argvs[1] 26 | ext = argvs[2] 27 | typest = argvs[3] 28 | 29 | files = os.listdir(dir) 30 | 31 | print("/* This is an auto-generated file. Do not edit manually*/\n") 32 | 33 | for file in files: 34 | if file.find(ext) == -1: 35 | continue 36 | 37 | stringify(file, dir, file.replace(ext, ""),typest) 38 | 39 | -------------------------------------------------------------------------------- /cmake/FindFBX_SDK.cmake: -------------------------------------------------------------------------------- 1 | set(FBX_SDK_DIR "C:/Program Files/Autodesk/FBX/FBX SDK/2017.0.1") 2 | 3 | if (WIN32) 4 | set(FBX_SDK_LIB_NAME libfbxsdk-md) 5 | else () 6 | set(FBX_SDK_LIB_NAME fbxsdk) 7 | endif (WIN32) 8 | 9 | find_library(FBX_SDK_LIBRARY_RELEASE NAMES ${FBX_SDK_LIB_NAME} PATHS "${FBX_SDK_DIR}/lib/vs2015/x64/release") 10 | find_library(FBX_SDK_LIBRARY_DEBUG NAMES ${FBX_SDK_LIB_NAME} PATHS "${FBX_SDK_DIR}/lib/vs2015/x64/debug") 11 | find_path(FBX_SDK_INCLUDE_DIR NAMES fbxsdk.h PATHS "${FBX_SDK_DIR}/include") 12 | 13 | include(SelectLibraryConfigurations) 14 | select_library_configurations(FBX_SDK) 15 | 16 | find_package_handle_standard_args(FBX_SDK DEFAULT_MSG FBX_SDK_LIBRARY FBX_SDK_INCLUDE_DIR) 17 | 18 | add_library(fbxsdk::fbxsdk UNKNOWN IMPORTED) 19 | 20 | set_target_properties(fbxsdk::fbxsdk PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FBX_SDK_INCLUDE_DIR}") 21 | 22 | if (OIIO_LIBRARY_RELEASE) 23 | set_property(TARGET fbxsdk::fbxsdk APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 24 | set_target_properties(fbxsdk::fbxsdk PROPERTIES IMPORTED_LOCATION_RELEASE "${FBX_SDK_LIBRARY_RELEASE}") 25 | endif (OIIO_LIBRARY_RELEASE) 26 | 27 | if (OIIO_LIBRARY_DEBUG) 28 | set_property(TARGET fbxsdk::fbxsdk APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) 29 | set_target_properties(fbxsdk::fbxsdk PROPERTIES IMPORTED_LOCATION_DEBUG "${FBX_SDK_LIBRARY_DEBUG}") 30 | endif (OIIO_LIBRARY_DEBUG) 31 | 32 | if(NOT OIIO_LIBRARY_RELEASE AND NOT OIIO_LIBRARY_DEBUG) 33 | set_property(TARGET fbxsdk::fbxsdk APPEND PROPERTY IMPORTED_LOCATION "${FBX_SDK_LIBRARY}") 34 | endif(NOT OIIO_LIBRARY_RELEASE AND NOT OIIO_LIBRARY_DEBUG) 35 | -------------------------------------------------------------------------------- /cmake/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #.rst: 5 | # FindGLEW 6 | # -------- 7 | # 8 | # Find the OpenGL Extension Wrangler Library (GLEW) 9 | # 10 | # IMPORTED Targets 11 | # ^^^^^^^^^^^^^^^^ 12 | # 13 | # This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``, 14 | # if GLEW has been found. 15 | # 16 | # Result Variables 17 | # ^^^^^^^^^^^^^^^^ 18 | # 19 | # This module defines the following variables: 20 | # 21 | # :: 22 | # 23 | # GLEW_INCLUDE_DIRS - include directories for GLEW 24 | # GLEW_LIBRARIES - libraries to link against GLEW 25 | # GLEW_FOUND - true if GLEW has been found and can be used 26 | 27 | set(GLEW_DIR "${Baikal_SOURCE_DIR}/3rdparty/glew") 28 | 29 | find_path(GLEW_INCLUDE_DIR GL/glew.h PATHS "${GLEW_DIR}/include") 30 | 31 | if(NOT GLEW_LIBRARY) 32 | find_library(GLEW_LIBRARY_RELEASE NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64 PATHS "${GLEW_DIR}/lib/x64") 33 | find_library(GLEW_LIBRARY_DEBUG NAMES GLEWd glew32d glewd PATH_SUFFIXES lib64 PATHS "${GLEW_DIR}/lib/x64") 34 | 35 | include(SelectLibraryConfigurations) 36 | select_library_configurations(GLEW) 37 | endif () 38 | 39 | find_package_handle_standard_args(GLEW REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) 40 | 41 | if(GLEW_FOUND) 42 | set(GLEW_INCLUDE_DIRS "${GLEW_INCLUDE_DIR}") 43 | 44 | if(NOT GLEW_LIBRARIES) 45 | set(GLEW_LIBRARIES "${GLEW_LIBRARY}") 46 | endif() 47 | 48 | if (NOT TARGET GLEW::GLEW) 49 | add_library(GLEW::GLEW UNKNOWN IMPORTED) 50 | set_target_properties(GLEW::GLEW PROPERTIES 51 | INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") 52 | 53 | if(GLEW_LIBRARY_RELEASE) 54 | set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 55 | set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_LIBRARY_RELEASE}") 56 | endif() 57 | 58 | if(GLEW_LIBRARY_DEBUG) 59 | set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) 60 | set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_LIBRARY_DEBUG}") 61 | endif() 62 | 63 | if(NOT GLEW_LIBRARY_RELEASE AND NOT GLEW_LIBRARY_DEBUG) 64 | set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_LOCATION "${GLEW_LIBRARY}") 65 | endif() 66 | endif() 67 | endif() 68 | 69 | mark_as_advanced(GLEW_INCLUDE_DIR) 70 | -------------------------------------------------------------------------------- /cmake/FindGLFW3.cmake: -------------------------------------------------------------------------------- 1 | set(GLFW3_DIR "${Baikal_SOURCE_DIR}/3rdparty/glfw") 2 | 3 | find_library(GLFW3_LIB NAMES glfw glfw3 PATHS "${GLFW3_DIR}/lib/x64") 4 | find_path(GLFW3_INCLUDE_DIR NAMES GLFW/glfw3.h PATHS "${GLFW3_DIR}/include") 5 | 6 | find_package_handle_standard_args(GLFW3 DEFAULT_MSG GLFW3_LIB GLFW3_INCLUDE_DIR) 7 | 8 | add_library(glfw3::glfw3 UNKNOWN IMPORTED) 9 | set_target_properties(glfw3::glfw3 PROPERTIES IMPORTED_LOCATION "${GLFW3_LIB}") 10 | set_target_properties(glfw3::glfw3 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLFW3_INCLUDE_DIR}") 11 | -------------------------------------------------------------------------------- /cmake/FindOIIO.cmake: -------------------------------------------------------------------------------- 1 | set(OIIO_DIR "${Baikal_SOURCE_DIR}/3rdparty/oiio") 2 | 3 | 4 | find_library(OIIO_LIBRARY_RELEASE NAMES OpenImageIO PATH_SUFFIXES lib64 PATHS "${OIIO_DIR}/lib/x64") 5 | find_library(OIIO_LIBRARY_DEBUG NAMES OpenImageIOD PATH_SUFFIXES lib64 PATHS "${OIIO_DIR}/lib/x64") 6 | find_path(OIIO_INCLUDE_DIR NAMES OpenImageIO/oiioversion.h PATHS "${OIIO_DIR}/include") 7 | 8 | include(SelectLibraryConfigurations) 9 | select_library_configurations(OIIO) 10 | 11 | find_package_handle_standard_args(OIIO DEFAULT_MSG OIIO_LIBRARY OIIO_INCLUDE_DIR) 12 | 13 | add_library(OpenImageIO::OpenImageIO UNKNOWN IMPORTED) 14 | 15 | set_target_properties(OpenImageIO::OpenImageIO PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OIIO_INCLUDE_DIR}") 16 | 17 | if (OIIO_LIBRARY_RELEASE) 18 | set_property(TARGET OpenImageIO::OpenImageIO APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 19 | set_target_properties(OpenImageIO::OpenImageIO PROPERTIES IMPORTED_LOCATION_RELEASE "${OIIO_LIBRARY_RELEASE}") 20 | endif (OIIO_LIBRARY_RELEASE) 21 | 22 | if (OIIO_LIBRARY_DEBUG) 23 | set_property(TARGET OpenImageIO::OpenImageIO APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) 24 | set_target_properties(OpenImageIO::OpenImageIO PROPERTIES IMPORTED_LOCATION_DEBUG "${OIIO_LIBRARY_DEBUG}") 25 | endif (OIIO_LIBRARY_DEBUG) 26 | 27 | if(NOT OIIO_LIBRARY_RELEASE AND NOT OIIO_LIBRARY_DEBUG) 28 | set_property(TARGET OpenImageIO::OpenImageIO APPEND PROPERTY IMPORTED_LOCATION "${OIIO_LIBRARY}") 29 | endif(NOT OIIO_LIBRARY_RELEASE AND NOT OIIO_LIBRARY_DEBUG) 30 | 31 | --------------------------------------------------------------------------------