| 819 | return res; |
| 820 | } |
| 821 | id define_sampler(const location &loc, const texture &, sampler &info) override |
| 822 | { |
| 823 | const id res = info.id = create_block(); |
| 824 | define_name<naming::unique>(res, info.unique_name); |
| 825 | |
| 826 | std::string &code = _blocks.at(res); |
| 827 | |
| 828 | write_location(code, loc); |
| 829 | |
| 830 | // Default to a binding index equivalent to the entry in the sampler list (this is later overwritten in 'finalize_code_for_entry_point' to a more optimal placement) |
| 831 | const uint32_t default_binding = static_cast<uint32_t>(_module.samplers.size()); |
| 832 | |
| 833 | code += "layout(binding = " + std::to_string(default_binding); |
| 834 | code += ") uniform "; |
| 835 | write_type(code, info.type); |
| 836 | code += ' ' + id_to_name(res) + ";\n"; |
| 837 | |
| 838 | _module.samplers.push_back(info); |
| 839 | |
| 840 | return res; |
| 841 | } |
| 842 | id define_storage(const location &loc, const texture &tex_info, storage &info) override |
| 843 | { |
| 844 | const id res = info.id = create_block(); |
no test coverage detected