MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / FALCOR_SCRIPT_BINDING

Function FALCOR_SCRIPT_BINDING

Source/Falcor/Core/Program/Program.cpp:393–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393FALCOR_SCRIPT_BINDING(Program)
394{
395 using namespace pybind11::literals;
396
397 FALCOR_SCRIPT_BINDING_DEPENDENCY(Types)
398 FALCOR_SCRIPT_BINDING_DEPENDENCY(ProgramReflection)
399
400 pybind11::enum_<SlangCompilerFlags> slangCompilerFlags(m, "SlangCompilerFlags");
401 slangCompilerFlags.value("None_", SlangCompilerFlags::None);
402 slangCompilerFlags.value("TreatWarningsAsErrors", SlangCompilerFlags::TreatWarningsAsErrors);
403 slangCompilerFlags.value("DumpIntermediates", SlangCompilerFlags::DumpIntermediates);
404 slangCompilerFlags.value("FloatingPointModeFast", SlangCompilerFlags::FloatingPointModeFast);
405 slangCompilerFlags.value("FloatingPointModePrecise", SlangCompilerFlags::FloatingPointModePrecise);
406 slangCompilerFlags.value("GenerateDebugInfo", SlangCompilerFlags::GenerateDebugInfo);
407 slangCompilerFlags.value("MatrixLayoutColumnMajor", SlangCompilerFlags::MatrixLayoutColumnMajor);
408 ScriptBindings::addEnumBinaryOperators(slangCompilerFlags);
409
410 pybind11::class_<ProgramDesc> programDesc(m, "ProgramDesc");
411
412 pybind11::class_<ProgramDesc::ShaderModule>(programDesc, "ShaderModule")
413 .def("add_file", &ProgramDesc::ShaderModule::addFile, "path"_a)
414 .def("add_string", &ProgramDesc::ShaderModule::addString, "string"_a, "path"_a = std::filesystem::path());
415
416 pybind11::class_<ProgramDesc::EntryPointGroup>(programDesc, "EntryPointGroup")
417 .def_property(
418 "type_conformances",
419 [](const ProgramDesc::EntryPointGroup& self) { return typeConformanceListToPython(self.typeConformances); },
420 [](ProgramDesc::EntryPointGroup& self, const pybind11::dict& dict)
421 { return self.typeConformances = typeConformanceListFromPython(dict); }
422 );
423
424 programDesc.def(pybind11::init<>());
425 programDesc.def_readwrite("shader_model", &ProgramDesc::shaderModel);
426 programDesc.def_readwrite("compiler_flags", &ProgramDesc::compilerFlags);
427 programDesc.def_readwrite("compiler_arguments", &ProgramDesc::compilerArguments);
428 programDesc.def(
429 "add_shader_module",
430 pybind11::overload_cast<std::string>(&ProgramDesc::addShaderModule),
431 "name"_a = "",
432 pybind11::return_value_policy::reference
433 );
434 programDesc.def("cs_entry", &ProgramDesc::csEntry, "name"_a);
435
436 pybind11::class_<Program, ref<Program>> program(m, "Program");
437
438 program.def_property_readonly("reflector", &Program::getReflector);
439 program.def_property(
440 "defines",
441 [](const Program& self) { return defineListToPython(self.getDefines()); },
442 [](Program& self, const pybind11::dict& dict) { self.setDefines(defineListFromPython(dict)); }
443 );
444 program.def("add_define", &Program::addDefine, "name"_a, "value"_a = "");
445 program.def("remove_define", &Program::removeDefine, "name"_a);
446 program.def_property(
447 "type_conformances",
448 [](const Program& self) { return typeConformanceListToPython(self.getTypeConformances()); },
449 [](Program& self, const pybind11::dict& dict) { return self.setTypeConformances(typeConformanceListFromPython(dict)); }
450 );

Callers

nothing calls this directly

Calls 10

addEnumBinaryOperatorsFunction · 0.85
defineListToPythonFunction · 0.85
defineListFromPythonFunction · 0.85
setDefinesMethod · 0.80
setTypeConformancesMethod · 0.80
valueMethod · 0.45
getDefinesMethod · 0.45
getTypeConformancesMethod · 0.45

Tested by

no test coverage detected