From 5b5d1244d9089bb4a9e74cc34265a524b84ec258 Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Tue, 9 Sep 2014 15:15:36 -0400 Subject: Add queries for attachment targets. Queries for the FBO attachment Textures and Renderbuffers allow us more options than specific methods for querying the texture storage or texture serial. BUG=angle:732 Change-Id: Ieb4ddca3955fcf716dbf54331524d0c1e25fe946 Reviewed-on: https://chromium-review.googlesource.com/217028 Tested-by: Jamie Madill Reviewed-by: Brandon Jones --- src/libGLESv2/Context.cpp | 18 +++++++------ src/libGLESv2/FramebufferAttachment.cpp | 36 ++++++++++++------------- src/libGLESv2/FramebufferAttachment.h | 15 ++++++----- src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp | 3 ++- 4 files changed, 39 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp index 2b936317..985a7569 100644 --- a/src/libGLESv2/Context.cpp +++ b/src/libGLESv2/Context.cpp @@ -1391,7 +1391,7 @@ void Context::applyShaders(ProgramBinary *programBinary, bool transformFeedbackA { const VertexAttribute *vertexAttributes = mState.getVertexArray()->getVertexAttributes(); - VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS]; + VertexFormat inputLayout[MAX_VERTEX_ATTRIBS]; VertexFormat::GetInputLayout(inputLayout, programBinary, vertexAttributes, mState.getVertexAttribCurrentValues()); const Framebuffer *fbo = mState.getDrawFramebuffer(); @@ -1488,7 +1488,7 @@ bool Context::applyUniformBuffers() Program *programObject = getProgram(mState.getCurrentProgramId()); ProgramBinary *programBinary = programObject->getProgramBinary(); - std::vector boundBuffers; + std::vector boundBuffers; for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < programBinary->getActiveUniformBlockCount(); uniformBlockIndex++) { @@ -1677,7 +1677,7 @@ Error Context::clearBufferfi(GLenum buffer, int drawbuffer, float depth, int ste Error Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels) { - gl::Framebuffer *framebuffer = mState.getReadFramebuffer(); + Framebuffer *framebuffer = mState.getReadFramebuffer(); GLenum sizedInternalFormat = GetSizedInternalFormat(format, type); const InternalFormat &sizedFormatInfo = GetInternalFormatInfo(sizedInternalFormat); @@ -2232,14 +2232,16 @@ size_t Context::getBoundFramebufferTextureSerials(FramebufferTextureSerialArray FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i); if (attachment && attachment->isTexture()) { - (*outSerialArray)[serialCount++] = attachment->getTextureSerial(); + Texture *texture = attachment->getTexture(); + (*outSerialArray)[serialCount++] = texture->getTextureSerial(); } } FramebufferAttachment *depthStencilAttachment = drawFramebuffer->getDepthOrStencilbuffer(); if (depthStencilAttachment && depthStencilAttachment->isTexture()) { - (*outSerialArray)[serialCount++] = depthStencilAttachment->getTextureSerial(); + Texture *depthStencilTexture = depthStencilAttachment->getTexture(); + (*outSerialArray)[serialCount++] = depthStencilTexture->getTextureSerial(); } std::sort(outSerialArray->begin(), outSerialArray->begin() + serialCount); @@ -2269,11 +2271,11 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1 blitDepth = true; } - gl::Rectangle srcRect(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0); - gl::Rectangle dstRect(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0); + Rectangle srcRect(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0); + Rectangle dstRect(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0); if (blitRenderTarget || blitDepth || blitStencil) { - const gl::Rectangle *scissor = mState.isScissorTestEnabled() ? &mState.getScissor() : NULL; + const Rectangle *scissor = mState.isScissorTestEnabled() ? &mState.getScissor() : NULL; mRenderer->blitRect(readFramebuffer, srcRect, drawFramebuffer, dstRect, scissor, blitRenderTarget, blitDepth, blitStencil, filter); } diff --git a/src/libGLESv2/FramebufferAttachment.cpp b/src/libGLESv2/FramebufferAttachment.cpp index 971f188c..fa933ad0 100644 --- a/src/libGLESv2/FramebufferAttachment.cpp +++ b/src/libGLESv2/FramebufferAttachment.cpp @@ -90,11 +90,6 @@ TextureAttachment::~TextureAttachment() mTexture.set(NULL); } -rx::TextureStorage *TextureAttachment::getTextureStorage() -{ - return mTexture->getNativeTexture()->getStorageInstance(); -} - GLsizei TextureAttachment::getSamples() const { return 0; @@ -105,11 +100,6 @@ GLuint TextureAttachment::id() const return mTexture->id(); } -unsigned int TextureAttachment::getTextureSerial() const -{ - return mTexture->getTextureSerial(); -} - GLsizei TextureAttachment::getWidth() const { return mTexture->getWidth(mIndex); @@ -155,6 +145,17 @@ unsigned int TextureAttachment::getSerial() const return mTexture->getRenderTargetSerial(mIndex); } +Texture *TextureAttachment::getTexture() +{ + return mTexture.get(); +} + +Renderbuffer *TextureAttachment::getRenderbuffer() +{ + UNREACHABLE(); + return NULL; +} + ////// RenderbufferAttachment Implementation ////// RenderbufferAttachment::RenderbufferAttachment(GLenum binding, Renderbuffer *renderbuffer) @@ -174,12 +175,6 @@ rx::RenderTarget *RenderbufferAttachment::getRenderTarget() return mRenderbuffer->getStorage()->getRenderTarget(); } -rx::TextureStorage *RenderbufferAttachment::getTextureStorage() -{ - UNREACHABLE(); - return NULL; -} - GLsizei RenderbufferAttachment::getWidth() const { return mRenderbuffer->getWidth(); @@ -230,10 +225,15 @@ GLint RenderbufferAttachment::layer() const return 0; } -unsigned int RenderbufferAttachment::getTextureSerial() const +Texture *RenderbufferAttachment::getTexture() { UNREACHABLE(); - return 0; + return NULL; +} + +Renderbuffer *RenderbufferAttachment::getRenderbuffer() +{ + return mRenderbuffer.get(); } } diff --git a/src/libGLESv2/FramebufferAttachment.h b/src/libGLESv2/FramebufferAttachment.h index 4b827641..e4cb9162 100644 --- a/src/libGLESv2/FramebufferAttachment.h +++ b/src/libGLESv2/FramebufferAttachment.h @@ -57,7 +57,6 @@ class FramebufferAttachment // Child class interface virtual rx::RenderTarget *getRenderTarget() = 0; - virtual rx::TextureStorage *getTextureStorage() = 0; virtual GLsizei getWidth() const = 0; virtual GLsizei getHeight() const = 0; @@ -71,7 +70,9 @@ class FramebufferAttachment virtual GLenum type() const = 0; virtual GLint mipLevel() const = 0; virtual GLint layer() const = 0; - virtual unsigned int getTextureSerial() const = 0; + + virtual Texture *getTexture() = 0; + virtual Renderbuffer *getRenderbuffer() = 0; private: DISALLOW_COPY_AND_ASSIGN(FramebufferAttachment); @@ -85,10 +86,8 @@ class TextureAttachment : public FramebufferAttachment TextureAttachment(GLenum binding, Texture *texture, const ImageIndex &index); virtual ~TextureAttachment(); - rx::TextureStorage *getTextureStorage(); virtual GLsizei getSamples() const; virtual GLuint id() const; - virtual unsigned int getTextureSerial() const; virtual GLsizei getWidth() const; virtual GLsizei getHeight() const; @@ -102,6 +101,9 @@ class TextureAttachment : public FramebufferAttachment virtual rx::RenderTarget *getRenderTarget(); virtual unsigned int getSerial() const; + virtual Texture *getTexture(); + virtual Renderbuffer *getRenderbuffer(); + private: DISALLOW_COPY_AND_ASSIGN(TextureAttachment); @@ -117,7 +119,6 @@ class RenderbufferAttachment : public FramebufferAttachment virtual ~RenderbufferAttachment(); rx::RenderTarget *getRenderTarget(); - rx::TextureStorage *getTextureStorage(); virtual GLsizei getWidth() const; virtual GLsizei getHeight() const; @@ -131,7 +132,9 @@ class RenderbufferAttachment : public FramebufferAttachment virtual GLenum type() const; virtual GLint mipLevel() const; virtual GLint layer() const; - virtual unsigned int getTextureSerial() const; + + virtual Texture *getTexture(); + virtual Renderbuffer *getRenderbuffer(); private: DISALLOW_COPY_AND_ASSIGN(RenderbufferAttachment); diff --git a/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp b/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp index 5e45e2b1..b9de4caa 100644 --- a/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp +++ b/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp @@ -3086,7 +3086,8 @@ ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source, void Renderer11::invalidateFBOAttachmentSwizzles(gl::FramebufferAttachment *attachment, int mipLevel) { ASSERT(attachment->isTexture()); - TextureStorage *texStorage = attachment->getTextureStorage(); + gl::Texture *texture = attachment->getTexture(); + TextureStorage *texStorage = texture->getNativeTexture()->getStorageInstance(); if (texStorage) { TextureStorage11 *texStorage11 = TextureStorage11::makeTextureStorage11(texStorage); -- cgit v1.2.3