feat(render): style, GLSL line/text pipelines, staging batches, bitmap font
This commit is contained in:
1 parent
9a086b7d69
commit
7cbc1c9955
22 files changed
+1535
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#include <plot/render/buffer.hpp>
|
||||
|
||||
namespace plot::render {
|
||||
namespace detail {
|
||||
|
||||
bool InstanceStore::create(Status* st) noexcept {
|
||||
// plot::gl::Buffer::create() already reports Unsupported while the entry
|
||||
// points are unresolved and GLFailure when the driver hands out no name, so
|
||||
// the wrapper only has to propagate its answer.
|
||||
if (!buffer_.create(st)) {
|
||||
return false;
|
||||
}
|
||||
capacity_ = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void InstanceStore::upload(const void* data, u32 count, usize instance_bytes) noexcept {
|
||||
if (buffer_.id() == 0 || count == 0 || instance_bytes == 0) {
|
||||
return;
|
||||
}
|
||||
if (count > capacity_) {
|
||||
// Only a workload larger than anything staged so far pays for an
|
||||
// allocation; a frame that repeats the previous one writes into the store
|
||||
// that is already there.
|
||||
buffer_.upload(nullptr, static_cast<usize>(count) * instance_bytes, gl::GL_STREAM_DRAW);
|
||||
capacity_ = count;
|
||||
}
|
||||
buffer_.upload_sub(data, static_cast<usize>(count) * instance_bytes, 0);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace plot::render
|
||||
Reference in new issue
Block a user