improve usage of opengl PBO and fence
This commit is contained in:
parent
42738f4923
commit
1ee59aaedf
@ -15,12 +15,10 @@ namespace nf7::gl {
|
||||
inline void Await(const std::shared_ptr<nf7::Context>& ctx,
|
||||
nf7::Future<std::monostate>::Promise& pro,
|
||||
GLsync sync) noexcept {
|
||||
GLsizei len;
|
||||
GLint v;
|
||||
glGetSynciv(sync, GL_SYNC_STATUS, sizeof(v), &len, &v);
|
||||
const auto state = glClientWaitSync(sync, 0, 0);
|
||||
assert(0 == glGetError());
|
||||
|
||||
if (v == GL_SIGNALED) {
|
||||
if (state == GL_ALREADY_SIGNALED || state == GL_CONDITION_SATISFIED) {
|
||||
glDeleteSync(sync);
|
||||
pro.Return({});
|
||||
} else {
|
||||
|
@ -497,7 +497,7 @@ struct Texture {
|
||||
const auto size = tex.meta().size;
|
||||
const auto texel = std::accumulate(size.begin(), size.end(), 1, std::multiplies<uint32_t> {});
|
||||
const auto bsize = static_cast<size_t>(texel)*GetCompCount(comp)*GetByteSize(numtype);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, static_cast<GLsizeiptr>(bsize), nullptr, GL_DYNAMIC_READ);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, static_cast<GLsizeiptr>(bsize), nullptr, GL_STREAM_READ);
|
||||
|
||||
const auto t = gl::ToEnum(tex.meta().target);
|
||||
glBindTexture(t, tex.id());
|
||||
|
Loading…
x
Reference in New Issue
Block a user