mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 08:45:45 +00:00
buffer_cache: Return handles instead of pointer to handles
The original idea of returning pointers is that handles can be moved. The problem is that the implementation didn't take that in mind and made everything harder to work with. This commit drops pointer to handles and returns the handles themselves. While it is still true that handles can be invalidated, this way we get an old handle instead of a dangling pointer. This problem can be solved in the future with sparse buffers.
This commit is contained in:
parent
f2f2262c5e
commit
c1ad40a3cb
14 changed files with 90 additions and 228 deletions
|
@ -11,49 +11,6 @@
|
|||
|
||||
namespace OpenGL {
|
||||
|
||||
class StateTracker;
|
||||
|
||||
class VertexArrayPushBuffer final {
|
||||
public:
|
||||
explicit VertexArrayPushBuffer(StateTracker& state_tracker);
|
||||
~VertexArrayPushBuffer();
|
||||
|
||||
void Setup();
|
||||
|
||||
void SetIndexBuffer(const GLuint* buffer);
|
||||
|
||||
void SetVertexBuffer(GLuint binding_index, const GLuint* buffer, GLintptr offset,
|
||||
GLsizei stride);
|
||||
|
||||
void Bind();
|
||||
|
||||
private:
|
||||
struct Entry;
|
||||
|
||||
StateTracker& state_tracker;
|
||||
|
||||
const GLuint* index_buffer{};
|
||||
std::vector<Entry> vertex_buffers;
|
||||
};
|
||||
|
||||
class BindBuffersRangePushBuffer final {
|
||||
public:
|
||||
explicit BindBuffersRangePushBuffer(GLenum target);
|
||||
~BindBuffersRangePushBuffer();
|
||||
|
||||
void Setup();
|
||||
|
||||
void Push(GLuint binding, const GLuint* buffer, GLintptr offset, GLsizeiptr size);
|
||||
|
||||
void Bind();
|
||||
|
||||
private:
|
||||
struct Entry;
|
||||
|
||||
GLenum target;
|
||||
std::vector<Entry> entries;
|
||||
};
|
||||
|
||||
void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string_view extra_info = {});
|
||||
|
||||
} // namespace OpenGL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue