mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 09:15:50 +02:00
Add private start/stopNamedCall batch commands
This commit is contained in:
parent
753fc44c12
commit
4d6931c5a8
4 changed files with 41 additions and 3 deletions
|
@ -344,6 +344,15 @@ void Batch::runLambda(std::function<void()> f) {
|
|||
_params.push_back(_lambdas.cache(f));
|
||||
}
|
||||
|
||||
void Batch::startNamedCall(const std::string& name) {
|
||||
ADD_COMMAND(startNamedCall);
|
||||
_params.push_back(_names.cache(name));
|
||||
}
|
||||
|
||||
void Batch::stopNamedCall() {
|
||||
ADD_COMMAND(stopNamedCall);
|
||||
}
|
||||
|
||||
void Batch::enableStereo(bool enable) {
|
||||
_enableStereo = enable;
|
||||
}
|
||||
|
@ -383,8 +392,14 @@ BufferPointer Batch::getNamedBuffer(const std::string& instanceName, uint8_t ind
|
|||
|
||||
void Batch::preExecute() {
|
||||
for (auto& mapItem : _namedData) {
|
||||
mapItem.second.process(*this);
|
||||
auto& name = mapItem.first;
|
||||
auto& instance = mapItem.second;
|
||||
|
||||
startNamedCall(name);
|
||||
instance.process(*this);
|
||||
stopNamedCall();
|
||||
}
|
||||
|
||||
_namedData.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -304,6 +304,9 @@ public:
|
|||
|
||||
COMMAND_runLambda,
|
||||
|
||||
COMMAND_startNamedCall,
|
||||
COMMAND_stopNamedCall,
|
||||
|
||||
// TODO: As long as we have gl calls explicitely issued from interface
|
||||
// code, we need to be able to record and batch these calls. THe long
|
||||
// term strategy is to get rid of any GL calls in favor of the HIFI GPU API
|
||||
|
@ -395,7 +398,7 @@ public:
|
|||
typedef Cache<PipelinePointer>::Vector PipelineCaches;
|
||||
typedef Cache<FramebufferPointer>::Vector FramebufferCaches;
|
||||
typedef Cache<QueryPointer>::Vector QueryCaches;
|
||||
typedef Cache<std::string>::Vector ProfileRangeCaches;
|
||||
typedef Cache<std::string>::Vector StringCaches;
|
||||
typedef Cache<std::function<void()>>::Vector LambdaCache;
|
||||
|
||||
// Cache Data in a byte array if too big to fit in Param
|
||||
|
@ -423,7 +426,8 @@ public:
|
|||
FramebufferCaches _framebuffers;
|
||||
QueryCaches _queries;
|
||||
LambdaCache _lambdas;
|
||||
ProfileRangeCaches _profileRanges;
|
||||
StringCaches _profileRanges;
|
||||
StringCaches _names;
|
||||
|
||||
NamedBatchDataMap _namedData;
|
||||
|
||||
|
@ -431,6 +435,9 @@ public:
|
|||
bool _enableSkybox{ false };
|
||||
|
||||
protected:
|
||||
void startNamedCall(const std::string& name);
|
||||
void stopNamedCall();
|
||||
|
||||
// Maybe useful but shoudln't be public. Please convince me otherwise
|
||||
void runLambda(std::function<void()> f);
|
||||
};
|
||||
|
|
|
@ -62,6 +62,9 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
|||
|
||||
(&::gpu::GLBackend::do_runLambda),
|
||||
|
||||
(&::gpu::GLBackend::do_startNamedCall),
|
||||
(&::gpu::GLBackend::do_stopNamedCall),
|
||||
|
||||
(&::gpu::GLBackend::do_glActiveBindTexture),
|
||||
|
||||
(&::gpu::GLBackend::do_glUniform1i),
|
||||
|
@ -423,6 +426,14 @@ void GLBackend::do_runLambda(Batch& batch, size_t paramOffset) {
|
|||
f();
|
||||
}
|
||||
|
||||
void GLBackend::do_startNamedCall(Batch& batch, size_t paramOffset) {
|
||||
_currentNamedCall = batch._names.get(batch._params[paramOffset]._uint);
|
||||
}
|
||||
|
||||
void GLBackend::do_stopNamedCall(Batch& batch, size_t paramOffset) {
|
||||
_currentNamedCall.clear();
|
||||
}
|
||||
|
||||
void GLBackend::resetStages() {
|
||||
resetInputStage();
|
||||
resetPipelineStage();
|
||||
|
|
|
@ -245,6 +245,8 @@ protected:
|
|||
void renderPassTransfer(Batch& batch);
|
||||
void renderPassDraw(Batch& batch);
|
||||
|
||||
std::string _currentNamedCall;
|
||||
|
||||
Stats _stats;
|
||||
|
||||
// Draw Stage
|
||||
|
@ -465,6 +467,9 @@ protected:
|
|||
|
||||
void do_runLambda(Batch& batch, size_t paramOffset);
|
||||
|
||||
void do_startNamedCall(Batch& batch, size_t paramOffset);
|
||||
void do_stopNamedCall(Batch& batch, size_t paramOffset);
|
||||
|
||||
void resetStages();
|
||||
|
||||
// TODO: As long as we have gl calls explicitely issued from interface
|
||||
|
|
Loading…
Reference in a new issue