The specialization constants would be ignored anyway, so better be
explicit about it.
void Compiler::compile(Mode mode)
{
+ if(specialized && mode!=PROGRAM)
+ throw invalid_operation("Compiler::compile");
+
for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
generate(*i);
ConstantIdAssigner().apply(*module, features);
if(!valid)
throw invalid_shader_source(get_diagnostics());
- if(mode==PROGRAM && specialized)
+ if(specialized)
{
for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
ConstantSpecializer().apply(*i, spec_values);
else if(!dump_ast)
combined = true;
+ if(!spec_values_in.empty() && as_module)
+ throw usage_error("Modules can't be specialized");
for(vector<string>::const_iterator i=spec_values_in.begin(); i!=spec_values_in.end(); ++i)
{
unsigned colon = i->find(':');