* Create a new graphics program from file. * @param[in] pDevice GPU device. * @param[in] path Graphics program file path. * @param[in] vsEntry Vertex shader entry point. If this string is empty (""), it will use a default vertex shader, which transforms and * outputs all default vertex attributes. * @param[in] psEntry Pixel shader entry point * @param[in] programDefin
| 632 | * @return A new object, or an exception is thrown if creation failed. |
| 633 | */ |
| 634 | static ref<Program> createGraphics( |
| 635 | ref<Device> pDevice, |
| 636 | const std::filesystem::path& path, |
| 637 | const std::string& vsEntry, |
| 638 | const std::string& psEntry, |
| 639 | DefineList programDefines = {}, |
| 640 | SlangCompilerFlags flags = SlangCompilerFlags::None, |
| 641 | ShaderModel shaderModel = ShaderModel::Unknown |
| 642 | ) |
| 643 | { |
| 644 | ProgramDesc d; |
| 645 | d.addShaderLibrary(path); |
| 646 | if (shaderModel != ShaderModel::Unknown) |
| 647 | d.setShaderModel(shaderModel); |
| 648 | d.setCompilerFlags(flags); |
| 649 | d.vsEntry(vsEntry).psEntry(psEntry); |
| 650 | return create(std::move(pDevice), std::move(d), std::move(programDefines)); |
| 651 | } |
| 652 | |
| 653 | /** |
| 654 | * Get the API handle of the active program. |