Commit e737b06c by Jamie Madill

Revert "Query attachment render targets from Impl class."

D3D9 bug is causing failures in the WebGL depth texture test. BUG=angleproject:963 This reverts commit 804e8436. Change-Id: I660f05033360e97258794138cb50b604f5ac16b6 Reviewed-on: https://chromium-review.googlesource.com/269005Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent c1c1cdc4
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "angle_gl.h" #include "angle_gl.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h"
#include "libANGLE/ImageIndex.h" #include "libANGLE/ImageIndex.h"
#include "libANGLE/RefCountObject.h" #include "libANGLE/RefCountObject.h"
...@@ -21,20 +20,6 @@ namespace egl ...@@ -21,20 +20,6 @@ namespace egl
class Surface; class Surface;
} }
namespace rx
{
// An implementation-specific object associated with an attachment.
class FramebufferAttachmentRenderTarget : angle::NonCopyable
{
public:
FramebufferAttachmentRenderTarget() {}
virtual ~FramebufferAttachmentRenderTarget() {}
};
class FramebufferAttachmentObjectImpl;
}
namespace gl namespace gl
{ {
class FramebufferAttachmentObject; class FramebufferAttachmentObject;
...@@ -134,20 +119,7 @@ class FramebufferAttachment final ...@@ -134,20 +119,7 @@ class FramebufferAttachment final
Texture *getTexture() const; Texture *getTexture() const;
const egl::Surface *getSurface() const; const egl::Surface *getSurface() const;
// "T" must be static_castable from FramebufferAttachmentRenderTarget
template <typename T>
gl::Error getRenderTarget(T **rtOut) const
{
// Cast through the pointer-to-pointer type
rx::FramebufferAttachmentRenderTarget *rtPtr = nullptr;
gl::Error error = getRenderTarget(&rtPtr);
*rtOut = static_cast<T*>(rtPtr);
return error;
}
private: private:
gl::Error getRenderTarget(rx::FramebufferAttachmentRenderTarget **rtOut) const;
GLenum mType; GLenum mType;
Target mTarget; Target mTarget;
BindingPointer<FramebufferAttachmentObject> mResource; BindingPointer<FramebufferAttachmentObject> mResource;
...@@ -163,12 +135,6 @@ class FramebufferAttachmentObject : public RefCountObject ...@@ -163,12 +135,6 @@ class FramebufferAttachmentObject : public RefCountObject
virtual GLsizei getAttachmentHeight(const FramebufferAttachment::Target &target) const = 0; virtual GLsizei getAttachmentHeight(const FramebufferAttachment::Target &target) const = 0;
virtual GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &target) const = 0; virtual GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &target) const = 0;
virtual GLsizei getAttachmentSamples(const FramebufferAttachment::Target &target) const = 0; virtual GLsizei getAttachmentSamples(const FramebufferAttachment::Target &target) const = 0;
Error getAttachmentRenderTarget(const FramebufferAttachment::Target &target,
rx::FramebufferAttachmentRenderTarget **rtOut) const;
protected:
virtual rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const = 0;
}; };
inline GLsizei FramebufferAttachment::getWidth() const inline GLsizei FramebufferAttachment::getWidth() const
...@@ -191,38 +157,6 @@ inline GLsizei FramebufferAttachment::getSamples() const ...@@ -191,38 +157,6 @@ inline GLsizei FramebufferAttachment::getSamples() const
return mResource->getAttachmentSamples(mTarget); return mResource->getAttachmentSamples(mTarget);
} }
inline gl::Error FramebufferAttachment::getRenderTarget(rx::FramebufferAttachmentRenderTarget **rtOut) const
{
return mResource->getAttachmentRenderTarget(mTarget, rtOut);
}
} // namespace gl
namespace rx
{
class FramebufferAttachmentObjectImpl : angle::NonCopyable
{
public:
FramebufferAttachmentObjectImpl() {}
virtual ~FramebufferAttachmentObjectImpl() {}
virtual gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) = 0;
};
} // namespace rx
namespace gl
{
inline Error FramebufferAttachmentObject::getAttachmentRenderTarget(
const FramebufferAttachment::Target &target,
rx::FramebufferAttachmentRenderTarget **rtOut) const
{
return getAttachmentImpl()->getAttachmentRenderTarget(target, rtOut);
}
} }
#endif // LIBANGLE_FRAMEBUFFERATTACHMENT_H_ #endif // LIBANGLE_FRAMEBUFFERATTACHMENT_H_
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "libANGLE/Texture.h" #include "libANGLE/Texture.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/RenderTargetD3D.h" #include "libANGLE/renderer/d3d/RenderTargetD3D.h"
#include "libANGLE/renderer/RenderbufferImpl.h"
namespace gl namespace gl
{ {
......
...@@ -15,7 +15,11 @@ ...@@ -15,7 +15,11 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/renderer/RenderbufferImpl.h"
namespace rx
{
class RenderbufferImpl;
}
namespace gl namespace gl
{ {
...@@ -54,8 +58,6 @@ class Renderbuffer : public FramebufferAttachmentObject ...@@ -54,8 +58,6 @@ class Renderbuffer : public FramebufferAttachmentObject
GLsizei getAttachmentSamples(const FramebufferAttachment::Target &/*target*/) const override { return getSamples(); } GLsizei getAttachmentSamples(const FramebufferAttachment::Target &/*target*/) const override { return getSamples(); }
private: private:
rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mRenderbuffer; }
rx::RenderbufferImpl *mRenderbuffer; rx::RenderbufferImpl *mRenderbuffer;
GLsizei mWidth; GLsizei mWidth;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "libANGLE/Config.h" #include "libANGLE/Config.h"
#include "libANGLE/Texture.h" #include "libANGLE/Texture.h"
#include "libANGLE/renderer/SurfaceImpl.h"
#include <EGL/eglext.h> #include <EGL/eglext.h>
......
...@@ -16,13 +16,17 @@ ...@@ -16,13 +16,17 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/renderer/SurfaceImpl.h"
namespace gl namespace gl
{ {
class Texture; class Texture;
} }
namespace rx
{
class SurfaceImpl;
}
namespace egl namespace egl
{ {
class AttributeMap; class AttributeMap;
...@@ -72,7 +76,6 @@ class Surface final : public gl::FramebufferAttachmentObject ...@@ -72,7 +76,6 @@ class Surface final : public gl::FramebufferAttachmentObject
private: private:
virtual ~Surface(); virtual ~Surface();
rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mImplementation; }
rx::SurfaceImpl *mImplementation; rx::SurfaceImpl *mImplementation;
......
...@@ -29,7 +29,6 @@ class MockSurfaceImpl : public rx::SurfaceImpl ...@@ -29,7 +29,6 @@ class MockSurfaceImpl : public rx::SurfaceImpl
MOCK_CONST_METHOD0(getWidth, EGLint()); MOCK_CONST_METHOD0(getWidth, EGLint());
MOCK_CONST_METHOD0(getHeight, EGLint()); MOCK_CONST_METHOD0(getHeight, EGLint());
MOCK_CONST_METHOD0(isPostSubBufferSupported, EGLint(void)); MOCK_CONST_METHOD0(isPostSubBufferSupported, EGLint(void));
MOCK_METHOD2(getAttachmentRenderTarget, gl::Error(const gl::FramebufferAttachment::Target &, rx::FramebufferAttachmentRenderTarget **));
MOCK_METHOD0(destroy, void()); MOCK_METHOD0(destroy, void());
}; };
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "libANGLE/Data.h" #include "libANGLE/Data.h"
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/TextureImpl.h"
namespace gl namespace gl
{ {
......
...@@ -19,13 +19,17 @@ ...@@ -19,13 +19,17 @@
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/angletypes.h" #include "libANGLE/angletypes.h"
#include "libANGLE/renderer/TextureImpl.h"
namespace egl namespace egl
{ {
class Surface; class Surface;
} }
namespace rx
{
class TextureImpl;
}
namespace gl namespace gl
{ {
class Framebuffer; class Framebuffer;
...@@ -97,7 +101,6 @@ class Texture final : public FramebufferAttachmentObject ...@@ -97,7 +101,6 @@ class Texture final : public FramebufferAttachmentObject
GLsizei getAttachmentSamples(const FramebufferAttachment::Target &target) const override; GLsizei getAttachmentSamples(const FramebufferAttachment::Target &target) const override;
private: private:
rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mTexture; }
static unsigned int issueTextureSerial(); static unsigned int issueTextureSerial();
rx::TextureImpl *mTexture; rx::TextureImpl *mTexture;
......
...@@ -12,12 +12,11 @@ ...@@ -12,12 +12,11 @@
#include "angle_gl.h" #include "angle_gl.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h"
namespace rx namespace rx
{ {
class RenderbufferImpl : public FramebufferAttachmentObjectImpl class RenderbufferImpl : angle::NonCopyable
{ {
public: public:
RenderbufferImpl(); RenderbufferImpl();
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h"
namespace egl namespace egl
{ {
...@@ -22,7 +21,7 @@ struct Config; ...@@ -22,7 +21,7 @@ struct Config;
namespace rx namespace rx
{ {
class SurfaceImpl : public FramebufferAttachmentObjectImpl class SurfaceImpl : angle::NonCopyable
{ {
public: public:
SurfaceImpl(); SurfaceImpl();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "angle_gl.h" #include "angle_gl.h"
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/ImageIndex.h" #include "libANGLE/ImageIndex.h"
namespace egl namespace egl
...@@ -36,7 +35,7 @@ struct SamplerState; ...@@ -36,7 +35,7 @@ struct SamplerState;
namespace rx namespace rx
{ {
class TextureImpl : public FramebufferAttachmentObjectImpl class TextureImpl : angle::NonCopyable
{ {
public: public:
TextureImpl() {} TextureImpl() {}
......
...@@ -226,7 +226,7 @@ GLenum FramebufferD3D::getImplementationColorReadFormat() const ...@@ -226,7 +226,7 @@ GLenum FramebufferD3D::getImplementationColorReadFormat() const
} }
RenderTargetD3D *attachmentRenderTarget = NULL; RenderTargetD3D *attachmentRenderTarget = NULL;
gl::Error error = readAttachment->getRenderTarget(&attachmentRenderTarget); gl::Error error = GetAttachmentRenderTarget(readAttachment, &attachmentRenderTarget);
if (error.isError()) if (error.isError())
{ {
return GL_NONE; return GL_NONE;
...@@ -248,7 +248,7 @@ GLenum FramebufferD3D::getImplementationColorReadType() const ...@@ -248,7 +248,7 @@ GLenum FramebufferD3D::getImplementationColorReadType() const
} }
RenderTargetD3D *attachmentRenderTarget = NULL; RenderTargetD3D *attachmentRenderTarget = NULL;
gl::Error error = readAttachment->getRenderTarget(&attachmentRenderTarget); gl::Error error = GetAttachmentRenderTarget(readAttachment, &attachmentRenderTarget);
if (error.isError()) if (error.isError())
{ {
return GL_NONE; return GL_NONE;
...@@ -376,6 +376,48 @@ const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const Wor ...@@ -376,6 +376,48 @@ const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const Wor
return mColorAttachmentsForRender; return mColorAttachmentsForRender;
} }
gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTargetD3D **outRT)
{
if (attachment->type() == GL_TEXTURE)
{
gl::Texture *texture = attachment->getTexture();
ASSERT(texture);
TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
const gl::ImageIndex &index = attachment->getTextureImageIndex();
return textureD3D->getRenderTarget(index, outRT);
}
else if (attachment->type() == GL_RENDERBUFFER)
{
gl::Renderbuffer *renderbuffer = attachment->getRenderbuffer();
ASSERT(renderbuffer);
RenderbufferD3D *renderbufferD3D = GetImplAs<RenderbufferD3D>(renderbuffer);
*outRT = renderbufferD3D->getRenderTarget();
return gl::Error(GL_NO_ERROR);
}
else if (attachment->type() == GL_FRAMEBUFFER_DEFAULT)
{
const egl::Surface *surface = attachment->getSurface();
ASSERT(surface);
const SurfaceD3D *surfaceD3D = GetImplAs<SurfaceD3D>(surface);
ASSERT(surfaceD3D);
if (attachment->getBinding() == GL_BACK)
{
*outRT = surfaceD3D->getSwapChain()->getColorRenderTarget();
}
else
{
*outRT = surfaceD3D->getSwapChain()->getDepthStencilRenderTarget();
}
return gl::Error(GL_NO_ERROR);
}
else
{
UNREACHABLE();
return gl::Error(GL_INVALID_OPERATION);
}
}
// Note: RenderTarget serials should ideally be in the RenderTargets themselves. // Note: RenderTarget serials should ideally be in the RenderTargets themselves.
unsigned int GetAttachmentSerial(const gl::FramebufferAttachment *attachment) unsigned int GetAttachmentSerial(const gl::FramebufferAttachment *attachment)
{ {
......
...@@ -106,6 +106,7 @@ class FramebufferD3D : public FramebufferImpl ...@@ -106,6 +106,7 @@ class FramebufferD3D : public FramebufferImpl
virtual GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const = 0; virtual GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const = 0;
}; };
gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTargetD3D **outRT);
unsigned int GetAttachmentSerial(const gl::FramebufferAttachment *attachment); unsigned int GetAttachmentSerial(const gl::FramebufferAttachment *attachment);
} }
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h" #include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
namespace rx namespace rx
{ {
...@@ -31,11 +30,11 @@ ImageD3D::ImageD3D() ...@@ -31,11 +30,11 @@ ImageD3D::ImageD3D()
gl::Error ImageD3D::copy(const gl::Offset &destOffset, const gl::Rectangle &sourceArea, const gl::Framebuffer *source) gl::Error ImageD3D::copy(const gl::Offset &destOffset, const gl::Rectangle &sourceArea, const gl::Framebuffer *source)
{ {
const gl::FramebufferAttachment *srcAttachment = source->getReadColorbuffer(); const gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
ASSERT(srcAttachment); ASSERT(colorbuffer);
RenderTargetD3D *renderTarget = NULL; RenderTargetD3D *renderTarget = NULL;
gl::Error error = srcAttachment->getRenderTarget(&renderTarget); gl::Error error = GetAttachmentRenderTarget(colorbuffer, &renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -12,12 +12,11 @@ ...@@ -12,12 +12,11 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/angletypes.h" #include "libANGLE/angletypes.h"
#include "libANGLE/FramebufferAttachment.h"
namespace rx namespace rx
{ {
class RenderTargetD3D : public FramebufferAttachmentRenderTarget class RenderTargetD3D : angle::NonCopyable
{ {
public: public:
RenderTargetD3D(); RenderTargetD3D();
......
...@@ -75,11 +75,4 @@ unsigned int RenderbufferD3D::getRenderTargetSerial() const ...@@ -75,11 +75,4 @@ unsigned int RenderbufferD3D::getRenderTargetSerial() const
return (mRenderTarget ? mRenderTarget->getSerial() : 0); return (mRenderTarget ? mRenderTarget->getSerial() : 0);
} }
gl::Error RenderbufferD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut)
{
*rtOut = mRenderTarget;
return gl::Error(GL_NO_ERROR);
}
} }
...@@ -32,9 +32,6 @@ class RenderbufferD3D : public RenderbufferImpl ...@@ -32,9 +32,6 @@ class RenderbufferD3D : public RenderbufferImpl
RenderTargetD3D *getRenderTarget(); RenderTargetD3D *getRenderTarget();
unsigned int getRenderTargetSerial() const; unsigned int getRenderTargetSerial() const;
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) override;
private: private:
RendererD3D *mRenderer; RendererD3D *mRenderer;
RenderTargetD3D *mRenderTarget; RenderTargetD3D *mRenderTarget;
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/renderer/d3d/DisplayD3D.h" #include "libANGLE/renderer/d3d/DisplayD3D.h"
#include "libANGLE/renderer/d3d/RendererD3D.h" #include "libANGLE/renderer/d3d/RendererD3D.h"
#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
#include "libANGLE/renderer/d3d/SwapChainD3D.h" #include "libANGLE/renderer/d3d/SwapChainD3D.h"
#include <tchar.h> #include <tchar.h>
...@@ -361,18 +360,4 @@ egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value) ...@@ -361,18 +360,4 @@ egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value)
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
gl::Error SurfaceD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut)
{
if (target.binding() == GL_BACK)
{
*rtOut = mSwapChain->getColorRenderTarget();
}
else
{
*rtOut = mSwapChain->getDepthStencilRenderTarget();
}
return gl::Error(GL_NO_ERROR);
}
} }
...@@ -54,9 +54,6 @@ class SurfaceD3D : public SurfaceImpl ...@@ -54,9 +54,6 @@ class SurfaceD3D : public SurfaceImpl
// Returns true if swapchain changed due to resize or interval update // Returns true if swapchain changed due to resize or interval update
bool checkForOutOfDateSwapChain(); bool checkForOutOfDateSwapChain();
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) override;
private: private:
SurfaceD3D(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLint width, EGLint height, SurfaceD3D(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLint width, EGLint height,
EGLint fixedSize, EGLClientBuffer shareHandle, EGLNativeWindowType window); EGLint fixedSize, EGLClientBuffer shareHandle, EGLNativeWindowType window);
......
...@@ -608,15 +608,6 @@ gl::Error TextureD3D::commitRegion(const gl::ImageIndex &index, const gl::Box &r ...@@ -608,15 +608,6 @@ gl::Error TextureD3D::commitRegion(const gl::ImageIndex &index, const gl::Box &r
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
gl::Error TextureD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut)
{
RenderTargetD3D *rtD3D = nullptr;
gl::Error error = getRenderTarget(target.textureIndex(), &rtD3D);
*rtOut = static_cast<FramebufferAttachmentRenderTarget *>(rtD3D);
return error;
}
TextureD3D_2D::TextureD3D_2D(RendererD3D *renderer) TextureD3D_2D::TextureD3D_2D(RendererD3D *renderer)
: TextureD3D(renderer) : TextureD3D(renderer)
{ {
......
...@@ -64,9 +64,6 @@ class TextureD3D : public TextureImpl ...@@ -64,9 +64,6 @@ class TextureD3D : public TextureImpl
TextureStorage *getStorage(); TextureStorage *getStorage();
ImageD3D *getBaseLevelImage() const; ImageD3D *getBaseLevelImage() const;
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) override;
protected: protected:
gl::Error setImage(const gl::ImageIndex &index, GLenum type, gl::Error setImage(const gl::ImageIndex &index, GLenum type,
const gl::PixelUnpackState &unpack, const uint8_t *pixels, const gl::PixelUnpackState &unpack, const uint8_t *pixels,
......
...@@ -260,7 +260,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl ...@@ -260,7 +260,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl
drawBufferStates[colorAttachment] != GL_NONE) drawBufferStates[colorAttachment] != GL_NONE)
{ {
RenderTarget11 *renderTarget = NULL; RenderTarget11 *renderTarget = NULL;
gl::Error error = attachment.getRenderTarget(&renderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(&attachment, &renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -349,7 +349,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl ...@@ -349,7 +349,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams, const gl
ASSERT(attachment != nullptr); ASSERT(attachment != nullptr);
RenderTarget11 *renderTarget = NULL; RenderTarget11 *renderTarget = NULL;
gl::Error error = attachment->getRenderTarget(&renderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(attachment, &renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -115,7 +115,7 @@ static gl::Error getRenderTargetResource(const gl::FramebufferAttachment *colorb ...@@ -115,7 +115,7 @@ static gl::Error getRenderTargetResource(const gl::FramebufferAttachment *colorb
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget11 *renderTarget = nullptr; RenderTarget11 *renderTarget = nullptr;
gl::Error error = colorbuffer->getRenderTarget(&renderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(colorbuffer, &renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -189,7 +189,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang ...@@ -189,7 +189,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
ASSERT(readBuffer); ASSERT(readBuffer);
RenderTargetD3D *readRenderTarget = nullptr; RenderTargetD3D *readRenderTarget = nullptr;
gl::Error error = readBuffer->getRenderTarget(&readRenderTarget); gl::Error error = GetAttachmentRenderTarget(readBuffer, &readRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -207,7 +207,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang ...@@ -207,7 +207,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
drawBufferStates[colorAttachment] != GL_NONE) drawBufferStates[colorAttachment] != GL_NONE)
{ {
RenderTargetD3D *drawRenderTarget = nullptr; RenderTargetD3D *drawRenderTarget = nullptr;
error = drawBuffer.getRenderTarget(&drawRenderTarget); error = GetAttachmentRenderTarget(&drawBuffer, &drawRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -230,7 +230,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang ...@@ -230,7 +230,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
ASSERT(readBuffer); ASSERT(readBuffer);
RenderTargetD3D *readRenderTarget = nullptr; RenderTargetD3D *readRenderTarget = nullptr;
gl::Error error = readBuffer->getRenderTarget(&readRenderTarget); gl::Error error = GetAttachmentRenderTarget(readBuffer, &readRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -241,7 +241,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang ...@@ -241,7 +241,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
ASSERT(drawBuffer); ASSERT(drawBuffer);
RenderTargetD3D *drawRenderTarget = nullptr; RenderTargetD3D *drawRenderTarget = nullptr;
error = drawBuffer->getRenderTarget(&drawRenderTarget); error = GetAttachmentRenderTarget(drawBuffer, &drawRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -1290,7 +1290,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer) ...@@ -1290,7 +1290,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
// Extract the render target dimensions and view // Extract the render target dimensions and view
RenderTarget11 *renderTarget = NULL; RenderTarget11 *renderTarget = NULL;
gl::Error error = colorbuffer->getRenderTarget(&renderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(colorbuffer, &renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -1327,7 +1327,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer) ...@@ -1327,7 +1327,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
if (depthStencil) if (depthStencil)
{ {
RenderTarget11 *depthStencilRenderTarget = NULL; RenderTarget11 *depthStencilRenderTarget = NULL;
gl::Error error = depthStencil->getRenderTarget(&depthStencilRenderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(depthStencil, &depthStencilRenderTarget);
if (error.isError()) if (error.isError())
{ {
SafeRelease(framebufferRTVs); SafeRelease(framebufferRTVs);
...@@ -2423,7 +2423,7 @@ gl::Error Renderer11::copyImage2D(const gl::Framebuffer *framebuffer, const gl:: ...@@ -2423,7 +2423,7 @@ gl::Error Renderer11::copyImage2D(const gl::Framebuffer *framebuffer, const gl::
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL; RenderTarget11 *sourceRenderTarget = NULL;
gl::Error error = colorbuffer->getRenderTarget(&sourceRenderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(colorbuffer, &sourceRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -2474,7 +2474,7 @@ gl::Error Renderer11::copyImageCube(const gl::Framebuffer *framebuffer, const gl ...@@ -2474,7 +2474,7 @@ gl::Error Renderer11::copyImageCube(const gl::Framebuffer *framebuffer, const gl
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL; RenderTarget11 *sourceRenderTarget = NULL;
gl::Error error = colorbuffer->getRenderTarget(&sourceRenderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(colorbuffer, &sourceRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -2525,7 +2525,7 @@ gl::Error Renderer11::copyImage3D(const gl::Framebuffer *framebuffer, const gl:: ...@@ -2525,7 +2525,7 @@ gl::Error Renderer11::copyImage3D(const gl::Framebuffer *framebuffer, const gl::
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL; RenderTarget11 *sourceRenderTarget = NULL;
gl::Error error = colorbuffer->getRenderTarget(&sourceRenderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(colorbuffer, &sourceRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -2576,7 +2576,7 @@ gl::Error Renderer11::copyImage2DArray(const gl::Framebuffer *framebuffer, const ...@@ -2576,7 +2576,7 @@ gl::Error Renderer11::copyImage2DArray(const gl::Framebuffer *framebuffer, const
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget11 *sourceRenderTarget = NULL; RenderTarget11 *sourceRenderTarget = NULL;
gl::Error error = colorbuffer->getRenderTarget(&sourceRenderTarget); gl::Error error = d3d11::GetAttachmentRenderTarget(colorbuffer, &sourceRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -1189,6 +1189,18 @@ HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name) ...@@ -1189,6 +1189,18 @@ HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
#endif #endif
} }
gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTarget11 **outRT)
{
RenderTargetD3D *renderTarget = NULL;
gl::Error error = rx::GetAttachmentRenderTarget(attachment, &renderTarget);
if (error.isError())
{
return error;
}
*outRT = GetAs<RenderTarget11>(renderTarget);
return gl::Error(GL_NO_ERROR);
}
Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel) Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel)
{ {
Workarounds workarounds; Workarounds workarounds;
......
...@@ -179,6 +179,8 @@ inline void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBu ...@@ -179,6 +179,8 @@ inline void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBu
context->Unmap(constantBuffer, 0); context->Unmap(constantBuffer, 0);
} }
gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTarget11 **outRT);
Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel); Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel);
} }
......
...@@ -239,8 +239,8 @@ gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRe ...@@ -239,8 +239,8 @@ gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRe
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0); const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = nullptr; RenderTarget9 *renderTarget9 = NULL;
error = colorbuffer->getRenderTarget(&renderTarget9); error = d3d9::GetAttachmentRenderTarget(colorbuffer, &renderTarget9);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -278,8 +278,8 @@ gl::Error Blit9::copyCube(const gl::Framebuffer *framebuffer, const RECT &source ...@@ -278,8 +278,8 @@ gl::Error Blit9::copyCube(const gl::Framebuffer *framebuffer, const RECT &source
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0); const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = nullptr; RenderTarget9 *renderTarget9 = NULL;
error = colorbuffer->getRenderTarget(&renderTarget9); error = d3d9::GetAttachmentRenderTarget(colorbuffer, &renderTarget9);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -60,7 +60,7 @@ gl::Error Framebuffer9::readPixels(const gl::Rectangle &area, GLenum format, GLe ...@@ -60,7 +60,7 @@ gl::Error Framebuffer9::readPixels(const gl::Rectangle &area, GLenum format, GLe
ASSERT(colorbuffer); ASSERT(colorbuffer);
RenderTarget9 *renderTarget = nullptr; RenderTarget9 *renderTarget = nullptr;
gl::Error error = colorbuffer->getRenderTarget(&renderTarget); gl::Error error = d3d9::GetAttachmentRenderTarget(colorbuffer, &renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -247,7 +247,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl ...@@ -247,7 +247,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
ASSERT(readBuffer); ASSERT(readBuffer);
RenderTarget9 *readRenderTarget = nullptr; RenderTarget9 *readRenderTarget = nullptr;
gl::Error error = readBuffer->getRenderTarget(&readRenderTarget); gl::Error error = d3d9::GetAttachmentRenderTarget(readBuffer, &readRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -258,7 +258,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl ...@@ -258,7 +258,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
ASSERT(drawBuffer); ASSERT(drawBuffer);
RenderTarget9 *drawRenderTarget = nullptr; RenderTarget9 *drawRenderTarget = nullptr;
error = drawBuffer->getRenderTarget(&drawRenderTarget); error = d3d9::GetAttachmentRenderTarget(drawBuffer, &drawRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -373,7 +373,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl ...@@ -373,7 +373,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
ASSERT(readBuffer); ASSERT(readBuffer);
RenderTarget9 *readDepthStencil = nullptr; RenderTarget9 *readDepthStencil = nullptr;
gl::Error error = readBuffer->getRenderTarget(&readDepthStencil); gl::Error error = d3d9::GetAttachmentRenderTarget(readBuffer, &readDepthStencil);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -384,7 +384,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl ...@@ -384,7 +384,7 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
ASSERT(drawBuffer); ASSERT(drawBuffer);
RenderTarget9 *drawDepthStencil = nullptr; RenderTarget9 *drawDepthStencil = nullptr;
error = drawBuffer->getRenderTarget(&drawDepthStencil); error = d3d9::GetAttachmentRenderTarget(drawBuffer, &drawDepthStencil);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -1312,19 +1312,17 @@ gl::Error Renderer9::getNullColorbuffer(const gl::FramebufferAttachment *depthbu ...@@ -1312,19 +1312,17 @@ gl::Error Renderer9::getNullColorbuffer(const gl::FramebufferAttachment *depthbu
gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuffer, const gl::FramebufferAttachment *depthStencilBuffer) gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuffer, const gl::FramebufferAttachment *depthStencilBuffer)
{ {
const gl::FramebufferAttachment *renderAttachment = colorBuffer;
// if there is no color attachment we must synthesize a NULL colorattachment // if there is no color attachment we must synthesize a NULL colorattachment
// to keep the D3D runtime happy. This should only be possible if depth texturing. // to keep the D3D runtime happy. This should only be possible if depth texturing.
if (renderAttachment == nullptr) if (!colorBuffer)
{ {
gl::Error error = getNullColorbuffer(depthStencilBuffer, &renderAttachment); gl::Error error = getNullColorbuffer(depthStencilBuffer, &colorBuffer);
if (error.isError()) if (error.isError())
{ {
return error; return error;
} }
} }
ASSERT(renderAttachment != nullptr); ASSERT(colorBuffer);
size_t renderTargetWidth = 0; size_t renderTargetWidth = 0;
size_t renderTargetHeight = 0; size_t renderTargetHeight = 0;
...@@ -1335,8 +1333,8 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf ...@@ -1335,8 +1333,8 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf
if (renderTargetSerial != mAppliedRenderTargetSerial) if (renderTargetSerial != mAppliedRenderTargetSerial)
{ {
// Apply the render target on the device // Apply the render target on the device
RenderTarget9 *renderTarget = nullptr; RenderTarget9 *renderTarget = NULL;
gl::Error error = renderAttachment->getRenderTarget(&renderTarget); gl::Error error = d3d9::GetAttachmentRenderTarget(colorBuffer, &renderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -1366,8 +1364,8 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf ...@@ -1366,8 +1364,8 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf
// Apply the depth stencil on the device // Apply the depth stencil on the device
if (depthStencilBuffer) if (depthStencilBuffer)
{ {
RenderTarget9 *depthStencilRenderTarget = nullptr; RenderTarget9 *depthStencilRenderTarget = NULL;
gl::Error error = depthStencilBuffer->getRenderTarget(&depthStencilRenderTarget); gl::Error error = d3d9::GetAttachmentRenderTarget(depthStencilBuffer, &depthStencilRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -2012,10 +2010,8 @@ gl::Error Renderer9::clear(const ClearParameters &clearParams, ...@@ -2012,10 +2010,8 @@ gl::Error Renderer9::clear(const ClearParameters &clearParams,
unsigned int stencilUnmasked = 0x0; unsigned int stencilUnmasked = 0x0;
if (clearParams.clearStencil && depthStencilBuffer->getStencilSize() > 0) if (clearParams.clearStencil && depthStencilBuffer->getStencilSize() > 0)
{ {
ASSERT(depthStencilBuffer != nullptr); RenderTargetD3D *stencilRenderTarget = NULL;
gl::Error error = GetAttachmentRenderTarget(depthStencilBuffer, &stencilRenderTarget);
RenderTargetD3D *stencilRenderTarget = nullptr;
gl::Error error = depthStencilBuffer->getRenderTarget(&stencilRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
...@@ -2035,10 +2031,8 @@ gl::Error Renderer9::clear(const ClearParameters &clearParams, ...@@ -2035,10 +2031,8 @@ gl::Error Renderer9::clear(const ClearParameters &clearParams,
D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0); D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0);
if (clearColor) if (clearColor)
{ {
ASSERT(colorBuffer != nullptr);
RenderTargetD3D *colorRenderTarget = NULL; RenderTargetD3D *colorRenderTarget = NULL;
gl::Error error = colorBuffer->getRenderTarget(&colorRenderTarget); gl::Error error = GetAttachmentRenderTarget(colorBuffer, &colorRenderTarget);
if (error.isError()) if (error.isError())
{ {
return error; return error;
......
...@@ -574,6 +574,18 @@ void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsize ...@@ -574,6 +574,18 @@ void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsize
*levelOffset = upsampleCount; *levelOffset = upsampleCount;
} }
gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTarget9 **outRT)
{
RenderTargetD3D *renderTarget = NULL;
gl::Error error = rx::GetAttachmentRenderTarget(attachment, &renderTarget);
if (error.isError())
{
return error;
}
*outRT = GetAs<RenderTarget9>(renderTarget);
return gl::Error(GL_NO_ERROR);
}
Workarounds GenerateWorkarounds() Workarounds GenerateWorkarounds()
{ {
Workarounds workarounds; Workarounds workarounds;
......
...@@ -76,6 +76,7 @@ inline bool isDeviceLostError(HRESULT errorCode) ...@@ -76,6 +76,7 @@ inline bool isDeviceLostError(HRESULT errorCode)
} }
} }
gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTarget9 **outRT);
Workarounds GenerateWorkarounds(); Workarounds GenerateWorkarounds();
} }
......
...@@ -33,12 +33,6 @@ class RenderbufferGL : public RenderbufferImpl ...@@ -33,12 +33,6 @@ class RenderbufferGL : public RenderbufferImpl
GLuint getRenderbufferID() const; GLuint getRenderbufferID() const;
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) override
{
return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL");
}
private: private:
const FunctionsGL *mFunctions; const FunctionsGL *mFunctions;
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
......
...@@ -20,12 +20,6 @@ class SurfaceGL : public SurfaceImpl ...@@ -20,12 +20,6 @@ class SurfaceGL : public SurfaceImpl
SurfaceGL(); SurfaceGL();
~SurfaceGL() override; ~SurfaceGL() override;
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) override
{
return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL");
}
virtual egl::Error makeCurrent() = 0; virtual egl::Error makeCurrent() = 0;
}; };
......
...@@ -51,12 +51,6 @@ class TextureGL : public TextureImpl ...@@ -51,12 +51,6 @@ class TextureGL : public TextureImpl
void syncSamplerState(const gl::SamplerState &samplerState) const; void syncSamplerState(const gl::SamplerState &samplerState) const;
GLuint getTextureID() const; GLuint getTextureID() const;
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
FramebufferAttachmentRenderTarget **rtOut) override
{
return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL");
}
private: private:
GLenum mTextureType; GLenum mTextureType;
......
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