forked from suyu/suyu
gl_texture_cache: Use Stream Buffers instead of Persistant for Buffer Copies.
This commit is contained in:
parent
fac3706253
commit
9422cf7c10
3 changed files with 4 additions and 5 deletions
|
@ -148,12 +148,11 @@ void OGLBuffer::Release() {
|
||||||
handle = 0;
|
handle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLBuffer::MakePersistant(std::size_t buffer_size) {
|
void OGLBuffer::MakeStreamCopy(std::size_t buffer_size) {
|
||||||
if (handle == 0 || buffer_size == 0)
|
if (handle == 0 || buffer_size == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const GLbitfield flags = GL_MAP_PERSISTENT_BIT | GL_MAP_WRITE_BIT | GL_MAP_READ_BIT;
|
glNamedBufferData(handle, buffer_size, nullptr, GL_STREAM_COPY);
|
||||||
glNamedBufferStorage(handle, static_cast<GLsizeiptr>(buffer_size), nullptr, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLSync::Create() {
|
void OGLSync::Create() {
|
||||||
|
|
|
@ -187,7 +187,7 @@ public:
|
||||||
void Release();
|
void Release();
|
||||||
|
|
||||||
// Converts the buffer into a persistant storage buffer
|
// Converts the buffer into a persistant storage buffer
|
||||||
void MakePersistant(std::size_t buffer_size);
|
void MakeStreamCopy(std::size_t buffer_size);
|
||||||
|
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -599,7 +599,7 @@ GLuint TextureCacheOpenGL::FetchPBO(std::size_t buffer_size) {
|
||||||
if (cp.handle == 0) {
|
if (cp.handle == 0) {
|
||||||
const std::size_t ceil_size = 1ULL << l2;
|
const std::size_t ceil_size = 1ULL << l2;
|
||||||
cp.Create();
|
cp.Create();
|
||||||
cp.MakePersistant(ceil_size);
|
cp.MakeStreamCopy(ceil_size);
|
||||||
}
|
}
|
||||||
return cp.handle;
|
return cp.handle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue