Browse Source

Renamed Buffered{Image,Texture} to Buffer{Image,Texture}.

Buffered* hinted that it has something to do with caching, streaming or
whatever. "Buffer texture" is now also consistent with naming in
specification.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
2acbd49e9c
  1. 2
      src/AbstractImage.h
  2. 2
      src/Buffer.h
  3. 10
      src/BufferImage.cpp
  4. 26
      src/BufferImage.h
  5. 14
      src/BufferTexture.cpp
  6. 32
      src/BufferTexture.h
  7. 8
      src/CMakeLists.txt
  8. 4
      src/Context.cpp
  9. 8
      src/CubeMapTextureArray.h
  10. 4
      src/Framebuffer.cpp
  11. 2
      src/Framebuffer.h
  12. 2
      src/Image.h
  13. 2
      src/ImageWrapper.h
  14. 10
      src/Magnum.h
  15. 6
      src/Texture.h
  16. 2
      src/Trade/ImageData.h

2
src/AbstractImage.h

@ -30,7 +30,7 @@ namespace Magnum {
/**
@brief Non-templated base for one-, two- or three-dimensional images
See Image, ImageWrapper, BufferedImage, Trade::ImageData documentation for
See Image, ImageWrapper, BufferImage, Trade::ImageData documentation for
more information.
*/
class MAGNUM_EXPORT AbstractImage {

2
src/Buffer.h

@ -167,7 +167,7 @@ class MAGNUM_EXPORT Buffer {
ShaderStorage = GL_SHADER_STORAGE_BUFFER,
/**
* Source for texel fetches. See BufferedTexture.
* Source for texel fetches. See BufferTexture.
* @requires_gl31 Extension @extension{ARB,texture_buffer_object}
* @requires_gl Texture buffers are not available in OpenGL ES.
*/

10
src/BufferedImage.cpp → src/BufferImage.cpp

@ -13,21 +13,21 @@
GNU Lesser General Public License version 3 for more details.
*/
#include "BufferedImage.h"
#include "BufferImage.h"
namespace Magnum {
#ifndef MAGNUM_TARGET_GLES2
template<std::uint8_t dimensions> void BufferedImage<dimensions>::setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, const GLvoid* data, Buffer::Usage usage) {
template<std::uint8_t dimensions> void BufferImage<dimensions>::setData(const typename DimensionTraits<Dimensions, GLsizei>::VectorType& size, Format format, Type type, const GLvoid* data, Buffer::Usage usage) {
_format = format;
_type = type;
_size = size;
_buffer.setData(pixelSize(format, type)*size.product(), data, usage);
}
template class BufferedImage<1>;
template class BufferedImage<2>;
template class BufferedImage<3>;
template class BufferImage<1>;
template class BufferImage<2>;
template class BufferImage<3>;
#endif
}

26
src/BufferedImage.h → src/BufferImage.h

@ -1,5 +1,5 @@
#ifndef Magnum_BufferedImage_h
#define Magnum_BufferedImage_h
#ifndef Magnum_BufferImage_h
#define Magnum_BufferImage_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -17,7 +17,7 @@
#ifndef MAGNUM_TARGET_GLES2
/** @file
* @brief Class Magnum::BufferedImage, typedef Magnum::BufferedImage1D, Magnum::BufferedImage2D, Magnum::BufferedImage3D
* @brief Class Magnum::BufferImage, typedef Magnum::BufferImage1D, Magnum::BufferImage2D, Magnum::BufferImage3D
*/
#endif
@ -30,14 +30,14 @@ namespace Magnum {
#ifndef MAGNUM_TARGET_GLES2
/**
@brief %Buffered image
@brief %Buffer image
Stores image data in GPU memory. Interchangeable with Image, ImageWrapper or
Trade::ImageData.
@see BufferedImage1D, BufferedImage2D, BufferedImage3D, Buffer
@see BufferImage1D, BufferImage2D, BufferImage3D, Buffer
@requires_gles30 Pixel buffer objects are not available in OpenGL ES 2.0.
*/
template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferedImage: public AbstractImage {
template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferImage: public AbstractImage {
public:
const static std::uint8_t Dimensions = dimensions; /**< @brief %Image dimension count */
@ -49,7 +49,7 @@ template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferedImage: public Abst
* Dimensions and buffer are empty, call setData() to fill the image
* with data.
*/
inline BufferedImage(Format format, Type type): AbstractImage(format, type) {
inline BufferImage(Format format, Type type): AbstractImage(format, type) {
_buffer.setTargetHint(Buffer::Target::PixelPack);
}
@ -93,14 +93,14 @@ template<std::uint8_t dimensions> class MAGNUM_EXPORT BufferedImage: public Abst
Buffer _buffer;
};
/** @brief One-dimensional buffered image */
typedef BufferedImage<1> BufferedImage1D;
/** @brief One-dimensional buffer image */
typedef BufferImage<1> BufferImage1D;
/** @brief Two-dimensional buffered image */
typedef BufferedImage<2> BufferedImage2D;
/** @brief Two-dimensional buffer image */
typedef BufferImage<2> BufferImage2D;
/** @brief Three-dimensional buffered image */
typedef BufferedImage<3> BufferedImage3D;
/** @brief Three-dimensional buffer image */
typedef BufferImage<3> BufferImage3D;
#endif
}

14
src/BufferedTexture.cpp → src/BufferTexture.cpp

@ -13,7 +13,7 @@
GNU Lesser General Public License version 3 for more details.
*/
#include "BufferedTexture.h"
#include "BufferTexture.h"
#ifndef MAGNUM_TARGET_GLES
#include "Buffer.h"
@ -22,22 +22,22 @@
namespace Magnum {
BufferedTexture::SetBufferImplementation BufferedTexture::setBufferImplementation = &BufferedTexture::setBufferImplementationDefault;
BufferTexture::SetBufferImplementation BufferTexture::setBufferImplementation = &BufferTexture::setBufferImplementationDefault;
void BufferedTexture::initializeContextBasedFunctionality(Context* context) {
void BufferTexture::initializeContextBasedFunctionality(Context* context) {
if(context->isExtensionSupported<Extensions::GL::EXT::direct_state_access>()) {
Debug() << "BufferedTexture: using" << Extensions::GL::EXT::direct_state_access::string() << "features";
Debug() << "BufferTexture: using" << Extensions::GL::EXT::direct_state_access::string() << "features";
setBufferImplementation = &BufferedTexture::setBufferImplementationDSA;
setBufferImplementation = &BufferTexture::setBufferImplementationDSA;
}
}
void BufferedTexture::setBufferImplementationDefault(BufferedTexture::InternalFormat internalFormat, Buffer* buffer) {
void BufferTexture::setBufferImplementationDefault(BufferTexture::InternalFormat internalFormat, Buffer* buffer) {
bindInternal();
glTexBuffer(GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer->id());
}
void BufferedTexture::setBufferImplementationDSA(BufferedTexture::InternalFormat internalFormat, Buffer* buffer) {
void BufferTexture::setBufferImplementationDSA(BufferTexture::InternalFormat internalFormat, Buffer* buffer) {
glTextureBufferEXT(id(), GL_TEXTURE_BUFFER, GLenum(internalFormat), buffer->id());
}

32
src/BufferedTexture.h → src/BufferTexture.h

@ -1,5 +1,5 @@
#ifndef Magnum_BufferedTexture_h
#define Magnum_BufferedTexture_h
#ifndef Magnum_BufferTexture_h
#define Magnum_BufferTexture_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
@ -17,7 +17,7 @@
#ifndef MAGNUM_TARGET_GLES
/** @file
* @brief Class Magnum::BufferedTexture
* @brief Class Magnum::BufferTexture
*/
#endif
@ -27,13 +27,13 @@
namespace Magnum {
/**
@brief Buffered texture
@brief %Buffer texture
This texture is, unlike classic textures such as Texture or CubeMapTexture,
used as simple data source, without any unnecessary interpolation and
wrapping methods.
@section BufferedTexture-usage Usage
@section BufferTexture-usage Usage
%Texture data are stored in buffer and after binding the buffer to the texture
using setBuffer(), you can fill the buffer at any time using data setting
@ -46,7 +46,7 @@ to use one buffer for more textures or store more than one data in it.
Example usage:
@code
Buffer* buffer;
BufferedTexture texture;
BufferTexture texture;
texture.setBuffer(buffer);
constexpr static Vector3 data[] = {
@ -57,10 +57,10 @@ buffer.setData(data, Buffer::Usage::StaticDraw);
The texture is bound to layer specified by shader via bind(). In shader, the
texture is used via `samplerBuffer`. Unlike in classic textures, coordinates
for buffered textures are integer coordinates passed to `texelFetch()`. See
also AbstractShaderProgram documentation for more information.
for buffer textures are integer coordinates passed to `texelFetch()`. See also
AbstractShaderProgram documentation for more information.
@section BufferedTexture-performance-optimization Performance optimizations
@section BufferTexture-performance-optimization Performance optimizations
If extension @extension{EXT,direct_state_access} is available, setBuffer()
uses DSA function to avoid unnecessary calls to @fn_gl{ActiveTexture} and
@fn_gl{BindTexture}. See @ref AbstractTexture-performance-optimization
@ -70,13 +70,13 @@ documentation for more information.
@requires_gl31 Extension @extension{ARB,texture_buffer_object}
@requires_gl Texture buffers are not available in OpenGL ES.
*/
class MAGNUM_EXPORT BufferedTexture: private AbstractTexture {
class MAGNUM_EXPORT BufferTexture: private AbstractTexture {
friend class Context;
BufferedTexture(const BufferedTexture& other) = delete;
BufferedTexture(BufferedTexture&& other) = delete;
BufferedTexture& operator=(const BufferedTexture& other) = delete;
BufferedTexture& operator=(BufferedTexture&& other) = delete;
BufferTexture(const BufferTexture& other) = delete;
BufferTexture(BufferTexture&& other) = delete;
BufferTexture& operator=(const BufferTexture& other) = delete;
BufferTexture& operator=(BufferTexture&& other) = delete;
public:
/**
@ -194,7 +194,7 @@ class MAGNUM_EXPORT BufferedTexture: private AbstractTexture {
RGBA32F = GL_RGBA32F
};
inline BufferedTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {}
inline BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {}
/** @copydoc AbstractTexture::bind() */
inline void bind(GLint layer) { AbstractTexture::bind(layer); }
@ -217,7 +217,7 @@ class MAGNUM_EXPORT BufferedTexture: private AbstractTexture {
private:
static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context);
typedef void(BufferedTexture::*SetBufferImplementation)(InternalFormat, Buffer*);
typedef void(BufferTexture::*SetBufferImplementation)(InternalFormat, Buffer*);
void MAGNUM_LOCAL setBufferImplementationDefault(InternalFormat internalFormat, Buffer* buffer);
void MAGNUM_LOCAL setBufferImplementationDSA(InternalFormat internalFormat, Buffer* buffer);
static SetBufferImplementation setBufferImplementation;

8
src/CMakeLists.txt

@ -40,13 +40,13 @@ set(Magnum_SRCS
# Desktop-only code
if(NOT TARGET_GLES)
set(Magnum_SRCS ${Magnum_SRCS}
BufferedTexture.cpp)
BufferTexture.cpp)
endif()
# Not-ES2 code
if(NOT TARGET_GLES2)
set(Magnum_SRCS ${Magnum_SRCS}
BufferedImage.cpp)
BufferImage.cpp)
endif()
set(Magnum_HEADERS
@ -86,14 +86,14 @@ set(Magnum_HEADERS
# Desktop-only headers
if(NOT TARGET_GLES)
set(Magnum_HEADERS ${Magnum_HEADERS}
BufferedTexture.h
BufferTexture.h
CubeMapTextureArray.h)
endif()
# Not-ES2 headers
if(NOT TARGET_GLES2)
set(Magnum_HEADERS ${Magnum_HEADERS}
BufferedImage.h)
BufferImage.h)
endif()
add_library(MagnumObjects OBJECT ${Magnum_SRCS})

4
src/Context.cpp

@ -23,7 +23,7 @@
#include "AbstractShaderProgram.h"
#include "AbstractTexture.h"
#include "Buffer.h"
#include "BufferedTexture.h"
#include "BufferTexture.h"
#include "Extensions.h"
#include "IndexedMesh.h"
#include "Mesh.h"
@ -296,7 +296,7 @@ Context::Context() {
AbstractTexture::initializeContextBasedFunctionality(this);
Buffer::initializeContextBasedFunctionality(this);
#ifndef MAGNUM_TARGET_GLES
BufferedTexture::initializeContextBasedFunctionality(this);
BufferTexture::initializeContextBasedFunctionality(this);
#endif
DebugMarker::initializeContextBasedFunctionality(this);
IndexedMesh::initializeContextBasedFunctionality(this);

8
src/CubeMapTextureArray.h

@ -113,8 +113,8 @@ class CubeMapTextureArray: public AbstractTexture {
* @brief Set texture subdata from 3D image
* @param mipLevel Mip level
* @param offset Offset where to put data in the texture
* @param image Three-dimensional Image, BufferedImage or for
* example Trade::ImageData
* @param image Image3D, ImageWrapper3D, BufferImage3D or
* Trade::ImageData3D
* @return Pointer to self (for method chaining)
*
* Sets texture subdata from given image. The image is not deleted
@ -138,8 +138,8 @@ class CubeMapTextureArray: public AbstractTexture {
* @param coordinate Coordinate
* @param mipLevel Mip level
* @param offset Offset where to put data in the texture
* @param image Two-dimensional Image, BufferedImage or for
* example Trade::ImageData
* @param image Image2D, ImageWrapper2D, BufferImage2D or
* Trade::ImageData2D
* @return Pointer to self (for method chaining)
*
* Sets texture subdata from given image. The image is not deleted

4
src/Framebuffer.cpp

@ -15,7 +15,7 @@
#include "Framebuffer.h"
#include "BufferedImage.h"
#include "BufferImage.h"
#include "Image.h"
namespace Magnum {
@ -52,7 +52,7 @@ void Framebuffer::read(const Vector2i& offset, const Vector2i& size, AbstractIma
}
#ifndef MAGNUM_TARGET_GLES2
void Framebuffer::read(const Vector2i& offset, const Vector2i& size, AbstractImage::Format format, AbstractImage::Type type, BufferedImage2D* image, Buffer::Usage usage) {
void Framebuffer::read(const Vector2i& offset, const Vector2i& size, AbstractImage::Format format, AbstractImage::Type type, BufferImage2D* image, Buffer::Usage usage) {
/* If the buffer doesn't have sufficient size, resize it */
/** @todo Explicitly reset also when buffer usage changes */
if(image->size() != size || image->format() != format || image->type() != type)

2
src/Framebuffer.h

@ -700,7 +700,7 @@ class MAGNUM_EXPORT Framebuffer {
* @requires_gl30 Extension @extension{EXT,framebuffer_object}
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES 2.0.
*/
static void read(const Vector2i& offset, const Vector2i& size, AbstractImage::Format format, AbstractImage::Type type, BufferedImage2D* image, Buffer::Usage usage);
static void read(const Vector2i& offset, const Vector2i& size, AbstractImage::Format format, AbstractImage::Type type, BufferImage2D* image, Buffer::Usage usage);
#endif
/*@}*/

2
src/Image.h

@ -29,7 +29,7 @@ namespace Magnum {
@brief %Image
Stores image data on client memory. Interchangeable with ImageWrapper,
BufferedImage or Trade::ImageData.
BufferImage or Trade::ImageData.
@see Image1D, Image2D, Image3D
*/
template<std::uint8_t dimensions> class Image: public AbstractImage {

2
src/ImageWrapper.h

@ -37,7 +37,7 @@ targeted for wrapping data which are either stored in stack/constant memory
same properties for each frame, such as video stream. Thus it is not possible
to change image properties, only data pointer.
Interchangeable with Image, BufferedImage or Trade::ImageData.
Interchangeable with Image, BufferImage or Trade::ImageData.
@see ImageWrapper1D, ImageWrapper2D, ImageWrapper3D
*/
template<std::uint8_t dimensions> class ImageWrapper: public AbstractImage {

10
src/Magnum.h

@ -134,14 +134,14 @@ template<class T> class Array3D;
class Buffer;
#ifndef MAGNUM_TARGET_GLES2
template<std::uint8_t> class BufferedImage;
typedef BufferedImage<1> BufferedImage1D;
typedef BufferedImage<2> BufferedImage2D;
typedef BufferedImage<3> BufferedImage3D;
template<std::uint8_t> class BufferImage;
typedef BufferImage<1> BufferImage1D;
typedef BufferImage<2> BufferImage2D;
typedef BufferImage<3> BufferImage3D;
#endif
#ifndef MAGNUM_TARGET_GLES
class BufferedTexture;
class BufferTexture;
#endif
template<class T = GLfloat> class Color3;

6
src/Texture.h

@ -200,7 +200,7 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
* @brief Set texture data
* @param mipLevel Mip level
* @param internalFormat Internal texture format
* @param image Image, BufferedImage or for example
* @param image Image, ImageWrapper, BufferImage or
* Trade::ImageData of the same dimension count
* @return Pointer to self (for method chaining)
*
@ -222,8 +222,8 @@ template<std::uint8_t dimensions> class Texture: public AbstractTexture {
* @brief Set texture subdata
* @param mipLevel Mip level
* @param offset Offset where to put data in the texture
* @param image Image, BufferedImage or for example
* Trade::ImageData
* @param image Image, ImageWrapper, BufferImage or
* Trade::ImageData of the same or one less dimension count
* @return Pointer to self (for method chaining)
*
* Sets texture subdata from given image. The image is not deleted

2
src/Trade/ImageData.h

@ -29,7 +29,7 @@ namespace Magnum { namespace Trade {
@brief %Image data
Access to image data provided by AbstractImporter subclasses. Interchangeable
with Image, ImageWrapper or BufferedImage.
with Image, ImageWrapper or BufferImage.
@see ImageData1D, ImageData2D, ImageData3D
*/
template<std::uint8_t dimensions> class ImageData: public AbstractImage {

Loading…
Cancel
Save