mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Don't capture raw draw calls during named calls processing
This commit is contained in:
parent
a5603140de
commit
838b637591
2 changed files with 21 additions and 4 deletions
|
@ -378,9 +378,7 @@ void Batch::setupNamedCalls(const std::string& instanceName, NamedBatchData::Fun
|
|||
instance.function = function;
|
||||
}
|
||||
|
||||
_currentNamedCall = instanceName;
|
||||
captureDrawCallInfo();
|
||||
_currentNamedCall.clear();
|
||||
captureNamedDrawCallInfo(instanceName);
|
||||
}
|
||||
|
||||
BufferPointer Batch::getNamedBuffer(const std::string& instanceName, uint8_t index) {
|
||||
|
@ -412,7 +410,7 @@ const Batch::DrawCallInfoBuffer& Batch::getDrawCallInfoBuffer() const {
|
|||
}
|
||||
}
|
||||
|
||||
void Batch::captureDrawCallInfo() {
|
||||
void Batch::captureDrawCallInfoImpl() {
|
||||
if (_invalidModel) {
|
||||
TransformObject object;
|
||||
_currentModel.getMatrix(object._model);
|
||||
|
@ -433,6 +431,21 @@ void Batch::captureDrawCallInfo() {
|
|||
drawCallInfos.push_back((uint16)_objects.size() - 1);
|
||||
}
|
||||
|
||||
void Batch::captureDrawCallInfo() {
|
||||
if (!_currentNamedCall.empty()) {
|
||||
// If we are processing a named call, we don't want to register the raw draw calls
|
||||
return;
|
||||
}
|
||||
|
||||
captureDrawCallInfoImpl();
|
||||
}
|
||||
|
||||
void Batch::captureNamedDrawCallInfo(std::string name) {
|
||||
std::swap(_currentNamedCall, name); // Set and save _currentNamedCall
|
||||
captureDrawCallInfoImpl();
|
||||
std::swap(_currentNamedCall, name); // Restore _currentNamedCall
|
||||
}
|
||||
|
||||
void Batch::preExecute() {
|
||||
for (auto& mapItem : _namedData) {
|
||||
auto& name = mapItem.first;
|
||||
|
|
|
@ -91,7 +91,9 @@ public:
|
|||
|
||||
const DrawCallInfoBuffer& getDrawCallInfoBuffer() const;
|
||||
DrawCallInfoBuffer& getDrawCallInfoBuffer();
|
||||
|
||||
void captureDrawCallInfo();
|
||||
void captureNamedDrawCallInfo(std::string name);
|
||||
|
||||
class CacheState {
|
||||
public:
|
||||
|
@ -478,6 +480,8 @@ protected:
|
|||
|
||||
// Maybe useful but shoudln't be public. Please convince me otherwise
|
||||
void runLambda(std::function<void()> f);
|
||||
|
||||
void captureDrawCallInfoImpl();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue