| 97 | } |
| 98 | |
| 99 | static lua_chunk_view_t fill_chunk_view(sugoi_storage_t* storage, sugoi_chunk_view_t* view, const sugoi_type_index_t* indices, uint32_t count, const sugoi_operation_t* operations, bool readonly) |
| 100 | { |
| 101 | lua_chunk_view_t luaView = {}; |
| 102 | |
| 103 | luaView.storage = storage; |
| 104 | luaView.view = *view; |
| 105 | luaView.count = count; |
| 106 | luaView.types = indices; |
| 107 | luaView.datas = localStack.allocate<void*>(count); |
| 108 | luaView.strides = localStack.allocate<uint32_t>(count); |
| 109 | luaView.guidStrs = localStack.allocate<const char8_t*>(count); |
| 110 | luaView.elementSizes = localStack.allocate<uint32_t>(count); |
| 111 | luaView.lua_pushs = localStack.allocate<lua_push_t>(count); |
| 112 | luaView.lua_checks = localStack.allocate<lua_check_t>(count); |
| 113 | luaView.operations = operations; |
| 114 | luaView.readonly = readonly; |
| 115 | |
| 116 | luaView.entities = sugoiV_get_entities(view); |
| 117 | auto& typeReg = sugoi::type_registry_t::get(); |
| 118 | forloop (i, 0, count) |
| 119 | { |
| 120 | auto& desc = typeReg.descriptions[sugoi::type_index_t(indices[i]).index()]; |
| 121 | if ((operations && !operations[i].readonly) || !readonly) |
| 122 | { |
| 123 | luaView.lua_checks[i] = desc.callback.lua_check; |
| 124 | luaView.datas[i] = (void*)sugoiV_get_owned_rw(view, indices[i]); |
| 125 | } |
| 126 | else |
| 127 | { |
| 128 | luaView.lua_checks[i] = nullptr; |
| 129 | luaView.datas[i] = (void*)sugoiV_get_owned_ro(view, indices[i]); |
| 130 | } |
| 131 | luaView.strides[i] = desc.size; |
| 132 | luaView.guidStrs[i] = desc.guidStr; |
| 133 | luaView.elementSizes[i] = desc.elementSize; |
| 134 | luaView.lua_pushs[i] = desc.callback.lua_push; |
| 135 | } |
| 136 | return luaView; |
| 137 | } |
| 138 | |
| 139 | static lua_chunk_view_t init_chunk_view(sugoi_storage_t* storage, sugoi_chunk_view_t* view, const sugoi_type_set_t& type, bool readonly = true) |
| 140 | { |
no test coverage detected