| 57 | } |
| 58 | |
| 59 | Program::Program(ref<Device> pDevice, ProgramDesc desc, DefineList defineList) |
| 60 | : mpDevice(std::move(pDevice)), mDesc(std::move(desc)), mDefineList(std::move(defineList)), mTypeConformanceList(mDesc.typeConformances) |
| 61 | { |
| 62 | mDesc.finalize(); |
| 63 | |
| 64 | // If not shader model was requested, use the default shader model for the device. |
| 65 | if (mDesc.shaderModel == ShaderModel::Unknown) |
| 66 | mDesc.shaderModel = mpDevice->getDefaultShaderModel(); |
| 67 | |
| 68 | // Check that shader model is supported on the device. |
| 69 | if (!mpDevice->isShaderModelSupported(mDesc.shaderModel)) |
| 70 | FALCOR_THROW("Requested Shader Model {} is not supported by the device", enumToString(mDesc.shaderModel)); |
| 71 | |
| 72 | if (mDesc.hasEntryPoint(ShaderType::RayGeneration)) |
| 73 | { |
| 74 | if (desc.maxTraceRecursionDepth == uint32_t(-1)) |
| 75 | FALCOR_THROW("Can't create a raytacing program without specifying maximum trace recursion depth"); |
| 76 | if (desc.maxPayloadSize == uint32_t(-1)) |
| 77 | FALCOR_THROW("Can't create a raytacing program without specifying maximum ray payload size"); |
| 78 | } |
| 79 | |
| 80 | validateEntryPoints(); |
| 81 | |
| 82 | mpDevice->getProgramManager()->registerProgramForReload(this); |
| 83 | } |
| 84 | |
| 85 | Program::~Program() |
| 86 | { |
nothing calls this directly
no test coverage detected