Browse Source

Test: we have halves now, so why not test them.

pull/217/head
Vladimír Vondruš 9 years ago
parent
commit
b64ef212df
  1. 13
      src/Magnum/Test/MeshGLTest.cpp

13
src/Magnum/Test/MeshGLTest.cpp

@ -37,6 +37,7 @@
#include "Magnum/RenderbufferFormat.h" #include "Magnum/RenderbufferFormat.h"
#include "Magnum/Shader.h" #include "Magnum/Shader.h"
#include "Magnum/Math/Color.h" #include "Magnum/Math/Color.h"
#include "Magnum/Math/Half.h"
#include "Magnum/Math/Matrix.h" #include "Magnum/Math/Matrix.h"
#include "Magnum/Math/Vector4.h" #include "Magnum/Math/Vector4.h"
@ -985,17 +986,25 @@ void MeshGLTest::addVertexBufferFloatWithHalfFloat() {
CORRADE_SKIP(Extensions::GL::OES::vertex_half_float::string() + std::string(" is not supported.")); CORRADE_SKIP(Extensions::GL::OES::vertex_half_float::string() + std::string(" is not supported."));
#endif #endif
using namespace Math::Literals;
typedef Attribute<0, Float> Attribute; typedef Attribute<0, Float> Attribute;
const Half data[] = { 0.0_h, -0.7_h, Half(Math::unpack<Float, UnsignedByte>(186)) };
Buffer buffer; Buffer buffer;
buffer.setData({nullptr, 6}, BufferUsage::StaticDraw); buffer.setData(data, BufferUsage::StaticDraw);
Mesh mesh; Mesh mesh;
mesh.setBaseVertex(1) mesh.setBaseVertex(1)
.addVertexBuffer(buffer, 2, Attribute(Attribute::DataType::HalfFloat)); .addVertexBuffer(buffer, 2, Attribute(Attribute::DataType::HalfFloat));
MAGNUM_VERIFY_NO_ERROR(); MAGNUM_VERIFY_NO_ERROR();
/* Won't test the actual values */
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
RenderbufferFormat::RGBA8, mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(value, 186);
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES

Loading…
Cancel
Save