Eliminates getD3DTexture, instead returning the texture storage object.

TRAC #21910 Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1372 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 0f195ada
...@@ -438,18 +438,17 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL ...@@ -438,18 +438,17 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
return true; return true;
} }
// D3D9_REPLACE TextureStorage *Texture::getNativeTexture()
IDirect3DBaseTexture9 *Texture::getD3DTexture()
{ {
// ensure the underlying texture is created // ensure the underlying texture is created
if (getStorage(false) == NULL)
{
return NULL;
}
TextureStorage *storage = getStorage(false);
if (storage)
{
updateTexture(); updateTexture();
}
return getBaseTexture(); return storage;
} }
bool Texture::hasDirtyParameters() const bool Texture::hasDirtyParameters() const
......
...@@ -86,7 +86,7 @@ class Texture : public RefCountObject ...@@ -86,7 +86,7 @@ class Texture : public RefCountObject
virtual bool isSamplerComplete() const = 0; virtual bool isSamplerComplete() const = 0;
IDirect3DBaseTexture9 *getD3DTexture(); // D3D9_REPLACE TextureStorage *getNativeTexture();
virtual Renderbuffer *getRenderbuffer(GLenum target) = 0; virtual Renderbuffer *getRenderbuffer(GLenum target) = 0;
virtual void generateMipmaps() = 0; virtual void generateMipmaps() = 0;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "common/debug.h" #include "common/debug.h"
#include "libGLESv2/utilities.h" #include "libGLESv2/utilities.h"
#include "libGLESv2/renderer/Renderer9.h" #include "libGLESv2/renderer/Renderer9.h"
#include "libGLESv2/renderer/TextureStorage.h"
#include "libEGL/Config.h" #include "libEGL/Config.h"
#include "libEGL/Display.h" #include "libEGL/Display.h"
...@@ -553,8 +554,12 @@ void Renderer9::setTexture(gl::SamplerType type, int index, gl::Texture *texture ...@@ -553,8 +554,12 @@ void Renderer9::setTexture(gl::SamplerType type, int index, gl::Texture *texture
if (texture) if (texture)
{ {
d3dTexture = texture->getD3DTexture(); gl::TextureStorage *texStorage = texture->getNativeTexture();
// If we get NULL back from getTexture here, something went wrong if (texStorage)
{
d3dTexture = texStorage->getBaseTexture();
}
// If we get NULL back from getBaseTexture here, something went wrong
// in the texture class and we're unexpectedly missing the d3d texture // in the texture class and we're unexpectedly missing the d3d texture
ASSERT(d3dTexture != NULL); ASSERT(d3dTexture != NULL);
} }
......
...@@ -41,6 +41,7 @@ class TextureStorage ...@@ -41,6 +41,7 @@ class TextureStorage
D3DPOOL getPool() const; D3DPOOL getPool() const;
DWORD getUsage() const; DWORD getUsage() const;
unsigned int getTextureSerial() const; unsigned int getTextureSerial() const;
virtual IDirect3DBaseTexture9 *getBaseTexture() const = 0;
virtual unsigned int getRenderTargetSerial(GLenum target) const = 0; virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
int getLodOffset() const; int getLodOffset() const;
...@@ -68,7 +69,7 @@ class TextureStorage2D : public TextureStorage ...@@ -68,7 +69,7 @@ class TextureStorage2D : public TextureStorage
virtual ~TextureStorage2D(); virtual ~TextureStorage2D();
IDirect3DSurface9 *getSurfaceLevel(int level, bool dirty); IDirect3DSurface9 *getSurfaceLevel(int level, bool dirty);
IDirect3DBaseTexture9 *getBaseTexture() const; virtual IDirect3DBaseTexture9 *getBaseTexture() const;
virtual unsigned int getRenderTargetSerial(GLenum target) const; virtual unsigned int getRenderTargetSerial(GLenum target) const;
...@@ -87,7 +88,7 @@ class TextureStorageCubeMap : public TextureStorage ...@@ -87,7 +88,7 @@ class TextureStorageCubeMap : public TextureStorage
virtual ~TextureStorageCubeMap(); virtual ~TextureStorageCubeMap();
IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level, bool dirty); IDirect3DSurface9 *getCubeMapSurface(GLenum faceTarget, int level, bool dirty);
IDirect3DBaseTexture9 *getBaseTexture() const; virtual IDirect3DBaseTexture9 *getBaseTexture() const;
virtual unsigned int getRenderTargetSerial(GLenum target) const; virtual unsigned int getRenderTargetSerial(GLenum target) const;
......
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