[Fix] (BufferState, GL_Drawing): mark dirty buffers

This commit is contained in:
2025-05-08 21:40:48 +08:00
parent 5142f3c72b
commit 614c5f7324
3 changed files with 34 additions and 16 deletions
+7 -2
View File
@@ -9,10 +9,15 @@
#include "../../../Includes.h"
class BufferState {
template <typename K, typename V>
using unordered_map = ankerl::unordered_dense::map<K, V>;
public:
struct BufferObject {
GLenum usage = GL_STATIC_DRAW;
std::vector<GLubyte> data;
bool dataValid = false;
bool dirty = false; // TODO: encapsulate this with an public API to RHI
bool isMapped = false;
bool generated = false;
GLenum accessMode = GL_READ_WRITE;
@@ -34,8 +39,8 @@ public:
void Delete(GLuint buffer);
GLuint GetCurrentBinding(GLenum target) const;
std::unordered_map<GLenum, GLuint> currentBindings_;
std::unordered_map<GLuint, BufferObject> buffers_;
unordered_map<GLenum, GLuint> currentBindings_;
unordered_map<GLuint, BufferObject> buffers_;
private:
std::vector<GLuint> freeId_;
GLuint lastId_ = 1;