{
auto i = spec_indices.find(b.condition);
b.condition = (i!=spec_indices.end() ? &spec_constants[i->second] : 0);
+ if(b.condition)
+ specializable = true;
for(const Variable *&v: b.accessed_variables)
{
std::vector<Variable> variables;
std::vector<Constant> spec_constants;
std::vector<InstructionBlock> blocks;
+ bool specializable = false;
public:
virtual Format get_format() const { return SPIR_V; }
const std::vector<Variable> &get_variables() const { return variables; }
const std::vector<Constant> &get_spec_constants() const { return spec_constants; }
const std::vector<InstructionBlock> &get_blocks() const { return blocks; }
+ bool is_specializable() const { return specializable; }
/** Creates a new module which is a specialized version of this one. */
SpirVModule *specialize(const std::map<std::string, int> &) const;
add_glsl_stages(static_cast<const GlslModule &>(mod), spec_values);
break;
case Module::SPIR_V:
- if(!spec_values.empty())
+ if(static_cast<const SpirVModule &>(mod).is_specializable())
{
specialized_spirv = static_cast<const SpirVModule &>(mod).specialize(spec_values);
final_module = specialized_spirv;