Improved handling of subloading.
Removed the rescalling of images in osg::Image during texture apply, moving the rescale so it is locally calculated. This solves an outstanding threading problem which occured by multiple draw threads all tried to rescale the same image at one time. Made osg::Image ptr in osg::Texture2D non mutable as it is no longer modified during apply.
This commit is contained in:
@@ -194,7 +194,7 @@ class SG_EXPORT Image : public Object
|
||||
static unsigned int computeNumComponents(GLenum format);
|
||||
static unsigned int computePixelSizeInBits(GLenum format,GLenum type);
|
||||
static unsigned int computeRowWidthInBytes(int width,GLenum format,GLenum type,int packing);
|
||||
static unsigned int computeNearestPowerOfTwo(unsigned int s,float bias=0.5f);
|
||||
static int computeNearestPowerOfTwo(int s,float bias=0.5f);
|
||||
|
||||
// precomputed mipmaps stuff;
|
||||
typedef std::vector< unsigned int > MipmapDataType;
|
||||
|
||||
@@ -299,11 +299,11 @@ class SG_EXPORT Texture : public osg::StateAttribute
|
||||
|
||||
/** Helper method which does the creation of the texture itself, but does not set or use texture binding.
|
||||
* Note, do not call this method directly unless you are implementing your own Subload callback*/
|
||||
void applyTexImage2D_load(GLenum target, Image* image, State& state, GLsizei& width, GLsizei& height,GLsizei& numMimpmapLevels) const;
|
||||
void applyTexImage2D_load(GLenum target, const Image* image, State& state, GLsizei& width, GLsizei& height,GLsizei& numMimpmapLevels) const;
|
||||
|
||||
/** Helper method which subloads images to the texture itself, but does not set or use texture binding.
|
||||
* Note, do not call this method directly unless you are implementing your own Subload callback*/
|
||||
void applyTexImage2D_subload(GLenum target, Image* image, State& state, GLsizei& width, GLsizei& height,GLsizei& numMimpmapLevels) const;
|
||||
void applyTexImage2D_subload(GLenum target, const Image* image, State& state, GLsizei& width, GLsizei& height,GLsizei& numMimpmapLevels) const;
|
||||
|
||||
protected :
|
||||
|
||||
@@ -311,7 +311,7 @@ class SG_EXPORT Texture : public osg::StateAttribute
|
||||
|
||||
virtual void computeInternalFormat() const = 0;
|
||||
|
||||
void computeInternalFormatWithImage(osg::Image& image) const;
|
||||
void computeInternalFormatWithImage(const osg::Image& image) const;
|
||||
|
||||
bool isCompressedInternalFormat(GLint internalFormat) const;
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class SG_EXPORT Texture2D : public Texture
|
||||
// Image::ensureDimensionsArePowerOfTwo() can only be called
|
||||
// in a valid OpenGL context, a therefore within an Texture::apply
|
||||
// which is const...
|
||||
mutable ref_ptr<Image> _image;
|
||||
ref_ptr<Image> _image;
|
||||
|
||||
// subloaded images can have different texture and image sizes.
|
||||
mutable GLsizei _textureWidth, _textureHeight;
|
||||
|
||||
Reference in New Issue
Block a user