From 4f163972bbd9c7379b01a1f9aa5310646ca7865e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 10 Jun 2019 12:38:51 -0300 Subject: Refactored RID/RID_Owner to always use O(1) allocation. * Implements a growing chunked allocator * Removed redudant methods get and getptr, only getornull is supported now. --- drivers/dummy/rasterizer_dummy.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers/dummy') diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h index 418e18cb78..4521b9208d 100644 --- a/drivers/dummy/rasterizer_dummy.h +++ b/drivers/dummy/rasterizer_dummy.h @@ -32,6 +32,7 @@ #define RASTERIZER_DUMMY_H #include "core/math/camera_matrix.h" +#include "core/rid_owner.h" #include "core/self_list.h" #include "scene/resources/mesh.h" #include "servers/visual/rasterizer.h" @@ -121,7 +122,7 @@ public: class RasterizerStorageDummy : public RasterizerStorage { public: /* TEXTURE API */ - struct DummyTexture : public RID_Data { + struct DummyTexture { int width; int height; uint32_t flags; @@ -142,14 +143,14 @@ public: Vector bone_aabbs; }; - struct DummyMesh : public RID_Data { + struct DummyMesh { Vector surfaces; int blend_shape_count; VS::BlendShapeMode blend_shape_mode; }; - mutable RID_Owner texture_owner; - mutable RID_Owner mesh_owner; + mutable RID_PtrOwner texture_owner; + mutable RID_PtrOwner mesh_owner; RID texture_create() { @@ -178,7 +179,7 @@ public: } void texture_set_data_partial(RID p_texture, const Ref &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_level) { - DummyTexture *t = texture_owner.get(p_texture); + DummyTexture *t = texture_owner.getornull(p_texture); ERR_FAIL_COND(!t); ERR_FAIL_COND_MSG(p_image.is_null(), "It's not a reference to a valid Image object."); @@ -588,7 +589,7 @@ public: void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {} /* LIGHTMAP CAPTURE */ - struct Instantiable : public RID_Data { + struct Instantiable { SelfList::List instance_list; @@ -630,7 +631,7 @@ public: } }; - mutable RID_Owner lightmap_capture_data_owner; + mutable RID_PtrOwner lightmap_capture_data_owner; void lightmap_capture_set_bounds(RID p_capture, const AABB &p_bounds) {} AABB lightmap_capture_get_bounds(RID p_capture) const { return AABB(); } void lightmap_capture_set_octree(RID p_capture, const PoolVector &p_octree) {} @@ -724,7 +725,7 @@ public: if (texture_owner.owns(p_rid)) { // delete the texture - DummyTexture *texture = texture_owner.get(p_rid); + DummyTexture *texture = texture_owner.getornull(p_rid); texture_owner.free(p_rid); memdelete(texture); } -- cgit v1.2.3