|
|
|
|
@ -26,8 +26,8 @@
|
|
|
|
|
|
|
|
|
|
#include "Buffer.h" |
|
|
|
|
|
|
|
|
|
#include <tuple> |
|
|
|
|
#include <Corrade/Containers/Array.h> |
|
|
|
|
#include <Corrade/Containers/Triple.h> |
|
|
|
|
#ifndef MAGNUM_TARGET_WEBGL |
|
|
|
|
#include <Corrade/Containers/String.h> |
|
|
|
|
#endif |
|
|
|
|
@ -151,7 +151,11 @@ void Buffer::unbind(const Target target, const UnsignedInt firstIndex, const std
|
|
|
|
|
Context::current().state().buffer.bindBasesImplementation(target, firstIndex, {nullptr, count}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Buffer::bind(const Target target, const UnsignedInt firstIndex, Containers::ArrayView<const std::tuple<Buffer*, GLintptr, GLsizeiptr>> buffers) { |
|
|
|
|
void Buffer::bind(const Target target, const UnsignedInt firstIndex, Containers::ArrayView<const Containers::Triple<Buffer*, GLintptr, GLsizeiptr>> buffers) { |
|
|
|
|
Context::current().state().buffer.bindRangesImplementation(target, firstIndex, {buffers.begin(), buffers.size()}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Buffer::bind(const Target target, const UnsignedInt firstIndex, std::initializer_list<Containers::Triple<Buffer*, GLintptr, GLsizeiptr>> buffers) { |
|
|
|
|
Context::current().state().buffer.bindRangesImplementation(target, firstIndex, {buffers.begin(), buffers.size()}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -404,24 +408,25 @@ void Buffer::bindImplementationMulti(const Target target, const GLuint firstInde
|
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
void Buffer::bindImplementationFallback(const Target target, const GLuint firstIndex, Containers::ArrayView<const std::tuple<Buffer*, GLintptr, GLsizeiptr>> buffers) { |
|
|
|
|
void Buffer::bindImplementationFallback(const Target target, const GLuint firstIndex, Containers::ArrayView<const Containers::Triple<Buffer*, GLintptr, GLsizeiptr>> buffers) { |
|
|
|
|
for(std::size_t i = 0; i != buffers.size(); ++i) { |
|
|
|
|
if(buffers && std::get<0>(buffers[i])) |
|
|
|
|
std::get<0>(buffers[i])->bind(target, firstIndex + i, std::get<1>(buffers[i]), std::get<2>(buffers[i])); |
|
|
|
|
if(buffers && buffers[i].first()) |
|
|
|
|
buffers[i].first()->bind(target, firstIndex + i, buffers[i].second(), buffers[i].third()); |
|
|
|
|
else unbind(target, firstIndex + i); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
void Buffer::bindImplementationMulti(const Target target, const GLuint firstIndex, Containers::ArrayView<const std::tuple<Buffer*, GLintptr, GLsizeiptr>> buffers) { |
|
|
|
|
void Buffer::bindImplementationMulti(const Target target, const GLuint firstIndex, Containers::ArrayView<const Containers::Triple<Buffer*, GLintptr, GLsizeiptr>> buffers) { |
|
|
|
|
/** @todo use ArrayTuple */ |
|
|
|
|
Containers::Array<GLuint> ids{buffers ? buffers.size() : 0}; |
|
|
|
|
Containers::Array<GLintptr> offsetsSizes{buffers ? buffers.size()*2 : 0}; |
|
|
|
|
if(buffers) for(std::size_t i = 0; i != buffers.size(); ++i) { |
|
|
|
|
if(std::get<0>(buffers[i])) { |
|
|
|
|
std::get<0>(buffers[i])->createIfNotAlready(); |
|
|
|
|
ids[i] = std::get<0>(buffers[i])->_id; |
|
|
|
|
std::tie(std::ignore, offsetsSizes[i], offsetsSizes[buffers.size() + i]) = buffers[i]; |
|
|
|
|
if(buffers[i].first()) { |
|
|
|
|
buffers[i].first()->createIfNotAlready(); |
|
|
|
|
ids[i] = buffers[i].first()->_id; |
|
|
|
|
offsetsSizes[i] = buffers[i].second(); |
|
|
|
|
offsetsSizes[buffers.size() + i] = buffers[i].third(); |
|
|
|
|
} else { |
|
|
|
|
ids[i] = 0; |
|
|
|
|
offsetsSizes[i] = 0; |
|
|
|
|
|