| 265 | } |
| 266 | |
| 267 | Status Runtime::AllocateConstObject(const Object& object, uint32_t* id) { |
| 268 | const ObjectData* data = GetData(object); |
| 269 | if (data == nullptr) { |
| 270 | return InternalError("Unable to allocate reference as a const object"); |
| 271 | } |
| 272 | *id = next_const_id_++; |
| 273 | switch (object.object_type) { |
| 274 | case ObjectType::BUFFER: { |
| 275 | GlBuffer gl_buffer; |
| 276 | if (!shared_readonly_buffer_ || |
| 277 | !shared_readonly_buffer_->Add(*data, &gl_buffer)) { |
| 278 | RETURN_IF_ERROR(MakeGlBuffer(object, *data, &gl_buffer)); |
| 279 | } |
| 280 | RETURN_IF_ERROR(const_objects_.RegisterBuffer(*id, std::move(gl_buffer))); |
| 281 | break; |
| 282 | } |
| 283 | case ObjectType::TEXTURE: { |
| 284 | GlTexture gl_texture; |
| 285 | RETURN_IF_ERROR(MakeGlTexture(object, *data, &gl_texture)); |
| 286 | RETURN_IF_ERROR( |
| 287 | const_objects_.RegisterTexture(*id, std::move(gl_texture))); |
| 288 | break; |
| 289 | } |
| 290 | case ObjectType::UNKNOWN: |
| 291 | return InternalError("Unknown object type"); |
| 292 | } |
| 293 | return OkStatus(); |
| 294 | } |
| 295 | |
| 296 | Status Runtime::PrepareForExecution() { |
| 297 | if (shared_readonly_buffer_ && !shared_readonly_buffer_->empty()) { |
nothing calls this directly
no test coverage detected