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
|
@ -165,24 +165,25 @@ void GLBackend::renderPassTransfer(Batch& batch) {
|
||||||
|
|
||||||
for (_commandIndex = 0; _commandIndex < numCommands; ++_commandIndex) {
|
for (_commandIndex = 0; _commandIndex < numCommands; ++_commandIndex) {
|
||||||
switch (*command) {
|
switch (*command) {
|
||||||
case Batch::COMMAND_draw:
|
case Batch::COMMAND_draw:
|
||||||
case Batch::COMMAND_drawIndexed:
|
case Batch::COMMAND_drawIndexed:
|
||||||
case Batch::COMMAND_drawInstanced:
|
case Batch::COMMAND_drawInstanced:
|
||||||
case Batch::COMMAND_drawIndexedInstanced:
|
case Batch::COMMAND_drawIndexedInstanced:
|
||||||
_transform.preUpdate(_commandIndex, _stereo);
|
_transform.preUpdate(_commandIndex, _stereo);
|
||||||
break;
|
captureDrawCallInfo();
|
||||||
|
break;
|
||||||
|
|
||||||
case Batch::COMMAND_setModelTransform:
|
case Batch::COMMAND_setModelTransform:
|
||||||
case Batch::COMMAND_setViewportTransform:
|
case Batch::COMMAND_setViewportTransform:
|
||||||
case Batch::COMMAND_setViewTransform:
|
case Batch::COMMAND_setViewTransform:
|
||||||
case Batch::COMMAND_setProjectionTransform: {
|
case Batch::COMMAND_setProjectionTransform: {
|
||||||
CommandCall call = _commandCalls[(*command)];
|
CommandCall call = _commandCalls[(*command)];
|
||||||
(this->*(call))(batch, *offset);
|
(this->*(call))(batch, *offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
command++;
|
command++;
|
||||||
offset++;
|
offset++;
|
||||||
|
|
|
@ -245,8 +245,39 @@ protected:
|
||||||
void renderPassTransfer(Batch& batch);
|
void renderPassTransfer(Batch& batch);
|
||||||
void renderPassDraw(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;
|
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;
|
Stats _stats;
|
||||||
|
|
||||||
// Draw Stage
|
// Draw Stage
|
||||||
|
|
Loading…
Reference in a new issue