mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Trying to use separate vertex attribute format
This commit is contained in:
parent
d471cc4ec5
commit
8eb89b394c
2 changed files with 26 additions and 8 deletions
|
@ -292,7 +292,8 @@ public:
|
||||||
|
|
||||||
|
|
||||||
static const int MAX_NUM_ATTRIBUTES = Stream::NUM_INPUT_SLOTS;
|
static const int MAX_NUM_ATTRIBUTES = Stream::NUM_INPUT_SLOTS;
|
||||||
static const int MAX_NUM_INPUT_BUFFERS = 16;
|
// The drawcall Info attribute channel is reserved and is the upper bound for the number of availables Input buffers
|
||||||
|
static const int MAX_NUM_INPUT_BUFFERS = Stream::DRAW_CALL_INFO;
|
||||||
|
|
||||||
size_t getNumInputBuffers() const { return _input._invalidBuffers.size(); }
|
size_t getNumInputBuffers() const { return _input._invalidBuffers.size(); }
|
||||||
|
|
||||||
|
@ -435,6 +436,8 @@ protected:
|
||||||
bool _invalidProj { false };
|
bool _invalidProj { false };
|
||||||
bool _invalidViewport { false };
|
bool _invalidViewport { false };
|
||||||
|
|
||||||
|
bool _enabledDrawcallInfoBuffer{ false };
|
||||||
|
|
||||||
using Pair = std::pair<size_t, size_t>;
|
using Pair = std::pair<size_t, size_t>;
|
||||||
using List = std::list<Pair>;
|
using List = std::list<Pair>;
|
||||||
List _cameraOffsets;
|
List _cameraOffsets;
|
||||||
|
|
|
@ -206,19 +206,34 @@ void GLBackend::updateTransform(const Batch& batch) {
|
||||||
auto& drawCallInfoBuffer = batch.getDrawCallInfoBuffer();
|
auto& drawCallInfoBuffer = batch.getDrawCallInfoBuffer();
|
||||||
if (batch._currentNamedCall.empty()) {
|
if (batch._currentNamedCall.empty()) {
|
||||||
auto& drawCallInfo = drawCallInfoBuffer[_currentDraw];
|
auto& drawCallInfo = drawCallInfoBuffer[_currentDraw];
|
||||||
glDisableVertexAttribArray(gpu::Stream::DRAW_CALL_INFO); // Make sure attrib array is disabled
|
if (_transform._enabledDrawcallInfoBuffer) {
|
||||||
|
glDisableVertexAttribArray(gpu::Stream::DRAW_CALL_INFO); // Make sure attrib array is disabled
|
||||||
|
_transform._enabledDrawcallInfoBuffer = false;
|
||||||
|
}
|
||||||
glVertexAttribI2i(gpu::Stream::DRAW_CALL_INFO, drawCallInfo.index, drawCallInfo.unused);
|
glVertexAttribI2i(gpu::Stream::DRAW_CALL_INFO, drawCallInfo.index, drawCallInfo.unused);
|
||||||
} else {
|
} else {
|
||||||
glEnableVertexAttribArray(gpu::Stream::DRAW_CALL_INFO); // Make sure attrib array is enabled
|
if (!_transform._enabledDrawcallInfoBuffer) {
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, _transform._drawCallInfoBuffer);
|
glEnableVertexAttribArray(gpu::Stream::DRAW_CALL_INFO); // Make sure attrib array is enabled
|
||||||
glVertexAttribIPointer(gpu::Stream::DRAW_CALL_INFO, 2, GL_UNSIGNED_SHORT, 0,
|
// glBindBuffer(GL_ARRAY_BUFFER, _transform._drawCallInfoBuffer);
|
||||||
_transform._drawCallInfoOffsets[batch._currentNamedCall]);
|
/* glVertexAttribIPointer(gpu::Stream::DRAW_CALL_INFO, 2, GL_UNSIGNED_SHORT, 0,
|
||||||
glVertexAttribDivisor(gpu::Stream::DRAW_CALL_INFO, 1);
|
_transform._drawCallInfoOffsets[batch._currentNamedCall]);
|
||||||
|
glVertexAttribDivisor(gpu::Stream::DRAW_CALL_INFO, 1);
|
||||||
|
*/
|
||||||
|
|
||||||
|
glVertexAttribIFormat(gpu::Stream::DRAW_CALL_INFO, 2, GL_UNSIGNED_SHORT, 0);
|
||||||
|
glVertexAttribBinding(gpu::Stream::DRAW_CALL_INFO, gpu::Stream::DRAW_CALL_INFO);
|
||||||
|
glVertexBindingDivisor(gpu::Stream::DRAW_CALL_INFO, 1);
|
||||||
|
_transform._enabledDrawcallInfoBuffer = true;
|
||||||
|
}
|
||||||
|
glBindVertexBuffer(gpu::Stream::DRAW_CALL_INFO, _transform._drawCallInfoBuffer, (GLintptr) _transform._drawCallInfoOffsets[batch._currentNamedCall], 0);
|
||||||
|
// _transform._drawCallInfoOffsets[batch._currentNamedCall]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)CHECK_GL_ERROR();
|
(void)CHECK_GL_ERROR();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::resetTransformStage() {
|
void GLBackend::resetTransformStage() {
|
||||||
|
glDisableVertexAttribArray(gpu::Stream::DRAW_CALL_INFO);
|
||||||
|
_transform._enabledDrawcallInfoBuffer = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue