mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 20:42:56 +02:00
set currentNamedCall during setupNamedCalls
This commit is contained in:
parent
670cfc263b
commit
d639a838ad
5 changed files with 10 additions and 10 deletions
|
@ -378,7 +378,9 @@ void Batch::setupNamedCalls(const std::string& instanceName, NamedBatchData::Fun
|
||||||
instance.function = function;
|
instance.function = function;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_currentNamedCall = instanceName;
|
||||||
captureDrawCallInfo();
|
captureDrawCallInfo();
|
||||||
|
_currentNamedCall.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferPointer Batch::getNamedBuffer(const std::string& instanceName, uint8_t index) {
|
BufferPointer Batch::getNamedBuffer(const std::string& instanceName, uint8_t index) {
|
||||||
|
@ -411,9 +413,8 @@ const Batch::DrawCallInfoBuffer& Batch::getDrawCallInfoBuffer() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Batch::captureDrawCallInfo() {
|
void Batch::captureDrawCallInfo() {
|
||||||
TransformObject object;
|
|
||||||
|
|
||||||
if (_invalidModel) {
|
if (_invalidModel) {
|
||||||
|
TransformObject object;
|
||||||
_currentModel.getMatrix(object._model);
|
_currentModel.getMatrix(object._model);
|
||||||
|
|
||||||
// FIXME - we don't want to be using glm::inverse() here but it fixes the flickering issue we are
|
// FIXME - we don't want to be using glm::inverse() here but it fixes the flickering issue we are
|
||||||
|
@ -423,10 +424,10 @@ void Batch::captureDrawCallInfo() {
|
||||||
object._modelInverse = glm::inverse(object._model);
|
object._modelInverse = glm::inverse(object._model);
|
||||||
|
|
||||||
_objects.push_back(object);
|
_objects.push_back(object);
|
||||||
}
|
|
||||||
|
|
||||||
// Flags are clean
|
// Flag is clean
|
||||||
_invalidModel = false;
|
_invalidModel = false;
|
||||||
|
}
|
||||||
|
|
||||||
auto& drawCallInfos = getDrawCallInfoBuffer();
|
auto& drawCallInfos = getDrawCallInfoBuffer();
|
||||||
drawCallInfos.push_back((uint16)_objects.size() - 1);
|
drawCallInfos.push_back((uint16)_objects.size() - 1);
|
||||||
|
|
|
@ -447,7 +447,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
using TransformObjects = std::vector<TransformObject>;
|
using TransformObjects = std::vector<TransformObject>;
|
||||||
bool _invalidModel { false };
|
bool _invalidModel { true };
|
||||||
Transform _currentModel;
|
Transform _currentModel;
|
||||||
TransformObjects _objects;
|
TransformObjects _objects;
|
||||||
|
|
||||||
|
|
|
@ -412,12 +412,12 @@ void GLBackend::do_runLambda(Batch& batch, size_t paramOffset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::do_startNamedCall(Batch& batch, size_t paramOffset) {
|
void GLBackend::do_startNamedCall(Batch& batch, size_t paramOffset) {
|
||||||
_currentNamedCall = batch._names.get(batch._params[paramOffset]._uint);
|
batch._currentNamedCall = batch._names.get(batch._params[paramOffset]._uint);
|
||||||
_currentDraw = -1;
|
_currentDraw = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::do_stopNamedCall(Batch& batch, size_t paramOffset) {
|
void GLBackend::do_stopNamedCall(Batch& batch, size_t paramOffset) {
|
||||||
_currentNamedCall.clear();
|
batch._currentNamedCall.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::resetStages() {
|
void GLBackend::resetStages() {
|
||||||
|
|
|
@ -482,7 +482,6 @@ protected:
|
||||||
void do_pushProfileRange(Batch& batch, size_t paramOffset);
|
void do_pushProfileRange(Batch& batch, size_t paramOffset);
|
||||||
void do_popProfileRange(Batch& batch, size_t paramOffset);
|
void do_popProfileRange(Batch& batch, size_t paramOffset);
|
||||||
|
|
||||||
std::string _currentNamedCall;
|
|
||||||
int _currentDraw { -1 };
|
int _currentDraw { -1 };
|
||||||
|
|
||||||
typedef void (GLBackend::*CommandCall)(Batch&, size_t);
|
typedef void (GLBackend::*CommandCall)(Batch&, size_t);
|
||||||
|
|
|
@ -168,7 +168,7 @@ void GLBackend::updateTransform(const Batch& batch) {
|
||||||
_transform.update(_commandIndex, _stereo);
|
_transform.update(_commandIndex, _stereo);
|
||||||
|
|
||||||
auto& drawCallInfoBuffer = batch.getDrawCallInfoBuffer();
|
auto& drawCallInfoBuffer = batch.getDrawCallInfoBuffer();
|
||||||
if (_currentNamedCall.empty()) {
|
if (batch._currentNamedCall.empty()) {
|
||||||
auto& drawCallInfo = drawCallInfoBuffer[_currentDraw];
|
auto& drawCallInfo = drawCallInfoBuffer[_currentDraw];
|
||||||
glVertexAttribI2i(gpu::Stream::DRAW_CALL_INFO, (GLint)drawCallInfo.index, (GLint)drawCallInfo.unused);
|
glVertexAttribI2i(gpu::Stream::DRAW_CALL_INFO, (GLint)drawCallInfo.index, (GLint)drawCallInfo.unused);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue