Commit d8a2258c by Geoff Lang

Remove all uses of "actual" formats.

BUG=angle:861 Change-Id: I7cd2d1a56772fdf18bcf926456399322d13e7a4f Reviewed-on: https://chromium-review.googlesource.com/236305Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 4f89e3dd
...@@ -34,42 +34,42 @@ FramebufferAttachment::~FramebufferAttachment() ...@@ -34,42 +34,42 @@ FramebufferAttachment::~FramebufferAttachment()
GLuint FramebufferAttachment::getRedSize() const GLuint FramebufferAttachment::getRedSize() const
{ {
return (GetInternalFormatInfo(getInternalFormat()).redBits > 0) ? GetInternalFormatInfo(getActualFormat()).redBits : 0; return GetInternalFormatInfo(getInternalFormat()).redBits;
} }
GLuint FramebufferAttachment::getGreenSize() const GLuint FramebufferAttachment::getGreenSize() const
{ {
return (GetInternalFormatInfo(getInternalFormat()).greenBits > 0) ? GetInternalFormatInfo(getActualFormat()).greenBits : 0; return GetInternalFormatInfo(getInternalFormat()).greenBits;
} }
GLuint FramebufferAttachment::getBlueSize() const GLuint FramebufferAttachment::getBlueSize() const
{ {
return (GetInternalFormatInfo(getInternalFormat()).blueBits > 0) ? GetInternalFormatInfo(getActualFormat()).blueBits : 0; return GetInternalFormatInfo(getInternalFormat()).blueBits;
} }
GLuint FramebufferAttachment::getAlphaSize() const GLuint FramebufferAttachment::getAlphaSize() const
{ {
return (GetInternalFormatInfo(getInternalFormat()).alphaBits > 0) ? GetInternalFormatInfo(getActualFormat()).alphaBits : 0; return GetInternalFormatInfo(getInternalFormat()).alphaBits;
} }
GLuint FramebufferAttachment::getDepthSize() const GLuint FramebufferAttachment::getDepthSize() const
{ {
return (GetInternalFormatInfo(getInternalFormat()).depthBits > 0) ? GetInternalFormatInfo(getActualFormat()).depthBits : 0; return GetInternalFormatInfo(getInternalFormat()).depthBits;
} }
GLuint FramebufferAttachment::getStencilSize() const GLuint FramebufferAttachment::getStencilSize() const
{ {
return (GetInternalFormatInfo(getInternalFormat()).stencilBits > 0) ? GetInternalFormatInfo(getActualFormat()).stencilBits : 0; return GetInternalFormatInfo(getInternalFormat()).stencilBits;
} }
GLenum FramebufferAttachment::getComponentType() const GLenum FramebufferAttachment::getComponentType() const
{ {
return GetInternalFormatInfo(getActualFormat()).componentType; return GetInternalFormatInfo(getInternalFormat()).componentType;
} }
GLenum FramebufferAttachment::getColorEncoding() const GLenum FramebufferAttachment::getColorEncoding() const
{ {
return GetInternalFormatInfo(getActualFormat()).colorEncoding; return GetInternalFormatInfo(getInternalFormat()).colorEncoding;
} }
///// TextureAttachment Implementation //////// ///// TextureAttachment Implementation ////////
...@@ -111,11 +111,6 @@ GLenum TextureAttachment::getInternalFormat() const ...@@ -111,11 +111,6 @@ GLenum TextureAttachment::getInternalFormat() const
return mTexture->getInternalFormat(mIndex); return mTexture->getInternalFormat(mIndex);
} }
GLenum TextureAttachment::getActualFormat() const
{
return mTexture->getActualFormat(mIndex);
}
GLenum TextureAttachment::type() const GLenum TextureAttachment::type() const
{ {
return GL_TEXTURE; return GL_TEXTURE;
...@@ -181,11 +176,6 @@ GLenum RenderbufferAttachment::getInternalFormat() const ...@@ -181,11 +176,6 @@ GLenum RenderbufferAttachment::getInternalFormat() const
return mRenderbuffer->getInternalFormat(); return mRenderbuffer->getInternalFormat();
} }
GLenum RenderbufferAttachment::getActualFormat() const
{
return mRenderbuffer->getActualFormat();
}
GLsizei RenderbufferAttachment::getSamples() const GLsizei RenderbufferAttachment::getSamples() const
{ {
return mRenderbuffer->getSamples(); return mRenderbuffer->getSamples();
...@@ -261,11 +251,6 @@ GLenum DefaultAttachment::getInternalFormat() const ...@@ -261,11 +251,6 @@ GLenum DefaultAttachment::getInternalFormat() const
return mImpl->getInternalFormat(); return mImpl->getInternalFormat();
} }
GLenum DefaultAttachment::getActualFormat() const
{
return mImpl->getActualFormat();
}
GLsizei DefaultAttachment::getSamples() const GLsizei DefaultAttachment::getSamples() const
{ {
return mImpl->getSamples(); return mImpl->getSamples();
......
...@@ -57,7 +57,6 @@ class FramebufferAttachment ...@@ -57,7 +57,6 @@ class FramebufferAttachment
virtual GLsizei getWidth() const = 0; virtual GLsizei getWidth() const = 0;
virtual GLsizei getHeight() const = 0; virtual GLsizei getHeight() const = 0;
virtual GLenum getInternalFormat() const = 0; virtual GLenum getInternalFormat() const = 0;
virtual GLenum getActualFormat() const = 0;
virtual GLsizei getSamples() const = 0; virtual GLsizei getSamples() const = 0;
virtual GLuint id() const = 0; virtual GLuint id() const = 0;
...@@ -88,7 +87,6 @@ class TextureAttachment : public FramebufferAttachment ...@@ -88,7 +87,6 @@ class TextureAttachment : public FramebufferAttachment
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const; virtual GLsizei getHeight() const;
virtual GLenum getInternalFormat() const; virtual GLenum getInternalFormat() const;
virtual GLenum getActualFormat() const;
virtual GLenum type() const; virtual GLenum type() const;
virtual GLint mipLevel() const; virtual GLint mipLevel() const;
...@@ -116,7 +114,6 @@ class RenderbufferAttachment : public FramebufferAttachment ...@@ -116,7 +114,6 @@ class RenderbufferAttachment : public FramebufferAttachment
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const; virtual GLsizei getHeight() const;
virtual GLenum getInternalFormat() const; virtual GLenum getInternalFormat() const;
virtual GLenum getActualFormat() const;
virtual GLsizei getSamples() const; virtual GLsizei getSamples() const;
virtual GLuint id() const; virtual GLuint id() const;
...@@ -145,7 +142,6 @@ class DefaultAttachment : public FramebufferAttachment ...@@ -145,7 +142,6 @@ class DefaultAttachment : public FramebufferAttachment
virtual GLsizei getWidth() const; virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const; virtual GLsizei getHeight() const;
virtual GLenum getInternalFormat() const; virtual GLenum getInternalFormat() const;
virtual GLenum getActualFormat() const;
virtual GLsizei getSamples() const; virtual GLsizei getSamples() const;
virtual GLuint id() const; virtual GLuint id() const;
......
...@@ -25,7 +25,6 @@ Renderbuffer::Renderbuffer(rx::RenderbufferImpl *impl, GLuint id) ...@@ -25,7 +25,6 @@ Renderbuffer::Renderbuffer(rx::RenderbufferImpl *impl, GLuint id)
mWidth(0), mWidth(0),
mHeight(0), mHeight(0),
mInternalFormat(GL_RGBA4), mInternalFormat(GL_RGBA4),
mActualFormat(GL_RGBA4),
mSamples(0) mSamples(0)
{ {
ASSERT(mRenderbuffer); ASSERT(mRenderbuffer);
...@@ -48,7 +47,6 @@ Error Renderbuffer::setStorage(GLsizei width, GLsizei height, GLenum internalfor ...@@ -48,7 +47,6 @@ Error Renderbuffer::setStorage(GLsizei width, GLsizei height, GLenum internalfor
mHeight = height; mHeight = height;
mInternalFormat = internalformat; mInternalFormat = internalformat;
mSamples = samples; mSamples = samples;
mActualFormat = mRenderbuffer->getActualFormat();
return Error(GL_NO_ERROR); return Error(GL_NO_ERROR);
} }
...@@ -74,11 +72,6 @@ GLenum Renderbuffer::getInternalFormat() const ...@@ -74,11 +72,6 @@ GLenum Renderbuffer::getInternalFormat() const
return mInternalFormat; return mInternalFormat;
} }
GLenum Renderbuffer::getActualFormat() const
{
return mActualFormat;
}
GLsizei Renderbuffer::getSamples() const GLsizei Renderbuffer::getSamples() const
{ {
return mSamples; return mSamples;
...@@ -86,32 +79,32 @@ GLsizei Renderbuffer::getSamples() const ...@@ -86,32 +79,32 @@ GLsizei Renderbuffer::getSamples() const
GLuint Renderbuffer::getRedSize() const GLuint Renderbuffer::getRedSize() const
{ {
return GetInternalFormatInfo(getActualFormat()).redBits; return GetInternalFormatInfo(mInternalFormat).redBits;
} }
GLuint Renderbuffer::getGreenSize() const GLuint Renderbuffer::getGreenSize() const
{ {
return GetInternalFormatInfo(getActualFormat()).greenBits; return GetInternalFormatInfo(mInternalFormat).greenBits;
} }
GLuint Renderbuffer::getBlueSize() const GLuint Renderbuffer::getBlueSize() const
{ {
return GetInternalFormatInfo(getActualFormat()).blueBits; return GetInternalFormatInfo(mInternalFormat).blueBits;
} }
GLuint Renderbuffer::getAlphaSize() const GLuint Renderbuffer::getAlphaSize() const
{ {
return GetInternalFormatInfo(getActualFormat()).alphaBits; return GetInternalFormatInfo(mInternalFormat).alphaBits;
} }
GLuint Renderbuffer::getDepthSize() const GLuint Renderbuffer::getDepthSize() const
{ {
return GetInternalFormatInfo(getActualFormat()).depthBits; return GetInternalFormatInfo(mInternalFormat).depthBits;
} }
GLuint Renderbuffer::getStencilSize() const GLuint Renderbuffer::getStencilSize() const
{ {
return GetInternalFormatInfo(getActualFormat()).stencilBits; return GetInternalFormatInfo(mInternalFormat).stencilBits;
} }
} }
...@@ -45,7 +45,6 @@ class Renderbuffer : public RefCountObject ...@@ -45,7 +45,6 @@ class Renderbuffer : public RefCountObject
GLsizei getWidth() const; GLsizei getWidth() const;
GLsizei getHeight() const; GLsizei getHeight() const;
GLenum getInternalFormat() const; GLenum getInternalFormat() const;
GLenum getActualFormat() const;
GLsizei getSamples() const; GLsizei getSamples() const;
GLuint getRedSize() const; GLuint getRedSize() const;
GLuint getGreenSize() const; GLuint getGreenSize() const;
...@@ -62,7 +61,6 @@ class Renderbuffer : public RefCountObject ...@@ -62,7 +61,6 @@ class Renderbuffer : public RefCountObject
GLsizei mWidth; GLsizei mWidth;
GLsizei mHeight; GLsizei mHeight;
GLenum mInternalFormat; GLenum mInternalFormat;
GLenum mActualFormat;
GLsizei mSamples; GLsizei mSamples;
}; };
......
...@@ -273,13 +273,10 @@ ClearParameters State::getClearParameters(GLbitfield mask) const ...@@ -273,13 +273,10 @@ ClearParameters State::getClearParameters(GLbitfield mask) const
if (mask & GL_STENCIL_BUFFER_BIT) if (mask & GL_STENCIL_BUFFER_BIT)
{ {
if (framebufferObject->getStencilbuffer() != NULL) if (framebufferObject->getStencilbuffer() != NULL &&
framebufferObject->getStencilbuffer()->getStencilSize() > 0)
{ {
GLenum stencilActualFormat = framebufferObject->getStencilbuffer()->getActualFormat(); clearParams.clearStencil = true;
if (GetInternalFormatInfo(stencilActualFormat).stencilBits > 0)
{
clearParams.clearStencil = true;
}
} }
} }
......
...@@ -124,12 +124,6 @@ GLenum Texture::getInternalFormat(const ImageIndex &index) const ...@@ -124,12 +124,6 @@ GLenum Texture::getInternalFormat(const ImageIndex &index) const
return image->getInternalFormat(); return image->getInternalFormat();
} }
GLenum Texture::getActualFormat(const ImageIndex &index) const
{
rx::Image *image = mTexture->getImage(index);
return image->getActualFormat();
}
Error Texture::generateMipmaps() Error Texture::generateMipmaps()
{ {
return getImplementation()->generateMipmaps(); return getImplementation()->generateMipmaps();
...@@ -210,14 +204,6 @@ GLenum Texture2D::getInternalFormat(GLint level) const ...@@ -210,14 +204,6 @@ GLenum Texture2D::getInternalFormat(GLint level) const
return GL_NONE; return GL_NONE;
} }
GLenum Texture2D::getActualFormat(GLint level) const
{
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mTexture->getImage(level, 0)->getActualFormat();
else
return GL_NONE;
}
Error Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels) Error Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{ {
releaseTexImage(); releaseTexImage();
...@@ -455,14 +441,6 @@ GLenum TextureCubeMap::getInternalFormat(GLenum target, GLint level) const ...@@ -455,14 +441,6 @@ GLenum TextureCubeMap::getInternalFormat(GLenum target, GLint level) const
return GL_NONE; return GL_NONE;
} }
GLenum TextureCubeMap::getActualFormat(GLenum target, GLint level) const
{
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mTexture->getImage(level, targetToLayerIndex(target))->getActualFormat();
else
return GL_NONE;
}
Error TextureCubeMap::setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels) Error TextureCubeMap::setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
{ {
return mTexture->setImage(target, level, width, height, 1, internalFormat, format, type, unpack, pixels); return mTexture->setImage(target, level, width, height, 1, internalFormat, format, type, unpack, pixels);
...@@ -700,11 +678,6 @@ GLenum Texture3D::getInternalFormat(GLint level) const ...@@ -700,11 +678,6 @@ GLenum Texture3D::getInternalFormat(GLint level) const
return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mTexture->getImage(level, 0)->getInternalFormat() : GL_NONE; return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mTexture->getImage(level, 0)->getInternalFormat() : GL_NONE;
} }
GLenum Texture3D::getActualFormat(GLint level) const
{
return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mTexture->getImage(level, 0)->getActualFormat() : GL_NONE;
}
bool Texture3D::isCompressed(GLint level) const bool Texture3D::isCompressed(GLint level) const
{ {
return GetInternalFormatInfo(getInternalFormat(level)).compressed; return GetInternalFormatInfo(getInternalFormat(level)).compressed;
...@@ -867,11 +840,6 @@ GLenum Texture2DArray::getInternalFormat(GLint level) const ...@@ -867,11 +840,6 @@ GLenum Texture2DArray::getInternalFormat(GLint level) const
return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mTexture->getLayerCount(level) > 0) ? mTexture->getImage(level, 0)->getInternalFormat() : GL_NONE; return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mTexture->getLayerCount(level) > 0) ? mTexture->getImage(level, 0)->getInternalFormat() : GL_NONE;
} }
GLenum Texture2DArray::getActualFormat(GLint level) const
{
return (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && mTexture->getLayerCount(level) > 0) ? mTexture->getImage(level, 0)->getActualFormat() : GL_NONE;
}
bool Texture2DArray::isCompressed(GLint level) const bool Texture2DArray::isCompressed(GLint level) const
{ {
return GetInternalFormatInfo(getInternalFormat(level)).compressed; return GetInternalFormatInfo(getInternalFormat(level)).compressed;
......
...@@ -64,7 +64,6 @@ class Texture : public RefCountObject ...@@ -64,7 +64,6 @@ class Texture : public RefCountObject
GLsizei getWidth(const ImageIndex &index) const; GLsizei getWidth(const ImageIndex &index) const;
GLsizei getHeight(const ImageIndex &index) const; GLsizei getHeight(const ImageIndex &index) const;
GLenum getInternalFormat(const ImageIndex &index) const; GLenum getInternalFormat(const ImageIndex &index) const;
GLenum getActualFormat(const ImageIndex &index) const;
virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const = 0; virtual bool isSamplerComplete(const SamplerState &samplerState, const TextureCapsMap &textureCaps, const Extensions &extensions, int clientVersion) const = 0;
...@@ -115,7 +114,6 @@ class Texture2D : public Texture ...@@ -115,7 +114,6 @@ class Texture2D : public Texture
GLsizei getWidth(GLint level) const; GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const; GLsizei getHeight(GLint level) const;
GLenum getInternalFormat(GLint level) const; GLenum getInternalFormat(GLint level) const;
GLenum getActualFormat(GLint level) const;
bool isCompressed(GLint level) const; bool isCompressed(GLint level) const;
bool isDepth(GLint level) const; bool isDepth(GLint level) const;
...@@ -151,7 +149,6 @@ class TextureCubeMap : public Texture ...@@ -151,7 +149,6 @@ class TextureCubeMap : public Texture
GLsizei getWidth(GLenum target, GLint level) const; GLsizei getWidth(GLenum target, GLint level) const;
GLsizei getHeight(GLenum target, GLint level) const; GLsizei getHeight(GLenum target, GLint level) const;
GLenum getInternalFormat(GLenum target, GLint level) const; GLenum getInternalFormat(GLenum target, GLint level) const;
GLenum getActualFormat(GLenum target, GLint level) const;
bool isCompressed(GLenum target, GLint level) const; bool isCompressed(GLenum target, GLint level) const;
bool isDepth(GLenum target, GLint level) const; bool isDepth(GLenum target, GLint level) const;
...@@ -187,7 +184,6 @@ class Texture3D : public Texture ...@@ -187,7 +184,6 @@ class Texture3D : public Texture
GLsizei getHeight(GLint level) const; GLsizei getHeight(GLint level) const;
GLsizei getDepth(GLint level) const; GLsizei getDepth(GLint level) const;
GLenum getInternalFormat(GLint level) const; GLenum getInternalFormat(GLint level) const;
GLenum getActualFormat(GLint level) const;
bool isCompressed(GLint level) const; bool isCompressed(GLint level) const;
bool isDepth(GLint level) const; bool isDepth(GLint level) const;
...@@ -217,7 +213,6 @@ class Texture2DArray : public Texture ...@@ -217,7 +213,6 @@ class Texture2DArray : public Texture
GLsizei getHeight(GLint level) const; GLsizei getHeight(GLint level) const;
GLsizei getLayers(GLint level) const; GLsizei getLayers(GLint level) const;
GLenum getInternalFormat(GLint level) const; GLenum getInternalFormat(GLint level) const;
GLenum getActualFormat(GLint level) const;
bool isCompressed(GLint level) const; bool isCompressed(GLint level) const;
bool isDepth(GLint level) const; bool isDepth(GLint level) const;
......
...@@ -32,7 +32,6 @@ class DefaultAttachmentImpl ...@@ -32,7 +32,6 @@ class DefaultAttachmentImpl
virtual GLsizei getWidth() const = 0; virtual GLsizei getWidth() const = 0;
virtual GLsizei getHeight() const = 0; virtual GLsizei getHeight() const = 0;
virtual GLenum getInternalFormat() const = 0; virtual GLenum getInternalFormat() const = 0;
virtual GLenum getActualFormat() const = 0;
virtual GLsizei getSamples() const = 0; virtual GLsizei getSamples() const = 0;
}; };
......
...@@ -19,7 +19,6 @@ Image::Image() ...@@ -19,7 +19,6 @@ Image::Image()
mHeight = 0; mHeight = 0;
mDepth = 0; mDepth = 0;
mInternalFormat = GL_NONE; mInternalFormat = GL_NONE;
mActualFormat = GL_NONE;
mTarget = GL_NONE; mTarget = GL_NONE;
mRenderable = false; mRenderable = false;
mDirty = false; mDirty = false;
......
...@@ -39,7 +39,6 @@ class Image ...@@ -39,7 +39,6 @@ class Image
GLsizei getHeight() const { return mHeight; } GLsizei getHeight() const { return mHeight; }
GLsizei getDepth() const { return mDepth; } GLsizei getDepth() const { return mDepth; }
GLenum getInternalFormat() const { return mInternalFormat; } GLenum getInternalFormat() const { return mInternalFormat; }
GLenum getActualFormat() const { return mActualFormat; }
GLenum getTarget() const { return mTarget; } GLenum getTarget() const { return mTarget; }
bool isRenderableFormat() const { return mRenderable; } bool isRenderableFormat() const { return mRenderable; }
...@@ -63,7 +62,6 @@ class Image ...@@ -63,7 +62,6 @@ class Image
GLsizei mHeight; GLsizei mHeight;
GLsizei mDepth; GLsizei mDepth;
GLenum mInternalFormat; GLenum mInternalFormat;
GLenum mActualFormat;
bool mRenderable; bool mRenderable;
GLenum mTarget; GLenum mTarget;
......
...@@ -25,20 +25,12 @@ class RenderTarget ...@@ -25,20 +25,12 @@ class RenderTarget
virtual GLsizei getHeight() const = 0; virtual GLsizei getHeight() const = 0;
virtual GLsizei getDepth() const = 0; virtual GLsizei getDepth() const = 0;
virtual GLenum getInternalFormat() const = 0; virtual GLenum getInternalFormat() const = 0;
virtual GLenum getActualFormat() const = 0;
virtual GLsizei getSamples() const = 0; virtual GLsizei getSamples() const = 0;
gl::Extents getExtents() const { return gl::Extents(getWidth(), getHeight(), getDepth()); } gl::Extents getExtents() const { return gl::Extents(getWidth(), getHeight(), getDepth()); }
virtual unsigned int getSerial() const; virtual unsigned int getSerial() const;
static unsigned int issueSerials(unsigned int count); static unsigned int issueSerials(unsigned int count);
struct Desc {
GLsizei width;
GLsizei height;
GLsizei depth;
GLenum format;
};
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderTarget); DISALLOW_COPY_AND_ASSIGN(RenderTarget);
......
...@@ -26,8 +26,6 @@ class RenderbufferImpl ...@@ -26,8 +26,6 @@ class RenderbufferImpl
virtual gl::Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples) = 0; virtual gl::Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples) = 0;
virtual GLenum getActualFormat() const = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderbufferImpl); DISALLOW_COPY_AND_ASSIGN(RenderbufferImpl);
}; };
......
...@@ -50,11 +50,6 @@ GLenum DefaultAttachmentD3D::getInternalFormat() const ...@@ -50,11 +50,6 @@ GLenum DefaultAttachmentD3D::getInternalFormat() const
return mRenderTarget->getInternalFormat(); return mRenderTarget->getInternalFormat();
} }
GLenum DefaultAttachmentD3D::getActualFormat() const
{
return mRenderTarget->getActualFormat();
}
GLsizei DefaultAttachmentD3D::getSamples() const GLsizei DefaultAttachmentD3D::getSamples() const
{ {
return mRenderTarget->getSamples(); return mRenderTarget->getSamples();
...@@ -222,10 +217,17 @@ GLenum FramebufferD3D::getImplementationColorReadFormat() const ...@@ -222,10 +217,17 @@ GLenum FramebufferD3D::getImplementationColorReadFormat() const
return GL_NONE; return GL_NONE;
} }
GLenum actualFormat = mColorBuffers[0]->getActualFormat(); RenderTarget *attachmentRenderTarget = NULL;
const gl::InternalFormat &actualFormatInfo = gl::GetInternalFormatInfo(actualFormat); gl::Error error = GetAttachmentRenderTarget(mColorBuffers[0], &attachmentRenderTarget);
if (error.isError())
{
return GL_NONE;
}
return actualFormatInfo.format; GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
const gl::InternalFormat &implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
return implementationFormatInfo.format;
} }
GLenum FramebufferD3D::getImplementationColorReadType() const GLenum FramebufferD3D::getImplementationColorReadType() const
...@@ -238,10 +240,17 @@ GLenum FramebufferD3D::getImplementationColorReadType() const ...@@ -238,10 +240,17 @@ GLenum FramebufferD3D::getImplementationColorReadType() const
return GL_NONE; return GL_NONE;
} }
GLenum actualFormat = mColorBuffers[0]->getActualFormat(); RenderTarget *attachmentRenderTarget = NULL;
const gl::InternalFormat &actualFormatInfo = gl::GetInternalFormatInfo(actualFormat); gl::Error error = GetAttachmentRenderTarget(mColorBuffers[0], &attachmentRenderTarget);
if (error.isError())
{
return GL_NONE;
}
GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
const gl::InternalFormat &implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
return actualFormatInfo.type; return implementationFormatInfo.type;
} }
gl::Error FramebufferD3D::readPixels(const gl::State &state, const gl::Rectangle &area, GLenum format, GLenum type, GLvoid *pixels) const gl::Error FramebufferD3D::readPixels(const gl::State &state, const gl::Rectangle &area, GLenum format, GLenum type, GLvoid *pixels) const
......
...@@ -37,7 +37,6 @@ class DefaultAttachmentD3D : public DefaultAttachmentImpl ...@@ -37,7 +37,6 @@ class DefaultAttachmentD3D : public DefaultAttachmentImpl
virtual GLsizei getWidth() const override; virtual GLsizei getWidth() const override;
virtual GLsizei getHeight() const override; virtual GLsizei getHeight() const override;
virtual GLenum getInternalFormat() const override; virtual GLenum getInternalFormat() const override;
virtual GLenum getActualFormat() const override;
virtual GLsizei getSamples() const override; virtual GLsizei getSamples() const override;
RenderTarget *getRenderTarget() const; RenderTarget *getRenderTarget() const;
...@@ -97,6 +96,8 @@ class FramebufferD3D : public FramebufferImpl ...@@ -97,6 +96,8 @@ class FramebufferD3D : public FramebufferImpl
virtual gl::Error blit(const gl::Rectangle &sourceArea, const gl::Rectangle &destArea, const gl::Rectangle *scissor, virtual gl::Error blit(const gl::Rectangle &sourceArea, const gl::Rectangle &destArea, const gl::Rectangle *scissor,
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
const gl::Framebuffer *sourceFramebuffer) = 0; const gl::Framebuffer *sourceFramebuffer) = 0;
virtual GLenum getRenderTargetImplementationFormat(RenderTarget *renderTarget) const = 0;
}; };
gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTarget **outRT); gl::Error GetAttachmentRenderTarget(const gl::FramebufferAttachment *attachment, RenderTarget **outRT);
......
...@@ -55,11 +55,6 @@ gl::Error RenderbufferD3D::setStorage(GLsizei width, GLsizei height, GLenum inte ...@@ -55,11 +55,6 @@ gl::Error RenderbufferD3D::setStorage(GLsizei width, GLsizei height, GLenum inte
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
GLenum RenderbufferD3D::getActualFormat() const
{
return (mRenderTarget ? mRenderTarget->getActualFormat() : GL_RGBA4);
}
RenderTarget *RenderbufferD3D::getRenderTarget() RenderTarget *RenderbufferD3D::getRenderTarget()
{ {
return mRenderTarget; return mRenderTarget;
......
...@@ -30,8 +30,6 @@ class RenderbufferD3D : public RenderbufferImpl ...@@ -30,8 +30,6 @@ class RenderbufferD3D : public RenderbufferImpl
virtual gl::Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples) override; virtual gl::Error setStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples) override;
virtual GLenum getActualFormat() const;
RenderTarget *getRenderTarget(); RenderTarget *getRenderTarget();
unsigned int getRenderTargetSerial() const; unsigned int getRenderTargetSerial() const;
......
...@@ -577,14 +577,6 @@ GLenum TextureD3D_2D::getInternalFormat(GLint level) const ...@@ -577,14 +577,6 @@ GLenum TextureD3D_2D::getInternalFormat(GLint level) const
return GL_NONE; return GL_NONE;
} }
GLenum TextureD3D_2D::getActualFormat(GLint level) const
{
if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mImageArray[level]->getActualFormat();
else
return GL_NONE;
}
bool TextureD3D_2D::isDepth(GLint level) const bool TextureD3D_2D::isDepth(GLint level) const
{ {
return gl::GetInternalFormatInfo(getInternalFormat(level)).depthBits > 0; return gl::GetInternalFormatInfo(getInternalFormat(level)).depthBits > 0;
......
...@@ -119,7 +119,6 @@ class TextureD3D_2D : public TextureD3D ...@@ -119,7 +119,6 @@ class TextureD3D_2D : public TextureD3D
GLsizei getWidth(GLint level) const; GLsizei getWidth(GLint level) const;
GLsizei getHeight(GLint level) const; GLsizei getHeight(GLint level) const;
GLenum getInternalFormat(GLint level) const; GLenum getInternalFormat(GLint level) const;
GLenum getActualFormat(GLint level) const;
bool isDepth(GLint level) const; bool isDepth(GLint level) const;
virtual gl::Error setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels); virtual gl::Error setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h" #include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
...@@ -302,16 +303,16 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons ...@@ -302,16 +303,16 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons
return gl::Error(GL_OUT_OF_MEMORY, "Internal render target view pointer unexpectedly null."); return gl::Error(GL_OUT_OF_MEMORY, "Internal render target view pointer unexpectedly null.");
} }
const gl::InternalFormat &actualFormatInfo = gl::GetInternalFormatInfo(attachment->getActualFormat()); const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(renderTarget->getDXGIFormat());
// Check if the actual format has a channel that the internal format does not and set them to the // Check if the actual format has a channel that the internal format does not and set them to the
// default values // default values
const float clearValues[4] = const float clearValues[4] =
{ {
((formatInfo.redBits == 0 && actualFormatInfo.redBits > 0) ? 0.0f : clearParams.colorFClearValue.red), ((formatInfo.redBits == 0 && dxgiFormatInfo.redBits > 0) ? 0.0f : clearParams.colorFClearValue.red),
((formatInfo.greenBits == 0 && actualFormatInfo.greenBits > 0) ? 0.0f : clearParams.colorFClearValue.green), ((formatInfo.greenBits == 0 && dxgiFormatInfo.greenBits > 0) ? 0.0f : clearParams.colorFClearValue.green),
((formatInfo.blueBits == 0 && actualFormatInfo.blueBits > 0) ? 0.0f : clearParams.colorFClearValue.blue), ((formatInfo.blueBits == 0 && dxgiFormatInfo.blueBits > 0) ? 0.0f : clearParams.colorFClearValue.blue),
((formatInfo.alphaBits == 0 && actualFormatInfo.alphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha), ((formatInfo.alphaBits == 0 && dxgiFormatInfo.alphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha),
}; };
if (needScissoredClear) if (needScissoredClear)
...@@ -347,9 +348,9 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons ...@@ -347,9 +348,9 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons
return error; return error;
} }
const gl::InternalFormat &actualFormatInfo = gl::GetInternalFormatInfo(attachment->getActualFormat()); const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(renderTarget->getDXGIFormat());
unsigned int stencilUnmasked = (stencilAttachment != nullptr) ? (1 << actualFormatInfo.stencilBits) - 1 : 0; unsigned int stencilUnmasked = (stencilAttachment != nullptr) ? (1 << dxgiFormatInfo.stencilBits) - 1 : 0;
bool needMaskedStencilClear = clearParams.clearStencil && (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked; bool needMaskedStencilClear = clearParams.clearStencil && (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
if (needScissoredClear || needMaskedStencilClear) if (needScissoredClear || needMaskedStencilClear)
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h" #include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/TextureD3D.h" #include "libANGLE/renderer/d3d/TextureD3D.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
...@@ -225,4 +226,11 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang ...@@ -225,4 +226,11 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTarget *renderTarget) const
{
RenderTarget11 *renderTarget11 = RenderTarget11::makeRenderTarget11(renderTarget);
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(renderTarget11->getDXGIFormat());
return dxgiFormatInfo.internalFormat;
}
} }
...@@ -34,6 +34,9 @@ class Framebuffer11 : public FramebufferD3D ...@@ -34,6 +34,9 @@ class Framebuffer11 : public FramebufferD3D
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
const gl::Framebuffer *sourceFramebuffer) override; const gl::Framebuffer *sourceFramebuffer) override;
GLenum getRenderTargetImplementationFormat(RenderTarget *renderTarget) const override;
Renderer11 *const mRenderer; Renderer11 *const mRenderer;
}; };
......
...@@ -222,9 +222,7 @@ bool Image11::redefine(GLenum target, GLenum internalformat, GLsizei width, GLsi ...@@ -222,9 +222,7 @@ bool Image11::redefine(GLenum target, GLenum internalformat, GLsizei width, GLsi
// compute the d3d format that will be used // compute the d3d format that will be used
const d3d11::TextureFormat &formatInfo = d3d11::GetTextureFormatInfo(internalformat, mFeatureLevel); const d3d11::TextureFormat &formatInfo = d3d11::GetTextureFormatInfo(internalformat, mFeatureLevel);
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(formatInfo.texFormat);
mDXGIFormat = formatInfo.texFormat; mDXGIFormat = formatInfo.texFormat;
mActualFormat = dxgiFormatInfo.internalFormat;
mRenderable = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN); mRenderable = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
releaseStagingTexture(); releaseStagingTexture();
...@@ -438,7 +436,8 @@ gl::Error Image11::copy(GLint xoffset, GLint yoffset, GLint zoffset, const gl::R ...@@ -438,7 +436,8 @@ gl::Error Image11::copy(GLint xoffset, GLint yoffset, GLint zoffset, const gl::R
} }
// determine the offset coordinate into the destination buffer // determine the offset coordinate into the destination buffer
GLsizei rowOffset = gl::GetInternalFormatInfo(mActualFormat).pixelBytes * xoffset; const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mDXGIFormat);
GLsizei rowOffset = dxgiFormatInfo.pixelBytes * xoffset;
uint8_t *dataOffset = static_cast<uint8_t*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset + zoffset * mappedImage.DepthPitch; uint8_t *dataOffset = static_cast<uint8_t*>(mappedImage.pData) + mappedImage.RowPitch * yoffset + rowOffset + zoffset * mappedImage.DepthPitch;
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat); const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
......
...@@ -188,7 +188,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv, ID3D11 ...@@ -188,7 +188,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv, ID3D11
mHeight(height), mHeight(height),
mDepth(depth), mDepth(depth),
mInternalFormat(internalFormat), mInternalFormat(internalFormat),
mActualFormat(internalFormat), mDXGIFormat(DXGI_FORMAT_UNKNOWN),
mSamples(samples), mSamples(samples),
mSubresourceIndex(0), mSubresourceIndex(0),
mTexture(resource), mTexture(resource),
...@@ -217,9 +217,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv, ID3D11 ...@@ -217,9 +217,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv, ID3D11
D3D11_RENDER_TARGET_VIEW_DESC desc; D3D11_RENDER_TARGET_VIEW_DESC desc;
mRenderTarget->GetDesc(&desc); mRenderTarget->GetDesc(&desc);
mDXGIFormat = desc.Format;
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(desc.Format);
mActualFormat = dxgiFormatInfo.internalFormat;
} }
} }
...@@ -229,7 +227,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, ID3D11 ...@@ -229,7 +227,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, ID3D11
mHeight(height), mHeight(height),
mDepth(depth), mDepth(depth),
mInternalFormat(internalFormat), mInternalFormat(internalFormat),
mActualFormat(internalFormat), mDXGIFormat(DXGI_FORMAT_UNKNOWN),
mSamples(samples), mSamples(samples),
mSubresourceIndex(0), mSubresourceIndex(0),
mTexture(resource), mTexture(resource),
...@@ -258,9 +256,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, ID3D11 ...@@ -258,9 +256,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, ID3D11
D3D11_DEPTH_STENCIL_VIEW_DESC desc; D3D11_DEPTH_STENCIL_VIEW_DESC desc;
mDepthStencil->GetDesc(&desc); mDepthStencil->GetDesc(&desc);
mDXGIFormat = desc.Format;
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(desc.Format);
mActualFormat = dxgiFormatInfo.internalFormat;
} }
} }
...@@ -312,11 +308,6 @@ GLenum TextureRenderTarget11::getInternalFormat() const ...@@ -312,11 +308,6 @@ GLenum TextureRenderTarget11::getInternalFormat() const
return mInternalFormat; return mInternalFormat;
} }
GLenum TextureRenderTarget11::getActualFormat() const
{
return mActualFormat;
}
GLsizei TextureRenderTarget11::getSamples() const GLsizei TextureRenderTarget11::getSamples() const
{ {
return mSamples; return mSamples;
...@@ -327,6 +318,10 @@ unsigned int TextureRenderTarget11::getSubresourceIndex() const ...@@ -327,6 +318,10 @@ unsigned int TextureRenderTarget11::getSubresourceIndex() const
return mSubresourceIndex; return mSubresourceIndex;
} }
DXGI_FORMAT TextureRenderTarget11::getDXGIFormat() const
{
return mDXGIFormat;
}
SurfaceRenderTarget11::SurfaceRenderTarget11(SwapChain11 *swapChain, Renderer11 *renderer, bool depth) SurfaceRenderTarget11::SurfaceRenderTarget11(SwapChain11 *swapChain, Renderer11 *renderer, bool depth)
: mSwapChain(swapChain), : mSwapChain(swapChain),
...@@ -360,11 +355,6 @@ GLenum SurfaceRenderTarget11::getInternalFormat() const ...@@ -360,11 +355,6 @@ GLenum SurfaceRenderTarget11::getInternalFormat() const
return (mDepth ? mSwapChain->GetDepthBufferInternalFormat() : mSwapChain->GetBackBufferInternalFormat()); return (mDepth ? mSwapChain->GetDepthBufferInternalFormat() : mSwapChain->GetBackBufferInternalFormat());
} }
GLenum SurfaceRenderTarget11::getActualFormat() const
{
return d3d11::GetDXGIFormatInfo(d3d11::GetTextureFormatInfo(getInternalFormat(), mRenderer->getFeatureLevel()).texFormat).internalFormat;
}
GLsizei SurfaceRenderTarget11::getSamples() const GLsizei SurfaceRenderTarget11::getSamples() const
{ {
// Our EGL surfaces do not support multisampling. // Our EGL surfaces do not support multisampling.
...@@ -396,4 +386,9 @@ unsigned int SurfaceRenderTarget11::getSubresourceIndex() const ...@@ -396,4 +386,9 @@ unsigned int SurfaceRenderTarget11::getSubresourceIndex() const
return 0; return 0;
} }
DXGI_FORMAT SurfaceRenderTarget11::getDXGIFormat() const
{
return d3d11::GetTextureFormatInfo(getInternalFormat(), mRenderer->getFeatureLevel()).texFormat;
}
} }
...@@ -32,6 +32,8 @@ class RenderTarget11 : public RenderTarget ...@@ -32,6 +32,8 @@ class RenderTarget11 : public RenderTarget
virtual unsigned int getSubresourceIndex() const = 0; virtual unsigned int getSubresourceIndex() const = 0;
virtual DXGI_FORMAT getDXGIFormat() const = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderTarget11); DISALLOW_COPY_AND_ASSIGN(RenderTarget11);
D3D_FEATURE_LEVEL mFeatureLevel; D3D_FEATURE_LEVEL mFeatureLevel;
...@@ -51,7 +53,6 @@ class TextureRenderTarget11 : public RenderTarget11 ...@@ -51,7 +53,6 @@ class TextureRenderTarget11 : public RenderTarget11
GLsizei getHeight() const override; GLsizei getHeight() const override;
GLsizei getDepth() const override; GLsizei getDepth() const override;
GLenum getInternalFormat() const override; GLenum getInternalFormat() const override;
GLenum getActualFormat() const override;
GLsizei getSamples() const override; GLsizei getSamples() const override;
ID3D11Resource *getTexture() const override; ID3D11Resource *getTexture() const override;
...@@ -61,6 +62,8 @@ class TextureRenderTarget11 : public RenderTarget11 ...@@ -61,6 +62,8 @@ class TextureRenderTarget11 : public RenderTarget11
unsigned int getSubresourceIndex() const override; unsigned int getSubresourceIndex() const override;
DXGI_FORMAT getDXGIFormat() const override;
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureRenderTarget11); DISALLOW_COPY_AND_ASSIGN(TextureRenderTarget11);
...@@ -68,7 +71,7 @@ class TextureRenderTarget11 : public RenderTarget11 ...@@ -68,7 +71,7 @@ class TextureRenderTarget11 : public RenderTarget11
GLsizei mHeight; GLsizei mHeight;
GLsizei mDepth; GLsizei mDepth;
GLenum mInternalFormat; GLenum mInternalFormat;
GLenum mActualFormat; DXGI_FORMAT mDXGIFormat;
GLsizei mSamples; GLsizei mSamples;
unsigned int mSubresourceIndex; unsigned int mSubresourceIndex;
...@@ -88,7 +91,6 @@ class SurfaceRenderTarget11 : public RenderTarget11 ...@@ -88,7 +91,6 @@ class SurfaceRenderTarget11 : public RenderTarget11
GLsizei getHeight() const override; GLsizei getHeight() const override;
GLsizei getDepth() const override; GLsizei getDepth() const override;
GLenum getInternalFormat() const override; GLenum getInternalFormat() const override;
GLenum getActualFormat() const override;
GLsizei getSamples() const override; GLsizei getSamples() const override;
ID3D11Resource *getTexture() const override; ID3D11Resource *getTexture() const override;
...@@ -98,6 +100,8 @@ class SurfaceRenderTarget11 : public RenderTarget11 ...@@ -98,6 +100,8 @@ class SurfaceRenderTarget11 : public RenderTarget11
unsigned int getSubresourceIndex() const override; unsigned int getSubresourceIndex() const override;
DXGI_FORMAT getDXGIFormat() const override;
private: private:
DISALLOW_COPY_AND_ASSIGN(SurfaceRenderTarget11); DISALLOW_COPY_AND_ASSIGN(SurfaceRenderTarget11);
......
...@@ -995,7 +995,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer) ...@@ -995,7 +995,7 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
// Also extract the render target dimensions and view // Also extract the render target dimensions and view
unsigned int renderTargetWidth = 0; unsigned int renderTargetWidth = 0;
unsigned int renderTargetHeight = 0; unsigned int renderTargetHeight = 0;
GLenum renderTargetFormat = 0; DXGI_FORMAT renderTargetFormat = DXGI_FORMAT_UNKNOWN;
unsigned int renderTargetSerials[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS] = {0}; unsigned int renderTargetSerials[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS] = {0};
ID3D11RenderTargetView* framebufferRTVs[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS] = {NULL}; ID3D11RenderTargetView* framebufferRTVs[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS] = {NULL};
bool missingColorRenderTarget = true; bool missingColorRenderTarget = true;
...@@ -1034,9 +1034,9 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer) ...@@ -1034,9 +1034,9 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
if (missingColorRenderTarget) if (missingColorRenderTarget)
{ {
renderTargetWidth = colorbuffer->getWidth(); renderTargetWidth = renderTarget->getWidth();
renderTargetHeight = colorbuffer->getHeight(); renderTargetHeight = renderTarget->getHeight();
renderTargetFormat = colorbuffer->getActualFormat(); renderTargetFormat = renderTarget->getDXGIFormat();
missingColorRenderTarget = false; missingColorRenderTarget = false;
} }
...@@ -1088,9 +1088,9 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer) ...@@ -1088,9 +1088,9 @@ gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
// the depth stencil // the depth stencil
if (missingColorRenderTarget) if (missingColorRenderTarget)
{ {
renderTargetWidth = depthStencil->getWidth(); renderTargetWidth = depthStencilRenderTarget->getWidth();
renderTargetHeight = depthStencil->getHeight(); renderTargetHeight = depthStencilRenderTarget->getHeight();
renderTargetFormat = depthStencil->getActualFormat(); renderTargetFormat = depthStencilRenderTarget->getDXGIFormat();
} }
} }
...@@ -3098,12 +3098,12 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const ...@@ -3098,12 +3098,12 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRect, const
drawRect.x < 0 || drawRect.x + drawRect.width > drawSize.width || drawRect.x < 0 || drawRect.x + drawRect.width > drawSize.width ||
drawRect.y < 0 || drawRect.y + drawRect.height > drawSize.height; drawRect.y < 0 || drawRect.y + drawRect.height > drawSize.height;
const gl::InternalFormat &actualFormatInfo = gl::GetInternalFormatInfo(drawRenderTarget->getActualFormat()); const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(drawRenderTarget11->getDXGIFormat());
bool partialDSBlit = (actualFormatInfo.depthBits > 0 && depthBlit) != (actualFormatInfo.stencilBits > 0 && stencilBlit); bool partialDSBlit = (dxgiFormatInfo.depthBits > 0 && depthBlit) != (dxgiFormatInfo.stencilBits > 0 && stencilBlit);
gl::Error result(GL_NO_ERROR); gl::Error result(GL_NO_ERROR);
if (readRenderTarget11->getActualFormat() == drawRenderTarget->getActualFormat() && if (readRenderTarget11->getDXGIFormat() == drawRenderTarget11->getDXGIFormat() &&
!stretchRequired && !outOfBounds && !flipRequired && !partialDSBlit && !stretchRequired && !outOfBounds && !flipRequired && !partialDSBlit &&
(!(depthBlit || stencilBlit) || wholeBufferCopy)) (!(depthBlit || stencilBlit) || wholeBufferCopy))
{ {
......
...@@ -249,7 +249,14 @@ class Renderer11 : public RendererD3D ...@@ -249,7 +249,14 @@ class Renderer11 : public RendererD3D
unsigned int mAppliedStencilbufferSerial; unsigned int mAppliedStencilbufferSerial;
bool mDepthStencilInitialized; bool mDepthStencilInitialized;
bool mRenderTargetDescInitialized; bool mRenderTargetDescInitialized;
RenderTarget::Desc mRenderTargetDesc;
struct RenderTargetDesc
{
size_t width;
size_t height;
DXGI_FORMAT format;
};
RenderTargetDesc mRenderTargetDesc;
// Currently applied sampler states // Currently applied sampler states
std::vector<bool> mForceSetVertexSamplerStates; std::vector<bool> mForceSetVertexSamplerStates;
......
...@@ -410,4 +410,11 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl ...@@ -410,4 +410,11 @@ gl::Error Framebuffer9::blit(const gl::Rectangle &sourceArea, const gl::Rectangl
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTarget *renderTarget) const
{
RenderTarget9 *renderTarget9 = RenderTarget9::makeRenderTarget9(renderTarget);
const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(renderTarget9->getD3DFormat());
return d3dFormatInfo.internalFormat;
}
} }
...@@ -31,6 +31,8 @@ class Framebuffer9 : public FramebufferD3D ...@@ -31,6 +31,8 @@ class Framebuffer9 : public FramebufferD3D
bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter, bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
const gl::Framebuffer *sourceFramebuffer) override; const gl::Framebuffer *sourceFramebuffer) override;
GLenum getRenderTargetImplementationFormat(RenderTarget *renderTarget) const override;
Renderer9 *const mRenderer; Renderer9 *const mRenderer;
}; };
......
...@@ -190,9 +190,7 @@ bool Image9::redefine(GLenum target, GLenum internalformat, GLsizei width, GLsiz ...@@ -190,9 +190,7 @@ bool Image9::redefine(GLenum target, GLenum internalformat, GLsizei width, GLsiz
// compute the d3d format that will be used // compute the d3d format that will be used
const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(internalformat); const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(internalformat);
const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(d3d9FormatInfo.texFormat);
mD3DFormat = d3d9FormatInfo.texFormat; mD3DFormat = d3d9FormatInfo.texFormat;
mActualFormat = d3dFormatInfo.internalFormat;
mRenderable = (d3d9FormatInfo.renderFormat != D3DFMT_UNKNOWN); mRenderable = (d3d9FormatInfo.renderFormat != D3DFMT_UNKNOWN);
SafeRelease(mSurface); SafeRelease(mSurface);
......
...@@ -29,7 +29,7 @@ TextureRenderTarget9::TextureRenderTarget9(IDirect3DSurface9 *surface, GLenum in ...@@ -29,7 +29,7 @@ TextureRenderTarget9::TextureRenderTarget9(IDirect3DSurface9 *surface, GLenum in
mHeight(height), mHeight(height),
mDepth(depth), mDepth(depth),
mInternalFormat(internalFormat), mInternalFormat(internalFormat),
mActualFormat(internalFormat), mD3DFormat(D3DFMT_UNKNOWN),
mSamples(samples), mSamples(samples),
mRenderTarget(surface) mRenderTarget(surface)
{ {
...@@ -39,9 +39,7 @@ TextureRenderTarget9::TextureRenderTarget9(IDirect3DSurface9 *surface, GLenum in ...@@ -39,9 +39,7 @@ TextureRenderTarget9::TextureRenderTarget9(IDirect3DSurface9 *surface, GLenum in
{ {
D3DSURFACE_DESC description; D3DSURFACE_DESC description;
mRenderTarget->GetDesc(&description); mRenderTarget->GetDesc(&description);
mD3DFormat = description.Format;
const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(description.Format);
mActualFormat = d3dFormatInfo.internalFormat;
} }
} }
...@@ -70,11 +68,6 @@ GLenum TextureRenderTarget9::getInternalFormat() const ...@@ -70,11 +68,6 @@ GLenum TextureRenderTarget9::getInternalFormat() const
return mInternalFormat; return mInternalFormat;
} }
GLenum TextureRenderTarget9::getActualFormat() const
{
return mActualFormat;
}
GLsizei TextureRenderTarget9::getSamples() const GLsizei TextureRenderTarget9::getSamples() const
{ {
return mSamples; return mSamples;
...@@ -92,6 +85,10 @@ IDirect3DSurface9 *TextureRenderTarget9::getSurface() ...@@ -92,6 +85,10 @@ IDirect3DSurface9 *TextureRenderTarget9::getSurface()
return mRenderTarget; return mRenderTarget;
} }
D3DFORMAT TextureRenderTarget9::getD3DFormat() const
{
return mD3DFormat;
}
SurfaceRenderTarget9::SurfaceRenderTarget9(SwapChain9 *swapChain, bool depth) SurfaceRenderTarget9::SurfaceRenderTarget9(SwapChain9 *swapChain, bool depth)
: mSwapChain(swapChain), : mSwapChain(swapChain),
...@@ -123,11 +120,6 @@ GLenum SurfaceRenderTarget9::getInternalFormat() const ...@@ -123,11 +120,6 @@ GLenum SurfaceRenderTarget9::getInternalFormat() const
return (mDepth ? mSwapChain->GetDepthBufferInternalFormat() : mSwapChain->GetBackBufferInternalFormat()); return (mDepth ? mSwapChain->GetDepthBufferInternalFormat() : mSwapChain->GetBackBufferInternalFormat());
} }
GLenum SurfaceRenderTarget9::getActualFormat() const
{
return d3d9::GetD3DFormatInfo(d3d9::GetTextureFormatInfo(getInternalFormat()).texFormat).internalFormat;
}
GLsizei SurfaceRenderTarget9::getSamples() const GLsizei SurfaceRenderTarget9::getSamples() const
{ {
// Our EGL surfaces do not support multisampling. // Our EGL surfaces do not support multisampling.
...@@ -139,4 +131,9 @@ IDirect3DSurface9 *SurfaceRenderTarget9::getSurface() ...@@ -139,4 +131,9 @@ IDirect3DSurface9 *SurfaceRenderTarget9::getSurface()
return (mDepth ? mSwapChain->getDepthStencil() : mSwapChain->getRenderTarget()); return (mDepth ? mSwapChain->getDepthStencil() : mSwapChain->getRenderTarget());
} }
D3DFORMAT SurfaceRenderTarget9::getD3DFormat() const
{
return d3d9::GetTextureFormatInfo(getInternalFormat()).texFormat;
}
} }
...@@ -27,6 +27,8 @@ class RenderTarget9 : public RenderTarget ...@@ -27,6 +27,8 @@ class RenderTarget9 : public RenderTarget
virtual IDirect3DSurface9 *getSurface() = 0; virtual IDirect3DSurface9 *getSurface() = 0;
virtual D3DFORMAT getD3DFormat() const = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(RenderTarget9); DISALLOW_COPY_AND_ASSIGN(RenderTarget9);
}; };
...@@ -42,11 +44,12 @@ class TextureRenderTarget9 : public RenderTarget9 ...@@ -42,11 +44,12 @@ class TextureRenderTarget9 : public RenderTarget9
GLsizei getHeight() const override; GLsizei getHeight() const override;
GLsizei getDepth() const override; GLsizei getDepth() const override;
GLenum getInternalFormat() const override; GLenum getInternalFormat() const override;
GLenum getActualFormat() const override;
GLsizei getSamples() const override; GLsizei getSamples() const override;
IDirect3DSurface9 *getSurface() override; IDirect3DSurface9 *getSurface() override;
D3DFORMAT getD3DFormat() const override;
private: private:
DISALLOW_COPY_AND_ASSIGN(TextureRenderTarget9); DISALLOW_COPY_AND_ASSIGN(TextureRenderTarget9);
...@@ -54,7 +57,7 @@ class TextureRenderTarget9 : public RenderTarget9 ...@@ -54,7 +57,7 @@ class TextureRenderTarget9 : public RenderTarget9
GLsizei mHeight; GLsizei mHeight;
GLsizei mDepth; GLsizei mDepth;
GLenum mInternalFormat; GLenum mInternalFormat;
GLenum mActualFormat; D3DFORMAT mD3DFormat;
GLsizei mSamples; GLsizei mSamples;
IDirect3DSurface9 *mRenderTarget; IDirect3DSurface9 *mRenderTarget;
...@@ -70,11 +73,12 @@ class SurfaceRenderTarget9 : public RenderTarget9 ...@@ -70,11 +73,12 @@ class SurfaceRenderTarget9 : public RenderTarget9
GLsizei getHeight() const override; GLsizei getHeight() const override;
GLsizei getDepth() const override; GLsizei getDepth() const override;
GLenum getInternalFormat() const override; GLenum getInternalFormat() const override;
GLenum getActualFormat() const override;
GLsizei getSamples() const override; GLsizei getSamples() const override;
IDirect3DSurface9 *getSurface() override; IDirect3DSurface9 *getSurface() override;
D3DFORMAT getD3DFormat() const override;
private: private:
DISALLOW_COPY_AND_ASSIGN(SurfaceRenderTarget9); DISALLOW_COPY_AND_ASSIGN(SurfaceRenderTarget9);
......
...@@ -1219,6 +1219,10 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf ...@@ -1219,6 +1219,10 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf
} }
ASSERT(colorBuffer); ASSERT(colorBuffer);
size_t renderTargetWidth = 0;
size_t renderTargetHeight = 0;
D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN;
bool renderTargetChanged = false; bool renderTargetChanged = false;
unsigned int renderTargetSerial = GetAttachmentSerial(colorBuffer); unsigned int renderTargetSerial = GetAttachmentSerial(colorBuffer);
if (renderTargetSerial != mAppliedRenderTargetSerial) if (renderTargetSerial != mAppliedRenderTargetSerial)
...@@ -1238,6 +1242,10 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf ...@@ -1238,6 +1242,10 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf
mDevice->SetRenderTarget(0, renderTargetSurface); mDevice->SetRenderTarget(0, renderTargetSurface);
SafeRelease(renderTargetSurface); SafeRelease(renderTargetSurface);
renderTargetWidth = renderTarget->getWidth();
renderTargetHeight = renderTarget->getHeight();
renderTargetFormat = renderTarget->getD3DFormat();
mAppliedRenderTargetSerial = renderTargetSerial; mAppliedRenderTargetSerial = renderTargetSerial;
renderTargetChanged = true; renderTargetChanged = true;
} }
...@@ -1295,9 +1303,9 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf ...@@ -1295,9 +1303,9 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf
mForceSetViewport = true; mForceSetViewport = true;
mForceSetBlendState = true; mForceSetBlendState = true;
mRenderTargetDesc.width = colorBuffer->getWidth(); mRenderTargetDesc.width = renderTargetWidth;
mRenderTargetDesc.height = colorBuffer->getHeight(); mRenderTargetDesc.height = renderTargetHeight;
mRenderTargetDesc.format = colorBuffer->getActualFormat(); mRenderTargetDesc.format = renderTargetFormat;
mRenderTargetDescInitialized = true; mRenderTargetDescInitialized = true;
} }
...@@ -1896,8 +1904,18 @@ gl::Error Renderer9::clear(const gl::ClearParameters &clearParams, const gl::Fra ...@@ -1896,8 +1904,18 @@ gl::Error Renderer9::clear(const gl::ClearParameters &clearParams, const gl::Fra
unsigned int stencilUnmasked = 0x0; unsigned int stencilUnmasked = 0x0;
if (clearParams.clearStencil && depthStencilBuffer->getStencilSize() > 0) if (clearParams.clearStencil && depthStencilBuffer->getStencilSize() > 0)
{ {
unsigned int stencilSize = gl::GetInternalFormatInfo((depthStencilBuffer->getActualFormat())).stencilBits; RenderTarget *stencilRenderTarget = NULL;
stencilUnmasked = (0x1 << stencilSize) - 1; gl::Error error = GetAttachmentRenderTarget(depthStencilBuffer, &stencilRenderTarget);
if (error.isError())
{
return error;
}
RenderTarget9 *stencilRenderTarget9 = RenderTarget9::makeRenderTarget9(stencilRenderTarget);
ASSERT(stencilRenderTarget9);
const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(stencilRenderTarget9->getD3DFormat());
stencilUnmasked = (0x1 << d3dFormatInfo.stencilBits) - 1;
} }
const bool needMaskedStencilClear = clearParams.clearStencil && const bool needMaskedStencilClear = clearParams.clearStencil &&
...@@ -1907,13 +1925,23 @@ gl::Error Renderer9::clear(const gl::ClearParameters &clearParams, const gl::Fra ...@@ -1907,13 +1925,23 @@ gl::Error Renderer9::clear(const gl::ClearParameters &clearParams, const gl::Fra
D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0); D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0);
if (clearColor) if (clearColor)
{ {
RenderTarget *colorRenderTarget = NULL;
gl::Error error = GetAttachmentRenderTarget(colorBuffer, &colorRenderTarget);
if (error.isError())
{
return error;
}
RenderTarget9 *colorRenderTarget9 = RenderTarget9::makeRenderTarget9(colorRenderTarget);
ASSERT(colorRenderTarget9);
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(colorBuffer->getInternalFormat()); const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(colorBuffer->getInternalFormat());
const gl::InternalFormat &actualFormatInfo = gl::GetInternalFormatInfo(colorBuffer->getActualFormat()); const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(colorRenderTarget9->getD3DFormat());
color = D3DCOLOR_ARGB(gl::unorm<8>((formatInfo.alphaBits == 0 && actualFormatInfo.alphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha), color = D3DCOLOR_ARGB(gl::unorm<8>((formatInfo.alphaBits == 0 && d3dFormatInfo.alphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha),
gl::unorm<8>((formatInfo.redBits == 0 && actualFormatInfo.redBits > 0) ? 0.0f : clearParams.colorFClearValue.red), gl::unorm<8>((formatInfo.redBits == 0 && d3dFormatInfo.redBits > 0) ? 0.0f : clearParams.colorFClearValue.red),
gl::unorm<8>((formatInfo.greenBits == 0 && actualFormatInfo.greenBits > 0) ? 0.0f : clearParams.colorFClearValue.green), gl::unorm<8>((formatInfo.greenBits == 0 && d3dFormatInfo.greenBits > 0) ? 0.0f : clearParams.colorFClearValue.green),
gl::unorm<8>((formatInfo.blueBits == 0 && actualFormatInfo.blueBits > 0) ? 0.0f : clearParams.colorFClearValue.blue)); gl::unorm<8>((formatInfo.blueBits == 0 && d3dFormatInfo.blueBits > 0) ? 0.0f : clearParams.colorFClearValue.blue));
if ((formatInfo.redBits > 0 && !clearParams.colorMaskRed) || if ((formatInfo.redBits > 0 && !clearParams.colorMaskRed) ||
(formatInfo.greenBits > 0 && !clearParams.colorMaskGreen) || (formatInfo.greenBits > 0 && !clearParams.colorMaskGreen) ||
......
...@@ -268,10 +268,17 @@ class Renderer9 : public RendererD3D ...@@ -268,10 +268,17 @@ class Renderer9 : public RendererD3D
unsigned int mAppliedDepthStencilSerial; unsigned int mAppliedDepthStencilSerial;
bool mDepthStencilInitialized; bool mDepthStencilInitialized;
bool mRenderTargetDescInitialized; bool mRenderTargetDescInitialized;
RenderTarget::Desc mRenderTargetDesc;
unsigned int mCurStencilSize; unsigned int mCurStencilSize;
unsigned int mCurDepthSize; unsigned int mCurDepthSize;
struct RenderTargetDesc
{
size_t width;
size_t height;
D3DFORMAT format;
};
RenderTargetDesc mRenderTargetDesc;
IDirect3DStateBlock9 *mMaskedClearSavedState; IDirect3DStateBlock9 *mMaskedClearSavedState;
// previously set render states // previously set render states
......
...@@ -521,14 +521,14 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -521,14 +521,14 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (readColorBuffer && drawColorBuffer) if (readColorBuffer && drawColorBuffer)
{ {
GLenum readInternalFormat = readColorBuffer->getActualFormat(); GLenum readInternalFormat = readColorBuffer->getInternalFormat();
const InternalFormat &readFormatInfo = GetInternalFormatInfo(readInternalFormat); const InternalFormat &readFormatInfo = GetInternalFormatInfo(readInternalFormat);
for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; i++) for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
{ {
if (drawFramebuffer->isEnabledColorAttachment(i)) if (drawFramebuffer->isEnabledColorAttachment(i))
{ {
GLenum drawInternalFormat = drawFramebuffer->getColorbuffer(i)->getActualFormat(); GLenum drawInternalFormat = drawFramebuffer->getColorbuffer(i)->getInternalFormat();
const InternalFormat &drawFormatInfo = GetInternalFormatInfo(drawInternalFormat); const InternalFormat &drawFormatInfo = GetInternalFormatInfo(drawInternalFormat);
// The GL ES 3.0.2 spec (pg 193) states that: // The GL ES 3.0.2 spec (pg 193) states that:
...@@ -628,7 +628,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -628,7 +628,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (readBuffer && drawBuffer) if (readBuffer && drawBuffer)
{ {
if (readBuffer->getActualFormat() != drawBuffer->getActualFormat()) if (readBuffer->getInternalFormat() != drawBuffer->getInternalFormat())
{ {
context->recordError(Error(GL_INVALID_OPERATION)); context->recordError(Error(GL_INVALID_OPERATION));
return false; return false;
...@@ -912,7 +912,7 @@ bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsize ...@@ -912,7 +912,7 @@ bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsize
GLenum currentFormat = framebuffer->getImplementationColorReadFormat(); GLenum currentFormat = framebuffer->getImplementationColorReadFormat();
GLenum currentType = framebuffer->getImplementationColorReadType(); GLenum currentType = framebuffer->getImplementationColorReadType();
GLenum currentInternalFormat = readBuffer->getActualFormat(); GLenum currentInternalFormat = readBuffer->getInternalFormat();
GLuint clientVersion = context->getClientVersion(); GLuint clientVersion = context->getClientVersion();
bool validReadFormat = (clientVersion < 3) ? ValidES2ReadFormatType(context, format, type) : bool validReadFormat = (clientVersion < 3) ? ValidES2ReadFormatType(context, format, type) :
......
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