mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 15:13:09 +02:00
Capture DrawCallInfo during renderPassTransfer
This commit is contained in:
parent
4d6931c5a8
commit
bd8f62504d
2 changed files with 48 additions and 16 deletions
|
@ -170,6 +170,7 @@ void GLBackend::renderPassTransfer(Batch& batch) {
|
|||
case Batch::COMMAND_drawInstanced:
|
||||
case Batch::COMMAND_drawIndexedInstanced:
|
||||
_transform.preUpdate(_commandIndex, _stereo);
|
||||
captureDrawCallInfo();
|
||||
break;
|
||||
|
||||
case Batch::COMMAND_setModelTransform:
|
||||
|
|
|
@ -245,8 +245,39 @@ protected:
|
|||
void renderPassTransfer(Batch& batch);
|
||||
void renderPassDraw(Batch& batch);
|
||||
|
||||
class DrawCallInfo {
|
||||
public:
|
||||
using Index = uint16_t;
|
||||
|
||||
DrawCallInfo(Index idx) : index(idx) {}
|
||||
|
||||
Index index;
|
||||
uint16_t unused; // Reserved space for later
|
||||
};
|
||||
// Make sure DrawCallInfo has no extra padding
|
||||
static_assert(sizeof(DrawCallInfo) == 4, "DrawCallInfo size is incorrect.");
|
||||
|
||||
using DrawCallInfoBuffer = std::vector<DrawCallInfo>;
|
||||
using NamedDrawCallInfoBuffer = std::map<std::string, DrawCallInfoBuffer>;
|
||||
|
||||
DrawCallInfoBuffer _drawCallInfos;
|
||||
NamedDrawCallInfoBuffer _namedDrawCallInfos;
|
||||
|
||||
std::string _currentNamedCall;
|
||||
|
||||
DrawCallInfoBuffer& getDrawCallInfoBuffer() {
|
||||
if (_currentNamedCall.empty()) {
|
||||
return _drawCallInfos;
|
||||
} else {
|
||||
return _namedDrawCallInfos[_currentNamedCall];
|
||||
}
|
||||
}
|
||||
|
||||
void captureDrawCallInfo() {
|
||||
auto& drawCallInfos = getDrawCallInfoBuffer();
|
||||
drawCallInfos.push_back(_transform._objects.size() - 1);
|
||||
}
|
||||
|
||||
Stats _stats;
|
||||
|
||||
// Draw Stage
|
||||
|
|
Loading…
Reference in a new issue