mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-14 16:07:01 +02:00
Working on build
This commit is contained in:
parent
cab1843eff
commit
66cc9136eb
2 changed files with 21 additions and 8 deletions
|
@ -282,11 +282,6 @@ void Buffer::markDirty(Size offset, Size bytes) {
|
|||
_pages.markRegion(offset, bytes);
|
||||
}
|
||||
|
||||
void Buffer::applyUpdate(const Update& update) {
|
||||
_renderPages = update.pages;
|
||||
update.updateOperator(_renderSysmem);
|
||||
}
|
||||
|
||||
Buffer::Update Buffer::getUpdate() const {
|
||||
static Update EMPTY_UPDATE;
|
||||
if (!_pages) {
|
||||
|
@ -319,6 +314,21 @@ Buffer::Update Buffer::getUpdate() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void Buffer::applyUpdate(const Update& update) {
|
||||
_renderPages = update.pages;
|
||||
update.updateOperator(_renderSysmem);
|
||||
}
|
||||
|
||||
void Buffer::flush() {
|
||||
_renderPages = _pages;
|
||||
_renderSysmem.resize(_sysmem.getSize());
|
||||
auto dirtyPages = _pages.getMarkedPages();
|
||||
for (Size page : dirtyPages) {
|
||||
Size offset = page * _pages._pageSize;
|
||||
memcpy(_renderSysmem.editData() + offset, _sysmem.readData() + offset, _pages._pageSize);
|
||||
}
|
||||
}
|
||||
|
||||
Buffer::Size Buffer::setData(Size size, const Byte* data) {
|
||||
resize(size);
|
||||
setSubData(0, size, data);
|
||||
|
|
|
@ -105,8 +105,6 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
using Sysmem = gpu::Sysmem;
|
||||
|
||||
Resource() {}
|
||||
virtual ~Resource() {}
|
||||
|
||||
|
@ -135,7 +133,7 @@ struct PageManager {
|
|||
uint8 _flags{ 0 };
|
||||
const Size _pageSize;
|
||||
|
||||
operator bool const() {
|
||||
operator bool() const {
|
||||
return (*this)(DIRTY);
|
||||
}
|
||||
|
||||
|
@ -346,6 +344,11 @@ public:
|
|||
// Main thread operation to say that the buffer is ready to be used as a frame
|
||||
Update getUpdate() const;
|
||||
|
||||
// For use by the render thread to avoid the intermediate step of getUpdate/applyUpdate
|
||||
void flush();
|
||||
|
||||
// FIXME don't maintain a second buffer continuously. We should be able to apply updates
|
||||
// directly to the GL object and discard _renderSysmem and _renderPages
|
||||
mutable PageManager _renderPages;
|
||||
Sysmem _renderSysmem;
|
||||
|
||||
|
|
Loading…
Reference in a new issue