| 138 | } |
| 139 | |
| 140 | ProgramDesc programDescFromPython(const pybind11::kwargs& kwargs) |
| 141 | { |
| 142 | ProgramDesc desc; |
| 143 | for (const auto& arg : kwargs) |
| 144 | { |
| 145 | std::string key = arg.first.cast<std::string>(); |
| 146 | const auto& value = arg.second; |
| 147 | |
| 148 | if (key == "file") |
| 149 | desc.addShaderModule().addFile(value.cast<std::filesystem::path>()); |
| 150 | else if (key == "string") |
| 151 | desc.addShaderModule().addString(value.cast<std::string>()); |
| 152 | else if (key == "cs_entry") |
| 153 | desc.csEntry(value.cast<std::string>()); |
| 154 | else if (key == "type_conformances") |
| 155 | desc.typeConformances = typeConformanceListFromPython(value.cast<pybind11::dict>()); |
| 156 | else if (key == "shader_model") |
| 157 | desc.shaderModel = value.cast<ShaderModel>(); |
| 158 | else if (key == "compiler_flags") |
| 159 | desc.compilerFlags = value.cast<SlangCompilerFlags>(); |
| 160 | else if (key == "compiler_arguments") |
| 161 | desc.compilerArguments = value.cast<std::vector<std::string>>(); |
| 162 | else |
| 163 | FALCOR_THROW("Unknown keyword argument '{}'.", key); |
| 164 | } |
| 165 | return desc; |
| 166 | } |
| 167 | |
| 168 | } // namespace Falcor |
no test coverage detected