TextureColorbufferProxy must query the texture to get the latest width & height.
TRAC #12372
Signed-off-by: Daniel Koch
Author: Andrew Lewycky
git-svn-id: https://angleproject.googlecode.com/svn/trunk@315 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Renderbuffer.cpp b/src/libGLESv2/Renderbuffer.cpp
index 32eabcf..edd38ec 100644
--- a/src/libGLESv2/Renderbuffer.cpp
+++ b/src/libGLESv2/Renderbuffer.cpp
@@ -64,6 +64,13 @@
return mHeight;
}
+void Renderbuffer::setSize(int width, int height)
+{
+ mWidth = width;
+ mHeight = height;
+}
+
+
GLenum Renderbuffer::getFormat()
{
return mFormat;
@@ -88,8 +95,7 @@
D3DSURFACE_DESC description;
renderTarget->GetDesc(&description);
- mWidth = description.Width;
- mHeight = description.Height;
+ setSize(description.Width, description.Height);
}
}
@@ -113,14 +119,12 @@
if (mRenderTarget)
{
- mWidth = width;
- mHeight = height;
+ setSize(width, height);
mFormat = format;
}
else
{
- mWidth = 0;
- mHeight = 0;
+ setSize(0, 0);
mFormat = GL_RGBA4;
}
}
@@ -204,8 +208,7 @@
D3DSURFACE_DESC description;
depthStencil->GetDesc(&description);
- mWidth = description.Width;
- mHeight = description.Height;
+ setSize(description.Width, description.Height);
mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage
@@ -230,16 +233,14 @@
if (mDepthStencil)
{
- mWidth = width;
- mHeight = height;
+ setSize(width, height);
mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage
}
else
{
- mWidth = 0;
- mHeight = 0;
+ setSize(0, 0);
mFormat = GL_RGBA4; //default format
}
}
@@ -284,8 +285,7 @@
D3DSURFACE_DESC description;
depthStencil->GetDesc(&description);
- mWidth = description.Width;
- mHeight = description.Height;
+ setSize(description.Width, description.Height);
mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage
@@ -310,16 +310,14 @@
if (mDepthStencil)
{
- mWidth = width;
- mHeight = height;
+ setSize(width, height);
mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage
}
else
{
- mWidth = 0;
- mHeight = 0;
+ setSize(0, 0);
mFormat = GL_RGBA4; //default format
}
}
diff --git a/src/libGLESv2/Renderbuffer.h b/src/libGLESv2/Renderbuffer.h
index ee9133c..2c70ce9 100644
--- a/src/libGLESv2/Renderbuffer.h
+++ b/src/libGLESv2/Renderbuffer.h
@@ -33,16 +33,15 @@
virtual IDirect3DSurface9 *getRenderTarget();
virtual IDirect3DSurface9 *getDepthStencil();
- int getWidth();
- int getHeight();
+ virtual int getWidth();
+ virtual int getHeight();
GLenum getFormat();
unsigned int getSerial() const;
static unsigned int issueSerial();
protected:
- int mWidth;
- int mHeight;
+ void setSize(int width, int height);
GLenum mFormat;
unsigned int mSerial;
@@ -50,6 +49,9 @@
DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
static unsigned int mCurrentSerial;
+
+ int mWidth;
+ int mHeight;
};
class Colorbuffer : public Renderbuffer
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index cbdb9a7..cbebcbf 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -1468,13 +1468,10 @@
: Colorbuffer(NULL), mTexture(texture), mTarget(target)
{
ASSERT(target == GL_TEXTURE_2D || IsCubemapTextureTarget(target));
- latchTextureInfo();
}
IDirect3DSurface9 *Texture::TextureColorbufferProxy::getRenderTarget()
{
- latchTextureInfo();
-
if (mRenderTarget) mRenderTarget->Release();
mRenderTarget = mTexture->getRenderTarget(mTarget);
@@ -1482,10 +1479,14 @@
return mRenderTarget;
}
-void Texture::TextureColorbufferProxy::latchTextureInfo()
+int Texture::TextureColorbufferProxy::getWidth()
{
- mWidth = mTexture->getWidth();
- mHeight = mTexture->getHeight();
+ return mTexture->getWidth();
+}
+
+int Texture::TextureColorbufferProxy::getHeight()
+{
+ return mTexture->getHeight();
}
}
diff --git a/src/libGLESv2/Texture.h b/src/libGLESv2/Texture.h
index d9bb053..40fa11d 100644
--- a/src/libGLESv2/Texture.h
+++ b/src/libGLESv2/Texture.h
@@ -76,11 +76,12 @@
virtual IDirect3DSurface9 *getRenderTarget();
+ virtual int getWidth();
+ virtual int getHeight();
+
private:
Texture *mTexture;
GLenum mTarget;
-
- void latchTextureInfo();
};
// Helper structure representing a single image layer