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
parent 81655a72
...@@ -64,6 +64,13 @@ int Renderbuffer::getHeight() ...@@ -64,6 +64,13 @@ int Renderbuffer::getHeight()
return mHeight; return mHeight;
} }
void Renderbuffer::setSize(int width, int height)
{
mWidth = width;
mHeight = height;
}
GLenum Renderbuffer::getFormat() GLenum Renderbuffer::getFormat()
{ {
return mFormat; return mFormat;
...@@ -88,8 +95,7 @@ Colorbuffer::Colorbuffer(IDirect3DSurface9 *renderTarget) : mRenderTarget(render ...@@ -88,8 +95,7 @@ Colorbuffer::Colorbuffer(IDirect3DSurface9 *renderTarget) : mRenderTarget(render
D3DSURFACE_DESC description; D3DSURFACE_DESC description;
renderTarget->GetDesc(&description); renderTarget->GetDesc(&description);
mWidth = description.Width; setSize(description.Width, description.Height);
mHeight = description.Height;
} }
} }
...@@ -113,14 +119,12 @@ Colorbuffer::Colorbuffer(int width, int height, GLenum format) ...@@ -113,14 +119,12 @@ Colorbuffer::Colorbuffer(int width, int height, GLenum format)
if (mRenderTarget) if (mRenderTarget)
{ {
mWidth = width; setSize(width, height);
mHeight = height;
mFormat = format; mFormat = format;
} }
else else
{ {
mWidth = 0; setSize(0, 0);
mHeight = 0;
mFormat = GL_RGBA4; mFormat = GL_RGBA4;
} }
} }
...@@ -204,8 +208,7 @@ Depthbuffer::Depthbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthS ...@@ -204,8 +208,7 @@ Depthbuffer::Depthbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthS
D3DSURFACE_DESC description; D3DSURFACE_DESC description;
depthStencil->GetDesc(&description); depthStencil->GetDesc(&description);
mWidth = description.Width; setSize(description.Width, description.Height);
mHeight = description.Height;
mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
...@@ -230,16 +233,14 @@ Depthbuffer::Depthbuffer(int width, int height) ...@@ -230,16 +233,14 @@ Depthbuffer::Depthbuffer(int width, int height)
if (mDepthStencil) if (mDepthStencil)
{ {
mWidth = width; setSize(width, height);
mHeight = height;
mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function mFormat = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
} }
else else
{ {
mWidth = 0; setSize(0, 0);
mHeight = 0;
mFormat = GL_RGBA4; //default format mFormat = GL_RGBA4; //default format
} }
} }
...@@ -284,8 +285,7 @@ Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(de ...@@ -284,8 +285,7 @@ Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(de
D3DSURFACE_DESC description; D3DSURFACE_DESC description;
depthStencil->GetDesc(&description); depthStencil->GetDesc(&description);
mWidth = description.Width; setSize(description.Width, description.Height);
mHeight = description.Height;
mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
...@@ -310,16 +310,14 @@ Stencilbuffer::Stencilbuffer(int width, int height) ...@@ -310,16 +310,14 @@ Stencilbuffer::Stencilbuffer(int width, int height)
if (mDepthStencil) if (mDepthStencil)
{ {
mWidth = width; setSize(width, height);
mHeight = height;
mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function mFormat = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
} }
else else
{ {
mWidth = 0; setSize(0, 0);
mHeight = 0;
mFormat = GL_RGBA4; //default format mFormat = GL_RGBA4; //default format
} }
} }
......
...@@ -33,16 +33,15 @@ class Renderbuffer ...@@ -33,16 +33,15 @@ class Renderbuffer
virtual IDirect3DSurface9 *getRenderTarget(); virtual IDirect3DSurface9 *getRenderTarget();
virtual IDirect3DSurface9 *getDepthStencil(); virtual IDirect3DSurface9 *getDepthStencil();
int getWidth(); virtual int getWidth();
int getHeight(); virtual int getHeight();
GLenum getFormat(); GLenum getFormat();
unsigned int getSerial() const; unsigned int getSerial() const;
static unsigned int issueSerial(); static unsigned int issueSerial();
protected: protected:
int mWidth; void setSize(int width, int height);
int mHeight;
GLenum mFormat; GLenum mFormat;
unsigned int mSerial; unsigned int mSerial;
...@@ -50,6 +49,9 @@ class Renderbuffer ...@@ -50,6 +49,9 @@ class Renderbuffer
DISALLOW_COPY_AND_ASSIGN(Renderbuffer); DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
static unsigned int mCurrentSerial; static unsigned int mCurrentSerial;
int mWidth;
int mHeight;
}; };
class Colorbuffer : public Renderbuffer class Colorbuffer : public Renderbuffer
......
...@@ -1468,13 +1468,10 @@ Texture::TextureColorbufferProxy::TextureColorbufferProxy(Texture *texture, GLen ...@@ -1468,13 +1468,10 @@ Texture::TextureColorbufferProxy::TextureColorbufferProxy(Texture *texture, GLen
: Colorbuffer(NULL), mTexture(texture), mTarget(target) : Colorbuffer(NULL), mTexture(texture), mTarget(target)
{ {
ASSERT(target == GL_TEXTURE_2D || IsCubemapTextureTarget(target)); ASSERT(target == GL_TEXTURE_2D || IsCubemapTextureTarget(target));
latchTextureInfo();
} }
IDirect3DSurface9 *Texture::TextureColorbufferProxy::getRenderTarget() IDirect3DSurface9 *Texture::TextureColorbufferProxy::getRenderTarget()
{ {
latchTextureInfo();
if (mRenderTarget) mRenderTarget->Release(); if (mRenderTarget) mRenderTarget->Release();
mRenderTarget = mTexture->getRenderTarget(mTarget); mRenderTarget = mTexture->getRenderTarget(mTarget);
...@@ -1482,10 +1479,14 @@ IDirect3DSurface9 *Texture::TextureColorbufferProxy::getRenderTarget() ...@@ -1482,10 +1479,14 @@ IDirect3DSurface9 *Texture::TextureColorbufferProxy::getRenderTarget()
return mRenderTarget; return mRenderTarget;
} }
void Texture::TextureColorbufferProxy::latchTextureInfo() int Texture::TextureColorbufferProxy::getWidth()
{
return mTexture->getWidth();
}
int Texture::TextureColorbufferProxy::getHeight()
{ {
mWidth = mTexture->getWidth(); return mTexture->getHeight();
mHeight = mTexture->getHeight();
} }
} }
...@@ -76,11 +76,12 @@ class Texture ...@@ -76,11 +76,12 @@ class Texture
virtual IDirect3DSurface9 *getRenderTarget(); virtual IDirect3DSurface9 *getRenderTarget();
virtual int getWidth();
virtual int getHeight();
private: private:
Texture *mTexture; Texture *mTexture;
GLenum mTarget; GLenum mTarget;
void latchTextureInfo();
}; };
// Helper structure representing a single image layer // Helper structure representing a single image layer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment