Replace getDepthStencil with getRenderTarget.
In all places where we called this method, we treated a NULL return
value as an internal error. This implies to me that we don't need the
two getRenderTarget and getDepthStencil methods, since we aren't using
them to check if a surface is depth or stencil.
BUG=angle:732
Change-Id: I4d1dc148abf3383b1b101bbff4f4d22de27ad03e
Reviewed-on: https://chromium-review.googlesource.com/213852
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 2ec1538..bd814ed 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -2341,7 +2341,7 @@
if (attachment)
{
- renderTarget = attachment->getDepthStencil();
+ renderTarget = attachment->getRenderTarget();
}
}
diff --git a/src/libGLESv2/FramebufferAttachment.cpp b/src/libGLESv2/FramebufferAttachment.cpp
index 861bd65..0cabf39 100644
--- a/src/libGLESv2/FramebufferAttachment.cpp
+++ b/src/libGLESv2/FramebufferAttachment.cpp
@@ -92,11 +92,6 @@
return mTexture2D->getRenderTarget(mLevel);
}
-rx::RenderTarget *Texture2DAttachment::getDepthStencil()
-{
- return mTexture2D->getDepthStencil(mLevel);
-}
-
rx::TextureStorage *Texture2DAttachment::getTextureStorage()
{
return mTexture2D->getNativeTexture()->getStorageInstance();
@@ -175,11 +170,6 @@
return mTextureCubeMap->getRenderTarget(mFaceTarget, mLevel);
}
-rx::RenderTarget *TextureCubeMapAttachment::getDepthStencil()
-{
- return mTextureCubeMap->getDepthStencil(mFaceTarget, mLevel);
-}
-
rx::TextureStorage *TextureCubeMapAttachment::getTextureStorage()
{
return mTextureCubeMap->getNativeTexture()->getStorageInstance();
@@ -258,11 +248,6 @@
return mTexture3D->getRenderTarget(mLevel, mLayer);
}
-rx::RenderTarget *Texture3DAttachment::getDepthStencil()
-{
- return mTexture3D->getDepthStencil(mLevel, mLayer);
-}
-
rx::TextureStorage *Texture3DAttachment::getTextureStorage()
{
return mTexture3D->getNativeTexture()->getStorageInstance();
@@ -341,11 +326,6 @@
return mTexture2DArray->getRenderTarget(mLevel, mLayer);
}
-rx::RenderTarget *Texture2DArrayAttachment::getDepthStencil()
-{
- return mTexture2DArray->getDepthStencil(mLevel, mLayer);
-}
-
rx::TextureStorage *Texture2DArrayAttachment::getTextureStorage()
{
return mTexture2DArray->getNativeTexture()->getStorageInstance();
@@ -424,11 +404,6 @@
return mRenderbuffer->getStorage()->getRenderTarget();
}
-rx::RenderTarget *RenderbufferAttachment::getDepthStencil()
-{
- return mRenderbuffer->getStorage()->getDepthStencil();
-}
-
rx::TextureStorage *RenderbufferAttachment::getTextureStorage()
{
UNREACHABLE();
diff --git a/src/libGLESv2/FramebufferAttachment.h b/src/libGLESv2/FramebufferAttachment.h
index fa1cd27..f12b55e 100644
--- a/src/libGLESv2/FramebufferAttachment.h
+++ b/src/libGLESv2/FramebufferAttachment.h
@@ -58,7 +58,6 @@
// Child class interface
virtual rx::RenderTarget *getRenderTarget() = 0;
- virtual rx::RenderTarget *getDepthStencil() = 0;
virtual rx::TextureStorage *getTextureStorage() = 0;
virtual GLsizei getWidth() const = 0;
@@ -87,7 +86,6 @@
virtual ~Texture2DAttachment();
rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
rx::TextureStorage *getTextureStorage();
virtual GLsizei getWidth() const;
@@ -119,7 +117,6 @@
virtual ~TextureCubeMapAttachment();
rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
rx::TextureStorage *getTextureStorage();
virtual GLsizei getWidth() const;
@@ -152,7 +149,6 @@
virtual ~Texture3DAttachment();
rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
rx::TextureStorage *getTextureStorage();
virtual GLsizei getWidth() const;
@@ -185,7 +181,6 @@
virtual ~Texture2DArrayAttachment();
rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
rx::TextureStorage *getTextureStorage();
virtual GLsizei getWidth() const;
@@ -218,7 +213,6 @@
virtual ~RenderbufferAttachment();
rx::RenderTarget *getRenderTarget();
- rx::RenderTarget *getDepthStencil();
rx::TextureStorage *getTextureStorage();
virtual GLsizei getWidth() const;
diff --git a/src/libGLESv2/Renderbuffer.cpp b/src/libGLESv2/Renderbuffer.cpp
index aec0fef..16ee775 100644
--- a/src/libGLESv2/Renderbuffer.cpp
+++ b/src/libGLESv2/Renderbuffer.cpp
@@ -251,7 +251,7 @@
}
}
-rx::RenderTarget *DepthStencilbuffer::getDepthStencil()
+rx::RenderTarget *DepthStencilbuffer::getRenderTarget()
{
return mDepthStencil;
}
diff --git a/src/libGLESv2/Renderbuffer.h b/src/libGLESv2/Renderbuffer.h
index 6c64bc4..c23a54a 100644
--- a/src/libGLESv2/Renderbuffer.h
+++ b/src/libGLESv2/Renderbuffer.h
@@ -125,7 +125,7 @@
~DepthStencilbuffer();
- virtual rx::RenderTarget *getDepthStencil();
+ virtual rx::RenderTarget *getRenderTarget();
protected:
rx::RenderTarget *mDepthStencil;
diff --git a/src/libGLESv2/State.cpp b/src/libGLESv2/State.cpp
index 9ddfc43..b472eeb 100644
--- a/src/libGLESv2/State.cpp
+++ b/src/libGLESv2/State.cpp
@@ -244,7 +244,7 @@
{
if (framebufferObject->getStencilbuffer() != NULL)
{
- rx::RenderTarget *depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
+ rx::RenderTarget *depthStencil = framebufferObject->getStencilbuffer()->getRenderTarget();
if (!depthStencil)
{
ERR("Depth stencil pointer unexpectedly null.");
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index 22a6f16..4f74532 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -352,11 +352,6 @@
return mTexture->getRenderTarget(level, 0);
}
-rx::RenderTarget *Texture2D::getDepthStencil(GLint level)
-{
- return mTexture->getDepthStencil(level, 0);
-}
-
// Tests for 2D texture (mipmap) completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
bool Texture2D::isMipmapComplete() const
{
@@ -622,11 +617,6 @@
return mTexture->getRenderTarget(level, targetToLayerIndex(target));
}
-rx::RenderTarget *TextureCubeMap::getDepthStencil(GLenum target, GLint level)
-{
- return mTexture->getDepthStencil(level, targetToLayerIndex(target));
-}
-
bool TextureCubeMap::isMipmapComplete() const
{
if (isImmutable())
@@ -802,11 +792,6 @@
return mTexture->getRenderTarget(level, layer);
}
-rx::RenderTarget *Texture3D::getDepthStencil(GLint level, GLint layer)
-{
- return mTexture->getDepthStencil(level, layer);
-}
-
bool Texture3D::isMipmapComplete() const
{
int levelCount = mipLevels();
@@ -975,11 +960,6 @@
return mTexture->getRenderTarget(level, layer);
}
-rx::RenderTarget *Texture2DArray::getDepthStencil(GLint level, GLint layer)
-{
- return mTexture->getDepthStencil(level, layer);
-}
-
bool Texture2DArray::isMipmapComplete() const
{
int levelCount = mipLevels();
diff --git a/src/libGLESv2/Texture.h b/src/libGLESv2/Texture.h
index 0786a95..3008a84 100644
--- a/src/libGLESv2/Texture.h
+++ b/src/libGLESv2/Texture.h
@@ -129,7 +129,6 @@
protected:
friend class Texture2DAttachment;
rx::RenderTarget *getRenderTarget(GLint level);
- rx::RenderTarget *getDepthStencil(GLint level);
private:
DISALLOW_COPY_AND_ASSIGN(Texture2D);
@@ -180,7 +179,6 @@
protected:
friend class TextureCubeMapAttachment;
rx::RenderTarget *getRenderTarget(GLenum target, GLint level);
- rx::RenderTarget *getDepthStencil(GLenum target, GLint level);
private:
DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
@@ -217,7 +215,6 @@
protected:
friend class Texture3DAttachment;
rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
- rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
private:
DISALLOW_COPY_AND_ASSIGN(Texture3D);
@@ -254,7 +251,6 @@
protected:
friend class Texture2DArrayAttachment;
rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
- rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
private:
DISALLOW_COPY_AND_ASSIGN(Texture2DArray);
diff --git a/src/libGLESv2/renderer/TextureImpl.h b/src/libGLESv2/renderer/TextureImpl.h
index e9ac554..c34485a 100644
--- a/src/libGLESv2/renderer/TextureImpl.h
+++ b/src/libGLESv2/renderer/TextureImpl.h
@@ -60,7 +60,6 @@
virtual unsigned int getRenderTargetSerial(GLint level, GLint layer) = 0;
virtual RenderTarget *getRenderTarget(GLint level, GLint layer) = 0;
- virtual RenderTarget *getDepthStencil(GLint level, GLint layer) = 0;
virtual void bindTexImage(egl::Surface *surface) = 0;
virtual void releaseTexImage() = 0;
diff --git a/src/libGLESv2/renderer/d3d/TextureD3D.cpp b/src/libGLESv2/renderer/d3d/TextureD3D.cpp
index d5e3ad8..5e29e4b 100644
--- a/src/libGLESv2/renderer/d3d/TextureD3D.cpp
+++ b/src/libGLESv2/renderer/d3d/TextureD3D.cpp
@@ -518,34 +518,6 @@
}
updateStorageLevel(level);
-
- // ensure this is NOT a depth texture
- if (isDepth(level))
- {
- return NULL;
- }
-
- return mTexStorage->getRenderTarget(level);
-}
-
-RenderTarget *TextureD3D_2D::getDepthStencil(GLint level, GLint layer)
-{
- ASSERT(layer == 0);
-
- // ensure the underlying texture is created
- if (!ensureRenderTarget())
- {
- return NULL;
- }
-
- updateStorageLevel(level);
-
- // ensure this is actually a depth texture
- if (!isDepth(level))
- {
- return NULL;
- }
-
return mTexStorage->getRenderTarget(level);
}
@@ -1040,35 +1012,6 @@
}
updateStorageFaceLevel(layer, level);
-
- // ensure this is NOT a depth texture
- if (isDepth(level, layer))
- {
- return NULL;
- }
-
- return mTexStorage->getRenderTarget(target, level);
-}
-
-RenderTarget *TextureD3D_Cube::getDepthStencil(GLint level, GLint layer)
-{
- GLenum target = gl::TextureCubeMap::layerIndexToTarget(layer);
- ASSERT(gl::IsCubemapTextureTarget(target));
-
- // ensure the underlying texture is created
- if (!ensureRenderTarget())
- {
- return NULL;
- }
-
- updateStorageFaceLevel(layer, level);
-
- // ensure this is a depth texture
- if (!isDepth(level, layer))
- {
- return NULL;
- }
-
return mTexStorage->getRenderTarget(target, level);
}
@@ -1565,31 +1508,6 @@
updateStorage();
- // ensure this is NOT a depth texture
- if (isDepth(level))
- {
- return NULL;
- }
-
- return mTexStorage->getRenderTarget(level, layer);
-}
-
-RenderTarget *TextureD3D_3D::getDepthStencil(GLint level, GLint layer)
-{
- // ensure the underlying texture is created
- if (!ensureRenderTarget())
- {
- return NULL;
- }
-
- updateStorageLevel(level);
-
- // ensure this is a depth texture
- if (!isDepth(level))
- {
- return NULL;
- }
-
return mTexStorage->getRenderTarget(level, layer);
}
@@ -2058,32 +1976,6 @@
}
updateStorageLevel(level);
-
- // ensure this is NOT a depth texture
- if (isDepth(level))
- {
- return NULL;
- }
-
- return mTexStorage->getRenderTarget(level, layer);
-}
-
-RenderTarget *TextureD3D_2DArray::getDepthStencil(GLint level, GLint layer)
-{
- // ensure the underlying texture is created
- if (!ensureRenderTarget())
- {
- return NULL;
- }
-
- updateStorageLevel(level);
-
- // ensure this is a depth texture
- if (!isDepth(level))
- {
- return NULL;
- }
-
return mTexStorage->getRenderTarget(level, layer);
}
diff --git a/src/libGLESv2/renderer/d3d/TextureD3D.h b/src/libGLESv2/renderer/d3d/TextureD3D.h
index d7dcc96..7f21630 100644
--- a/src/libGLESv2/renderer/d3d/TextureD3D.h
+++ b/src/libGLESv2/renderer/d3d/TextureD3D.h
@@ -114,7 +114,6 @@
virtual unsigned int getRenderTargetSerial(GLint level, GLint layer);
virtual RenderTarget *getRenderTarget(GLint level, GLint layer);
- virtual RenderTarget *getDepthStencil(GLint level, GLint layer);
private:
DISALLOW_COPY_AND_ASSIGN(TextureD3D_2D);
@@ -172,7 +171,6 @@
virtual unsigned int getRenderTargetSerial(GLint level, GLint layer);
virtual RenderTarget *getRenderTarget(GLint level, GLint layer);
- virtual RenderTarget *getDepthStencil(GLint level, GLint layer);
private:
DISALLOW_COPY_AND_ASSIGN(TextureD3D_Cube);
@@ -231,7 +229,6 @@
virtual RenderTarget *getRenderTarget(GLint level);
virtual RenderTarget *getRenderTarget(GLint level, GLint layer);
- virtual RenderTarget *getDepthStencil(GLint level, GLint layer);
private:
DISALLOW_COPY_AND_ASSIGN(TextureD3D_3D);
@@ -288,7 +285,6 @@
virtual unsigned int getRenderTargetSerial(GLint level, GLint layer);
virtual RenderTarget *getRenderTarget(GLint level, GLint layer);
- virtual RenderTarget *getDepthStencil(GLint level, GLint layer);
private:
DISALLOW_COPY_AND_ASSIGN(TextureD3D_2DArray);
diff --git a/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp b/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
index 072b630..ba9970b 100644
--- a/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
+++ b/src/libGLESv2/renderer/d3d/d3d11/Clear11.cpp
@@ -286,7 +286,7 @@
gl::FramebufferAttachment *attachment = frameBuffer->getDepthOrStencilbuffer();
if (attachment)
{
- RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(attachment->getDepthStencil());
+ RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(attachment->getRenderTarget());
if (!renderTarget)
{
ERR("Depth stencil render target pointer unexpectedly null.");
diff --git a/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp b/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
index 15060cf..3a276e1 100644
--- a/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
@@ -858,7 +858,7 @@
ID3D11DepthStencilView* framebufferDSV = NULL;
if (depthStencil)
{
- RenderTarget11 *depthStencilRenderTarget = RenderTarget11::makeRenderTarget11(depthStencil->getDepthStencil());
+ RenderTarget11 *depthStencilRenderTarget = RenderTarget11::makeRenderTarget11(depthStencil->getRenderTarget());
if (!depthStencilRenderTarget)
{
ERR("render target pointer unexpectedly null.");
@@ -2567,8 +2567,9 @@
return gl::error(GL_OUT_OF_MEMORY, false);
}
- RenderTarget *readRenderTarget = readBuffer->getDepthStencil();
- RenderTarget *drawRenderTarget = drawBuffer->getDepthStencil();
+ RenderTarget *readRenderTarget = readBuffer->getRenderTarget();
+ RenderTarget *drawRenderTarget = drawBuffer->getRenderTarget();
+ ASSERT(readRenderTarget && drawRenderTarget);
if (!blitRenderbufferRect(readRect, drawRect, readRenderTarget, drawRenderTarget, filter, scissor,
false, blitDepth, blitStencil))
diff --git a/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp b/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
index db8a267..e26dcc7 100644
--- a/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libGLESv2/renderer/d3d/d3d9/Renderer9.cpp
@@ -1197,7 +1197,7 @@
if (depthStencil)
{
IDirect3DSurface9 *depthStencilSurface = NULL;
- RenderTarget *depthStencilRenderTarget = depthStencil->getDepthStencil();
+ RenderTarget *depthStencilRenderTarget = depthStencil->getRenderTarget();
if (depthStencilRenderTarget)
{
@@ -2520,11 +2520,11 @@
if (readBuffer)
{
- readDepthStencil = RenderTarget9::makeRenderTarget9(readBuffer->getDepthStencil());
+ readDepthStencil = RenderTarget9::makeRenderTarget9(readBuffer->getRenderTarget());
}
if (drawBuffer)
{
- drawDepthStencil = RenderTarget9::makeRenderTarget9(drawBuffer->getDepthStencil());
+ drawDepthStencil = RenderTarget9::makeRenderTarget9(drawBuffer->getRenderTarget());
}
if (readDepthStencil)