|
|
|
|
@ -26,6 +26,8 @@
|
|
|
|
|
#include <Corrade/TestSuite/Compare/Container.h> |
|
|
|
|
|
|
|
|
|
#include "Magnum/DebugTools/BufferData.h" |
|
|
|
|
#include "Magnum/GL/Context.h" |
|
|
|
|
#include "Magnum/GL/Extensions.h" |
|
|
|
|
#include "Magnum/GL/OpenGLTester.h" |
|
|
|
|
|
|
|
|
|
namespace Magnum { namespace DebugTools { namespace Test { namespace { |
|
|
|
|
@ -45,6 +47,14 @@ BufferDataGLTest::BufferDataGLTest() {
|
|
|
|
|
constexpr Int Data[] = {2, 7, 5, 13, 25}; |
|
|
|
|
|
|
|
|
|
void BufferDataGLTest::data() { |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
if(!GL::Context::current().isExtensionSupported<GL::Extensions::ARB::map_buffer_range>()) |
|
|
|
|
CORRADE_SKIP(GL::Extensions::ARB::map_buffer_range::string() + std::string(" is not supported")); |
|
|
|
|
#elif defined(MAGNUM_TARGET_GLES2) |
|
|
|
|
if(!GL::Context::current().isExtensionSupported<GL::Extensions::EXT::map_buffer_range>()) |
|
|
|
|
CORRADE_SKIP(GL::Extensions::EXT::map_buffer_range::string() + std::string(" is not supported")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
GL::Buffer buffer; |
|
|
|
|
buffer.setData(Data, GL::BufferUsage::StaticDraw); |
|
|
|
|
const Containers::Array<Int> contents = bufferData<Int>(buffer); |
|
|
|
|
@ -54,6 +64,14 @@ void BufferDataGLTest::data() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void BufferDataGLTest::subData() { |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
if(!GL::Context::current().isExtensionSupported<GL::Extensions::ARB::map_buffer_range>()) |
|
|
|
|
CORRADE_SKIP(GL::Extensions::ARB::map_buffer_range::string() + std::string(" is not supported")); |
|
|
|
|
#elif defined(MAGNUM_TARGET_GLES2) |
|
|
|
|
if(!GL::Context::current().isExtensionSupported<GL::Extensions::EXT::map_buffer_range>()) |
|
|
|
|
CORRADE_SKIP(GL::Extensions::EXT::map_buffer_range::string() + std::string(" is not supported")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
GL::Buffer buffer; |
|
|
|
|
buffer.setData(Data, GL::BufferUsage::StaticDraw); |
|
|
|
|
const Containers::Array<Int> contents = bufferSubData<Int>(buffer, 4, 3); |
|
|
|
|
|