From fc5a3640bd7a007c2da025308e6d6a33402eb098 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 30 Mar 2021 16:40:52 +0300 Subject: [PATCH] Add some precondition checks to Program Adding stages from multiple modules presents some difficulties in matching the interfaces. --- source/core/program.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/core/program.cpp b/source/core/program.cpp index 789fa324..c41976ed 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -80,6 +80,9 @@ Program::~Program() void Program::add_stages(const Module &mod, const map &spec_values) { + if(!stage_ids.empty()) + throw invalid_operation("Program::add_stages"); + switch(mod.get_format()) { case Module::GLSL: return add_glsl_stages(static_cast(mod), spec_values); @@ -220,6 +223,9 @@ void Program::bind_fragment_data(unsigned index, const string &name) void Program::link() { + if(stage_ids.empty()) + throw invalid_operation("Program::link"); + uniforms.clear(); glLinkProgram(id); -- 2.43.0