0.8.2 API documentation
core/clear.hpp
1 #pragma once
2 
3 #include "convert_func.hpp"
4 
5 namespace gli{
6 namespace detail
7 {
8  template <typename textureType, typename T, precision P>
9  struct clear
10  {
11  static void call(textureType & Texture, typename convert<textureType, T, P>::writeFunc Write, tvec4<T, P> const & Color)
12  {
13  GLI_ASSERT(Write);
14 
15  texture const ConvertTexel(Texture.target(), Texture.format(), texture::extent_type(1), 1, 1, 1);
16  textureType Texel(ConvertTexel);
17  Write(Texel, typename textureType::extent_type(0), 0, 0, 0, Color);
18 
19  size_t const BlockSize(block_size(Texture.format()));
20  for(size_t BlockIndex = 0, BlockCount = Texture.size() / BlockSize; BlockIndex < BlockCount; ++BlockIndex)
21  memcpy(static_cast<std::uint8_t*>(Texture.data()) + BlockSize * BlockIndex, Texel.data(), BlockSize);
22  }
23  };
24 }//namespace detail
25 }//namespace gli
Namespace where all the classes and functions provided by GLI are exposed.
Definition: clear.hpp:6
void clear(texture_type &Texture)
Clear a complete texture.
size_t block_size(format Format)
Return the size in bytes of a block for a format.