- // the origin, tell the vertex shader so.
- if (phase->output_node->outgoing_links.empty() && output_origin == OUTPUT_ORIGIN_TOP_LEFT) {
- const string needle = "#define FLIP_ORIGIN 0";
- size_t pos = vert_shader.find(needle);
- assert(pos != string::npos);
+ // the origin, tell the vertex or compute shader so.
+ bool is_last_phase;
+ if (has_dummy_effect) {
+ is_last_phase = (phase->output_node->outgoing_links.size() == 1 &&
+ phase->output_node->outgoing_links[0]->effect->effect_type_id() == "ComputeShaderOutputDisplayEffect");
+ } else {
+ is_last_phase = phase->output_node->outgoing_links.empty();
+ }
+ if (is_last_phase && output_origin == OUTPUT_ORIGIN_TOP_LEFT) {
+ if (phase->is_compute_shader) {
+ frag_shader_header += "#define FLIP_ORIGIN 1\n";
+ } else {
+ const string needle = "#define FLIP_ORIGIN 0";
+ size_t pos = vert_shader.find(needle);
+ assert(pos != string::npos);