mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
gl_shader_gen: rearrange function definition to avoid suprious warnings
This commit is contained in:
parent
e35c634fc6
commit
92a1252835
@ -1640,6 +1640,24 @@ uint vertex_id = 0u;
|
||||
bool prim_emit = false;
|
||||
bool winding = false;
|
||||
|
||||
void setemit(uint vertex_id_, bool prim_emit_, bool winding_);
|
||||
void emit();
|
||||
|
||||
void main() {
|
||||
)";
|
||||
for (u32 i = 0; i < config.state.num_outputs; ++i) {
|
||||
out +=
|
||||
" output_buffer.attributes[" + std::to_string(i) + "] = vec4(0.0, 0.0, 0.0, 1.0);\n";
|
||||
}
|
||||
|
||||
// execute shader
|
||||
out += "\n exec_shader();\n\n";
|
||||
|
||||
out += "}\n\n";
|
||||
|
||||
// Put the definition of setemit and emit after main to avoid spurious warning about
|
||||
// uninitialized output_buffer in some drivers
|
||||
out += R"(
|
||||
void setemit(uint vertex_id_, bool prim_emit_, bool winding_) {
|
||||
vertex_id = vertex_id_;
|
||||
prim_emit = prim_emit_;
|
||||
@ -1658,18 +1676,7 @@ void emit() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
)";
|
||||
for (u32 i = 0; i < config.state.num_outputs; ++i) {
|
||||
out +=
|
||||
" output_buffer.attributes[" + std::to_string(i) + "] = vec4(0.0, 0.0, 0.0, 1.0);\n";
|
||||
}
|
||||
|
||||
// execute shader
|
||||
out += "\n exec_shader();\n\n";
|
||||
|
||||
out += "}\n\n";
|
||||
|
||||
out += program_source;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user