glgsg: Expose native IDs for other kinds of resources than textures

Fixes #1468
This commit is contained in:
rdb 2026-01-15 09:45:46 +01:00
parent d94b2dc5af
commit 0b3bdae8e8
12 changed files with 63 additions and 12 deletions

View File

@ -47,3 +47,13 @@ evict_lru() {
update_data_size_bytes(0);
set_resident(false);
}
/**
* 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(BufferContext)::
get_native_id() const {
return _index;
}

View File

@ -27,6 +27,8 @@ public:
virtual void evict_lru();
virtual uint64_t get_native_id() const;
CLP(GraphicsStateGuardian) *_glgsg;
// This is the GL "name" of the data object.

View File

@ -47,3 +47,13 @@ evict_lru() {
update_data_size_bytes(0);
mark_unloaded();
}
/**
* 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(IndexBufferContext)::
get_native_id() const {
return _index;
}

View File

@ -27,6 +27,8 @@ public:
virtual void evict_lru();
virtual uint64_t get_native_id() const;
CLP(GraphicsStateGuardian) *_glgsg;
// This is the GL "name" of the data object.

View File

@ -68,4 +68,14 @@ reset_data() {
// the sampler later. glGenSamplers(1, &_index);
}
/**
* 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(SamplerContext)::
get_native_id() const {
return _index;
}
#endif // OPENGLES_1

View File

@ -33,6 +33,8 @@ public:
virtual void evict_lru();
void reset_data();
virtual uint64_t get_native_id() const;
// This is the GL "name" of the sampler object.
GLuint _index;

View File

@ -47,3 +47,13 @@ evict_lru() {
update_data_size_bytes(0);
mark_unloaded();
}
/**
* 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(VertexBufferContext)::
get_native_id() const {
return _index;
}

View File

@ -29,6 +29,8 @@ public:
virtual void evict_lru();
virtual uint64_t get_native_id() const;
CLP(GraphicsStateGuardian) *_glgsg;
// This is the GL "name" of the data object.

View File

@ -31,3 +31,13 @@ void SavedContext::
write(std::ostream &out, int indent_level) const {
indent(out, indent_level) << *this << "\n";
}
/**
* 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 SavedContext::
get_native_id() const {
return 0;
}

View File

@ -31,10 +31,12 @@ public:
virtual void write(std::ostream &out, int indent_level) const;
PUBLISHED:
virtual uint64_t get_native_id() const;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
public:
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "SavedContext",

View File

@ -15,16 +15,6 @@
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.

View File

@ -37,7 +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_id() const;
virtual uint64_t get_native_buffer_id() const;
INLINE bool was_modified() const;