mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 13:33:27 +02:00
Exploring the bad peroformances
This commit is contained in:
parent
301d6c4de8
commit
8923055e91
5 changed files with 15 additions and 15 deletions
|
@ -61,9 +61,10 @@ GLBuffer* GL45Backend::syncGPUObject(const Buffer& buffer) {
|
||||||
|
|
||||||
|
|
||||||
bool GL45Backend::bindResourceBuffer(uint32_t slot, const BufferPointer& buffer) {
|
bool GL45Backend::bindResourceBuffer(uint32_t slot, const BufferPointer& buffer) {
|
||||||
GLBuffer* object = syncGPUObject((*buffer));
|
// GLBuffer* object = syncGPUObject((*buffer));
|
||||||
if (object) {
|
auto bo = getBufferIDUnsynced((*buffer));
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, slot, object->_id);
|
if (bo) {
|
||||||
|
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, slot, bo);
|
||||||
|
|
||||||
(void)CHECK_GL_ERROR();
|
(void)CHECK_GL_ERROR();
|
||||||
|
|
||||||
|
|
|
@ -685,6 +685,8 @@ void Batch::_glColor4f(float red, float green, float blue, float alpha) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Batch::finishFrame(BufferUpdates& updates) {
|
void Batch::finishFrame(BufferUpdates& updates) {
|
||||||
|
PROFILE_RANGE(render_gpu, __FUNCTION__);
|
||||||
|
|
||||||
for (auto& mapItem : _namedData) {
|
for (auto& mapItem : _namedData) {
|
||||||
auto& name = mapItem.first;
|
auto& name = mapItem.first;
|
||||||
auto& instance = mapItem.second;
|
auto& instance = mapItem.second;
|
||||||
|
@ -713,6 +715,7 @@ void Batch::finishFrame(BufferUpdates& updates) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Batch::flush() {
|
void Batch::flush() {
|
||||||
|
PROFILE_RANGE(render_gpu, __FUNCTION__);
|
||||||
for (auto& mapItem : _namedData) {
|
for (auto& mapItem : _namedData) {
|
||||||
auto& name = mapItem.first;
|
auto& name = mapItem.first;
|
||||||
auto& instance = mapItem.second;
|
auto& instance = mapItem.second;
|
||||||
|
|
|
@ -84,6 +84,7 @@ void Context::appendFrameBatch(const BatchPointer& batch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FramePointer Context::endFrame() {
|
FramePointer Context::endFrame() {
|
||||||
|
PROFILE_RANGE(render_gpu, __FUNCTION__);
|
||||||
assert(_frameActive);
|
assert(_frameActive);
|
||||||
auto result = _currentFrame;
|
auto result = _currentFrame;
|
||||||
_currentFrame.reset();
|
_currentFrame.reset();
|
||||||
|
@ -101,10 +102,12 @@ void Context::executeBatch(Batch& batch) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::recycle() const {
|
void Context::recycle() const {
|
||||||
|
PROFILE_RANGE(render_gpu, __FUNCTION__);
|
||||||
_backend->recycle();
|
_backend->recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::consumeFrameUpdates(const FramePointer& frame) const {
|
void Context::consumeFrameUpdates(const FramePointer& frame) const {
|
||||||
|
PROFILE_RANGE(render_gpu, __FUNCTION__);
|
||||||
frame->preRender();
|
frame->preRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,14 @@ Frame::~Frame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Frame::finish() {
|
void Frame::finish() {
|
||||||
|
PROFILE_RANGE(render_gpu, __FUNCTION__);
|
||||||
for (const auto& batch : batches) {
|
for (const auto& batch : batches) {
|
||||||
batch->finishFrame(bufferUpdates);
|
batch->finishFrame(bufferUpdates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Frame::preRender() {
|
void Frame::preRender() {
|
||||||
|
PROFILE_RANGE(render_gpu, __FUNCTION__);
|
||||||
for (auto& update : bufferUpdates) {
|
for (auto& update : bufferUpdates) {
|
||||||
update.apply();
|
update.apply();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1669,15 +1669,6 @@ void Blender::run() {
|
||||||
currentBlendshapeOffset.tangentOffsetAndSpare += glm::vec4(blendshape.tangents.at(j) * normalCoefficient, 0.0f);
|
currentBlendshapeOffset.tangentOffsetAndSpare += glm::vec4(blendshape.tangents.at(j) * normalCoefficient, 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*#if FBX_PACK_NORMALS
|
|
||||||
glm::uint32 finalNormal;
|
|
||||||
glm::uint32 finalTangent;
|
|
||||||
buffer_helpers::packNormalAndTangent(normal, tangent, finalNormal, finalTangent);
|
|
||||||
#else
|
|
||||||
const auto& finalNormal = normal;
|
|
||||||
const auto& finalTangent = tangent;
|
|
||||||
#endif*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1697,6 +1688,7 @@ bool Model::maybeStartBlender() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::setBlendedVertices(int blendNumber, const QVector<BlendshapeOffset>& blendshapeOffsets) {
|
void Model::setBlendedVertices(int blendNumber, const QVector<BlendshapeOffset>& blendshapeOffsets) {
|
||||||
|
PROFILE_RANGE(render, __FUNCTION__);
|
||||||
if (!isLoaded() || blendNumber < _appliedBlendNumber || !_blendshapeBuffersInitialized) {
|
if (!isLoaded() || blendNumber < _appliedBlendNumber || !_blendshapeBuffersInitialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1712,7 +1704,7 @@ void Model::setBlendedVertices(int blendNumber, const QVector<BlendshapeOffset>&
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto blendshapeOffsetSize = meshBlendshapeOffsets->second.size() * sizeof(BlendshapeOffset);
|
const auto blendshapeOffsetSize = meshBlendshapeOffsets->second.size() * sizeof(BlendshapeOffset);
|
||||||
buffer->second->setData(blendshapeOffsetSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset));
|
buffer->second->setSubData(0, blendshapeOffsetSize, (gpu::Byte*) blendshapeOffsets.constData() + index * sizeof(BlendshapeOffset));
|
||||||
|
|
||||||
index += meshBlendshapeOffsets->second.size();
|
index += meshBlendshapeOffsets->second.size();
|
||||||
}
|
}
|
||||||
|
@ -1728,11 +1720,10 @@ void Model::initializeBlendshapes(const FBXMesh& mesh, int index) {
|
||||||
}
|
}
|
||||||
// Mesh has blendshape, let s allocate the local buffer if not done yet
|
// Mesh has blendshape, let s allocate the local buffer if not done yet
|
||||||
if (_blendshapeBuffers.find(index) == _blendshapeBuffers.end()) {
|
if (_blendshapeBuffers.find(index) == _blendshapeBuffers.end()) {
|
||||||
_blendshapeBuffers[index] = std::make_shared<gpu::Buffer>();
|
|
||||||
QVector<BlendshapeOffset> blendshapeOffset;
|
QVector<BlendshapeOffset> blendshapeOffset;
|
||||||
blendshapeOffset.fill(BlendshapeOffset(), 3 * mesh.vertices.size());
|
blendshapeOffset.fill(BlendshapeOffset(), 3 * mesh.vertices.size());
|
||||||
const auto blendshapeOffsetsSize = blendshapeOffset.size() * sizeof(BlendshapeOffset);
|
const auto blendshapeOffsetsSize = blendshapeOffset.size() * sizeof(BlendshapeOffset);
|
||||||
_blendshapeBuffers[index]->setData(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData());
|
_blendshapeBuffers[index] = std::make_shared<gpu::Buffer>(blendshapeOffsetsSize, (const gpu::Byte*) blendshapeOffset.constData(), blendshapeOffsetsSize);
|
||||||
_blendshapeOffsets[index] = blendshapeOffset;
|
_blendshapeOffsets[index] = blendshapeOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue