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

Function emit_binary_op

source/effect_codegen_hlsl.cpp:1521–1629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1519 return res;
1520 }
1521 id emit_binary_op(const location &loc, tokenid op, const type &res_type, const type &, id lhs, id rhs) override
1522 {
1523 const id res = make_id();
1524
1525 std::string &code = _blocks.at(_current_block);
1526
1527 write_location(code, loc);
1528
1529 code += '\t';
1530 write_type(code, res_type);
1531 code += ' ' + id_to_name(res) + " = ";
1532
1533 if (_shader_model < 40)
1534 {
1535 // See bitwise shift operator emulation below
1536 if (op == tokenid::less_less || op == tokenid::less_less_equal)
1537 code += '(';
1538 else if (op == tokenid::greater_greater || op == tokenid::greater_greater_equal)
1539 code += "floor(";
1540 }
1541
1542 code += id_to_name(lhs) + ' ';
1543
1544 switch (op)
1545 {
1546 case tokenid::plus:
1547 case tokenid::plus_plus:
1548 case tokenid::plus_equal:
1549 code += '+';
1550 break;
1551 case tokenid::minus:
1552 case tokenid::minus_minus:
1553 case tokenid::minus_equal:
1554 code += '-';
1555 break;
1556 case tokenid::star:
1557 case tokenid::star_equal:
1558 code += '*';
1559 break;
1560 case tokenid::slash:
1561 case tokenid::slash_equal:
1562 code += '/';
1563 break;
1564 case tokenid::percent:
1565 case tokenid::percent_equal:
1566 code += '%';
1567 break;
1568 case tokenid::caret:
1569 case tokenid::caret_equal:
1570 code += '^';
1571 break;
1572 case tokenid::pipe:
1573 case tokenid::pipe_equal:
1574 code += '|';
1575 break;
1576 case tokenid::ampersand:
1577 case tokenid::ampersand_equal:
1578 code += '&';

Callers 1

emit_binary_opMethod · 0.85

Calls 4

write_locationFunction · 0.85
write_typeFunction · 0.85
id_to_nameFunction · 0.85
atMethod · 0.80

Tested by

no test coverage detected