diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/storage/texture_storage.cpp | 18 | ||||
-rw-r--r-- | drivers/gles3/storage/texture_storage.h | 6 |
2 files changed, 13 insertions, 11 deletions
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 54012c20e9..bd824a076e 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -729,7 +729,7 @@ void TextureStorage::texture_free(RID p_texture) { } } } else { - must_free_data = t->tex_id != 0 && !t->is_external; + must_free_data = t->tex_id != 0 && !t->is_from_native_handle; } if (must_free_data) { GLES3::Utilities::get_singleton()->texture_free_data(t->tex_id); @@ -874,26 +874,28 @@ void TextureStorage::texture_proxy_initialize(RID p_texture, RID p_base) { texture_owner.initialize_rid(p_texture, proxy_tex); } -RID TextureStorage::texture_create_external(GLES3::Texture::Type p_type, Image::Format p_format, unsigned int p_image, int p_width, int p_height, int p_depth, int p_layers, RS::TextureLayeredType p_layered_type) { +RID TextureStorage::texture_create_from_native_handle(RS::TextureType p_type, Image::Format p_format, uint64_t p_native_handle, int p_width, int p_height, int p_depth, int p_layers, RS::TextureLayeredType p_layered_type) { Texture texture; texture.active = true; - texture.is_external = true; - texture.type = p_type; + texture.is_from_native_handle = true; switch (p_type) { - case Texture::TYPE_2D: { + case RS::TEXTURE_TYPE_2D: { + texture.type = Texture::TYPE_2D; texture.target = GL_TEXTURE_2D; } break; - case Texture::TYPE_3D: { + case RS::TEXTURE_TYPE_3D: { + texture.type = Texture::TYPE_3D; texture.target = GL_TEXTURE_3D; } break; - case Texture::TYPE_LAYERED: { + case RS::TEXTURE_TYPE_LAYERED: { + texture.type = Texture::TYPE_LAYERED; texture.target = GL_TEXTURE_2D_ARRAY; } break; } texture.real_format = texture.format = p_format; - texture.tex_id = p_image; + texture.tex_id = p_native_handle; texture.alloc_width = texture.width = p_width; texture.alloc_height = texture.height = p_height; texture.depth = p_depth; diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h index 5569abcc73..26864c2f3b 100644 --- a/drivers/gles3/storage/texture_storage.h +++ b/drivers/gles3/storage/texture_storage.h @@ -146,7 +146,7 @@ struct Texture { RID self; bool is_proxy = false; - bool is_external = false; + bool is_from_native_handle = false; bool is_render_target = false; RID proxy_to; @@ -209,7 +209,7 @@ struct Texture { void copy_from(const Texture &o) { proxy_to = o.proxy_to; is_proxy = o.is_proxy; - is_external = o.is_external; + is_from_native_handle = o.is_from_native_handle; width = o.width; height = o.height; alloc_width = o.alloc_width; @@ -514,7 +514,7 @@ public: virtual void texture_3d_initialize(RID p_texture, Image::Format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_data) override; virtual void texture_proxy_initialize(RID p_texture, RID p_base) override; //all slices, then all the mipmaps, must be coherent - RID texture_create_external(Texture::Type p_type, Image::Format p_format, unsigned int p_image, int p_width, int p_height, int p_depth, int p_layers, RS::TextureLayeredType p_layered_type = RS::TEXTURE_LAYERED_2D_ARRAY); + virtual RID texture_create_from_native_handle(RS::TextureType p_type, Image::Format p_format, uint64_t p_native_handle, int p_width, int p_height, int p_depth, int p_layers = 1, RS::TextureLayeredType p_layered_type = RS::TEXTURE_LAYERED_2D_ARRAY) override; virtual void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) override; virtual void texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) override; |