Browse Source

GL: don't use std::fill_n().

This used to somehow get dragged along with <string> on all platforms we
tested on, but once we get rid of <string> we'd have to include
<algorithm> instead. Not acceptable, also it's much shorter and less
error-prone this way.
pull/240/merge
Vladimír Vondruš 4 years ago
parent
commit
6e7f2a5401
  1. 3
      src/Magnum/GL/Implementation/BufferState.cpp
  2. 6
      src/Magnum/GL/Implementation/TextureState.cpp

3
src/Magnum/GL/Implementation/BufferState.cpp

@ -209,8 +209,7 @@ BufferState::BufferState(Context& context, Containers::StaticArrayView<Implement
} }
void BufferState::reset() { void BufferState::reset() {
/* libc++ complains about decrementing enum value otherwise */ for(GLuint& i: bindings) i = State::DisengagedBinding;
std::fill_n(bindings, std::size_t{TargetCount}, State::DisengagedBinding);
} }
}}} }}}

6
src/Magnum/GL/Implementation/TextureState.cpp

@ -548,9 +548,11 @@ TextureState::TextureState(Context& context,
} }
void TextureState::reset() { void TextureState::reset() {
std::fill_n(bindings.begin(), bindings.size(), std::pair<GLenum, GLuint>{{}, State::DisengagedBinding}); for(std::pair<GLenum, GLuint>& i: bindings)
i = {{}, State::DisengagedBinding};
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
std::fill_n(imageBindings.begin(), imageBindings.size(), std::tuple<GLuint, GLint, GLboolean, GLint, GLenum>{State::DisengagedBinding, 0, false, 0, 0}); for(std::tuple<GLuint, GLint, GLboolean, GLint, GLenum>& i: imageBindings)
i = {State::DisengagedBinding, 0, false, 0, 0};
#endif #endif
} }

Loading…
Cancel
Save