MCPcopy Create free account
hub / github.com/crosire/reshade / leave_block_and_kill

Function leave_block_and_kill

source/effect_codegen_glsl.cpp:2316–2339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2314 _current_block = id;
2315 }
2316 id leave_block_and_kill() override
2317 {
2318 if (!is_in_block())
2319 return 0;
2320
2321 std::string &code = _blocks.at(_current_block);
2322
2323 code += "\tdiscard;\n";
2324
2325 const type &return_type = _current_function->return_type;
2326 if (!return_type.is_void())
2327 {
2328 // Add a return statement to exit functions in case discard is the last control flow statement
2329 code += "\treturn ";
2330 write_constant(code, return_type, constant());
2331 code += ";\n";
2332 }
2333 else
2334 {
2335 code += "\treturn;\n";
2336 }
2337
2338 return set_block(0);
2339 }
2340 id leave_block_and_return(id value) override
2341 {
2342 if (!is_in_block())

Callers

nothing calls this directly

Calls 5

write_constantFunction · 0.85
atMethod · 0.80
is_voidMethod · 0.80
constantClass · 0.70
set_blockFunction · 0.70

Tested by

no test coverage detected