Commit c61f46b8 by Nicolas Capens Committed by Nicolas Capens

Untangle internal & implementation format.

Textures and renderbuffers were storing both the OpenGL internalformat and the SwiftShader implementation format (i.e. sw::Format). This change removes the implementation format, only keeping it in the Image class. Change-Id: Ie6ac96f6450b9a55ea9b49c6cf4b2c0681e95522 Reviewed-on: https://swiftshader-review.googlesource.com/14528Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 0f4ac4c1
......@@ -4139,10 +4139,10 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
// well
es2::Renderbuffer *readRenderbuffer = readFramebuffer->getReadColorbuffer();
es2::Renderbuffer *drawRenderbuffer = drawFramebuffer->getColorbuffer(0);
sw::Format readFormat = readRenderbuffer->getInternalFormat();
sw::Format drawFormat = drawRenderbuffer->getInternalFormat();
GLenum readComponentType = sw2es::GetComponentType(readFormat, GL_COLOR_ATTACHMENT0);
GLenum drawComponentType = sw2es::GetComponentType(drawFormat, GL_COLOR_ATTACHMENT0);
GLint readFormat = readRenderbuffer->getFormat();
GLint drawFormat = drawRenderbuffer->getFormat();
GLenum readComponentType = GetComponentType(readFormat, GL_COLOR_ATTACHMENT0);
GLenum drawComponentType = GetComponentType(drawFormat, GL_COLOR_ATTACHMENT0);
bool readFixedPoint = ((readComponentType == GL_UNSIGNED_NORMALIZED) ||
(readComponentType == GL_SIGNED_NORMALIZED));
bool drawFixedPoint = ((drawComponentType == GL_UNSIGNED_NORMALIZED) ||
......@@ -4201,7 +4201,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
readDSBuffer = readFramebuffer->getDepthbuffer();
drawDSBuffer = drawFramebuffer->getDepthbuffer();
if(readDSBuffer->getInternalFormat() != drawDSBuffer->getInternalFormat())
if(readDSBuffer->getFormat() != drawDSBuffer->getFormat())
{
return error(GL_INVALID_OPERATION);
}
......@@ -4224,7 +4224,7 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
readDSBuffer = readFramebuffer->getStencilbuffer();
drawDSBuffer = drawFramebuffer->getStencilbuffer();
if(readDSBuffer->getInternalFormat() != drawDSBuffer->getInternalFormat())
if(readDSBuffer->getFormat() != drawDSBuffer->getFormat())
{
return error(GL_INVALID_OPERATION);
}
......
......@@ -41,32 +41,32 @@ void RenderbufferInterface::releaseProxy(const Renderbuffer *proxy)
GLuint RenderbufferInterface::getRedSize() const
{
return sw2es::GetRedSize(getInternalFormat());
return GetRedSize(getFormat());
}
GLuint RenderbufferInterface::getGreenSize() const
{
return sw2es::GetGreenSize(getInternalFormat());
return GetGreenSize(getFormat());
}
GLuint RenderbufferInterface::getBlueSize() const
{
return sw2es::GetBlueSize(getInternalFormat());
return GetBlueSize(getFormat());
}
GLuint RenderbufferInterface::getAlphaSize() const
{
return sw2es::GetAlphaSize(getInternalFormat());
return GetAlphaSize(getFormat());
}
GLuint RenderbufferInterface::getDepthSize() const
{
return sw2es::GetDepthSize(getInternalFormat());
return GetDepthSize(getFormat());
}
GLuint RenderbufferInterface::getStencilSize() const
{
return sw2es::GetStencilSize(getInternalFormat());
return GetStencilSize(getFormat());
}
///// RenderbufferTexture2D Implementation ////////
......@@ -122,16 +122,11 @@ GLsizei RenderbufferTexture2D::getHeight() const
return mTexture2D->getHeight(GL_TEXTURE_2D, mLevel);
}
GLenum RenderbufferTexture2D::getFormat() const
GLint RenderbufferTexture2D::getFormat() const
{
return mTexture2D->getFormat(GL_TEXTURE_2D, mLevel);
}
sw::Format RenderbufferTexture2D::getInternalFormat() const
{
return mTexture2D->getInternalFormat(GL_TEXTURE_2D, mLevel);
}
GLsizei RenderbufferTexture2D::getSamples() const
{
return 0;
......@@ -199,16 +194,11 @@ GLsizei RenderbufferTexture3D::getDepth() const
return mTexture3D->getDepth(mTexture3D->getTarget(), mLevel);
}
GLenum RenderbufferTexture3D::getFormat() const
GLint RenderbufferTexture3D::getFormat() const
{
return mTexture3D->getFormat(mTexture3D->getTarget(), mLevel);
}
sw::Format RenderbufferTexture3D::getInternalFormat() const
{
return mTexture3D->getInternalFormat(mTexture3D->getTarget(), mLevel);
}
GLsizei RenderbufferTexture3D::getSamples() const
{
return 0;
......@@ -267,16 +257,11 @@ GLsizei RenderbufferTextureCubeMap::getHeight() const
return mTextureCubeMap->getHeight(mTarget, mLevel);
}
GLenum RenderbufferTextureCubeMap::getFormat() const
GLint RenderbufferTextureCubeMap::getFormat() const
{
return mTextureCubeMap->getFormat(mTarget, mLevel);
}
sw::Format RenderbufferTextureCubeMap::getInternalFormat() const
{
return mTextureCubeMap->getInternalFormat(mTarget, mLevel);
}
GLsizei RenderbufferTextureCubeMap::getSamples() const
{
return 0;
......@@ -355,16 +340,11 @@ GLint Renderbuffer::getLevel() const
return mInstance->getLevel();
}
GLenum Renderbuffer::getFormat() const
GLint Renderbuffer::getFormat() const
{
return mInstance->getFormat();
}
sw::Format Renderbuffer::getInternalFormat() const
{
return mInstance->getInternalFormat();
}
GLuint Renderbuffer::getRedSize() const
{
return mInstance->getRedSize();
......@@ -423,7 +403,6 @@ RenderbufferStorage::RenderbufferStorage()
mWidth = 0;
mHeight = 0;
format = GL_RGBA4;
internalFormat = sw::FORMAT_NULL;
mSamples = 0;
}
......@@ -441,16 +420,11 @@ GLsizei RenderbufferStorage::getHeight() const
return mHeight;
}
GLenum RenderbufferStorage::getFormat() const
GLint RenderbufferStorage::getFormat() const
{
return format;
}
sw::Format RenderbufferStorage::getInternalFormat() const
{
return internalFormat;
}
GLsizei RenderbufferStorage::getSamples() const
{
return mSamples;
......@@ -462,24 +436,25 @@ Colorbuffer::Colorbuffer(egl::Image *renderTarget) : mRenderTarget(renderTarget)
{
renderTarget->addRef();
sw::Format implementationFormat = renderTarget->getInternalFormat();
format = sw2es::ConvertBackBufferFormat(implementationFormat);
mWidth = renderTarget->getWidth();
mHeight = renderTarget->getHeight();
internalFormat = renderTarget->getInternalFormat();
format = sw2es::ConvertBackBufferFormat(internalFormat);
mSamples = renderTarget->getDepth() & ~1;
}
}
Colorbuffer::Colorbuffer(int width, int height, GLenum format, GLsizei samples) : mRenderTarget(nullptr)
Colorbuffer::Colorbuffer(int width, int height, GLenum internalformat, GLsizei samples) : mRenderTarget(nullptr)
{
Device *device = getDevice();
sw::Format requestedFormat = es2sw::ConvertRenderbufferFormat(format);
sw::Format implementationFormat = es2sw::ConvertRenderbufferFormat(internalformat);
int supportedSamples = Context::getSupportedMultisampleCount(samples);
if(width > 0 && height > 0)
{
mRenderTarget = device->createRenderTarget(width, height, requestedFormat, supportedSamples, false);
mRenderTarget = device->createRenderTarget(width, height, implementationFormat, supportedSamples, false);
if(!mRenderTarget)
{
......@@ -490,8 +465,7 @@ Colorbuffer::Colorbuffer(int width, int height, GLenum format, GLsizei samples)
mWidth = width;
mHeight = height;
this->format = format;
internalFormat = requestedFormat;
format = internalformat;
mSamples = supportedSamples;
}
......@@ -539,40 +513,42 @@ DepthStencilbuffer::DepthStencilbuffer(egl::Image *depthStencil) : mDepthStencil
{
depthStencil->addRef();
sw::Format implementationFormat = depthStencil->getInternalFormat();
format = sw2es::ConvertDepthStencilFormat(implementationFormat);
mWidth = depthStencil->getWidth();
mHeight = depthStencil->getHeight();
internalFormat = depthStencil->getInternalFormat();
format = sw2es::ConvertDepthStencilFormat(internalFormat);
mSamples = depthStencil->getDepth() & ~1;
}
}
DepthStencilbuffer::DepthStencilbuffer(int width, int height, GLenum requestedFormat, GLsizei samples) : mDepthStencil(nullptr)
DepthStencilbuffer::DepthStencilbuffer(int width, int height, GLenum internalformat, GLsizei samples) : mDepthStencil(nullptr)
{
format = requestedFormat;
switch(requestedFormat)
format = internalformat;
sw::Format implementationFormat = sw::FORMAT_D24S8;
switch(internalformat)
{
case GL_STENCIL_INDEX8:
case GL_DEPTH_COMPONENT24:
case GL_DEPTH24_STENCIL8_OES:
internalFormat = sw::FORMAT_D24S8;
implementationFormat = sw::FORMAT_D24S8;
break;
case GL_DEPTH32F_STENCIL8:
internalFormat = sw::FORMAT_D32FS8_TEXTURE;
implementationFormat = sw::FORMAT_D32FS8_TEXTURE;
break;
case GL_DEPTH_COMPONENT16:
internalFormat = sw::FORMAT_D16;
implementationFormat = sw::FORMAT_D16;
break;
case GL_DEPTH_COMPONENT32_OES:
internalFormat = sw::FORMAT_D32;
implementationFormat = sw::FORMAT_D32;
break;
case GL_DEPTH_COMPONENT32F:
internalFormat = sw::FORMAT_D32F;
implementationFormat = sw::FORMAT_D32F;
break;
default:
UNREACHABLE(requestedFormat);
UNREACHABLE(internalformat);
format = GL_DEPTH24_STENCIL8_OES;
internalFormat = sw::FORMAT_D24S8;
implementationFormat = sw::FORMAT_D24S8;
}
Device *device = getDevice();
......@@ -581,7 +557,7 @@ DepthStencilbuffer::DepthStencilbuffer(int width, int height, GLenum requestedFo
if(width > 0 && height > 0)
{
mDepthStencil = device->createDepthStencilSurface(width, height, internalFormat, supportedSamples, false);
mDepthStencil = device->createDepthStencilSurface(width, height, implementationFormat, supportedSamples, false);
if(!mDepthStencil)
{
......@@ -637,7 +613,7 @@ Depthbuffer::Depthbuffer(egl::Image *depthStencil) : DepthStencilbuffer(depthSte
{
}
Depthbuffer::Depthbuffer(int width, int height, GLenum format, GLsizei samples) : DepthStencilbuffer(width, height, format, samples)
Depthbuffer::Depthbuffer(int width, int height, GLenum internalformat, GLsizei samples) : DepthStencilbuffer(width, height, internalformat, samples)
{
}
......
......@@ -53,8 +53,7 @@ public:
virtual GLsizei getDepth() const { return 1; }
virtual GLint getLayer() const { return 0; }
virtual GLint getLevel() const { return 0; }
virtual GLenum getFormat() const = 0;
virtual sw::Format getInternalFormat() const = 0;
virtual GLint getFormat() const = 0;
virtual GLsizei getSamples() const = 0;
virtual void setLayer(GLint) {}
......@@ -85,8 +84,7 @@ public:
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLint getLevel() const { return mLevel; }
virtual GLenum getFormat() const;
virtual sw::Format getInternalFormat() const;
virtual GLint getFormat() const;
virtual GLsizei getSamples() const;
virtual void setLevel(GLint level) { mLevel = level; }
......@@ -115,8 +113,7 @@ public:
virtual GLsizei getDepth() const;
virtual GLint getLayer() const { return mLayer; }
virtual GLint getLevel() const { return mLevel; }
virtual GLenum getFormat() const;
virtual sw::Format getInternalFormat() const;
virtual GLint getFormat() const;
virtual GLsizei getSamples() const;
virtual void setLayer(GLint layer) { mLayer = layer; }
......@@ -145,8 +142,7 @@ public:
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLint getLevel() const { return mLevel; }
virtual GLenum getFormat() const;
virtual sw::Format getInternalFormat() const;
virtual GLint getFormat() const;
virtual GLsizei getSamples() const;
virtual void setLevel(GLint level) { mLevel = level; }
......@@ -173,15 +169,13 @@ public:
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLenum getFormat() const;
virtual sw::Format getInternalFormat() const;
virtual GLint getFormat() const;
virtual GLsizei getSamples() const;
protected:
GLsizei mWidth;
GLsizei mHeight;
GLenum format;
sw::Format internalFormat;
GLsizei mSamples;
};
......@@ -211,8 +205,7 @@ public:
GLsizei getDepth() const;
GLint getLayer() const;
GLint getLevel() const;
GLenum getFormat() const;
sw::Format getInternalFormat() const;
GLint getFormat() const;
GLuint getRedSize() const;
GLuint getGreenSize() const;
GLuint getBlueSize() const;
......@@ -233,7 +226,7 @@ class Colorbuffer : public RenderbufferStorage
{
public:
explicit Colorbuffer(egl::Image *renderTarget);
Colorbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples);
Colorbuffer(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
virtual ~Colorbuffer();
......@@ -249,7 +242,7 @@ class DepthStencilbuffer : public RenderbufferStorage
{
public:
explicit DepthStencilbuffer(egl::Image *depthStencil);
DepthStencilbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples);
DepthStencilbuffer(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
~DepthStencilbuffer();
......@@ -265,7 +258,7 @@ class Depthbuffer : public DepthStencilbuffer
{
public:
explicit Depthbuffer(egl::Image *depthStencil);
Depthbuffer(GLsizei width, GLsizei height, GLenum format, GLsizei samples);
Depthbuffer(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
virtual ~Depthbuffer();
};
......
......@@ -450,7 +450,7 @@ void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GL
}
}
bool Texture::copy(egl::Image *source, const sw::SliceRect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, GLint zoffset, egl::Image *dest)
bool Texture::copy(egl::Image *source, const sw::SliceRect &sourceRect, GLint xoffset, GLint yoffset, GLint zoffset, egl::Image *dest)
{
Device *device = getDevice();
......@@ -589,12 +589,6 @@ GLenum Texture2D::getType(GLenum target, GLint level) const
return image[level] ? image[level]->getType() : GL_NONE;
}
sw::Format Texture2D::getInternalFormat(GLenum target, GLint level) const
{
ASSERT(target == GL_TEXTURE_2D);
return image[level] ? image[level]->getInternalFormat() : sw::FORMAT_NULL;
}
int Texture2D::getLevelCount() const
{
ASSERT(isSamplerComplete());
......@@ -673,7 +667,7 @@ void Texture2D::setCompressedImage(GLint level, GLenum format, GLsizei width, GL
image[level]->release();
}
GLenum sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
GLint sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
image[level] = egl::Image::create(this, width, height, sizedInternalFormat, GL_UNSIGNED_BYTE);
if(!image[level])
......@@ -709,7 +703,7 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
image[level]->release();
}
GLenum sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
GLint sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
image[level] = egl::Image::create(this, width, height, sizedInternalFormat, GL_UNSIGNED_BYTE);
if(!image[level])
......@@ -730,7 +724,7 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
sourceRect.clip(0, 0, renderbuffer->getWidth(), renderbuffer->getHeight());
copy(renderTarget, sourceRect, sizedInternalFormat, 0, 0, 0, image[level]);
copy(renderTarget, sourceRect, 0, 0, 0, image[level]);
}
renderTarget->release();
......@@ -769,7 +763,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
sourceRect.clip(0, 0, renderbuffer->getWidth(), renderbuffer->getHeight());
copy(renderTarget, sourceRect, image[level]->getFormat(), xoffset, yoffset, zoffset, image[level]);
copy(renderTarget, sourceRect, xoffset, yoffset, zoffset, image[level]);
renderTarget->release();
}
......@@ -1077,12 +1071,6 @@ GLenum TextureCubeMap::getType(GLenum target, GLint level) const
return image[face][level] ? image[face][level]->getType() : 0;
}
sw::Format TextureCubeMap::getInternalFormat(GLenum target, GLint level) const
{
int face = CubeFaceIndex(target);
return image[face][level] ? image[face][level]->getInternalFormat() : sw::FORMAT_NULL;
}
int TextureCubeMap::getLevelCount() const
{
ASSERT(isSamplerComplete());
......@@ -1105,7 +1093,7 @@ void TextureCubeMap::setCompressedImage(GLenum target, GLint level, GLenum forma
image[face][level]->release();
}
GLenum sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
GLint sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
int border = (egl::getClientVersion() >= 3) ? 1 : 0;
image[face][level] = egl::Image::create(this, width, height, 1, border, sizedInternalFormat, GL_UNSIGNED_BYTE);
......@@ -1339,7 +1327,7 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
image[face][level]->release();
}
GLenum sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
GLint sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
int border = (egl::getClientVersion() >= 3) ? 1 : 0;
image[face][level] = egl::Image::create(this, width, height, 1, border, sizedInternalFormat, GL_UNSIGNED_BYTE);
......@@ -1361,7 +1349,7 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
sourceRect.clip(0, 0, renderbuffer->getWidth(), renderbuffer->getHeight());
copy(renderTarget, sourceRect, sizedInternalFormat, 0, 0, 0, image[face][level]);
copy(renderTarget, sourceRect, 0, 0, 0, image[face][level]);
}
renderTarget->release();
......@@ -1414,7 +1402,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
sourceRect.clip(0, 0, renderbuffer->getWidth(), renderbuffer->getHeight());
copy(renderTarget, sourceRect, image[face][level]->getFormat(), xoffset, yoffset, zoffset, image[face][level]);
copy(renderTarget, sourceRect, xoffset, yoffset, zoffset, image[face][level]);
renderTarget->release();
}
......@@ -1614,12 +1602,6 @@ GLenum Texture3D::getType(GLenum target, GLint level) const
return image[level] ? image[level]->getType() : GL_NONE;
}
sw::Format Texture3D::getInternalFormat(GLenum target, GLint level) const
{
ASSERT(target == getTarget());
return image[level] ? image[level]->getInternalFormat() : sw::FORMAT_NULL;
}
int Texture3D::getLevelCount() const
{
ASSERT(isSamplerComplete());
......@@ -1698,7 +1680,7 @@ void Texture3D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLint z,
image[level]->release();
}
GLenum sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
GLint sizedInternalFormat = GetSizedInternalFormat(format, GL_UNSIGNED_BYTE);
image[level] = egl::Image::create(this, width, height, depth, 0, sizedInternalFormat, GL_UNSIGNED_BYTE);
if(!image[level])
......@@ -1720,7 +1702,7 @@ void Texture3D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLint z,
sourceRect.clip(0, 0, renderbuffer->getWidth(), renderbuffer->getHeight());
for(GLint sliceZ = 0; sliceZ < depth; ++sliceZ, ++sourceRect.slice)
{
copy(renderTarget, sourceRect, sizedInternalFormat, 0, 0, sliceZ, image[level]);
copy(renderTarget, sourceRect, 0, 0, sliceZ, image[level]);
}
}
......@@ -1760,7 +1742,7 @@ void Texture3D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
sw::SliceRect sourceRect = {x, y, x + width, y + height, 0};
sourceRect.clip(0, 0, renderbuffer->getWidth(), renderbuffer->getHeight());
copy(renderTarget, sourceRect, image[level]->getFormat(), xoffset, yoffset, zoffset, image[level]);
copy(renderTarget, sourceRect, xoffset, yoffset, zoffset, image[level]);
renderTarget->release();
}
......
......@@ -97,7 +97,6 @@ public:
virtual GLsizei getDepth(GLenum target, GLint level) const;
virtual GLenum getFormat(GLenum target, GLint level) const = 0;
virtual GLenum getType(GLenum target, GLint level) const = 0;
virtual sw::Format getInternalFormat(GLenum target, GLint level) const = 0;
virtual int getLevelCount() const = 0;
virtual bool isSamplerComplete() const = 0;
......@@ -120,7 +119,7 @@ protected:
void setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image);
void subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image);
bool copy(egl::Image *source, const sw::SliceRect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, GLint zoffset, egl::Image *dest);
bool copy(egl::Image *source, const sw::SliceRect &sourceRect, GLint xoffset, GLint yoffset, GLint zoffset, egl::Image *dest);
bool isMipmapFiltered() const;
......@@ -161,7 +160,6 @@ public:
GLsizei getHeight(GLenum target, GLint level) const override;
GLenum getFormat(GLenum target, GLint level) const override;
GLenum getType(GLenum target, GLint level) const override;
sw::Format getInternalFormat(GLenum target, GLint level) const override;
int getLevelCount() const override;
void setImage(egl::Context *context, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, const egl::Image::UnpackInfo& unpackInfo, const void *pixels);
......@@ -220,7 +218,6 @@ public:
GLsizei getHeight(GLenum target, GLint level) const override;
GLenum getFormat(GLenum target, GLint level) const override;
GLenum getType(GLenum target, GLint level) const override;
sw::Format getInternalFormat(GLenum target, GLint level) const override;
int getLevelCount() const override;
void setImage(egl::Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, const egl::Image::UnpackInfo& unpackInfo, const void *pixels);
......@@ -282,7 +279,6 @@ public:
GLsizei getDepth(GLenum target, GLint level) const override;
GLenum getFormat(GLenum target, GLint level) const override;
GLenum getType(GLenum target, GLint level) const override;
sw::Format getInternalFormat(GLenum target, GLint level) const override;
int getLevelCount() const override;
void setImage(egl::Context *context, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const egl::Image::UnpackInfo& unpackInfo, const void *pixels);
......
......@@ -2285,7 +2285,7 @@ void GenerateMipmap(GLenum target)
return error(GL_INVALID_OPERATION);
}
if(!IsMipmappable(texture->getFormat(target, 0), texture->getInternalFormat(target, 0), clientVersion))
if(!IsMipmappable(texture->getFormat(target, 0), clientVersion))
{
return error(GL_INVALID_OPERATION);
}
......@@ -3019,7 +3019,7 @@ void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenu
return error(GL_INVALID_OPERATION);
}
*params = sw2es::GetComponentType(renderbuffer->getInternalFormat(), attachment);
*params = GetComponentType(renderbuffer->getFormat(), attachment);
break;
case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
if(clientVersion >= 3)
......@@ -6319,7 +6319,7 @@ void TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei wi
return error(GL_INVALID_ENUM);
}
if(internalformat != (GLint)format)
if(internalformat != format)
{
return error(GL_INVALID_OPERATION);
}
......
......@@ -43,7 +43,7 @@ namespace es2
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
bool IsCompressed(GLenum format, GLint clientVersion);
GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type);
GLint GetSizedInternalFormat(GLint internalFormat, GLenum type);
GLenum ValidateCompressedFormat(GLenum format, GLint clientVersion, bool expectCompressedFormats);
GLenum ValidateSubImageParams(bool compressed, bool copy, GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format, GLenum type, Texture *texture, GLint clientVersion);
......@@ -61,7 +61,22 @@ namespace es2
bool IsColorRenderable(GLint internalformat, GLint clientVersion);
bool IsDepthRenderable(GLint internalformat, GLint clientVersion);
bool IsStencilRenderable(GLint internalformat, GLint clientVersion);
bool IsMipmappable(GLint internalformat, sw::Format format, GLint clientVersion);
bool IsMipmappable(GLint internalformat, GLint clientVersion);
GLuint GetAlphaSize(GLint internalformat);
GLuint GetRedSize(GLint internalformat);
GLuint GetGreenSize(GLint internalformat);
GLuint GetBlueSize(GLint internalformat);
GLuint GetDepthSize(GLint internalformat);
GLuint GetStencilSize(GLint internalformat);
GLenum GetColorComponentType(GLint internalformat);
GLenum GetComponentType(GLint internalformat, GLenum attachment);
bool IsNormalizedInteger(GLint internalformat);
bool IsNonNormalizedInteger(GLint internalformat);
bool IsFloatFormat(GLint internalformat);
bool IsSignedNonNormalizedInteger(GLint internalformat);
bool IsUnsignedNonNormalizedInteger(GLint internalformat);
// Parse the base uniform name and array index. Returns the base name of the uniform. outSubscript is
// set to GL_INVALID_INDEX if the provided name is not an array or the array index is invalid.
......@@ -90,14 +105,6 @@ namespace es2sw
namespace sw2es
{
GLuint GetAlphaSize(sw::Format colorFormat);
GLuint GetRedSize(sw::Format colorFormat);
GLuint GetGreenSize(sw::Format colorFormat);
GLuint GetBlueSize(sw::Format colorFormat);
GLuint GetDepthSize(sw::Format depthFormat);
GLuint GetStencilSize(sw::Format stencilFormat);
GLenum GetComponentType(sw::Format format, GLenum attachment);
GLenum ConvertBackBufferFormat(sw::Format format);
GLenum ConvertDepthStencilFormat(sw::Format format);
}
......
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