writer(content)
{ }
-void SpirVGenerator::apply(Module &module)
+void SpirVGenerator::apply(Module &module, const Features &f)
{
+ features = f;
use_capability(CAP_SHADER);
for(Stage &s: module.stages)
writer.end_op(OP_ENTRY_POINT);
if(stage->type==Stage::FRAGMENT)
- writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, EXEC_ORIGIN_LOWER_LEFT);
+ {
+ SpirVExecutionMode origin = (features.target_api==VULKAN ? EXEC_ORIGIN_UPPER_LEFT : EXEC_ORIGIN_LOWER_LEFT);
+ writer.write_op(content.exec_modes, OP_EXECUTION_MODE, func_id, origin);
+ }
else if(stage->type==Stage::GEOMETRY)
use_capability(CAP_GEOMETRY);
bool operator<(const ConstantKey &) const;
};
+ Features features;
Stage *stage = 0;
FunctionDeclaration *current_function = 0;
std::vector<const InterfaceLayout *> interface_layouts;
public:
SpirVGenerator();
- void apply(Module &);
+ void apply(Module &, const Features &);
const std::vector<Word> &get_code() const { return content.code; }
private: