Use timestamps for attribute updates (#2629)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <mbgl/gl/vertex_buffer_resource.hpp>
|
||||
#include <mbgl/gl/defines.hpp>
|
||||
#include <mbgl/gl/enum.hpp>
|
||||
#include <mbgl/util/instrumentation.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
@@ -13,10 +14,14 @@ using namespace platform;
|
||||
const constexpr ClearDepth::Type ClearDepth::Default;
|
||||
|
||||
void ClearDepth::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(ClearDepth::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glClearDepthf(value));
|
||||
}
|
||||
|
||||
ClearDepth::Type ClearDepth::Get() {
|
||||
MLN_TRACE_ZONE(ClearDepth::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLfloat clearDepth;
|
||||
MBGL_CHECK_ERROR(glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth));
|
||||
return clearDepth;
|
||||
@@ -25,10 +30,14 @@ ClearDepth::Type ClearDepth::Get() {
|
||||
const ClearColor::Type ClearColor::Default{0, 0, 0, 0};
|
||||
|
||||
void ClearColor::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(ClearColor::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glClearColor(value.r, value.g, value.b, value.a));
|
||||
}
|
||||
|
||||
ClearColor::Type ClearColor::Get() {
|
||||
MLN_TRACE_ZONE(ClearColor::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLfloat clearColor[4];
|
||||
MBGL_CHECK_ERROR(glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor));
|
||||
return {clearColor[0], clearColor[1], clearColor[2], clearColor[3]};
|
||||
@@ -37,10 +46,14 @@ ClearColor::Type ClearColor::Get() {
|
||||
const constexpr ClearStencil::Type ClearStencil::Default;
|
||||
|
||||
void ClearStencil::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(ClearStencil::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glClearStencil(value));
|
||||
}
|
||||
|
||||
ClearStencil::Type ClearStencil::Get() {
|
||||
MLN_TRACE_ZONE(ClearStencil::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint clearStencil;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil));
|
||||
return clearStencil;
|
||||
@@ -49,10 +62,14 @@ ClearStencil::Type ClearStencil::Get() {
|
||||
const constexpr StencilMask::Type StencilMask::Default;
|
||||
|
||||
void StencilMask::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(StencilMask::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glStencilMask(value));
|
||||
}
|
||||
|
||||
StencilMask::Type StencilMask::Get() {
|
||||
MLN_TRACE_ZONE(StencilMask::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint stencilMask;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_WRITEMASK, &stencilMask));
|
||||
return stencilMask;
|
||||
@@ -61,10 +78,14 @@ StencilMask::Type StencilMask::Get() {
|
||||
const constexpr DepthMask::Type DepthMask::Default;
|
||||
|
||||
void DepthMask::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(DepthMask::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glDepthMask(Enum<gfx::DepthMaskType>::to(value)));
|
||||
}
|
||||
|
||||
DepthMask::Type DepthMask::Get() {
|
||||
MLN_TRACE_ZONE(DepthMask::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLboolean depthMask;
|
||||
MBGL_CHECK_ERROR(glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask));
|
||||
return Enum<gfx::DepthMaskType>::from(depthMask);
|
||||
@@ -73,10 +94,14 @@ DepthMask::Type DepthMask::Get() {
|
||||
const constexpr ColorMask::Type ColorMask::Default;
|
||||
|
||||
void ColorMask::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(ColorMask::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glColorMask(value.r, value.g, value.b, value.a));
|
||||
}
|
||||
|
||||
ColorMask::Type ColorMask::Get() {
|
||||
MLN_TRACE_ZONE(ColorMask::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLboolean bools[4];
|
||||
MBGL_CHECK_ERROR(glGetBooleanv(GL_COLOR_WRITEMASK, bools));
|
||||
return {static_cast<bool>(bools[0]),
|
||||
@@ -88,10 +113,14 @@ ColorMask::Type ColorMask::Get() {
|
||||
const constexpr StencilFunc::Type StencilFunc::Default;
|
||||
|
||||
void StencilFunc::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(StencilFunc::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glStencilFunc(Enum<gfx::StencilFunctionType>::to(value.func), value.ref, value.mask));
|
||||
}
|
||||
|
||||
StencilFunc::Type StencilFunc::Get() {
|
||||
MLN_TRACE_ZONE(StencilFunc::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint func;
|
||||
GLint ref;
|
||||
GLint mask;
|
||||
@@ -104,10 +133,14 @@ StencilFunc::Type StencilFunc::Get() {
|
||||
const constexpr StencilTest::Type StencilTest::Default;
|
||||
|
||||
void StencilTest::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(StencilTest::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(value ? glEnable(GL_STENCIL_TEST) : glDisable(GL_STENCIL_TEST));
|
||||
}
|
||||
|
||||
StencilTest::Type StencilTest::Get() {
|
||||
MLN_TRACE_ZONE(StencilTest::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
Type stencilTest;
|
||||
MBGL_CHECK_ERROR(stencilTest = glIsEnabled(GL_STENCIL_TEST));
|
||||
return stencilTest;
|
||||
@@ -116,12 +149,16 @@ StencilTest::Type StencilTest::Get() {
|
||||
const constexpr StencilOp::Type StencilOp::Default;
|
||||
|
||||
void StencilOp::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(StencilOp::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glStencilOp(Enum<gfx::StencilOpType>::to(value.sfail),
|
||||
Enum<gfx::StencilOpType>::to(value.dpfail),
|
||||
Enum<gfx::StencilOpType>::to(value.dppass)));
|
||||
}
|
||||
|
||||
StencilOp::Type StencilOp::Get() {
|
||||
MLN_TRACE_ZONE(StencilOp::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint sfail;
|
||||
GLint dpfail;
|
||||
GLint dppass;
|
||||
@@ -137,10 +174,14 @@ StencilOp::Type StencilOp::Get() {
|
||||
const constexpr DepthRange::Type DepthRange::Default;
|
||||
|
||||
void DepthRange::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(DepthRange::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glDepthRangef(value.min, value.max));
|
||||
}
|
||||
|
||||
DepthRange::Type DepthRange::Get() {
|
||||
MLN_TRACE_ZONE(DepthRange::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLfloat floats[2];
|
||||
MBGL_CHECK_ERROR(glGetFloatv(GL_DEPTH_RANGE, floats));
|
||||
return {floats[0], floats[1]};
|
||||
@@ -150,10 +191,14 @@ DepthRange::Type DepthRange::Get() {
|
||||
const constexpr DepthTest::Type DepthTest::Default;
|
||||
|
||||
void DepthTest::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(DepthTest::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(value ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST));
|
||||
}
|
||||
|
||||
DepthTest::Type DepthTest::Get() {
|
||||
MLN_TRACE_ZONE(DepthTest::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
Type depthTest;
|
||||
MBGL_CHECK_ERROR(depthTest = glIsEnabled(GL_DEPTH_TEST));
|
||||
return depthTest;
|
||||
@@ -162,10 +207,14 @@ DepthTest::Type DepthTest::Get() {
|
||||
const constexpr DepthFunc::Type DepthFunc::Default;
|
||||
|
||||
void DepthFunc::Set(const DepthFunc::Type& value) {
|
||||
MLN_TRACE_ZONE(DepthFunc::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glDepthFunc(Enum<gfx::DepthFunctionType>::to(value)));
|
||||
}
|
||||
|
||||
DepthFunc::Type DepthFunc::Get() {
|
||||
MLN_TRACE_ZONE(DepthFunc::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint depthFunc;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_DEPTH_FUNC, &depthFunc));
|
||||
return Enum<gfx::DepthFunctionType>::from(depthFunc);
|
||||
@@ -174,10 +223,14 @@ DepthFunc::Type DepthFunc::Get() {
|
||||
const constexpr Blend::Type Blend::Default;
|
||||
|
||||
void Blend::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(Blend::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(value ? glEnable(GL_BLEND) : glDisable(GL_BLEND));
|
||||
}
|
||||
|
||||
Blend::Type Blend::Get() {
|
||||
MLN_TRACE_ZONE(Blend::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
Type blend;
|
||||
MBGL_CHECK_ERROR(blend = glIsEnabled(GL_BLEND));
|
||||
return blend;
|
||||
@@ -186,10 +239,14 @@ Blend::Type Blend::Get() {
|
||||
const constexpr BlendEquation::Type BlendEquation::Default;
|
||||
|
||||
void BlendEquation::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BlendEquation::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBlendEquation(Enum<gfx::ColorBlendEquationType>::to(value)));
|
||||
}
|
||||
|
||||
BlendEquation::Type BlendEquation::Get() {
|
||||
MLN_TRACE_ZONE(BlendEquation::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint blend;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_EQUATION_RGB, &blend));
|
||||
return Enum<gfx::ColorBlendEquationType>::from(blend);
|
||||
@@ -198,11 +255,15 @@ BlendEquation::Type BlendEquation::Get() {
|
||||
const constexpr BlendFunc::Type BlendFunc::Default;
|
||||
|
||||
void BlendFunc::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BlendFunc::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBlendFunc(Enum<gfx::ColorBlendFactorType>::to(value.sfactor),
|
||||
Enum<gfx::ColorBlendFactorType>::to(value.dfactor)));
|
||||
}
|
||||
|
||||
BlendFunc::Type BlendFunc::Get() {
|
||||
MLN_TRACE_ZONE(BlendFunc::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint sfactor;
|
||||
GLint dfactor;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_BLEND_SRC_ALPHA, &sfactor));
|
||||
@@ -213,10 +274,14 @@ BlendFunc::Type BlendFunc::Get() {
|
||||
const BlendColor::Type BlendColor::Default{0, 0, 0, 0};
|
||||
|
||||
void BlendColor::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BlendColor::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBlendColor(value.r, value.g, value.b, value.a));
|
||||
}
|
||||
|
||||
BlendColor::Type BlendColor::Get() {
|
||||
MLN_TRACE_ZONE(BlendColor::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLfloat floats[4];
|
||||
MBGL_CHECK_ERROR(glGetFloatv(GL_BLEND_COLOR, floats));
|
||||
return {floats[0], floats[1], floats[2], floats[3]};
|
||||
@@ -225,10 +290,14 @@ BlendColor::Type BlendColor::Get() {
|
||||
const constexpr Program::Type Program::Default;
|
||||
|
||||
void Program::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(Program::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glUseProgram(value));
|
||||
}
|
||||
|
||||
Program::Type Program::Get() {
|
||||
MLN_TRACE_ZONE(Program::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint program;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_CURRENT_PROGRAM, &program));
|
||||
return program;
|
||||
@@ -237,10 +306,14 @@ Program::Type Program::Get() {
|
||||
const constexpr LineWidth::Type LineWidth::Default;
|
||||
|
||||
void LineWidth::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(LineWidth::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glLineWidth(value));
|
||||
}
|
||||
|
||||
LineWidth::Type LineWidth::Get() {
|
||||
MLN_TRACE_ZONE(LineWidth::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLfloat lineWidth;
|
||||
MBGL_CHECK_ERROR(glGetFloatv(GL_LINE_WIDTH, &lineWidth));
|
||||
return lineWidth;
|
||||
@@ -249,10 +322,14 @@ LineWidth::Type LineWidth::Get() {
|
||||
const constexpr ActiveTextureUnit::Type ActiveTextureUnit::Default;
|
||||
|
||||
void ActiveTextureUnit::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(ActiveTextureUnit::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glActiveTexture(GL_TEXTURE0 + value));
|
||||
}
|
||||
|
||||
ActiveTextureUnit::Type ActiveTextureUnit::Get() {
|
||||
MLN_TRACE_ZONE(ActiveTextureUnit::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint activeTexture;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture));
|
||||
return static_cast<Type>(activeTexture - GL_TEXTURE0);
|
||||
@@ -261,10 +338,14 @@ ActiveTextureUnit::Type ActiveTextureUnit::Get() {
|
||||
const constexpr Viewport::Type Viewport::Default;
|
||||
|
||||
void Viewport::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(Viewport::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glViewport(value.x, value.y, value.size.width, value.size.height));
|
||||
}
|
||||
|
||||
Viewport::Type Viewport::Get() {
|
||||
MLN_TRACE_ZONE(Viewport::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint viewport[4];
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_VIEWPORT, viewport));
|
||||
return {static_cast<int32_t>(viewport[0]),
|
||||
@@ -275,10 +356,14 @@ Viewport::Type Viewport::Get() {
|
||||
const constexpr ScissorTest::Type ScissorTest::Default;
|
||||
|
||||
void ScissorTest::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(ScissorTest::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(value ? glEnable(GL_SCISSOR_TEST) : glDisable(GL_SCISSOR_TEST));
|
||||
}
|
||||
|
||||
ScissorTest::Type ScissorTest::Get() {
|
||||
MLN_TRACE_ZONE(ScissorTest::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
Type scissorTest;
|
||||
MBGL_CHECK_ERROR(scissorTest = glIsEnabled(GL_SCISSOR_TEST));
|
||||
return scissorTest;
|
||||
@@ -287,10 +372,14 @@ ScissorTest::Type ScissorTest::Get() {
|
||||
const constexpr BindFramebuffer::Type BindFramebuffer::Default;
|
||||
|
||||
void BindFramebuffer::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BindFramebuffer::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, value));
|
||||
}
|
||||
|
||||
BindFramebuffer::Type BindFramebuffer::Get() {
|
||||
MLN_TRACE_ZONE(BindFramebuffer::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint binding;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &binding));
|
||||
return binding;
|
||||
@@ -299,10 +388,14 @@ BindFramebuffer::Type BindFramebuffer::Get() {
|
||||
const constexpr BindRenderbuffer::Type BindRenderbuffer::Default;
|
||||
|
||||
void BindRenderbuffer::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BindRenderbuffer::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBindRenderbuffer(GL_RENDERBUFFER, value));
|
||||
}
|
||||
|
||||
BindRenderbuffer::Type BindRenderbuffer::Get() {
|
||||
MLN_TRACE_ZONE(BindRenderbuffer::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint binding;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_RENDERBUFFER_BINDING, &binding));
|
||||
return binding;
|
||||
@@ -311,10 +404,14 @@ BindRenderbuffer::Type BindRenderbuffer::Get() {
|
||||
const constexpr CullFace::Type CullFace::Default;
|
||||
|
||||
void CullFace::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(CullFace::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(value ? glEnable(GL_CULL_FACE) : glDisable(GL_CULL_FACE));
|
||||
}
|
||||
|
||||
CullFace::Type CullFace::Get() {
|
||||
MLN_TRACE_ZONE(CullFace::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLboolean cullFace;
|
||||
MBGL_CHECK_ERROR(cullFace = glIsEnabled(GL_CULL_FACE));
|
||||
return cullFace;
|
||||
@@ -323,10 +420,14 @@ CullFace::Type CullFace::Get() {
|
||||
const constexpr CullFaceSide::Type CullFaceSide::Default;
|
||||
|
||||
void CullFaceSide::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(CullFaceSide::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glCullFace(Enum<gfx::CullFaceSideType>::to(value)));
|
||||
}
|
||||
|
||||
CullFaceSide::Type CullFaceSide::Get() {
|
||||
MLN_TRACE_ZONE(CullFaceSide::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint cullFaceMode;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_CULL_FACE_MODE, &cullFaceMode));
|
||||
return Enum<gfx::CullFaceSideType>::from(cullFaceMode);
|
||||
@@ -335,10 +436,14 @@ CullFaceSide::Type CullFaceSide::Get() {
|
||||
const constexpr CullFaceWinding::Type CullFaceWinding::Default;
|
||||
|
||||
void CullFaceWinding::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(CullFaceWinding::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glFrontFace(Enum<gfx::CullFaceWindingType>::to(value)));
|
||||
}
|
||||
|
||||
CullFaceWinding::Type CullFaceWinding::Get() {
|
||||
MLN_TRACE_ZONE(CullFaceWinding::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint frontFace;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_FRONT_FACE, &frontFace));
|
||||
return Enum<gfx::CullFaceWindingType>::from(frontFace);
|
||||
@@ -347,10 +452,14 @@ CullFaceWinding::Type CullFaceWinding::Get() {
|
||||
const constexpr BindTexture::Type BindTexture::Default;
|
||||
|
||||
void BindTexture::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BindTexture::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, value));
|
||||
}
|
||||
|
||||
BindTexture::Type BindTexture::Get() {
|
||||
MLN_TRACE_ZONE(BindTexture::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint binding;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_TEXTURE_BINDING_2D, &binding));
|
||||
return binding;
|
||||
@@ -359,10 +468,14 @@ BindTexture::Type BindTexture::Get() {
|
||||
const constexpr BindVertexBuffer::Type BindVertexBuffer::Default;
|
||||
|
||||
void BindVertexBuffer::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BindVertexBuffer::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, value));
|
||||
}
|
||||
|
||||
BindVertexBuffer::Type BindVertexBuffer::Get() {
|
||||
MLN_TRACE_ZONE(BindVertexBuffer::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint binding;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &binding));
|
||||
return binding;
|
||||
@@ -371,10 +484,14 @@ BindVertexBuffer::Type BindVertexBuffer::Get() {
|
||||
const constexpr BindElementBuffer::Type BindElementBuffer::Default;
|
||||
|
||||
void BindElementBuffer::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BindElementBuffer::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, value));
|
||||
}
|
||||
|
||||
BindElementBuffer::Type BindElementBuffer::Get() {
|
||||
MLN_TRACE_ZONE(BindElementBuffer::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint binding;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &binding));
|
||||
return binding;
|
||||
@@ -383,10 +500,14 @@ BindElementBuffer::Type BindElementBuffer::Get() {
|
||||
const constexpr BindVertexArray::Type BindVertexArray::Default;
|
||||
|
||||
void BindVertexArray::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(BindVertexArray::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
MBGL_CHECK_ERROR(glBindVertexArray(value));
|
||||
}
|
||||
|
||||
BindVertexArray::Type BindVertexArray::Get() {
|
||||
MLN_TRACE_ZONE(BindVertexArray::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
GLint binding = 0;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &binding));
|
||||
return binding;
|
||||
@@ -485,8 +606,11 @@ GLint components(const gfx::AttributeDataType type) {
|
||||
#endif
|
||||
|
||||
void VertexAttribute::Set(const Type& binding, Context& context, AttributeLocation location) {
|
||||
MLN_TRACE_ZONE(VertexAttribute::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
if (binding && binding->vertexBufferResource) {
|
||||
context.vertexBuffer = reinterpret_cast<const gl::VertexBufferResource&>(*binding->vertexBufferResource).buffer;
|
||||
context.vertexBuffer =
|
||||
reinterpret_cast<const gl::VertexBufferResource&>(*binding->vertexBufferResource).getBuffer();
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(location));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(
|
||||
location,
|
||||
@@ -507,11 +631,15 @@ void VertexAttribute::Set(const Type& binding, Context& context, AttributeLocati
|
||||
const constexpr PixelStorePack::Type PixelStorePack::Default;
|
||||
|
||||
void PixelStorePack::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(PixelStorePack::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
assert(value.alignment == 1 || value.alignment == 2 || value.alignment == 4 || value.alignment == 8);
|
||||
MBGL_CHECK_ERROR(glPixelStorei(GL_PACK_ALIGNMENT, value.alignment));
|
||||
}
|
||||
|
||||
PixelStorePack::Type PixelStorePack::Get() {
|
||||
MLN_TRACE_ZONE(PixelStorePack::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
Type value;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_PACK_ALIGNMENT, &value.alignment));
|
||||
return value;
|
||||
@@ -520,11 +648,15 @@ PixelStorePack::Type PixelStorePack::Get() {
|
||||
const constexpr PixelStoreUnpack::Type PixelStoreUnpack::Default;
|
||||
|
||||
void PixelStoreUnpack::Set(const Type& value) {
|
||||
MLN_TRACE_ZONE(PixelStoreUnpack::Set);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
assert(value.alignment == 1 || value.alignment == 2 || value.alignment == 4 || value.alignment == 8);
|
||||
MBGL_CHECK_ERROR(glPixelStorei(GL_UNPACK_ALIGNMENT, value.alignment));
|
||||
}
|
||||
|
||||
PixelStoreUnpack::Type PixelStoreUnpack::Get() {
|
||||
MLN_TRACE_ZONE(PixelStoreUnpack::Get);
|
||||
MLN_TRACE_FUNC_GL();
|
||||
Type value;
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_UNPACK_ALIGNMENT, &value.alignment));
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user