Commit 3c7fa226 by Jamie Madill

Rename Renderbuffer to FramebufferAttachment.

Part of the refactoring effort to clean up our classes for FBO attachments and Renderbuffers. BUG=angle:660 Change-Id: Id23df904f56499568159611b66c8922b9dce6a3d Reviewed-on: https://chromium-review.googlesource.com/201832Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 6f38f823
...@@ -1105,7 +1105,7 @@ Texture *Context::getTexture(GLuint handle) ...@@ -1105,7 +1105,7 @@ Texture *Context::getTexture(GLuint handle)
return mResourceManager->getTexture(handle); return mResourceManager->getTexture(handle);
} }
Renderbuffer *Context::getRenderbuffer(GLuint handle) FramebufferAttachment *Context::getRenderbuffer(GLuint handle)
{ {
return mResourceManager->getRenderbuffer(handle); return mResourceManager->getRenderbuffer(handle);
} }
...@@ -1440,7 +1440,7 @@ void Context::setRenderbufferStorage(GLsizei width, GLsizei height, GLenum inter ...@@ -1440,7 +1440,7 @@ void Context::setRenderbufferStorage(GLsizei width, GLsizei height, GLenum inter
return; return;
} }
Renderbuffer *renderbufferObject = mState.renderbuffer.get(); FramebufferAttachment *renderbufferObject = mState.renderbuffer.get();
renderbufferObject->setStorage(renderbuffer); renderbufferObject->setStorage(renderbuffer);
} }
...@@ -1884,7 +1884,7 @@ void Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1884,7 +1884,7 @@ void Context::getIntegerv(GLenum pname, GLint *params)
case GL_ALPHA_BITS: case GL_ALPHA_BITS:
{ {
gl::Framebuffer *framebuffer = getDrawFramebuffer(); gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::Renderbuffer *colorbuffer = framebuffer->getFirstColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getFirstColorbuffer();
if (colorbuffer) if (colorbuffer)
{ {
...@@ -1905,7 +1905,7 @@ void Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1905,7 +1905,7 @@ void Context::getIntegerv(GLenum pname, GLint *params)
case GL_DEPTH_BITS: case GL_DEPTH_BITS:
{ {
gl::Framebuffer *framebuffer = getDrawFramebuffer(); gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::Renderbuffer *depthbuffer = framebuffer->getDepthbuffer(); gl::FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer();
if (depthbuffer) if (depthbuffer)
{ {
...@@ -1920,7 +1920,7 @@ void Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1920,7 +1920,7 @@ void Context::getIntegerv(GLenum pname, GLint *params)
case GL_STENCIL_BITS: case GL_STENCIL_BITS:
{ {
gl::Framebuffer *framebuffer = getDrawFramebuffer(); gl::Framebuffer *framebuffer = getDrawFramebuffer();
gl::Renderbuffer *stencilbuffer = framebuffer->getStencilbuffer(); gl::FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer();
if (stencilbuffer) if (stencilbuffer)
{ {
...@@ -3348,12 +3348,12 @@ void Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, G ...@@ -3348,12 +3348,12 @@ void Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, G
Framebuffer *framebuffer = getReadFramebuffer(); Framebuffer *framebuffer = getReadFramebuffer();
ASSERT(framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE); ASSERT(framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE);
Renderbuffer *renderbuffer = framebuffer->getReadColorbuffer(); FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
ASSERT(renderbuffer); ASSERT(attachment);
*internalFormat = renderbuffer->getActualFormat(); *internalFormat = attachment->getActualFormat();
*format = gl::GetFormat(renderbuffer->getActualFormat(), mClientVersion); *format = gl::GetFormat(attachment->getActualFormat(), mClientVersion);
*type = gl::GetType(renderbuffer->getActualFormat(), mClientVersion); *type = gl::GetType(attachment->getActualFormat(), mClientVersion);
} }
void Context::detachBuffer(GLuint buffer) void Context::detachBuffer(GLuint buffer)
...@@ -3393,7 +3393,7 @@ void Context::detachTexture(GLuint texture) ...@@ -3393,7 +3393,7 @@ void Context::detachTexture(GLuint texture)
// [OpenGL ES 2.0.24] section 4.4 page 112: // [OpenGL ES 2.0.24] section 4.4 page 112:
// If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is // If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is
// as if FramebufferTexture2D had been called, with a texture of 0, for each attachment point to which this // as if Texture2DAttachment had been called, with a texture of 0, for each attachment point to which this
// image was attached in the currently bound framebuffer. // image was attached in the currently bound framebuffer.
Framebuffer *readFramebuffer = getReadFramebuffer(); Framebuffer *readFramebuffer = getReadFramebuffer();
...@@ -3883,17 +3883,17 @@ size_t Context::getBoundFramebufferTextureSerials(FramebufferTextureSerialArray ...@@ -3883,17 +3883,17 @@ size_t Context::getBoundFramebufferTextureSerials(FramebufferTextureSerialArray
Framebuffer *drawFramebuffer = getDrawFramebuffer(); Framebuffer *drawFramebuffer = getDrawFramebuffer();
for (unsigned int i = 0; i < IMPLEMENTATION_MAX_DRAW_BUFFERS; i++) for (unsigned int i = 0; i < IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
{ {
Renderbuffer *renderBuffer = drawFramebuffer->getColorbuffer(i); FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i);
if (renderBuffer && renderBuffer->isTexture()) if (attachment && attachment->isTexture())
{ {
(*outSerialArray)[serialCount++] = renderBuffer->getTextureSerial(); (*outSerialArray)[serialCount++] = attachment->getTextureSerial();
} }
} }
Renderbuffer *depthStencilBuffer = drawFramebuffer->getDepthOrStencilbuffer(); FramebufferAttachment *depthStencilAttachment = drawFramebuffer->getDepthOrStencilbuffer();
if (depthStencilBuffer && depthStencilBuffer->isTexture()) if (depthStencilAttachment && depthStencilAttachment->isTexture())
{ {
(*outSerialArray)[serialCount++] = depthStencilBuffer->getTextureSerial(); (*outSerialArray)[serialCount++] = depthStencilAttachment->getTextureSerial();
} }
std::sort(outSerialArray->begin(), outSerialArray->begin() + serialCount); std::sort(outSerialArray->begin(), outSerialArray->begin() + serialCount);
...@@ -3958,43 +3958,43 @@ void Context::invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const ...@@ -3958,43 +3958,43 @@ void Context::invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const
if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT15) if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT15)
{ {
gl::Renderbuffer *renderBuffer = frameBuffer->getColorbuffer(attachments[i] - GL_COLOR_ATTACHMENT0); gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(attachments[i] - GL_COLOR_ATTACHMENT0);
if (renderBuffer) if (attachment)
{ {
renderTarget = renderBuffer->getRenderTarget(); renderTarget = attachment->getRenderTarget();
} }
} }
else if (attachments[i] == GL_COLOR) else if (attachments[i] == GL_COLOR)
{ {
gl::Renderbuffer *renderBuffer = frameBuffer->getColorbuffer(0); gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(0);
if (renderBuffer) if (attachment)
{ {
renderTarget = renderBuffer->getRenderTarget(); renderTarget = attachment->getRenderTarget();
} }
} }
else else
{ {
gl::Renderbuffer *renderBuffer = NULL; gl::FramebufferAttachment *attachment = NULL;
switch (attachments[i]) switch (attachments[i])
{ {
case GL_DEPTH_ATTACHMENT: case GL_DEPTH_ATTACHMENT:
case GL_DEPTH: case GL_DEPTH:
renderBuffer = frameBuffer->getDepthbuffer(); attachment = frameBuffer->getDepthbuffer();
break; break;
case GL_STENCIL_ATTACHMENT: case GL_STENCIL_ATTACHMENT:
case GL_STENCIL: case GL_STENCIL:
renderBuffer = frameBuffer->getStencilbuffer(); attachment = frameBuffer->getStencilbuffer();
break; break;
case GL_DEPTH_STENCIL_ATTACHMENT: case GL_DEPTH_STENCIL_ATTACHMENT:
renderBuffer = frameBuffer->getDepthOrStencilbuffer(); attachment = frameBuffer->getDepthOrStencilbuffer();
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
if (renderBuffer) if (attachment)
{ {
renderTarget = renderBuffer->getDepthStencil(); renderTarget = attachment->getDepthStencil();
} }
} }
......
...@@ -50,7 +50,7 @@ class TextureCubeMap; ...@@ -50,7 +50,7 @@ class TextureCubeMap;
class Texture3D; class Texture3D;
class Texture2DArray; class Texture2DArray;
class Framebuffer; class Framebuffer;
class Renderbuffer; class FramebufferAttachment;
class RenderbufferStorage; class RenderbufferStorage;
class Colorbuffer; class Colorbuffer;
class Depthbuffer; class Depthbuffer;
...@@ -100,7 +100,7 @@ struct State ...@@ -100,7 +100,7 @@ struct State
BindingPointer<Buffer> arrayBuffer; BindingPointer<Buffer> arrayBuffer;
GLuint readFramebuffer; GLuint readFramebuffer;
GLuint drawFramebuffer; GLuint drawFramebuffer;
BindingPointer<Renderbuffer> renderbuffer; BindingPointer<FramebufferAttachment> renderbuffer;
GLuint currentProgram; GLuint currentProgram;
VertexAttribCurrentValueData vertexAttribCurrentValues[MAX_VERTEX_ATTRIBS]; // From glVertexAttrib VertexAttribCurrentValueData vertexAttribCurrentValues[MAX_VERTEX_ATTRIBS]; // From glVertexAttrib
...@@ -331,7 +331,7 @@ class Context ...@@ -331,7 +331,7 @@ class Context
Program *getProgram(GLuint handle) const; Program *getProgram(GLuint handle) const;
Texture *getTexture(GLuint handle); Texture *getTexture(GLuint handle);
Framebuffer *getFramebuffer(GLuint handle) const; Framebuffer *getFramebuffer(GLuint handle) const;
Renderbuffer *getRenderbuffer(GLuint handle); FramebufferAttachment *getRenderbuffer(GLuint handle);
VertexArray *getVertexArray(GLuint handle) const; VertexArray *getVertexArray(GLuint handle) const;
Sampler *getSampler(GLuint handle) const; Sampler *getSampler(GLuint handle) const;
Query *getQuery(GLuint handle, bool create, GLenum type); Query *getQuery(GLuint handle, bool create, GLenum type);
......
...@@ -42,7 +42,7 @@ Framebuffer::~Framebuffer() ...@@ -42,7 +42,7 @@ Framebuffer::~Framebuffer()
mStencilbuffer.set(NULL, GL_NONE, 0, 0); mStencilbuffer.set(NULL, GL_NONE, 0, 0);
} }
Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint level, GLint layer) const FramebufferAttachment *Framebuffer::lookupAttachment(GLenum type, GLuint handle, GLint level, GLint layer) const
{ {
gl::Context *context = gl::getContext(); gl::Context *context = gl::getContext();
...@@ -59,7 +59,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint ...@@ -59,7 +59,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint
Texture *texture = context->getTexture(handle); Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_2D) if (texture && texture->getTarget() == GL_TEXTURE_2D)
{ {
return static_cast<Texture2D*>(texture)->getRenderbuffer(level); return static_cast<Texture2D*>(texture)->getAttachment(level);
} }
else else
{ {
...@@ -77,7 +77,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint ...@@ -77,7 +77,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint
Texture *texture = context->getTexture(handle); Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_CUBE_MAP) if (texture && texture->getTarget() == GL_TEXTURE_CUBE_MAP)
{ {
return static_cast<TextureCubeMap*>(texture)->getRenderbuffer(type, level); return static_cast<TextureCubeMap*>(texture)->getAttachment(type, level);
} }
else else
{ {
...@@ -90,7 +90,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint ...@@ -90,7 +90,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint
Texture *texture = context->getTexture(handle); Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_3D) if (texture && texture->getTarget() == GL_TEXTURE_3D)
{ {
return static_cast<Texture3D*>(texture)->getRenderbuffer(level, layer); return static_cast<Texture3D*>(texture)->getAttachment(level, layer);
} }
else else
{ {
...@@ -103,7 +103,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint ...@@ -103,7 +103,7 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint
Texture *texture = context->getTexture(handle); Texture *texture = context->getTexture(handle);
if (texture && texture->getTarget() == GL_TEXTURE_2D_ARRAY) if (texture && texture->getTarget() == GL_TEXTURE_2D_ARRAY)
{ {
return static_cast<Texture2DArray*>(texture)->getRenderbuffer(level, layer); return static_cast<Texture2DArray*>(texture)->getAttachment(level, layer);
} }
else else
{ {
...@@ -120,10 +120,10 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint ...@@ -120,10 +120,10 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint
void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer) void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer)
{ {
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS); ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
Renderbuffer *renderBuffer = lookupRenderbuffer(type, colorbuffer, level, layer); FramebufferAttachment *attachment = lookupAttachment(type, colorbuffer, level, layer);
if (renderBuffer) if (attachment)
{ {
mColorbuffers[colorAttachment].set(renderBuffer, type, level, layer); mColorbuffers[colorAttachment].set(attachment, type, level, layer);
} }
else else
{ {
...@@ -133,10 +133,10 @@ void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLui ...@@ -133,10 +133,10 @@ void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLui
void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer) void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer)
{ {
Renderbuffer *renderBuffer = lookupRenderbuffer(type, depthbuffer, level, layer); FramebufferAttachment *attachment = lookupAttachment(type, depthbuffer, level, layer);
if (renderBuffer) if (attachment)
{ {
mDepthbuffer.set(renderBuffer, type, level, layer); mDepthbuffer.set(attachment, type, level, layer);
} }
else else
{ {
...@@ -146,10 +146,10 @@ void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, G ...@@ -146,10 +146,10 @@ void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, G
void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer) void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer)
{ {
Renderbuffer *renderBuffer = lookupRenderbuffer(type, stencilbuffer, level, layer); FramebufferAttachment *attachment = lookupAttachment(type, stencilbuffer, level, layer);
if (renderBuffer) if (attachment)
{ {
mStencilbuffer.set(renderBuffer, type, level, layer); mStencilbuffer.set(attachment, type, level, layer);
} }
else else
{ {
...@@ -159,11 +159,11 @@ void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint leve ...@@ -159,11 +159,11 @@ void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint leve
void Framebuffer::setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer) void Framebuffer::setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer)
{ {
Renderbuffer *renderBuffer = lookupRenderbuffer(type, depthStencilBuffer, level, layer); FramebufferAttachment *attachment = lookupAttachment(type, depthStencilBuffer, level, layer);
if (renderBuffer && renderBuffer->getDepthSize() > 0 && renderBuffer->getStencilSize() > 0) if (attachment && attachment->getDepthSize() > 0 && attachment->getStencilSize() > 0)
{ {
mDepthbuffer.set(renderBuffer, type, level, layer); mDepthbuffer.set(attachment, type, level, layer);
mStencilbuffer.set(renderBuffer, type, level, layer); mStencilbuffer.set(attachment, type, level, layer);
} }
else else
{ {
...@@ -219,7 +219,7 @@ unsigned int Framebuffer::getRenderTargetSerial(unsigned int colorAttachment) co ...@@ -219,7 +219,7 @@ unsigned int Framebuffer::getRenderTargetSerial(unsigned int colorAttachment) co
{ {
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS); ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
Renderbuffer *colorbuffer = mColorbuffers[colorAttachment].get(); FramebufferAttachment *colorbuffer = mColorbuffers[colorAttachment].get();
if (colorbuffer) if (colorbuffer)
{ {
...@@ -231,7 +231,7 @@ unsigned int Framebuffer::getRenderTargetSerial(unsigned int colorAttachment) co ...@@ -231,7 +231,7 @@ unsigned int Framebuffer::getRenderTargetSerial(unsigned int colorAttachment) co
unsigned int Framebuffer::getDepthbufferSerial() const unsigned int Framebuffer::getDepthbufferSerial() const
{ {
Renderbuffer *depthbuffer = mDepthbuffer.get(); FramebufferAttachment *depthbuffer = mDepthbuffer.get();
if (depthbuffer) if (depthbuffer)
{ {
...@@ -243,7 +243,7 @@ unsigned int Framebuffer::getDepthbufferSerial() const ...@@ -243,7 +243,7 @@ unsigned int Framebuffer::getDepthbufferSerial() const
unsigned int Framebuffer::getStencilbufferSerial() const unsigned int Framebuffer::getStencilbufferSerial() const
{ {
Renderbuffer *stencilbuffer = mStencilbuffer.get(); FramebufferAttachment *stencilbuffer = mStencilbuffer.get();
if (stencilbuffer) if (stencilbuffer)
{ {
...@@ -253,30 +253,30 @@ unsigned int Framebuffer::getStencilbufferSerial() const ...@@ -253,30 +253,30 @@ unsigned int Framebuffer::getStencilbufferSerial() const
return 0; return 0;
} }
Renderbuffer *Framebuffer::getColorbuffer(unsigned int colorAttachment) const FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
{ {
ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS); ASSERT(colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS);
return mColorbuffers[colorAttachment].get(); return mColorbuffers[colorAttachment].get();
} }
Renderbuffer *Framebuffer::getDepthbuffer() const FramebufferAttachment *Framebuffer::getDepthbuffer() const
{ {
return mDepthbuffer.get(); return mDepthbuffer.get();
} }
Renderbuffer *Framebuffer::getStencilbuffer() const FramebufferAttachment *Framebuffer::getStencilbuffer() const
{ {
return mStencilbuffer.get(); return mStencilbuffer.get();
} }
Renderbuffer *Framebuffer::getDepthStencilBuffer() const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
{ {
return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.get() : NULL; return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.get() : NULL;
} }
Renderbuffer *Framebuffer::getDepthOrStencilbuffer() const FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const
{ {
Renderbuffer *depthstencilbuffer = mDepthbuffer.get(); FramebufferAttachment *depthstencilbuffer = mDepthbuffer.get();
if (!depthstencilbuffer) if (!depthstencilbuffer)
{ {
...@@ -286,7 +286,7 @@ Renderbuffer *Framebuffer::getDepthOrStencilbuffer() const ...@@ -286,7 +286,7 @@ Renderbuffer *Framebuffer::getDepthOrStencilbuffer() const
return depthstencilbuffer; return depthstencilbuffer;
} }
Renderbuffer *Framebuffer::getReadColorbuffer() const FramebufferAttachment *Framebuffer::getReadColorbuffer() const
{ {
// Will require more logic if glReadBuffers is supported // Will require more logic if glReadBuffers is supported
return mColorbuffers[0].get(); return mColorbuffers[0].get();
...@@ -298,7 +298,7 @@ GLenum Framebuffer::getReadColorbufferType() const ...@@ -298,7 +298,7 @@ GLenum Framebuffer::getReadColorbufferType() const
return mColorbuffers[0].type(); return mColorbuffers[0].type();
} }
Renderbuffer *Framebuffer::getFirstColorbuffer() const FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
{ {
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++) for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{ {
...@@ -427,7 +427,7 @@ bool Framebuffer::hasStencil() const ...@@ -427,7 +427,7 @@ bool Framebuffer::hasStencil() const
{ {
if (mStencilbuffer.type() != GL_NONE) if (mStencilbuffer.type() != GL_NONE)
{ {
const Renderbuffer *stencilbufferObject = getStencilbuffer(); const FramebufferAttachment *stencilbufferObject = getStencilbuffer();
if (stencilbufferObject) if (stencilbufferObject)
{ {
...@@ -464,7 +464,7 @@ GLenum Framebuffer::completeness() const ...@@ -464,7 +464,7 @@ GLenum Framebuffer::completeness() const
{ {
if (mColorbuffers[colorAttachment].type() != GL_NONE) if (mColorbuffers[colorAttachment].type() != GL_NONE)
{ {
const Renderbuffer *colorbuffer = getColorbuffer(colorAttachment); const FramebufferAttachment *colorbuffer = getColorbuffer(colorAttachment);
if (!colorbuffer) if (!colorbuffer)
{ {
...@@ -549,8 +549,8 @@ GLenum Framebuffer::completeness() const ...@@ -549,8 +549,8 @@ GLenum Framebuffer::completeness() const
} }
} }
const Renderbuffer *depthbuffer = NULL; const FramebufferAttachment *depthbuffer = NULL;
const Renderbuffer *stencilbuffer = NULL; const FramebufferAttachment *stencilbuffer = NULL;
if (mDepthbuffer.type() != GL_NONE) if (mDepthbuffer.type() != GL_NONE)
{ {
...@@ -690,9 +690,9 @@ GLenum Framebuffer::completeness() const ...@@ -690,9 +690,9 @@ GLenum Framebuffer::completeness() const
DefaultFramebuffer::DefaultFramebuffer(rx::Renderer *renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil) DefaultFramebuffer::DefaultFramebuffer(rx::Renderer *renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
: Framebuffer(renderer) : Framebuffer(renderer)
{ {
mColorbuffers[0].set(new Renderbuffer(mRenderer, 0, colorbuffer), GL_RENDERBUFFER, 0, 0); mColorbuffers[0].set(new FramebufferAttachment(mRenderer, 0, colorbuffer), GL_RENDERBUFFER, 0, 0);
Renderbuffer *depthStencilRenderbuffer = new Renderbuffer(mRenderer, 0, depthStencil); FramebufferAttachment *depthStencilRenderbuffer = new FramebufferAttachment(mRenderer, 0, depthStencil);
mDepthbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0); mDepthbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
mStencilbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0); mStencilbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
......
...@@ -21,7 +21,7 @@ class Renderer; ...@@ -21,7 +21,7 @@ class Renderer;
namespace gl namespace gl
{ {
class Renderbuffer; class FramebufferAttachment;
class Colorbuffer; class Colorbuffer;
class Depthbuffer; class Depthbuffer;
class Stencilbuffer; class Stencilbuffer;
...@@ -46,14 +46,14 @@ class Framebuffer ...@@ -46,14 +46,14 @@ class Framebuffer
unsigned int getDepthbufferSerial() const; unsigned int getDepthbufferSerial() const;
unsigned int getStencilbufferSerial() const; unsigned int getStencilbufferSerial() const;
Renderbuffer *getColorbuffer(unsigned int colorAttachment) const; FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
Renderbuffer *getDepthbuffer() const; FramebufferAttachment *getDepthbuffer() const;
Renderbuffer *getStencilbuffer() const; FramebufferAttachment *getStencilbuffer() const;
Renderbuffer *getDepthStencilBuffer() const; FramebufferAttachment *getDepthStencilBuffer() const;
Renderbuffer *getDepthOrStencilbuffer() const; FramebufferAttachment *getDepthOrStencilbuffer() const;
Renderbuffer *getReadColorbuffer() const; FramebufferAttachment *getReadColorbuffer() const;
GLenum getReadColorbufferType() const; GLenum getReadColorbufferType() const;
Renderbuffer *getFirstColorbuffer() const; FramebufferAttachment *getFirstColorbuffer() const;
GLenum getColorbufferType(unsigned int colorAttachment) const; GLenum getColorbufferType(unsigned int colorAttachment) const;
GLenum getDepthbufferType() const; GLenum getDepthbufferType() const;
...@@ -87,19 +87,19 @@ class Framebuffer ...@@ -87,19 +87,19 @@ class Framebuffer
virtual GLenum completeness() const; virtual GLenum completeness() const;
protected: protected:
FramebufferTextureBindingPointer<Renderbuffer> mColorbuffers[IMPLEMENTATION_MAX_DRAW_BUFFERS]; FramebufferTextureBindingPointer<FramebufferAttachment> mColorbuffers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
GLenum mDrawBufferStates[IMPLEMENTATION_MAX_DRAW_BUFFERS]; GLenum mDrawBufferStates[IMPLEMENTATION_MAX_DRAW_BUFFERS];
GLenum mReadBufferState; GLenum mReadBufferState;
FramebufferTextureBindingPointer<Renderbuffer> mDepthbuffer; FramebufferTextureBindingPointer<FramebufferAttachment> mDepthbuffer;
FramebufferTextureBindingPointer<Renderbuffer> mStencilbuffer; FramebufferTextureBindingPointer<FramebufferAttachment> mStencilbuffer;
rx::Renderer *mRenderer; rx::Renderer *mRenderer;
private: private:
DISALLOW_COPY_AND_ASSIGN(Framebuffer); DISALLOW_COPY_AND_ASSIGN(Framebuffer);
Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle, GLint level, GLint layer) const; FramebufferAttachment *lookupAttachment(GLenum type, GLuint handle, GLint level, GLint layer) const;
}; };
class DefaultFramebuffer : public Framebuffer class DefaultFramebuffer : public Framebuffer
......
...@@ -32,19 +32,19 @@ class Texture2D; ...@@ -32,19 +32,19 @@ class Texture2D;
class TextureCubeMap; class TextureCubeMap;
class Texture3D; class Texture3D;
class Texture2DArray; class Texture2DArray;
class Renderbuffer; class FramebufferAttachment;
class Colorbuffer; class Colorbuffer;
class DepthStencilbuffer; class DepthStencilbuffer;
class RenderbufferInterface class FramebufferAttachmentInterface
{ {
public: public:
RenderbufferInterface(); FramebufferAttachmentInterface();
virtual ~RenderbufferInterface() {}; virtual ~FramebufferAttachmentInterface() {};
virtual void addProxyRef(const Renderbuffer *proxy); virtual void addProxyRef(const FramebufferAttachment *proxy);
virtual void releaseProxy(const Renderbuffer *proxy); virtual void releaseProxy(const FramebufferAttachment *proxy);
virtual rx::RenderTarget *getRenderTarget() = 0; virtual rx::RenderTarget *getRenderTarget() = 0;
virtual rx::RenderTarget *getDepthStencil() = 0; virtual rx::RenderTarget *getDepthStencil() = 0;
...@@ -62,18 +62,18 @@ class RenderbufferInterface ...@@ -62,18 +62,18 @@ class RenderbufferInterface
virtual unsigned int getTextureSerial() const = 0; virtual unsigned int getTextureSerial() const = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferInterface); DISALLOW_COPY_AND_ASSIGN(FramebufferAttachmentInterface);
}; };
class RenderbufferTexture2D : public RenderbufferInterface class Texture2DAttachment : public FramebufferAttachmentInterface
{ {
public: public:
RenderbufferTexture2D(Texture2D *texture, GLint level); Texture2DAttachment(Texture2D *texture, GLint level);
virtual ~RenderbufferTexture2D(); virtual ~Texture2DAttachment();
void addProxyRef(const Renderbuffer *proxy); void addProxyRef(const FramebufferAttachment *proxy);
void releaseProxy(const Renderbuffer *proxy); void releaseProxy(const FramebufferAttachment *proxy);
rx::RenderTarget *getRenderTarget(); rx::RenderTarget *getRenderTarget();
rx::RenderTarget *getDepthStencil(); rx::RenderTarget *getDepthStencil();
...@@ -91,21 +91,21 @@ class RenderbufferTexture2D : public RenderbufferInterface ...@@ -91,21 +91,21 @@ class RenderbufferTexture2D : public RenderbufferInterface
virtual unsigned int getTextureSerial() const; virtual unsigned int getTextureSerial() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2D); DISALLOW_COPY_AND_ASSIGN(Texture2DAttachment);
BindingPointer <Texture2D> mTexture2D; BindingPointer <Texture2D> mTexture2D;
const GLint mLevel; const GLint mLevel;
}; };
class RenderbufferTextureCubeMap : public RenderbufferInterface class TextureCubeMapAttachment : public FramebufferAttachmentInterface
{ {
public: public:
RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum faceTarget, GLint level); TextureCubeMapAttachment(TextureCubeMap *texture, GLenum faceTarget, GLint level);
virtual ~RenderbufferTextureCubeMap(); virtual ~TextureCubeMapAttachment();
void addProxyRef(const Renderbuffer *proxy); void addProxyRef(const FramebufferAttachment *proxy);
void releaseProxy(const Renderbuffer *proxy); void releaseProxy(const FramebufferAttachment *proxy);
rx::RenderTarget *getRenderTarget(); rx::RenderTarget *getRenderTarget();
rx::RenderTarget *getDepthStencil(); rx::RenderTarget *getDepthStencil();
...@@ -123,22 +123,22 @@ class RenderbufferTextureCubeMap : public RenderbufferInterface ...@@ -123,22 +123,22 @@ class RenderbufferTextureCubeMap : public RenderbufferInterface
virtual unsigned int getTextureSerial() const; virtual unsigned int getTextureSerial() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTextureCubeMap); DISALLOW_COPY_AND_ASSIGN(TextureCubeMapAttachment);
BindingPointer <TextureCubeMap> mTextureCubeMap; BindingPointer <TextureCubeMap> mTextureCubeMap;
const GLint mLevel; const GLint mLevel;
const GLenum mFaceTarget; const GLenum mFaceTarget;
}; };
class RenderbufferTexture3DLayer : public RenderbufferInterface class Texture3DAttachment : public FramebufferAttachmentInterface
{ {
public: public:
RenderbufferTexture3DLayer(Texture3D *texture, GLint level, GLint layer); Texture3DAttachment(Texture3D *texture, GLint level, GLint layer);
virtual ~RenderbufferTexture3DLayer(); virtual ~Texture3DAttachment();
void addProxyRef(const Renderbuffer *proxy); void addProxyRef(const FramebufferAttachment *proxy);
void releaseProxy(const Renderbuffer *proxy); void releaseProxy(const FramebufferAttachment *proxy);
rx::RenderTarget *getRenderTarget(); rx::RenderTarget *getRenderTarget();
rx::RenderTarget *getDepthStencil(); rx::RenderTarget *getDepthStencil();
...@@ -156,22 +156,22 @@ public: ...@@ -156,22 +156,22 @@ public:
virtual unsigned int getTextureSerial() const; virtual unsigned int getTextureSerial() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture3DLayer); DISALLOW_COPY_AND_ASSIGN(Texture3DAttachment);
BindingPointer<Texture3D> mTexture3D; BindingPointer<Texture3D> mTexture3D;
const GLint mLevel; const GLint mLevel;
const GLint mLayer; const GLint mLayer;
}; };
class RenderbufferTexture2DArrayLayer : public RenderbufferInterface class Texture2DArrayAttachment : public FramebufferAttachmentInterface
{ {
public: public:
RenderbufferTexture2DArrayLayer(Texture2DArray *texture, GLint level, GLint layer); Texture2DArrayAttachment(Texture2DArray *texture, GLint level, GLint layer);
virtual ~RenderbufferTexture2DArrayLayer(); virtual ~Texture2DArrayAttachment();
void addProxyRef(const Renderbuffer *proxy); void addProxyRef(const FramebufferAttachment *proxy);
void releaseProxy(const Renderbuffer *proxy); void releaseProxy(const FramebufferAttachment *proxy);
rx::RenderTarget *getRenderTarget(); rx::RenderTarget *getRenderTarget();
rx::RenderTarget *getDepthStencil(); rx::RenderTarget *getDepthStencil();
...@@ -189,7 +189,7 @@ public: ...@@ -189,7 +189,7 @@ public:
virtual unsigned int getTextureSerial() const; virtual unsigned int getTextureSerial() const;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2DArrayLayer); DISALLOW_COPY_AND_ASSIGN(Texture2DArrayAttachment);
BindingPointer<Texture2DArray> mTexture2DArray; BindingPointer<Texture2DArray> mTexture2DArray;
const GLint mLevel; const GLint mLevel;
...@@ -199,7 +199,7 @@ private: ...@@ -199,7 +199,7 @@ private:
// A class derived from RenderbufferStorage is created whenever glRenderbufferStorage // A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
// is called. The specific concrete type depends on whether the internal format is // is called. The specific concrete type depends on whether the internal format is
// colour depth, stencil or packed depth/stencil. // colour depth, stencil or packed depth/stencil.
class RenderbufferStorage : public RenderbufferInterface class RenderbufferStorage : public FramebufferAttachmentInterface
{ {
public: public:
RenderbufferStorage(); RenderbufferStorage();
...@@ -238,20 +238,20 @@ class RenderbufferStorage : public RenderbufferInterface ...@@ -238,20 +238,20 @@ class RenderbufferStorage : public RenderbufferInterface
static unsigned int mCurrentSerial; static unsigned int mCurrentSerial;
}; };
// Renderbuffer implements the GL renderbuffer object. // FramebufferAttachment implements the GL renderbuffer object.
// It's only a proxy for a RenderbufferInterface instance; the internal object // It's only a proxy for a FramebufferAttachmentInterface instance; the internal object
// can change whenever glRenderbufferStorage is called. // can change whenever glRenderbufferStorage is called.
class Renderbuffer : public RefCountObject class FramebufferAttachment : public RefCountObject
{ {
public: public:
Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *storage); FramebufferAttachment(rx::Renderer *renderer, GLuint id, FramebufferAttachmentInterface *storage);
virtual ~Renderbuffer(); virtual ~FramebufferAttachment();
// These functions from RefCountObject are overloaded here because // These functions from RefCountObject are overloaded here because
// Textures need to maintain their own count of references to them via // Textures need to maintain their own count of references to them via
// Renderbuffers/RenderbufferTextures. These functions invoke those // Renderbuffers/RenderbufferTextures. These functions invoke those
// reference counting functions on the RenderbufferInterface. // reference counting functions on the FramebufferAttachmentInterface.
void addRef() const; void addRef() const;
void release() const; void release() const;
...@@ -281,10 +281,10 @@ class Renderbuffer : public RefCountObject ...@@ -281,10 +281,10 @@ class Renderbuffer : public RefCountObject
void setStorage(RenderbufferStorage *newStorage); void setStorage(RenderbufferStorage *newStorage);
private: private:
DISALLOW_COPY_AND_ASSIGN(Renderbuffer); DISALLOW_COPY_AND_ASSIGN(FramebufferAttachment);
rx::Renderer const *mRenderer; rx::Renderer const *mRenderer;
RenderbufferInterface *mInstance; FramebufferAttachmentInterface *mInstance;
}; };
class Colorbuffer : public RenderbufferStorage class Colorbuffer : public RenderbufferStorage
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace gl namespace gl
{ {
void RenderbufferProxySet::addRef(const Renderbuffer *proxy) void RenderbufferProxySet::addRef(const FramebufferAttachment *proxy)
{ {
RefCountMap::iterator i = mRefCountMap.find(proxy); RefCountMap::iterator i = mRefCountMap.find(proxy);
if (i != mRefCountMap.end()) if (i != mRefCountMap.end())
...@@ -23,7 +23,7 @@ void RenderbufferProxySet::addRef(const Renderbuffer *proxy) ...@@ -23,7 +23,7 @@ void RenderbufferProxySet::addRef(const Renderbuffer *proxy)
} }
} }
void RenderbufferProxySet::release(const Renderbuffer *proxy) void RenderbufferProxySet::release(const FramebufferAttachment *proxy)
{ {
RefCountMap::iterator i = mRefCountMap.find(proxy); RefCountMap::iterator i = mRefCountMap.find(proxy);
if (i != mRefCountMap.end()) if (i != mRefCountMap.end())
...@@ -35,7 +35,7 @@ void RenderbufferProxySet::release(const Renderbuffer *proxy) ...@@ -35,7 +35,7 @@ void RenderbufferProxySet::release(const Renderbuffer *proxy)
if (i->second == 0) if (i->second == 0)
{ {
// Clear the buffer map of references to this Renderbuffer // Clear the buffer map of references to this FramebufferAttachment
BufferMap::iterator j = mBufferMap.begin(); BufferMap::iterator j = mBufferMap.begin();
while (j != mBufferMap.end()) while (j != mBufferMap.end())
{ {
...@@ -54,7 +54,7 @@ void RenderbufferProxySet::release(const Renderbuffer *proxy) ...@@ -54,7 +54,7 @@ void RenderbufferProxySet::release(const Renderbuffer *proxy)
} }
} }
void RenderbufferProxySet::add(unsigned int mipLevel, unsigned int layer, Renderbuffer *renderBuffer) void RenderbufferProxySet::add(unsigned int mipLevel, unsigned int layer, FramebufferAttachment *renderBuffer)
{ {
if (mRefCountMap.find(renderBuffer) == mRefCountMap.end()) if (mRefCountMap.find(renderBuffer) == mRefCountMap.end())
{ {
...@@ -70,7 +70,7 @@ void RenderbufferProxySet::add(unsigned int mipLevel, unsigned int layer, Render ...@@ -70,7 +70,7 @@ void RenderbufferProxySet::add(unsigned int mipLevel, unsigned int layer, Render
} }
} }
Renderbuffer *RenderbufferProxySet::get(unsigned int mipLevel, unsigned int layer) const FramebufferAttachment *RenderbufferProxySet::get(unsigned int mipLevel, unsigned int layer) const
{ {
RenderbufferKey key; RenderbufferKey key;
key.mipLevel = mipLevel; key.mipLevel = mipLevel;
......
...@@ -14,16 +14,16 @@ ...@@ -14,16 +14,16 @@
namespace gl namespace gl
{ {
class Renderbuffer; class FramebufferAttachment;
class RenderbufferProxySet class RenderbufferProxySet
{ {
public: public:
void addRef(const Renderbuffer *proxy); void addRef(const FramebufferAttachment *proxy);
void release(const Renderbuffer *proxy); void release(const FramebufferAttachment *proxy);
void add(unsigned int mipLevel, unsigned int layer, Renderbuffer *renderBuffer); void add(unsigned int mipLevel, unsigned int layer, FramebufferAttachment *renderBuffer);
Renderbuffer *get(unsigned int mipLevel, unsigned int layer) const; FramebufferAttachment *get(unsigned int mipLevel, unsigned int layer) const;
private: private:
struct RenderbufferKey struct RenderbufferKey
...@@ -34,10 +34,10 @@ class RenderbufferProxySet ...@@ -34,10 +34,10 @@ class RenderbufferProxySet
bool operator<(const RenderbufferKey &other) const; bool operator<(const RenderbufferKey &other) const;
}; };
typedef std::map<RenderbufferKey, Renderbuffer*> BufferMap; typedef std::map<RenderbufferKey, FramebufferAttachment*> BufferMap;
BufferMap mBufferMap; BufferMap mBufferMap;
typedef std::map<const Renderbuffer*, unsigned int> RefCountMap; typedef std::map<const FramebufferAttachment*, unsigned int> RefCountMap;
RefCountMap mRefCountMap; RefCountMap mRefCountMap;
}; };
......
...@@ -311,7 +311,7 @@ Program *ResourceManager::getProgram(unsigned int handle) ...@@ -311,7 +311,7 @@ Program *ResourceManager::getProgram(unsigned int handle)
} }
} }
Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle) FramebufferAttachment *ResourceManager::getRenderbuffer(unsigned int handle)
{ {
RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle); RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle);
...@@ -353,7 +353,7 @@ FenceSync *ResourceManager::getFenceSync(unsigned int handle) ...@@ -353,7 +353,7 @@ FenceSync *ResourceManager::getFenceSync(unsigned int handle)
} }
} }
void ResourceManager::setRenderbuffer(GLuint handle, Renderbuffer *buffer) void ResourceManager::setRenderbuffer(GLuint handle, FramebufferAttachment *buffer)
{ {
mRenderbufferMap[handle] = buffer; mRenderbufferMap[handle] = buffer;
} }
...@@ -405,7 +405,7 @@ void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer) ...@@ -405,7 +405,7 @@ void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer)
{ {
if (renderbuffer != 0 && !getRenderbuffer(renderbuffer)) if (renderbuffer != 0 && !getRenderbuffer(renderbuffer))
{ {
Renderbuffer *renderbufferObject = new Renderbuffer(mRenderer, renderbuffer, new Colorbuffer(mRenderer, 0, 0, GL_RGBA4, 0)); FramebufferAttachment *renderbufferObject = new FramebufferAttachment(mRenderer, renderbuffer, new Colorbuffer(mRenderer, 0, 0, GL_RGBA4, 0));
mRenderbufferMap[renderbuffer] = renderbufferObject; mRenderbufferMap[renderbuffer] = renderbufferObject;
renderbufferObject->addRef(); renderbufferObject->addRef();
} }
......
...@@ -30,7 +30,7 @@ class Buffer; ...@@ -30,7 +30,7 @@ class Buffer;
class Shader; class Shader;
class Program; class Program;
class Texture; class Texture;
class Renderbuffer; class FramebufferAttachment;
class Sampler; class Sampler;
class FenceSync; class FenceSync;
...@@ -63,11 +63,11 @@ class ResourceManager ...@@ -63,11 +63,11 @@ class ResourceManager
Shader *getShader(GLuint handle); Shader *getShader(GLuint handle);
Program *getProgram(GLuint handle); Program *getProgram(GLuint handle);
Texture *getTexture(GLuint handle); Texture *getTexture(GLuint handle);
Renderbuffer *getRenderbuffer(GLuint handle); FramebufferAttachment *getRenderbuffer(GLuint handle);
Sampler *getSampler(GLuint handle); Sampler *getSampler(GLuint handle);
FenceSync *getFenceSync(GLuint handle); FenceSync *getFenceSync(GLuint handle);
void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer); void setRenderbuffer(GLuint handle, FramebufferAttachment *renderbuffer);
void checkBufferAllocation(unsigned int buffer); void checkBufferAllocation(unsigned int buffer);
void checkTextureAllocation(GLuint texture, TextureType type); void checkTextureAllocation(GLuint texture, TextureType type);
...@@ -97,7 +97,7 @@ class ResourceManager ...@@ -97,7 +97,7 @@ class ResourceManager
TextureMap mTextureMap; TextureMap mTextureMap;
HandleAllocator mTextureHandleAllocator; HandleAllocator mTextureHandleAllocator;
typedef std::unordered_map<GLuint, Renderbuffer*> RenderbufferMap; typedef std::unordered_map<GLuint, FramebufferAttachment*> RenderbufferMap;
RenderbufferMap mRenderbufferMap; RenderbufferMap mRenderbufferMap;
HandleAllocator mRenderbufferHandleAllocator; HandleAllocator mRenderbufferHandleAllocator;
......
...@@ -87,12 +87,12 @@ GLenum Texture::getTarget() const ...@@ -87,12 +87,12 @@ GLenum Texture::getTarget() const
return mTarget; return mTarget;
} }
void Texture::addProxyRef(const Renderbuffer *proxy) void Texture::addProxyRef(const FramebufferAttachment *proxy)
{ {
mRenderbufferProxies.addRef(proxy); mRenderbufferProxies.addRef(proxy);
} }
void Texture::releaseProxy(const Renderbuffer *proxy) void Texture::releaseProxy(const FramebufferAttachment *proxy)
{ {
mRenderbufferProxies.release(proxy); mRenderbufferProxies.release(proxy);
} }
...@@ -1027,16 +1027,16 @@ rx::TextureStorageInterface *Texture2D::getBaseLevelStorage() ...@@ -1027,16 +1027,16 @@ rx::TextureStorageInterface *Texture2D::getBaseLevelStorage()
return mTexStorage; return mTexStorage;
} }
Renderbuffer *Texture2D::getRenderbuffer(GLint level) FramebufferAttachment *Texture2D::getAttachment(GLint level)
{ {
Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, 0); FramebufferAttachment *attachment = mRenderbufferProxies.get(level, 0);
if (!renderBuffer) if (!attachment)
{ {
renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTexture2D(this, level)); attachment = new FramebufferAttachment(mRenderer, id(), new Texture2DAttachment(this, level));
mRenderbufferProxies.add(level, 0, renderBuffer); mRenderbufferProxies.add(level, 0, attachment);
} }
return renderBuffer; return attachment;
} }
unsigned int Texture2D::getRenderTargetSerial(GLint level) unsigned int Texture2D::getRenderTargetSerial(GLint level)
...@@ -1662,19 +1662,19 @@ rx::TextureStorageInterface *TextureCubeMap::getBaseLevelStorage() ...@@ -1662,19 +1662,19 @@ rx::TextureStorageInterface *TextureCubeMap::getBaseLevelStorage()
return mTexStorage; return mTexStorage;
} }
Renderbuffer *TextureCubeMap::getRenderbuffer(GLenum target, GLint level) FramebufferAttachment *TextureCubeMap::getAttachment(GLenum target, GLint level)
{ {
ASSERT(!IsCubemapTextureTarget(target)); ASSERT(!IsCubemapTextureTarget(target));
int faceIndex = targetToIndex(target); int faceIndex = targetToIndex(target);
Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, faceIndex); FramebufferAttachment *attachment = mRenderbufferProxies.get(level, faceIndex);
if (!renderBuffer) if (!attachment)
{ {
renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTextureCubeMap(this, target, level)); attachment = new FramebufferAttachment(mRenderer, id(), new TextureCubeMapAttachment(this, target, level));
mRenderbufferProxies.add(level, faceIndex, renderBuffer); mRenderbufferProxies.add(level, faceIndex, attachment);
} }
return renderBuffer; return attachment;
} }
unsigned int TextureCubeMap::getRenderTargetSerial(GLenum target, GLint level) unsigned int TextureCubeMap::getRenderTargetSerial(GLenum target, GLint level)
...@@ -2042,16 +2042,16 @@ bool Texture3D::isLevelComplete(int level) const ...@@ -2042,16 +2042,16 @@ bool Texture3D::isLevelComplete(int level) const
return true; return true;
} }
Renderbuffer *Texture3D::getRenderbuffer(GLint level, GLint layer) FramebufferAttachment *Texture3D::getAttachment(GLint level, GLint layer)
{ {
Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, layer); FramebufferAttachment *attachment = mRenderbufferProxies.get(level, layer);
if (!renderBuffer) if (!attachment)
{ {
renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTexture3DLayer(this, level, layer)); attachment = new FramebufferAttachment(mRenderer, id(), new Texture3DAttachment(this, level, layer));
mRenderbufferProxies.add(level, 0, renderBuffer); mRenderbufferProxies.add(level, 0, attachment);
} }
return renderBuffer; return attachment;
} }
unsigned int Texture3D::getRenderTargetSerial(GLint level, GLint layer) unsigned int Texture3D::getRenderTargetSerial(GLint level, GLint layer)
...@@ -2593,16 +2593,16 @@ bool Texture2DArray::isLevelComplete(int level) const ...@@ -2593,16 +2593,16 @@ bool Texture2DArray::isLevelComplete(int level) const
return true; return true;
} }
Renderbuffer *Texture2DArray::getRenderbuffer(GLint level, GLint layer) FramebufferAttachment *Texture2DArray::getAttachment(GLint level, GLint layer)
{ {
Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, layer); FramebufferAttachment *attachment = mRenderbufferProxies.get(level, layer);
if (!renderBuffer) if (!attachment)
{ {
renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTexture2DArrayLayer(this, level, layer)); attachment = new FramebufferAttachment(mRenderer, id(), new Texture2DArrayAttachment(this, level, layer));
mRenderbufferProxies.add(level, 0, renderBuffer); mRenderbufferProxies.add(level, 0, attachment);
} }
return renderBuffer; return attachment;
} }
unsigned int Texture2DArray::getRenderTargetSerial(GLint level, GLint layer) unsigned int Texture2DArray::getRenderTargetSerial(GLint level, GLint layer)
......
...@@ -41,7 +41,7 @@ class Image; ...@@ -41,7 +41,7 @@ class Image;
namespace gl namespace gl
{ {
class Framebuffer; class Framebuffer;
class Renderbuffer; class FramebufferAttachment;
enum enum
{ {
...@@ -65,8 +65,8 @@ class Texture : public RefCountObject ...@@ -65,8 +65,8 @@ class Texture : public RefCountObject
virtual ~Texture(); virtual ~Texture();
void addProxyRef(const Renderbuffer *proxy); void addProxyRef(const FramebufferAttachment *proxy);
void releaseProxy(const Renderbuffer *proxy); void releaseProxy(const FramebufferAttachment *proxy);
GLenum getTarget() const; GLenum getTarget() const;
...@@ -161,7 +161,7 @@ class Texture : public RefCountObject ...@@ -161,7 +161,7 @@ class Texture : public RefCountObject
// because, as the renderbuffer acting as proxy will maintain a binding pointer // because, as the renderbuffer acting as proxy will maintain a binding pointer
// back to this texture, there would be a circular reference if we used a binding // back to this texture, there would be a circular reference if we used a binding
// pointer here. This reference count will cause the pointer to be set to NULL if // pointer here. This reference count will cause the pointer to be set to NULL if
// the count drops to zero, but will not cause deletion of the Renderbuffer. // the count drops to zero, but will not cause deletion of the FramebufferAttachment.
RenderbufferProxySet mRenderbufferProxies; RenderbufferProxySet mRenderbufferProxies;
private: private:
...@@ -199,11 +199,11 @@ class Texture2D : public Texture ...@@ -199,11 +199,11 @@ class Texture2D : public Texture
virtual void generateMipmaps(); virtual void generateMipmaps();
Renderbuffer *getRenderbuffer(GLint level); FramebufferAttachment *getAttachment(GLint level);
unsigned int getRenderTargetSerial(GLint level); unsigned int getRenderTargetSerial(GLint level);
protected: protected:
friend class RenderbufferTexture2D; friend class Texture2DAttachment;
rx::RenderTarget *getRenderTarget(GLint level); rx::RenderTarget *getRenderTarget(GLint level);
rx::RenderTarget *getDepthSencil(GLint level); rx::RenderTarget *getDepthSencil(GLint level);
...@@ -267,13 +267,13 @@ class TextureCubeMap : public Texture ...@@ -267,13 +267,13 @@ class TextureCubeMap : public Texture
virtual void generateMipmaps(); virtual void generateMipmaps();
Renderbuffer *getRenderbuffer(GLenum target, GLint level); FramebufferAttachment *getAttachment(GLenum target, GLint level);
unsigned int getRenderTargetSerial(GLenum target, GLint level); unsigned int getRenderTargetSerial(GLenum target, GLint level);
static int targetToIndex(GLenum target); static int targetToIndex(GLenum target);
protected: protected:
friend class RenderbufferTextureCubeMap; friend class TextureCubeMapAttachment;
rx::RenderTarget *getRenderTarget(GLenum target, GLint level); rx::RenderTarget *getRenderTarget(GLenum target, GLint level);
rx::RenderTarget *getDepthStencil(GLenum target, GLint level); rx::RenderTarget *getDepthStencil(GLenum target, GLint level);
...@@ -330,11 +330,11 @@ class Texture3D : public Texture ...@@ -330,11 +330,11 @@ class Texture3D : public Texture
virtual bool isSamplerComplete(const SamplerState &samplerState) const; virtual bool isSamplerComplete(const SamplerState &samplerState) const;
virtual bool isMipmapComplete() const; virtual bool isMipmapComplete() const;
Renderbuffer *getRenderbuffer(GLint level, GLint layer); FramebufferAttachment *getAttachment(GLint level, GLint layer);
unsigned int getRenderTargetSerial(GLint level, GLint layer); unsigned int getRenderTargetSerial(GLint level, GLint layer);
protected: protected:
friend class RenderbufferTexture3DLayer; friend class Texture3DAttachment;
rx::RenderTarget *getRenderTarget(GLint level); rx::RenderTarget *getRenderTarget(GLint level);
rx::RenderTarget *getRenderTarget(GLint level, GLint layer); rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
rx::RenderTarget *getDepthStencil(GLint level, GLint layer); rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
...@@ -391,11 +391,11 @@ class Texture2DArray : public Texture ...@@ -391,11 +391,11 @@ class Texture2DArray : public Texture
virtual bool isSamplerComplete(const SamplerState &samplerState) const; virtual bool isSamplerComplete(const SamplerState &samplerState) const;
virtual bool isMipmapComplete() const; virtual bool isMipmapComplete() const;
Renderbuffer *getRenderbuffer(GLint level, GLint layer); FramebufferAttachment *getAttachment(GLint level, GLint layer);
unsigned int getRenderTargetSerial(GLint level, GLint layer); unsigned int getRenderTargetSerial(GLint level, GLint layer);
protected: protected:
friend class RenderbufferTexture2DArrayLayer; friend class Texture2DArrayAttachment;
rx::RenderTarget *getRenderTarget(GLint level, GLint layer); rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
rx::RenderTarget *getDepthStencil(GLint level, GLint layer); rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
......
...@@ -169,16 +169,16 @@ void Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, gl::Frame ...@@ -169,16 +169,16 @@ void Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, gl::Frame
gl::Extents framebufferSize; gl::Extents framebufferSize;
if (frameBuffer->getFirstColorbuffer() != NULL) if (frameBuffer->getFirstColorbuffer() != NULL)
{ {
gl::Renderbuffer *renderBuffer = frameBuffer->getFirstColorbuffer(); gl::FramebufferAttachment *attachment = frameBuffer->getFirstColorbuffer();
framebufferSize.width = renderBuffer->getWidth(); framebufferSize.width = attachment->getWidth();
framebufferSize.height = renderBuffer->getHeight(); framebufferSize.height = attachment->getHeight();
framebufferSize.depth = 1; framebufferSize.depth = 1;
} }
else if (frameBuffer->getDepthOrStencilbuffer() != NULL) else if (frameBuffer->getDepthOrStencilbuffer() != NULL)
{ {
gl::Renderbuffer *renderBuffer = frameBuffer->getDepthOrStencilbuffer(); gl::FramebufferAttachment *attachment = frameBuffer->getDepthOrStencilbuffer();
framebufferSize.width = renderBuffer->getWidth(); framebufferSize.width = attachment->getWidth();
framebufferSize.height = renderBuffer->getHeight(); framebufferSize.height = attachment->getHeight();
framebufferSize.depth = 1; framebufferSize.depth = 1;
} }
else else
...@@ -211,18 +211,18 @@ void Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, gl::Frame ...@@ -211,18 +211,18 @@ void Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, gl::Frame
{ {
if (clearParams.clearColor[colorAttachment] && frameBuffer->isEnabledColorAttachment(colorAttachment)) if (clearParams.clearColor[colorAttachment] && frameBuffer->isEnabledColorAttachment(colorAttachment))
{ {
gl::Renderbuffer *renderbuffer = frameBuffer->getColorbuffer(colorAttachment); gl::FramebufferAttachment *attachment = frameBuffer->getColorbuffer(colorAttachment);
if (renderbuffer) if (attachment)
{ {
RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(renderbuffer->getRenderTarget()); RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(attachment->getRenderTarget());
if (!renderTarget) if (!renderTarget)
{ {
ERR("Render target pointer unexpectedly null."); ERR("Render target pointer unexpectedly null.");
return; return;
} }
GLenum internalFormat = renderbuffer->getInternalFormat(); GLenum internalFormat = attachment->getInternalFormat();
GLenum actualFormat = renderbuffer->getActualFormat(); GLenum actualFormat = attachment->getActualFormat();
GLenum componentType = gl::GetComponentType(internalFormat, clientVersion); GLenum componentType = gl::GetComponentType(internalFormat, clientVersion);
if (clearParams.colorClearType == GL_FLOAT && if (clearParams.colorClearType == GL_FLOAT &&
!(componentType == GL_FLOAT || componentType == GL_UNSIGNED_NORMALIZED || componentType == GL_SIGNED_NORMALIZED)) !(componentType == GL_FLOAT || componentType == GL_UNSIGNED_NORMALIZED || componentType == GL_SIGNED_NORMALIZED))
...@@ -287,17 +287,17 @@ void Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, gl::Frame ...@@ -287,17 +287,17 @@ void Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, gl::Frame
if (clearParams.clearDepth || clearParams.clearStencil) if (clearParams.clearDepth || clearParams.clearStencil)
{ {
gl::Renderbuffer *renderbuffer = frameBuffer->getDepthOrStencilbuffer(); gl::FramebufferAttachment *attachment = frameBuffer->getDepthOrStencilbuffer();
if (renderbuffer) if (attachment)
{ {
RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(renderbuffer->getDepthStencil()); RenderTarget11 *renderTarget = RenderTarget11::makeRenderTarget11(attachment->getDepthStencil());
if (!renderTarget) if (!renderTarget)
{ {
ERR("Depth stencil render target pointer unexpectedly null."); ERR("Depth stencil render target pointer unexpectedly null.");
return; return;
} }
GLenum actualFormat = renderbuffer->getActualFormat(); GLenum actualFormat = attachment->getActualFormat();
unsigned int stencilUnmasked = frameBuffer->hasStencil() ? (1 << gl::GetStencilBits(actualFormat, clientVersion)) - 1 : 0; unsigned int stencilUnmasked = frameBuffer->hasStencil() ? (1 << gl::GetStencilBits(actualFormat, clientVersion)) - 1 : 0;
bool needMaskedStencilClear = clearParams.clearStencil && (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked; bool needMaskedStencilClear = clearParams.clearStencil && (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
......
...@@ -213,7 +213,7 @@ void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GL ...@@ -213,7 +213,7 @@ void Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GL
void Image11::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source) void Image11::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, gl::Framebuffer *source)
{ {
gl::Renderbuffer *colorbuffer = source->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = source->getReadColorbuffer();
if (colorbuffer && colorbuffer->getActualFormat() == mActualFormat) if (colorbuffer && colorbuffer->getActualFormat() == mActualFormat)
{ {
......
...@@ -93,18 +93,18 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::Framebuffer *framebu ...@@ -93,18 +93,18 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::Framebuffer *framebu
key.blendState = blendState; key.blendState = blendState;
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++) for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
{ {
gl::Renderbuffer *renderBuffer = framebuffer->getColorbuffer(i); gl::FramebufferAttachment *attachment = framebuffer->getColorbuffer(i);
if (renderBuffer) if (attachment)
{ {
if (i > 0) if (i > 0)
{ {
mrt = true; mrt = true;
} }
key.rtChannels[i][0] = renderBuffer->getRedSize() > 0; key.rtChannels[i][0] = attachment->getRedSize() > 0;
key.rtChannels[i][1] = renderBuffer->getGreenSize() > 0; key.rtChannels[i][1] = attachment->getGreenSize() > 0;
key.rtChannels[i][2] = renderBuffer->getBlueSize() > 0; key.rtChannels[i][2] = attachment->getBlueSize() > 0;
key.rtChannels[i][3] = renderBuffer->getAlphaSize() > 0; key.rtChannels[i][3] = attachment->getAlphaSize() > 0;
} }
else else
{ {
......
...@@ -979,7 +979,7 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer) ...@@ -979,7 +979,7 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
// the draw buffer must be either "none", "back" for the default buffer or the same index as this color (in order) // the draw buffer must be either "none", "back" for the default buffer or the same index as this color (in order)
ASSERT(drawBufferState == GL_BACK || drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + colorAttachment)); ASSERT(drawBufferState == GL_BACK || drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + colorAttachment));
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(colorAttachment); gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(colorAttachment);
if (!colorbuffer) if (!colorbuffer)
{ {
...@@ -1026,7 +1026,7 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer) ...@@ -1026,7 +1026,7 @@ bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
} }
// Get the depth stencil render buffer and serials // Get the depth stencil render buffer and serials
gl::Renderbuffer *depthStencil = NULL; gl::FramebufferAttachment *depthStencil = NULL;
unsigned int depthbufferSerial = 0; unsigned int depthbufferSerial = 0;
unsigned int stencilbufferSerial = 0; unsigned int stencilbufferSerial = 0;
if (framebuffer->getDepthbufferType() != GL_NONE) if (framebuffer->getDepthbufferType() != GL_NONE)
...@@ -2634,7 +2634,7 @@ bool Renderer11::copyToRenderTarget(TextureStorageInterface2DArray *dest, Textur ...@@ -2634,7 +2634,7 @@ bool Renderer11::copyToRenderTarget(TextureStorageInterface2DArray *dest, Textur
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level) GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
{ {
gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); ERR("Failed to retrieve the color buffer from the frame buffer.");
...@@ -2695,7 +2695,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so ...@@ -2695,7 +2695,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level) GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
{ {
gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); ERR("Failed to retrieve the color buffer from the frame buffer.");
...@@ -2756,7 +2756,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so ...@@ -2756,7 +2756,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level) GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface3D *storage, GLint level)
{ {
gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); ERR("Failed to retrieve the color buffer from the frame buffer.");
...@@ -2817,7 +2817,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so ...@@ -2817,7 +2817,7 @@ bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &so
bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level) GLint xoffset, GLint yoffset, GLint zOffset, TextureStorageInterface2DArray *storage, GLint level)
{ {
gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (!colorbuffer) if (!colorbuffer)
{ {
ERR("Failed to retrieve the color buffer from the frame buffer."); ERR("Failed to retrieve the color buffer from the frame buffer.");
...@@ -3169,7 +3169,7 @@ bool Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, uns ...@@ -3169,7 +3169,7 @@ bool Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, uns
return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea); return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea);
} }
bool Renderer11::getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource) bool Renderer11::getRenderTargetResource(gl::FramebufferAttachment *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource)
{ {
ASSERT(colorbuffer != NULL); ASSERT(colorbuffer != NULL);
...@@ -3210,7 +3210,7 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read ...@@ -3210,7 +3210,7 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read
{ {
if (blitRenderTarget) if (blitRenderTarget)
{ {
gl::Renderbuffer *readBuffer = readTarget->getReadColorbuffer(); gl::FramebufferAttachment *readBuffer = readTarget->getReadColorbuffer();
if (!readBuffer) if (!readBuffer)
{ {
...@@ -3224,7 +3224,7 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read ...@@ -3224,7 +3224,7 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read
{ {
if (drawTarget->isEnabledColorAttachment(colorAttachment)) if (drawTarget->isEnabledColorAttachment(colorAttachment))
{ {
gl::Renderbuffer *drawBuffer = drawTarget->getColorbuffer(colorAttachment); gl::FramebufferAttachment *drawBuffer = drawTarget->getColorbuffer(colorAttachment);
if (!drawBuffer) if (!drawBuffer)
{ {
...@@ -3245,8 +3245,8 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read ...@@ -3245,8 +3245,8 @@ bool Renderer11::blitRect(gl::Framebuffer *readTarget, const gl::Rectangle &read
if (blitDepth || blitStencil) if (blitDepth || blitStencil)
{ {
gl::Renderbuffer *readBuffer = readTarget->getDepthOrStencilbuffer(); gl::FramebufferAttachment *readBuffer = readTarget->getDepthOrStencilbuffer();
gl::Renderbuffer *drawBuffer = drawTarget->getDepthOrStencilbuffer(); gl::FramebufferAttachment *drawBuffer = drawTarget->getDepthOrStencilbuffer();
if (!readBuffer) if (!readBuffer)
{ {
...@@ -3281,7 +3281,7 @@ void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsi ...@@ -3281,7 +3281,7 @@ void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsi
ID3D11Texture2D *colorBufferTexture = NULL; ID3D11Texture2D *colorBufferTexture = NULL;
unsigned int subresourceIndex = 0; unsigned int subresourceIndex = 0;
gl::Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer(); gl::FramebufferAttachment *colorbuffer = framebuffer->getReadColorbuffer();
if (colorbuffer && getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture)) if (colorbuffer && getRenderTargetResource(colorbuffer, &subresourceIndex, &colorBufferTexture))
{ {
...@@ -3749,9 +3749,10 @@ ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source, ...@@ -3749,9 +3749,10 @@ ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source,
} }
} }
void Renderer11::invalidateRenderbufferSwizzles(gl::Renderbuffer *renderBuffer, int mipLevel) void Renderer11::invalidateFBOAttachmentSwizzles(gl::FramebufferAttachment *attachment, int mipLevel)
{ {
TextureStorage *texStorage = renderBuffer->getTextureStorage(); ASSERT(attachment->isTexture());
TextureStorage *texStorage = attachment->getTextureStorage();
if (texStorage) if (texStorage)
{ {
TextureStorage11 *texStorage11 = TextureStorage11::makeTextureStorage11(texStorage); TextureStorage11 *texStorage11 = TextureStorage11::makeTextureStorage11(texStorage);
...@@ -3769,23 +3770,23 @@ void Renderer11::invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer) ...@@ -3769,23 +3770,23 @@ void Renderer11::invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer)
{ {
for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++) for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{ {
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(colorAttachment); gl::FramebufferAttachment *attachment = framebuffer->getColorbuffer(colorAttachment);
if (colorbuffer) if (attachment && attachment->isTexture())
{ {
invalidateRenderbufferSwizzles(colorbuffer, framebuffer->getColorbufferMipLevel(colorAttachment)); invalidateFBOAttachmentSwizzles(attachment, framebuffer->getColorbufferMipLevel(colorAttachment));
} }
} }
gl::Renderbuffer *depthBuffer = framebuffer->getDepthbuffer(); gl::FramebufferAttachment *depthAttachment = framebuffer->getDepthbuffer();
if (depthBuffer) if (depthAttachment && depthAttachment->isTexture())
{ {
invalidateRenderbufferSwizzles(depthBuffer, framebuffer->getDepthbufferMipLevel()); invalidateFBOAttachmentSwizzles(depthAttachment, framebuffer->getDepthbufferMipLevel());
} }
gl::Renderbuffer *stencilBuffer = framebuffer->getStencilbuffer(); gl::FramebufferAttachment *stencilAttachment = framebuffer->getStencilbuffer();
if (stencilBuffer) if (stencilAttachment && stencilAttachment->isTexture())
{ {
invalidateRenderbufferSwizzles(stencilBuffer, framebuffer->getStencilbufferMipLevel()); invalidateFBOAttachmentSwizzles(stencilAttachment, framebuffer->getStencilbufferMipLevel());
} }
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
namespace gl namespace gl
{ {
class Renderbuffer; class FramebufferAttachment;
} }
namespace rx namespace rx
...@@ -229,7 +229,7 @@ class Renderer11 : public Renderer ...@@ -229,7 +229,7 @@ class Renderer11 : public Renderer
virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget, virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea); GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
bool getRenderTargetResource(gl::Renderbuffer *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource); bool getRenderTargetResource(gl::FramebufferAttachment *colorbuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource);
void unapplyRenderTargets(); void unapplyRenderTargets();
void setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView); void setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView);
void packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &params, void *pixelsOut); void packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &params, void *pixelsOut);
...@@ -255,7 +255,7 @@ class Renderer11 : public Renderer ...@@ -255,7 +255,7 @@ class Renderer11 : public Renderer
bool colorBlit, bool depthBlit, bool stencilBlit); bool colorBlit, bool depthBlit, bool stencilBlit);
ID3D11Texture2D *resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource); ID3D11Texture2D *resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource);
static void invalidateRenderbufferSwizzles(gl::Renderbuffer *renderBuffer, int mipLevel); static void invalidateFBOAttachmentSwizzles(gl::FramebufferAttachment *attachment, int mipLevel);
static void invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer); static void invalidateFramebufferSwizzles(gl::Framebuffer *framebuffer);
HMODULE mD3d11Module; HMODULE mD3d11Module;
......
...@@ -213,7 +213,7 @@ bool Blit9::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum de ...@@ -213,7 +213,7 @@ bool Blit9::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum de
{ {
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL; IDirect3DSurface9 *source = NULL;
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0); gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer) if (colorbuffer)
{ {
...@@ -249,7 +249,7 @@ bool Blit9::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum de ...@@ -249,7 +249,7 @@ bool Blit9::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum de
{ {
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL; IDirect3DSurface9 *source = NULL;
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0); gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer) if (colorbuffer)
{ {
......
...@@ -452,7 +452,7 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, ...@@ -452,7 +452,7 @@ void Image9::copy(GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y,
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *surface = NULL; IDirect3DSurface9 *surface = NULL;
gl::Renderbuffer *colorbuffer = source->getColorbuffer(0); gl::FramebufferAttachment *colorbuffer = source->getColorbuffer(0);
if (colorbuffer) if (colorbuffer)
{ {
......
...@@ -930,8 +930,8 @@ void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState ...@@ -930,8 +930,8 @@ void Renderer9::setBlendState(gl::Framebuffer *framebuffer, const gl::BlendState
FIXME("Sample alpha to coverage is unimplemented."); FIXME("Sample alpha to coverage is unimplemented.");
} }
gl::Renderbuffer *renderBuffer = framebuffer->getFirstColorbuffer(); gl::FramebufferAttachment *attachment = framebuffer->getFirstColorbuffer();
GLenum internalFormat = renderBuffer ? renderBuffer->getInternalFormat() : GL_NONE; GLenum internalFormat = attachment ? attachment->getInternalFormat() : GL_NONE;
GLuint clientVersion = getCurrentClientVersion(); GLuint clientVersion = getCurrentClientVersion();
// Set the color mask // Set the color mask
...@@ -1225,7 +1225,7 @@ bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count) ...@@ -1225,7 +1225,7 @@ bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count)
} }
gl::Renderbuffer *Renderer9::getNullColorbuffer(gl::Renderbuffer *depthbuffer) gl::FramebufferAttachment *Renderer9::getNullColorbuffer(gl::FramebufferAttachment *depthbuffer)
{ {
if (!depthbuffer) if (!depthbuffer)
{ {
...@@ -1248,7 +1248,7 @@ gl::Renderbuffer *Renderer9::getNullColorbuffer(gl::Renderbuffer *depthbuffer) ...@@ -1248,7 +1248,7 @@ gl::Renderbuffer *Renderer9::getNullColorbuffer(gl::Renderbuffer *depthbuffer)
} }
} }
gl::Renderbuffer *nullbuffer = new gl::Renderbuffer(this, 0, new gl::Colorbuffer(this, width, height, GL_NONE, 0)); gl::FramebufferAttachment *nullbuffer = new gl::FramebufferAttachment(this, 0, new gl::Colorbuffer(this, width, height, GL_NONE, 0));
// add nullbuffer to the cache // add nullbuffer to the cache
NullColorbufferCacheEntry *oldest = &mNullColorbufferCache[0]; NullColorbufferCacheEntry *oldest = &mNullColorbufferCache[0];
...@@ -1273,7 +1273,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer) ...@@ -1273,7 +1273,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
{ {
// 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.
gl::Renderbuffer *renderbufferObject = NULL; gl::FramebufferAttachment *renderbufferObject = NULL;
if (framebuffer->getColorbufferType(0) != GL_NONE) if (framebuffer->getColorbufferType(0) != GL_NONE)
{ {
renderbufferObject = framebuffer->getColorbuffer(0); renderbufferObject = framebuffer->getColorbuffer(0);
...@@ -1314,7 +1314,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer) ...@@ -1314,7 +1314,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
renderTargetChanged = true; renderTargetChanged = true;
} }
gl::Renderbuffer *depthStencil = NULL; gl::FramebufferAttachment *depthStencil = NULL;
unsigned int depthbufferSerial = 0; unsigned int depthbufferSerial = 0;
unsigned int stencilbufferSerial = 0; unsigned int stencilbufferSerial = 0;
if (framebuffer->getDepthbufferType() != GL_NONE) if (framebuffer->getDepthbufferType() != GL_NONE)
...@@ -1902,9 +1902,9 @@ void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *f ...@@ -1902,9 +1902,9 @@ void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *f
D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0); D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0);
if (clearColor) if (clearColor)
{ {
gl::Renderbuffer *renderbuffer = frameBuffer->getFirstColorbuffer(); gl::FramebufferAttachment *attachment = frameBuffer->getFirstColorbuffer();
GLenum internalFormat = renderbuffer->getInternalFormat(); GLenum internalFormat = attachment->getInternalFormat();
GLenum actualFormat = renderbuffer->getActualFormat(); GLenum actualFormat = attachment->getActualFormat();
GLuint clientVersion = getCurrentClientVersion(); GLuint clientVersion = getCurrentClientVersion();
GLuint internalRedBits = gl::GetRedBits(internalFormat, clientVersion); GLuint internalRedBits = gl::GetRedBits(internalFormat, clientVersion);
...@@ -2935,8 +2935,8 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle & ...@@ -2935,8 +2935,8 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &
if (blitRenderTarget) if (blitRenderTarget)
{ {
gl::Renderbuffer *readBuffer = readFramebuffer->getColorbuffer(0); gl::FramebufferAttachment *readBuffer = readFramebuffer->getColorbuffer(0);
gl::Renderbuffer *drawBuffer = drawFramebuffer->getColorbuffer(0); gl::FramebufferAttachment *drawBuffer = drawFramebuffer->getColorbuffer(0);
RenderTarget9 *readRenderTarget = NULL; RenderTarget9 *readRenderTarget = NULL;
RenderTarget9 *drawRenderTarget = NULL; RenderTarget9 *drawRenderTarget = NULL;
IDirect3DSurface9* readSurface = NULL; IDirect3DSurface9* readSurface = NULL;
...@@ -3064,8 +3064,8 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle & ...@@ -3064,8 +3064,8 @@ bool Renderer9::blitRect(gl::Framebuffer *readFramebuffer, const gl::Rectangle &
if (blitDepth || blitStencil) if (blitDepth || blitStencil)
{ {
gl::Renderbuffer *readBuffer = readFramebuffer->getDepthOrStencilbuffer(); gl::FramebufferAttachment *readBuffer = readFramebuffer->getDepthOrStencilbuffer();
gl::Renderbuffer *drawBuffer = drawFramebuffer->getDepthOrStencilbuffer(); gl::FramebufferAttachment *drawBuffer = drawFramebuffer->getDepthOrStencilbuffer();
RenderTarget9 *readDepthStencil = NULL; RenderTarget9 *readDepthStencil = NULL;
RenderTarget9 *drawDepthStencil = NULL; RenderTarget9 *drawDepthStencil = NULL;
IDirect3DSurface9* readSurface = NULL; IDirect3DSurface9* readSurface = NULL;
...@@ -3117,7 +3117,7 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz ...@@ -3117,7 +3117,7 @@ void Renderer9::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsiz
RenderTarget9 *renderTarget = NULL; RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *surface = NULL; IDirect3DSurface9 *surface = NULL;
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0); gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer) if (colorbuffer)
{ {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
namespace gl namespace gl
{ {
class Renderbuffer; class FramebufferAttachment;
} }
namespace rx namespace rx
...@@ -249,7 +249,7 @@ class Renderer9 : public Renderer ...@@ -249,7 +249,7 @@ class Renderer9 : public Renderer
void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer); void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged); bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
gl::Renderbuffer *getNullColorbuffer(gl::Renderbuffer *depthbuffer); gl::FramebufferAttachment *getNullColorbuffer(gl::FramebufferAttachment *depthbuffer);
D3DPOOL getBufferPool(DWORD usage) const; D3DPOOL getBufferPool(DWORD usage) const;
...@@ -401,7 +401,7 @@ class Renderer9 : public Renderer ...@@ -401,7 +401,7 @@ class Renderer9 : public Renderer
UINT lruCount; UINT lruCount;
int width; int width;
int height; int height;
gl::Renderbuffer *buffer; gl::FramebufferAttachment *buffer;
} mNullColorbufferCache[NUM_NULL_COLORBUFFER_CACHE_ENTRIES]; } mNullColorbufferCache[NUM_NULL_COLORBUFFER_CACHE_ENTRIES];
UINT mMaxNullColorbufferLRU; UINT mMaxNullColorbufferLRU;
......
...@@ -375,7 +375,7 @@ bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum targ ...@@ -375,7 +375,7 @@ bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum targ
return true; return true;
} }
static bool IsPartialBlit(gl::Context *context, gl::Renderbuffer *readBuffer, gl::Renderbuffer *writeBuffer, static bool IsPartialBlit(gl::Context *context, gl::FramebufferAttachment *readBuffer, gl::FramebufferAttachment *writeBuffer,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1) GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
{ {
...@@ -472,8 +472,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -472,8 +472,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (mask & GL_COLOR_BUFFER_BIT) if (mask & GL_COLOR_BUFFER_BIT)
{ {
gl::Renderbuffer *readColorBuffer = readFramebuffer->getReadColorbuffer(); gl::FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorbuffer();
gl::Renderbuffer *drawColorBuffer = drawFramebuffer->getFirstColorbuffer(); gl::FramebufferAttachment *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
if (readColorBuffer && drawColorBuffer) if (readColorBuffer && drawColorBuffer)
{ {
...@@ -555,8 +555,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -555,8 +555,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (mask & GL_DEPTH_BUFFER_BIT) if (mask & GL_DEPTH_BUFFER_BIT)
{ {
gl::Renderbuffer *readDepthBuffer = readFramebuffer->getDepthbuffer(); gl::FramebufferAttachment *readDepthBuffer = readFramebuffer->getDepthbuffer();
gl::Renderbuffer *drawDepthBuffer = drawFramebuffer->getDepthbuffer(); gl::FramebufferAttachment *drawDepthBuffer = drawFramebuffer->getDepthbuffer();
if (readDepthBuffer && drawDepthBuffer) if (readDepthBuffer && drawDepthBuffer)
{ {
...@@ -589,8 +589,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -589,8 +589,8 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (mask & GL_STENCIL_BUFFER_BIT) if (mask & GL_STENCIL_BUFFER_BIT)
{ {
gl::Renderbuffer *readStencilBuffer = readFramebuffer->getStencilbuffer(); gl::FramebufferAttachment *readStencilBuffer = readFramebuffer->getStencilbuffer();
gl::Renderbuffer *drawStencilBuffer = drawFramebuffer->getStencilbuffer(); gl::FramebufferAttachment *drawStencilBuffer = drawFramebuffer->getStencilbuffer();
if (readStencilBuffer && drawStencilBuffer) if (readStencilBuffer && drawStencilBuffer)
{ {
...@@ -1078,8 +1078,8 @@ bool ValidateStateQuery(gl::Context *context, GLenum pname, GLenum *nativeType, ...@@ -1078,8 +1078,8 @@ bool ValidateStateQuery(gl::Context *context, GLenum pname, GLenum *nativeType,
return gl::error(GL_INVALID_OPERATION, false); return gl::error(GL_INVALID_OPERATION, false);
} }
Renderbuffer *renderbuffer = framebuffer->getReadColorbuffer(); FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
if (!renderbuffer) if (!attachment)
{ {
return gl::error(GL_INVALID_OPERATION, false); return gl::error(GL_INVALID_OPERATION, false);
} }
......
...@@ -316,7 +316,18 @@ bool ValidateES3CopyTexImageParameters(gl::Context *context, GLenum target, GLin ...@@ -316,7 +316,18 @@ bool ValidateES3CopyTexImageParameters(gl::Context *context, GLenum target, GLin
} }
gl::Framebuffer *framebuffer = context->getReadFramebuffer(); gl::Framebuffer *framebuffer = context->getReadFramebuffer();
gl::Renderbuffer *source = framebuffer->getReadColorbuffer();
if (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
{
return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
}
if (context->getReadFramebufferHandle() != 0 && framebuffer->getSamples() != 0)
{
return gl::error(GL_INVALID_OPERATION, false);
}
gl::FramebufferAttachment *source = framebuffer->getReadColorbuffer();
GLenum colorbufferInternalFormat = source->getInternalFormat(); GLenum colorbufferInternalFormat = source->getInternalFormat();
if (isSubImage) if (isSubImage)
......
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