| 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(); |
| 845 | define_name<naming::unique>(res, info.unique_name); |
| 846 | |
| 847 | std::string &code = _blocks.at(res); |
| 848 | |
| 849 | write_location(code, loc); |
| 850 | |
| 851 | // Default to a binding index equivalent to the entry in the storage list (this is later overwritten in 'finalize_code_for_entry_point' to a more optimal placement) |
| 852 | const uint32_t default_binding = static_cast<uint32_t>(_module.storages.size()); |
| 853 | |
| 854 | code += "layout(binding = " + std::to_string(default_binding) + ", "; |
| 855 | write_texture_format(code, tex_info.format); |
| 856 | code += ") uniform "; |
| 857 | write_type(code, info.type); |
| 858 | code += ' ' + id_to_name(res) + ";\n"; |
| 859 | |
| 860 | _module.storages.push_back(info); |
| 861 | |
| 862 | return res; |
| 863 | } |
| 864 | id define_uniform(const location &loc, uniform &info) override |
| 865 | { |
| 866 | const id res = make_id(); |
no test coverage detected