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

Method emit_binary_op

source/effect_codegen_glsl.cpp:1749–1876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1747 return res;
1748 }
1749 id emit_binary_op(const location &loc, tokenid op, const type &res_type, const type &exp_type, id lhs, id rhs) override
1750 {
1751 const id res = make_id();
1752
1753 std::string &code = _blocks.at(_current_block);
1754
1755 write_location(code, loc);
1756
1757 code += '\t';
1758 write_type(code, res_type);
1759 code += ' ' + id_to_name(res) + " = ";
1760
1761 std::string intrinsic, operator_code;
1762
1763 switch (op)
1764 {
1765 case tokenid::plus:
1766 case tokenid::plus_plus:
1767 case tokenid::plus_equal:
1768 operator_code = '+';
1769 break;
1770 case tokenid::minus:
1771 case tokenid::minus_minus:
1772 case tokenid::minus_equal:
1773 operator_code = '-';
1774 break;
1775 case tokenid::star:
1776 case tokenid::star_equal:
1777 if (exp_type.is_matrix())
1778 intrinsic = "matrixCompMult";
1779 else
1780 operator_code = '*';
1781 break;
1782 case tokenid::slash:
1783 case tokenid::slash_equal:
1784 operator_code = '/';
1785 break;
1786 case tokenid::percent:
1787 case tokenid::percent_equal:
1788 if (exp_type.is_floating_point())
1789 intrinsic = "fmodHLSL",
1790 _uses_fmod = true;
1791 else
1792 operator_code = '%';
1793 break;
1794 case tokenid::caret:
1795 case tokenid::caret_equal:
1796 operator_code = '^';
1797 break;
1798 case tokenid::pipe:
1799 case tokenid::pipe_equal:
1800 operator_code = '|';
1801 break;
1802 case tokenid::ampersand:
1803 case tokenid::ampersand_equal:
1804 operator_code = '&';
1805 break;
1806 case tokenid::less_less:

Callers

nothing calls this directly

Calls 7

write_locationFunction · 0.85
write_typeFunction · 0.85
id_to_nameFunction · 0.85
atMethod · 0.80
is_matrixMethod · 0.80
is_floating_pointMethod · 0.80
is_vectorMethod · 0.80

Tested by

no test coverage detected