diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-06-10 12:38:51 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-11 11:53:26 +0100 |
commit | 4f163972bbd9c7379b01a1f9aa5310646ca7865e (patch) | |
tree | 3bbf4693663d8fc071912c114af782736ea17168 /drivers/dummy/rasterizer_dummy.h | |
parent | 1522d8c3ee6ddf43267f124940f4e43612058407 (diff) |
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.
Diffstat (limited to 'drivers/dummy/rasterizer_dummy.h')
-rw-r--r-- | drivers/dummy/rasterizer_dummy.h | 17 |
1 files changed, 9 insertions, 8 deletions
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<AABB> bone_aabbs; }; - struct DummyMesh : public RID_Data { + struct DummyMesh { Vector<DummySurface> surfaces; int blend_shape_count; VS::BlendShapeMode blend_shape_mode; }; - mutable RID_Owner<DummyTexture> texture_owner; - mutable RID_Owner<DummyMesh> mesh_owner; + mutable RID_PtrOwner<DummyTexture> texture_owner; + mutable RID_PtrOwner<DummyMesh> mesh_owner; RID texture_create() { @@ -178,7 +179,7 @@ public: } void texture_set_data_partial(RID p_texture, const Ref<Image> &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<RasterizerScene::InstanceBase>::List instance_list; @@ -630,7 +631,7 @@ public: } }; - mutable RID_Owner<LightmapCapture> lightmap_capture_data_owner; + mutable RID_PtrOwner<LightmapCapture> 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<uint8_t> &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); } |