mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-25 11:19:03 +01:00
GLES: Use buffer range mapping where appropriate.
This commit is contained in:
1 parent
9eb51a6a36
commit
edcd2f966a
2 files changed
+31
-13
No files matched your search
@@ -633,9 +633,14 @@ size_t GLPushBuffer::GetTotalSize() const {
|
||||
|
||||
void GLPushBuffer::MapDevice() {
|
||||
for (auto &info : buffers_) {
|
||||
if (!info.buffer->buffer) {
|
||||
// Can't map - no device buffer associated yet.
|
||||
continue;
|
||||
}
|
||||
|
||||
assert(!info.deviceMemory);
|
||||
// TODO: Can we use GL_WRITE_ONLY?
|
||||
info.deviceMemory = (uint8_t *)info.buffer->Map(GL_READ_WRITE);
|
||||
info.deviceMemory = (uint8_t *)info.buffer->Map(GL_READ_WRITE, GL_MAP_WRITE_BIT);
|
||||
|
||||
if (info.deviceMemory) {
|
||||
delete[] info.localMemory;
|
||||
@@ -664,3 +669,26 @@ void GLPushBuffer::UnmapDevice() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void *GLRBuffer::Map(GLenum accessOld, GLbitfield accessNew) {
|
||||
assert(buffer != 0);
|
||||
glBindBuffer(target_, buffer);
|
||||
|
||||
void *p;
|
||||
if (gl_extensions.VersionGEThan(3, 0, 0)) {
|
||||
p = glMapBufferRange(target_, 0, size_, accessNew);
|
||||
} else {
|
||||
#ifndef USING_GLES2
|
||||
p = glMapBuffer(target_, accessOld);
|
||||
#endif
|
||||
}
|
||||
|
||||
mapped_ = p != nullptr;
|
||||
return p;
|
||||
}
|
||||
|
||||
bool GLRBuffer::Unmap() {
|
||||
glBindBuffer(target_, buffer);
|
||||
mapped_ = false;
|
||||
return glUnmapBuffer(target_) == GL_TRUE;
|
||||
}
|
||||
@@ -139,18 +139,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void *Map(GLenum access) {
|
||||
glBindBuffer(target_, buffer);
|
||||
void *p = glMapBuffer(target_, access);
|
||||
mapped_ = p != nullptr;
|
||||
return p;
|
||||
}
|
||||
|
||||
bool Unmap() {
|
||||
glBindBuffer(target_, buffer);
|
||||
mapped_ = false;
|
||||
return glUnmapBuffer(target_) == GL_TRUE;
|
||||
}
|
||||
void *Map(GLenum accessOld, GLbitfield accessNew);
|
||||
bool Unmap();
|
||||
|
||||
bool Mapped() {
|
||||
return mapped_;
|
||||
|
||||
Reference in new issue
Block a user