mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:49:34 +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);
|
_pages.markRegion(offset, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::applyUpdate(const Update& update) {
|
|
||||||
_renderPages = update.pages;
|
|
||||||
update.updateOperator(_renderSysmem);
|
|
||||||
}
|
|
||||||
|
|
||||||
Buffer::Update Buffer::getUpdate() const {
|
Buffer::Update Buffer::getUpdate() const {
|
||||||
static Update EMPTY_UPDATE;
|
static Update EMPTY_UPDATE;
|
||||||
if (!_pages) {
|
if (!_pages) {
|
||||||
|
@ -319,6 +314,21 @@ Buffer::Update Buffer::getUpdate() const {
|
||||||
return result;
|
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) {
|
Buffer::Size Buffer::setData(Size size, const Byte* data) {
|
||||||
resize(size);
|
resize(size);
|
||||||
setSubData(0, size, data);
|
setSubData(0, size, data);
|
||||||
|
|
|
@ -105,8 +105,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using Sysmem = gpu::Sysmem;
|
|
||||||
|
|
||||||
Resource() {}
|
Resource() {}
|
||||||
virtual ~Resource() {}
|
virtual ~Resource() {}
|
||||||
|
|
||||||
|
@ -135,7 +133,7 @@ struct PageManager {
|
||||||
uint8 _flags{ 0 };
|
uint8 _flags{ 0 };
|
||||||
const Size _pageSize;
|
const Size _pageSize;
|
||||||
|
|
||||||
operator bool const() {
|
operator bool() const {
|
||||||
return (*this)(DIRTY);
|
return (*this)(DIRTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +344,11 @@ public:
|
||||||
// Main thread operation to say that the buffer is ready to be used as a frame
|
// Main thread operation to say that the buffer is ready to be used as a frame
|
||||||
Update getUpdate() const;
|
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;
|
mutable PageManager _renderPages;
|
||||||
Sysmem _renderSysmem;
|
Sysmem _renderSysmem;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue