| 3639 | //------------------------------------------------------------------------- |
| 3640 | template <typename T, typename It> |
| 3641 | static void safeSetConstant(const GpuProgramParametersPtr& params, const String& name, size_t index, It arrayStart, |
| 3642 | It arrayEnd, size_t count, PropertyAbstractNode* prop, ScriptCompiler* compiler) |
| 3643 | { |
| 3644 | int roundedCount = (count + 3) / 4; // integer ceil |
| 3645 | roundedCount *= 4; |
| 3646 | |
| 3647 | std::vector<T> vals; |
| 3648 | if (!_getVector(arrayStart, arrayEnd, vals, roundedCount)) |
| 3649 | { |
| 3650 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line); |
| 3651 | return; |
| 3652 | } |
| 3653 | |
| 3654 | try |
| 3655 | { |
| 3656 | if (!name.empty()) |
| 3657 | params->setNamedConstant(name, vals.data(), count, 1); |
| 3658 | else |
| 3659 | params->setConstant(index, vals.data(), roundedCount / 4); |
| 3660 | } |
| 3661 | catch (Exception& e) |
| 3662 | { |
| 3663 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, e.getDescription()); |
| 3664 | } |
| 3665 | } |
| 3666 | |
| 3667 | void GpuProgramTranslator::translateProgramParameters(ScriptCompiler *compiler, const GpuProgramParametersSharedPtr& params, ObjectAbstractNode *obj) |
| 3668 | { |
nothing calls this directly
no test coverage detected