summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_storage_gles3.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/rasterizer_storage_gles3.h')
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 7c86862425..d5efd5307c 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -242,6 +242,9 @@ public:
struct Texture : public RID_Data {
+ Texture *proxy;
+ Set<Texture *> proxy_owners;
+
String path;
uint32_t flags;
int width, height;
@@ -301,6 +304,15 @@ public:
detect_srgb_ud = NULL;
detect_normal = NULL;
detect_normal_ud = NULL;
+ proxy = NULL;
+ }
+
+ _ALWAYS_INLINE_ Texture *get_ptr() {
+ if (proxy) {
+ return proxy; //->get_ptr(); only one level of indirection, else not inlining possible.
+ } else {
+ return this;
+ }
}
~Texture() {
@@ -309,6 +321,14 @@ public:
glDeleteTextures(1, &tex_id);
}
+
+ for (Set<Texture *>::Element *E = proxy_owners.front(); E; E = E->next()) {
+ E->get()->proxy = NULL;
+ }
+
+ if (proxy) {
+ proxy->proxy_owners.erase(this);
+ }
}
};
@@ -343,6 +363,8 @@ public:
virtual void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
virtual void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
+ virtual void texture_set_proxy(RID p_texture, RID p_proxy);
+
/* SKY API */
struct Sky : public RID_Data {