diff --git a/panda/src/glstuff/glTextureContext_src.cxx b/panda/src/glstuff/glTextureContext_src.cxx index a56d6a20a4..e36f8f756e 100644 --- a/panda/src/glstuff/glTextureContext_src.cxx +++ b/panda/src/glstuff/glTextureContext_src.cxx @@ -95,6 +95,27 @@ reset_data() { #endif } +/** + * Returns an implementation-defined handle or pointer that can be used + * to interface directly with the underlying API. + * Returns 0 if the underlying implementation does not support this. + */ +uint64_t CLP(TextureContext):: +get_native_id() const { + return _index; +} + +/** + * Similar to get_native_id, but some implementations use a separate + * identifier for the buffer object associated with buffer textures. + * Returns 0 if the underlying implementation does not support this, or + * if this is not a buffer texture. + */ +uint64_t CLP(TextureContext):: +get_native_buffer_id() const { + return _buffer; +} + /** * */ diff --git a/panda/src/glstuff/glTextureContext_src.h b/panda/src/glstuff/glTextureContext_src.h index 309550eced..9a345b397d 100644 --- a/panda/src/glstuff/glTextureContext_src.h +++ b/panda/src/glstuff/glTextureContext_src.h @@ -33,6 +33,9 @@ public: virtual void evict_lru(); void reset_data(); + virtual uint64_t get_native_id() const; + virtual uint64_t get_native_buffer_id() const; + #ifndef OPENGLES void make_handle_resident(); GLuint64 get_handle(); diff --git a/panda/src/gobj/textureContext.cxx b/panda/src/gobj/textureContext.cxx index b0130bcf24..32224a7bde 100644 --- a/panda/src/gobj/textureContext.cxx +++ b/panda/src/gobj/textureContext.cxx @@ -15,6 +15,27 @@ TypeHandle TextureContext::_type_handle; +/** + * Returns an implementation-defined handle or pointer that can be used + * to interface directly with the underlying API. + * Returns 0 if the underlying implementation does not support this. + */ +uint64_t TextureContext:: +get_native_id() const { + return 0; +} + +/** + * Similar to get_native_id, but some implementations use a separate + * identifier for the buffer object associated with buffer textures. + * Returns 0 if the underlying implementation does not support this, or + * if this is not a buffer texture. + */ +uint64_t TextureContext:: +get_native_buffer_id() const { + return 0; +} + /** * */ diff --git a/panda/src/gobj/textureContext.h b/panda/src/gobj/textureContext.h index 7f5a514c81..813cd37dd9 100644 --- a/panda/src/gobj/textureContext.h +++ b/panda/src/gobj/textureContext.h @@ -37,6 +37,8 @@ public: PUBLISHED: INLINE Texture *get_texture() const; INLINE int get_view() const; + virtual uint64_t get_native_id() const; + virtual uint64_t get_native_buffer_id() const; INLINE bool was_modified() const; INLINE bool was_properties_modified() const;