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);
}
......
......@@ -497,57 +497,54 @@ GLenum Framebuffer::getImplementationColorReadFormat() const
if(colorbuffer)
{
switch(colorbuffer->getInternalFormat())
switch(colorbuffer->getFormat())
{
case sw::FORMAT_A8B8G8R8I: return GL_RGBA_INTEGER;
case sw::FORMAT_A8B8G8R8UI: return GL_RGBA_INTEGER;
case sw::FORMAT_A16B16G16R16I: return GL_RGBA_INTEGER;
case sw::FORMAT_A16B16G16R16UI: return GL_RGBA_INTEGER;
case sw::FORMAT_A32B32G32R32I: return GL_RGBA_INTEGER;
case sw::FORMAT_A32B32G32R32UI: return GL_RGBA_INTEGER;
case sw::FORMAT_A2B10G10R10: return GL_RGB10_A2;
case sw::FORMAT_A8B8G8R8I_SNORM: return GL_RGBA;
case sw::FORMAT_A8B8G8R8: return GL_RGBA;
case sw::FORMAT_SRGB8_A8: return GL_RGBA;
case sw::FORMAT_A8R8G8B8: return GL_BGRA_EXT;
case sw::FORMAT_A1R5G5B5: return GL_BGRA_EXT;
case sw::FORMAT_X8B8G8R8I: return GL_RGBA_INTEGER;
case sw::FORMAT_X8B8G8R8UI: return GL_RGBA_INTEGER;
case sw::FORMAT_X16B16G16R16I: return GL_RGBA_INTEGER;
case sw::FORMAT_X16B16G16R16UI: return GL_RGBA_INTEGER;
case sw::FORMAT_X32B32G32R32I: return GL_RGBA_INTEGER;
case sw::FORMAT_X32B32G32R32UI: return GL_RGBA_INTEGER;
case sw::FORMAT_X8B8G8R8I_SNORM: return GL_RGBA;
case sw::FORMAT_SRGB8_X8: return GL_RGBA;
case sw::FORMAT_X8B8G8R8: return GL_RGBA;
case sw::FORMAT_X8R8G8B8: return GL_BGRA_EXT;
case sw::FORMAT_R5G6B5: return GL_RGB;
case sw::FORMAT_G8R8I: return GL_RG_INTEGER;
case sw::FORMAT_G8R8UI: return GL_RG_INTEGER;
case sw::FORMAT_G16R16I: return GL_RG_INTEGER;
case sw::FORMAT_G16R16UI: return GL_RG_INTEGER;
case sw::FORMAT_G32R32I: return GL_RG_INTEGER;
case sw::FORMAT_G32R32UI: return GL_RG_INTEGER;
case sw::FORMAT_R8I: return GL_RED_INTEGER;
case sw::FORMAT_R8UI: return GL_RED_INTEGER;
case sw::FORMAT_R16I: return GL_RED_INTEGER;
case sw::FORMAT_R16UI: return GL_RED_INTEGER;
case sw::FORMAT_R32I: return GL_RED_INTEGER;
case sw::FORMAT_R32UI: return GL_RED_INTEGER;
case sw::FORMAT_R8: return GL_RED;
case sw::FORMAT_R8I_SNORM: return GL_RED;
case sw::FORMAT_R16F: return GL_RED;
case sw::FORMAT_R32F: return GL_RED;
case sw::FORMAT_G8R8: return GL_RG;
case sw::FORMAT_G8R8I_SNORM: return GL_RG;
case sw::FORMAT_G16R16F: return GL_RG;
case sw::FORMAT_G32R32F: return GL_RG;
case sw::FORMAT_B16G16R16F: return GL_RGB;
case sw::FORMAT_X32B32G32R32F: return GL_RGBA;
case sw::FORMAT_A16B16G16R16F: return GL_RGBA;
case sw::FORMAT_A32B32G32R32F: return GL_RGBA;
case GL_RGBA4: return GL_RGBA;
case GL_RGB5_A1: return GL_RGBA;
case GL_RGBA8: return GL_RGBA;
case GL_RGB565: return GL_RGBA;
case GL_RGB8: return GL_RGB;
case GL_R8: return GL_RED;
case GL_RG8: return GL_RG;
case GL_R8I: return GL_RED_INTEGER;
case GL_RG8I: return GL_RG_INTEGER;
case GL_RGB8I: return GL_RGB_INTEGER;
case GL_RGBA8I: return GL_RGBA_INTEGER;
case GL_R8UI: return GL_RED_INTEGER;
case GL_RG8UI: return GL_RG_INTEGER;
case GL_RGB8UI: return GL_RGB_INTEGER;
case GL_RGBA8UI: return GL_RGBA_INTEGER;
case GL_R16I: return GL_RED_INTEGER;
case GL_RG16I: return GL_RG_INTEGER;
case GL_RGB16I: return GL_RGB_INTEGER;
case GL_RGBA16I: return GL_RGBA_INTEGER;
case GL_R16UI: return GL_RED_INTEGER;
case GL_RG16UI: return GL_RG_INTEGER;
case GL_RGB16UI: return GL_RGB_INTEGER;
case GL_RGB10_A2UI: return GL_RGBA_INTEGER;
case GL_RGBA16UI: return GL_RGBA_INTEGER;
case GL_R32I: return GL_RED_INTEGER;
case GL_RG32I: return GL_RG_INTEGER;
case GL_RGB32I: return GL_RGB_INTEGER;
case GL_RGBA32I: return GL_RGBA_INTEGER;
case GL_R32UI: return GL_RED_INTEGER;
case GL_RG32UI: return GL_RG_INTEGER;
case GL_RGB32UI: return GL_RGB_INTEGER;
case GL_RGBA32UI: return GL_RGBA_INTEGER;
case GL_R16F: return GL_RED;
case GL_RG16F: return GL_RG;
case GL_R11F_G11F_B10F: return GL_RGB;
case GL_RGB16F: return GL_RGB;
case GL_RGBA16F: return GL_RGBA;
case GL_R32F: return GL_RED;
case GL_RG32F: return GL_RG;
case GL_RGB32F: return GL_RGB;
case GL_RGBA32F: return GL_RGBA;
case GL_RGB10_A2: return GL_RGBA;
case GL_SRGB8: return GL_RGB;
case GL_SRGB8_ALPHA8: return GL_RGBA;
default:
UNREACHABLE(colorbuffer->getInternalFormat());
UNREACHABLE(colorbuffer->getFormat());
}
}
......@@ -560,58 +557,54 @@ GLenum Framebuffer::getImplementationColorReadType() const
if(colorbuffer)
{
switch(colorbuffer->getInternalFormat())
switch(colorbuffer->getFormat())
{
case sw::FORMAT_R16F: return GL_FLOAT;
case sw::FORMAT_G16R16F: return GL_FLOAT;
case sw::FORMAT_B16G16R16F: return GL_FLOAT;
case sw::FORMAT_A16B16G16R16F: return GL_FLOAT;
case sw::FORMAT_R32F: return GL_FLOAT;
case sw::FORMAT_G32R32F: return GL_FLOAT;
case sw::FORMAT_B32G32R32F: return GL_FLOAT;
case sw::FORMAT_X32B32G32R32F: return GL_FLOAT;
case sw::FORMAT_A32B32G32R32F: return GL_FLOAT;
case sw::FORMAT_R8I_SNORM: return GL_BYTE;
case sw::FORMAT_G8R8I_SNORM: return GL_BYTE;
case sw::FORMAT_X8B8G8R8I_SNORM: return GL_BYTE;
case sw::FORMAT_A8B8G8R8I_SNORM: return GL_BYTE;
case sw::FORMAT_R8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_G8R8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_SRGB8_X8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_SRGB8_A8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_A8R8G8B8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_A8B8G8R8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_X8R8G8B8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_X8B8G8R8: return GL_UNSIGNED_BYTE;
case sw::FORMAT_R8I: return GL_INT;
case sw::FORMAT_G8R8I: return GL_INT;
case sw::FORMAT_X8B8G8R8I: return GL_INT;
case sw::FORMAT_A8B8G8R8I: return GL_INT;
case sw::FORMAT_R16I: return GL_INT;
case sw::FORMAT_G16R16I: return GL_INT;
case sw::FORMAT_X16B16G16R16I: return GL_INT;
case sw::FORMAT_A16B16G16R16I: return GL_INT;
case sw::FORMAT_R32I: return GL_INT;
case sw::FORMAT_G32R32I: return GL_INT;
case sw::FORMAT_X32B32G32R32I: return GL_INT;
case sw::FORMAT_A32B32G32R32I: return GL_INT;
case sw::FORMAT_R8UI: return GL_UNSIGNED_INT;
case sw::FORMAT_G8R8UI: return GL_UNSIGNED_INT;
case sw::FORMAT_X8B8G8R8UI: return GL_UNSIGNED_INT;
case sw::FORMAT_A8B8G8R8UI: return GL_UNSIGNED_INT;
case sw::FORMAT_R16UI: return GL_UNSIGNED_INT;
case sw::FORMAT_G16R16UI: return GL_UNSIGNED_INT;
case sw::FORMAT_X16B16G16R16UI: return GL_UNSIGNED_INT;
case sw::FORMAT_A16B16G16R16UI: return GL_UNSIGNED_INT;
case sw::FORMAT_R32UI: return GL_UNSIGNED_INT;
case sw::FORMAT_G32R32UI: return GL_UNSIGNED_INT;
case sw::FORMAT_X32B32G32R32UI: return GL_UNSIGNED_INT;
case sw::FORMAT_A32B32G32R32UI: return GL_UNSIGNED_INT;
case sw::FORMAT_A2B10G10R10: return GL_UNSIGNED_INT_10_10_10_2_OES;
case sw::FORMAT_A1R5G5B5: return GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT;
case sw::FORMAT_R5G6B5: return GL_UNSIGNED_SHORT_5_6_5;
case GL_RGBA4: return GL_UNSIGNED_BYTE;
case GL_RGB5_A1: return GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT;
case GL_RGBA8: return GL_UNSIGNED_BYTE;
case GL_RGB565: return GL_UNSIGNED_SHORT_5_6_5;
case GL_RGB8: return GL_UNSIGNED_BYTE;
case GL_R8: return GL_UNSIGNED_BYTE;
case GL_RG8: return GL_UNSIGNED_BYTE;
case GL_R8I: return GL_INT;
case GL_RG8I: return GL_INT;
case GL_RGB8I: return GL_INT;
case GL_RGBA8I: return GL_INT;
case GL_R8UI: return GL_UNSIGNED_BYTE;
case GL_RG8UI: return GL_UNSIGNED_BYTE;
case GL_RGB8UI: return GL_UNSIGNED_BYTE;
case GL_RGBA8UI: return GL_UNSIGNED_BYTE;
case GL_R16I: return GL_INT;
case GL_RG16I: return GL_INT;
case GL_RGB16I: return GL_INT;
case GL_RGBA16I: return GL_INT;
case GL_R16UI: return GL_UNSIGNED_INT;
case GL_RG16UI: return GL_UNSIGNED_INT;
case GL_RGB16UI: return GL_UNSIGNED_INT;
case GL_RGB10_A2UI: return GL_UNSIGNED_INT_10_10_10_2_OES;
case GL_RGBA16UI: return GL_UNSIGNED_INT;
case GL_R32I: return GL_INT;
case GL_RG32I: return GL_INT;
case GL_RGB32I: return GL_INT;
case GL_RGBA32I: return GL_INT;
case GL_R32UI: return GL_UNSIGNED_INT;
case GL_RG32UI: return GL_UNSIGNED_INT;
case GL_RGB32UI: return GL_UNSIGNED_INT;
case GL_RGBA32UI: return GL_UNSIGNED_INT;
case GL_R16F: return GL_FLOAT;
case GL_RG16F: return GL_FLOAT;
case GL_R11F_G11F_B10F: return GL_FLOAT;
case GL_RGB16F: return GL_FLOAT;
case GL_RGBA16F: return GL_FLOAT;
case GL_R32F: return GL_FLOAT;
case GL_RG32F: return GL_FLOAT;
case GL_RGB32F: return GL_FLOAT;
case GL_RGBA32F: return GL_FLOAT;
case GL_RGB10_A2: return GL_UNSIGNED_INT_10_10_10_2_OES;
case GL_SRGB8: return GL_UNSIGNED_BYTE;
case GL_SRGB8_ALPHA8: return GL_UNSIGNED_BYTE;
default:
UNREACHABLE(colorbuffer->getInternalFormat());
UNREACHABLE(colorbuffer->getFormat());
}
}
......@@ -638,18 +631,16 @@ GLenum Framebuffer::getDepthReadType() const
if(depthbuffer)
{
switch(depthbuffer->getInternalFormat())
switch(depthbuffer->getFormat())
{
case sw::FORMAT_D16: return GL_UNSIGNED_SHORT;
case sw::FORMAT_D24S8: return GL_UNSIGNED_INT_24_8_OES;
case sw::FORMAT_D32: return GL_UNSIGNED_INT;
case sw::FORMAT_D32F:
case sw::FORMAT_D32F_COMPLEMENTARY:
case sw::FORMAT_D32F_LOCKABLE:
case sw::FORMAT_D32FS8_TEXTURE:
case sw::FORMAT_D32FS8_SHADOW: return GL_FLOAT;
case GL_DEPTH_COMPONENT16: return GL_UNSIGNED_SHORT;
case GL_DEPTH_COMPONENT24: return GL_UNSIGNED_INT;
case GL_DEPTH_COMPONENT32_OES: return GL_UNSIGNED_INT;
case GL_DEPTH_COMPONENT32F: return GL_FLOAT;
case GL_DEPTH24_STENCIL8: return GL_UNSIGNED_INT_24_8_OES;
case GL_DEPTH32F_STENCIL8: return GL_FLOAT;
default:
UNREACHABLE(depthbuffer->getInternalFormat());
UNREACHABLE(depthbuffer->getFormat());
}
}
......
......@@ -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);
}
......
......@@ -33,19 +33,19 @@ namespace es2
// format and type combinations.
typedef std::pair<GLenum, GLenum> FormatTypePair;
typedef std::pair<FormatTypePair, GLenum> FormatPair;
typedef std::pair<FormatTypePair, GLint> FormatPair;
typedef std::map<FormatTypePair, GLenum> FormatMap;
// A helper function to insert data into the format map with fewer characters.
static inline void InsertFormatMapping(FormatMap *map, GLenum format, GLenum type, GLenum internalFormat)
static inline void InsertFormatMapping(FormatMap *map, GLenum format, GLenum type, GLint internalFormat)
{
map->insert(FormatPair(FormatTypePair(format, type), internalFormat));
}
FormatMap BuildFormatMap()
{
static const GLenum GL_BGRA4_ANGLEX = 0x6ABC;
static const GLenum GL_BGR5_A1_ANGLEX = 0x6ABD;
static const GLint GL_BGRA4_ANGLEX = 0x6ABC;
static const GLint GL_BGR5_A1_ANGLEX = 0x6ABD;
FormatMap map;
......@@ -146,9 +146,9 @@ namespace es2
return map;
}
GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type)
GLint GetSizedInternalFormat(GLint internalformat, GLenum type)
{
switch(internalFormat)
switch(internalformat)
{
case GL_ALPHA:
case GL_LUMINANCE:
......@@ -168,11 +168,11 @@ namespace es2
case GL_SRGB_ALPHA_EXT:
{
static const FormatMap formatMap = BuildFormatMap();
FormatMap::const_iterator iter = formatMap.find(FormatTypePair(internalFormat, type));
FormatMap::const_iterator iter = formatMap.find(FormatTypePair(internalformat, type));
return (iter != formatMap.end()) ? iter->second : GL_NONE;
}
default:
return internalFormat;
return internalformat;
}
}
......@@ -648,9 +648,9 @@ namespace es2
return false;
}
sw::Format internalformat = colorbuffer->getInternalFormat();
GLint internalformat = colorbuffer->getFormat();
if(sw::Surface::isNormalizedInteger(internalformat))
if(IsNormalizedInteger(internalformat))
{
// Combination always supported by normalized fixed-point rendering surfaces.
if(format == GL_RGBA && type == GL_UNSIGNED_BYTE)
......@@ -669,7 +669,7 @@ namespace es2
}
}
}
else if(sw::Surface::isFloatFormat(internalformat))
else if(IsFloatFormat(internalformat))
{
// Combination always supported by floating-point rendering surfaces.
// Supported in OpenGL ES 2.0 due to GL_EXT_color_buffer_half_float.
......@@ -678,7 +678,7 @@ namespace es2
return true;
}
}
else if(sw::Surface::isSignedNonNormalizedInteger(internalformat))
else if(IsSignedNonNormalizedInteger(internalformat))
{
ASSERT(clientVersion >= 3);
......@@ -687,7 +687,7 @@ namespace es2
return true;
}
}
else if(sw::Surface::isUnsignedNonNormalizedInteger(internalformat))
else if(IsUnsignedNonNormalizedInteger(internalformat))
{
ASSERT(clientVersion >= 3);
......@@ -897,8 +897,8 @@ namespace es2
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGB565:
case GL_RGB8_OES:
case GL_RGBA8_OES:
case GL_RGB8:
case GL_RGBA8:
case GL_R16F:
case GL_RG16F:
case GL_R11F_G11F_B10F:
......@@ -1238,8 +1238,8 @@ namespace es2
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGB565:
case GL_RGB8_OES:
case GL_RGBA8_OES:
case GL_RGB8:
case GL_RGBA8:
case GL_RED:
case GL_RG:
case GL_RGB:
......@@ -1300,8 +1300,8 @@ namespace es2
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGB565:
case GL_RGB8_OES:
case GL_RGBA8_OES:
case GL_RGB8:
case GL_RGBA8:
case GL_RED:
case GL_RG:
case GL_RGB:
......@@ -1331,9 +1331,9 @@ namespace es2
return false;
}
bool IsMipmappable(GLint internalformat, sw::Format format, GLint clientVersion)
bool IsMipmappable(GLint internalformat, GLint clientVersion)
{
if(sw::Surface::isNonNormalizedInteger(format))
if(IsNonNormalizedInteger(internalformat))
{
return false;
}
......@@ -1349,6 +1349,376 @@ namespace es2
}
}
GLuint GetAlphaSize(GLint internalformat)
{
switch(internalformat)
{
case GL_RGBA4: return 4;
case GL_RGB5_A1: return 1;
case GL_RGB565: return 0;
case GL_R8: return 0;
case GL_RG8: return 0;
case GL_RGB8: return 0;
case GL_RGBA8: return 8;
case GL_R16F: return 0;
case GL_RG16F: return 0;
case GL_RGB16F: return 0;
case GL_RGBA16F: return 16;
case GL_R32F: return 0;
case GL_RG32F: return 0;
case GL_RGB32F: return 0;
case GL_RGBA32F: return 32;
case GL_BGRA8_EXT: return 8;
case GL_R8UI: return 0;
case GL_R8I: return 0;
case GL_R16UI: return 0;
case GL_R16I: return 0;
case GL_R32UI: return 0;
case GL_R32I: return 0;
case GL_RG8UI: return 0;
case GL_RG8I: return 0;
case GL_RG16UI: return 0;
case GL_RG16I: return 0;
case GL_RG32UI: return 0;
case GL_RG32I: return 0;
case GL_SRGB8_ALPHA8: return 8;
case GL_RGB10_A2: return 2;
case GL_RGBA8UI: return 8;
case GL_RGBA8I: return 8;
case GL_RGB10_A2UI: return 2;
case GL_RGBA16UI: return 16;
case GL_RGBA16I: return 16;
case GL_RGBA32I: return 32;
case GL_RGBA32UI: return 32;
case GL_R11F_G11F_B10F: return 0;
default:
UNREACHABLE(internalformat);
return 0;
}
}
GLuint GetRedSize(GLint internalformat)
{
switch(internalformat)
{
case GL_RGBA4: return 4;
case GL_RGB5_A1: return 5;
case GL_RGB565: return 5;
case GL_R8: return 8;
case GL_RG8: return 8;
case GL_RGB8: return 8;
case GL_RGBA8: return 8;
case GL_R16F: return 16;
case GL_RG16F: return 16;
case GL_RGB16F: return 16;
case GL_RGBA16F: return 16;
case GL_R32F: return 32;
case GL_RG32F: return 32;
case GL_RGB32F: return 32;
case GL_RGBA32F: return 32;
case GL_BGRA8_EXT: return 8;
case GL_R8UI: return 8;
case GL_R8I: return 8;
case GL_R16UI: return 16;
case GL_R16I: return 16;
case GL_R32UI: return 32;
case GL_R32I: return 32;
case GL_RG8UI: return 8;
case GL_RG8I: return 8;
case GL_RG16UI: return 16;
case GL_RG16I: return 16;
case GL_RG32UI: return 32;
case GL_RG32I: return 32;
case GL_SRGB8_ALPHA8: return 8;
case GL_RGB10_A2: return 10;
case GL_RGBA8UI: return 8;
case GL_RGBA8I: return 8;
case GL_RGB10_A2UI: return 10;
case GL_RGBA16UI: return 16;
case GL_RGBA16I: return 16;
case GL_RGBA32I: return 32;
case GL_RGBA32UI: return 32;
case GL_R11F_G11F_B10F: return 11;
default:
UNREACHABLE(internalformat);
return 0;
}
}
GLuint GetGreenSize(GLint internalformat)
{
switch(internalformat)
{
case GL_RGBA4: return 4;
case GL_RGB5_A1: return 5;
case GL_RGB565: return 6;
case GL_R8: return 0;
case GL_RG8: return 8;
case GL_RGB8: return 8;
case GL_RGBA8: return 8;
case GL_R16F: return 0;
case GL_RG16F: return 16;
case GL_RGB16F: return 16;
case GL_RGBA16F: return 16;
case GL_R32F: return 0;
case GL_RG32F: return 32;
case GL_RGB32F: return 32;
case GL_RGBA32F: return 32;
case GL_BGRA8_EXT: return 8;
case GL_R8UI: return 0;
case GL_R8I: return 0;
case GL_R16UI: return 0;
case GL_R16I: return 0;
case GL_R32UI: return 0;
case GL_R32I: return 0;
case GL_RG8UI: return 8;
case GL_RG8I: return 8;
case GL_RG16UI: return 16;
case GL_RG16I: return 16;
case GL_RG32UI: return 32;
case GL_RG32I: return 32;
case GL_SRGB8_ALPHA8: return 8;
case GL_RGB10_A2: return 10;
case GL_RGBA8UI: return 8;
case GL_RGBA8I: return 8;
case GL_RGB10_A2UI: return 10;
case GL_RGBA16UI: return 16;
case GL_RGBA16I: return 16;
case GL_RGBA32I: return 32;
case GL_RGBA32UI: return 32;
case GL_R11F_G11F_B10F: return 11;
default:
UNREACHABLE(internalformat);
return 0;
}
}
GLuint GetBlueSize(GLint internalformat)
{
switch(internalformat)
{
case GL_RGBA4: return 4;
case GL_RGB5_A1: return 5;
case GL_RGB565: return 5;
case GL_R8: return 0;
case GL_RG8: return 0;
case GL_RGB8: return 8;
case GL_RGBA8: return 8;
case GL_R16F: return 0;
case GL_RG16F: return 0;
case GL_RGB16F: return 16;
case GL_RGBA16F: return 16;
case GL_R32F: return 0;
case GL_RG32F: return 0;
case GL_RGB32F: return 32;
case GL_RGBA32F: return 32;
case GL_BGRA8_EXT: return 8;
case GL_R8UI: return 0;
case GL_R8I: return 0;
case GL_R16UI: return 0;
case GL_R16I: return 0;
case GL_R32UI: return 0;
case GL_R32I: return 0;
case GL_RG8UI: return 0;
case GL_RG8I: return 0;
case GL_RG16UI: return 0;
case GL_RG16I: return 0;
case GL_RG32UI: return 0;
case GL_RG32I: return 0;
case GL_SRGB8_ALPHA8: return 8;
case GL_RGB10_A2: return 10;
case GL_RGBA8UI: return 8;
case GL_RGBA8I: return 8;
case GL_RGB10_A2UI: return 10;
case GL_RGBA16UI: return 16;
case GL_RGBA16I: return 16;
case GL_RGBA32I: return 32;
case GL_RGBA32UI: return 32;
case GL_R11F_G11F_B10F: return 10;
default:
UNREACHABLE(internalformat);
return 0;
}
}
GLuint GetDepthSize(GLint internalformat)
{
switch(internalformat)
{
case GL_STENCIL_INDEX8: return 0;
case GL_DEPTH_COMPONENT16: return 16;
case GL_DEPTH_COMPONENT24: return 24;
case GL_DEPTH_COMPONENT32_OES: return 32;
case GL_DEPTH_COMPONENT32F: return 32;
case GL_DEPTH24_STENCIL8: return 24;
case GL_DEPTH32F_STENCIL8: return 32;
default:
UNREACHABLE(internalformat);
return 0;
}
}
GLuint GetStencilSize(GLint internalformat)
{
switch(internalformat)
{
case GL_STENCIL_INDEX8: return 8;
case GL_DEPTH_COMPONENT16: return 0;
case GL_DEPTH_COMPONENT24: return 0;
case GL_DEPTH_COMPONENT32_OES: return 0;
case GL_DEPTH_COMPONENT32F: return 0;
case GL_DEPTH24_STENCIL8: return 8;
case GL_DEPTH32F_STENCIL8: return 8;
default:
UNREACHABLE(internalformat);
return 0;
}
}
GLenum GetColorComponentType(GLint internalformat)
{
switch(internalformat)
{
case GL_ALPHA8_EXT:
case GL_LUMINANCE8_ALPHA8_EXT:
case GL_LUMINANCE8_EXT:
case GL_R8:
case GL_RG8:
case GL_SRGB8_ALPHA8:
case GL_RGB10_A2:
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGB565:
case GL_RGB8:
case GL_RGBA8:
case GL_SRGB8:
return GL_UNSIGNED_NORMALIZED;
case GL_R8_SNORM:
case GL_RG8_SNORM:
case GL_RGB8_SNORM:
case GL_RGBA8_SNORM:
return GL_SIGNED_NORMALIZED;
case GL_R8UI:
case GL_R16UI:
case GL_R32UI:
case GL_RG8UI:
case GL_RG16UI:
case GL_RG32UI:
case GL_RGB8UI:
case GL_RGB16UI:
case GL_RGB32UI:
case GL_RGB10_A2UI:
case GL_RGBA16UI:
case GL_RGBA32UI:
case GL_RGBA8UI:
return GL_UNSIGNED_INT;
case GL_R8I:
case GL_R16I:
case GL_R32I:
case GL_RG8I:
case GL_RG16I:
case GL_RG32I:
case GL_RGB8I:
case GL_RGB16I:
case GL_RGB32I:
case GL_RGBA8I:
case GL_RGBA16I:
case GL_RGBA32I:
return GL_INT;
case GL_R16F:
case GL_RG16F:
case GL_R11F_G11F_B10F:
case GL_RGB16F:
case GL_RGBA16F:
case GL_R32F:
case GL_RG32F:
case GL_RGB32F:
case GL_RGBA32F:
case GL_RGB9_E5:
return GL_FLOAT;
default:
UNREACHABLE(internalformat);
return GL_NONE;
}
}
GLenum GetComponentType(GLint internalformat, GLenum attachment)
{
// Can be one of GL_FLOAT, GL_INT, GL_UNSIGNED_INT, GL_SIGNED_NORMALIZED, or GL_UNSIGNED_NORMALIZED
switch(attachment)
{
case GL_COLOR_ATTACHMENT0:
case GL_COLOR_ATTACHMENT1:
case GL_COLOR_ATTACHMENT2:
case GL_COLOR_ATTACHMENT3:
case GL_COLOR_ATTACHMENT4:
case GL_COLOR_ATTACHMENT5:
case GL_COLOR_ATTACHMENT6:
case GL_COLOR_ATTACHMENT7:
case GL_COLOR_ATTACHMENT8:
case GL_COLOR_ATTACHMENT9:
case GL_COLOR_ATTACHMENT10:
case GL_COLOR_ATTACHMENT11:
case GL_COLOR_ATTACHMENT12:
case GL_COLOR_ATTACHMENT13:
case GL_COLOR_ATTACHMENT14:
case GL_COLOR_ATTACHMENT15:
case GL_COLOR_ATTACHMENT16:
case GL_COLOR_ATTACHMENT17:
case GL_COLOR_ATTACHMENT18:
case GL_COLOR_ATTACHMENT19:
case GL_COLOR_ATTACHMENT20:
case GL_COLOR_ATTACHMENT21:
case GL_COLOR_ATTACHMENT22:
case GL_COLOR_ATTACHMENT23:
case GL_COLOR_ATTACHMENT24:
case GL_COLOR_ATTACHMENT25:
case GL_COLOR_ATTACHMENT26:
case GL_COLOR_ATTACHMENT27:
case GL_COLOR_ATTACHMENT28:
case GL_COLOR_ATTACHMENT29:
case GL_COLOR_ATTACHMENT30:
case GL_COLOR_ATTACHMENT31:
return GetColorComponentType(internalformat);
case GL_DEPTH_ATTACHMENT:
case GL_STENCIL_ATTACHMENT:
// Only color buffers may have integer components.
return GL_FLOAT;
default:
UNREACHABLE(attachment);
return GL_NONE;
}
}
bool IsNormalizedInteger(GLint internalformat)
{
GLenum type = GetColorComponentType(internalformat);
return type == GL_UNSIGNED_NORMALIZED || type == GL_SIGNED_NORMALIZED;
}
bool IsNonNormalizedInteger(GLint internalformat)
{
GLenum type = GetColorComponentType(internalformat);
return type == GL_UNSIGNED_INT || type == GL_INT;
}
bool IsFloatFormat(GLint internalformat)
{
return GetColorComponentType(internalformat) == GL_FLOAT;
}
bool IsSignedNonNormalizedInteger(GLint internalformat)
{
return GetColorComponentType(internalformat) == GL_INT;
}
bool IsUnsignedNonNormalizedInteger(GLint internalformat)
{
return GetColorComponentType(internalformat) == GL_UNSIGNED_INT;
}
std::string ParseUniformName(const std::string &name, unsigned int *outSubscript)
{
// Strip any trailing array operator and retrieve the subscript
......@@ -1678,9 +2048,9 @@ namespace es2sw
{
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGBA8_OES: return sw::FORMAT_A8B8G8R8;
case GL_RGBA8: return sw::FORMAT_A8B8G8R8;
case GL_RGB565: return sw::FORMAT_R5G6B5;
case GL_RGB8_OES: return sw::FORMAT_X8B8G8R8;
case GL_RGB8: return sw::FORMAT_X8B8G8R8;
case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT24:
case GL_STENCIL_INDEX8:
......@@ -1732,391 +2102,19 @@ namespace es2sw
namespace sw2es
{
unsigned int GetStencilSize(sw::Format stencilFormat)
{
switch(stencilFormat)
{
case sw::FORMAT_NULL:
return 0;
case sw::FORMAT_D24FS8:
case sw::FORMAT_D24S8:
case sw::FORMAT_D32FS8_TEXTURE:
case sw::FORMAT_D32FS8_SHADOW:
case sw::FORMAT_S8:
return 8;
// case sw::FORMAT_D24X4S4:
// return 4;
// case sw::FORMAT_D15S1:
// return 1;
// case sw::FORMAT_D16_LOCKABLE:
case sw::FORMAT_D32:
case sw::FORMAT_D24X8:
case sw::FORMAT_D32F_LOCKABLE:
case sw::FORMAT_D16:
return 0;
// case sw::FORMAT_D32_LOCKABLE: return 0;
// case sw::FORMAT_S8_LOCKABLE: return 8;
default:
UNREACHABLE(stencilFormat);
return 0;
}
}
unsigned int GetAlphaSize(sw::Format colorFormat)
{
switch(colorFormat)
{
case sw::FORMAT_NULL:
return 0;
case sw::FORMAT_A16B16G16R16F:
case sw::FORMAT_A16B16G16R16I:
case sw::FORMAT_A16B16G16R16UI:
return 16;
case sw::FORMAT_A32B32G32R32F:
case sw::FORMAT_A32B32G32R32I:
case sw::FORMAT_A32B32G32R32UI:
return 32;
case sw::FORMAT_A2R10G10B10:
return 2;
case sw::FORMAT_A8R8G8B8:
case sw::FORMAT_A8B8G8R8:
case sw::FORMAT_SRGB8_A8:
case sw::FORMAT_A8B8G8R8I:
case sw::FORMAT_A8B8G8R8UI:
case sw::FORMAT_A8B8G8R8I_SNORM:
return 8;
case sw::FORMAT_A2B10G10R10:
return 2;
case sw::FORMAT_A1R5G5B5:
return 1;
case sw::FORMAT_X8R8G8B8:
case sw::FORMAT_X8B8G8R8:
case sw::FORMAT_SRGB8_X8:
case sw::FORMAT_R5G6B5:
return 0;
default:
UNREACHABLE(colorFormat);
return 0;
}
}
unsigned int GetRedSize(sw::Format colorFormat)
{
switch(colorFormat)
{
case sw::FORMAT_NULL:
return 0;
case sw::FORMAT_R16F:
case sw::FORMAT_G16R16F:
case sw::FORMAT_B16G16R16F:
case sw::FORMAT_A16B16G16R16F:
case sw::FORMAT_R16I:
case sw::FORMAT_G16R16I:
case sw::FORMAT_X16B16G16R16I:
case sw::FORMAT_A16B16G16R16I:
case sw::FORMAT_R16UI:
case sw::FORMAT_G16R16UI:
case sw::FORMAT_X16B16G16R16UI:
case sw::FORMAT_A16B16G16R16UI:
return 16;
case sw::FORMAT_R32F:
case sw::FORMAT_G32R32F:
case sw::FORMAT_B32G32R32F:
case sw::FORMAT_X32B32G32R32F:
case sw::FORMAT_A32B32G32R32F:
case sw::FORMAT_R32I:
case sw::FORMAT_G32R32I:
case sw::FORMAT_X32B32G32R32I:
case sw::FORMAT_A32B32G32R32I:
case sw::FORMAT_R32UI:
case sw::FORMAT_G32R32UI:
case sw::FORMAT_X32B32G32R32UI:
case sw::FORMAT_A32B32G32R32UI:
return 32;
case sw::FORMAT_A2B10G10R10:
case sw::FORMAT_A2R10G10B10:
return 10;
case sw::FORMAT_A8R8G8B8:
case sw::FORMAT_A8B8G8R8:
case sw::FORMAT_X8R8G8B8:
case sw::FORMAT_X8B8G8R8:
case sw::FORMAT_SRGB8_A8:
case sw::FORMAT_SRGB8_X8:
case sw::FORMAT_R8:
case sw::FORMAT_G8R8:
case sw::FORMAT_R8I:
case sw::FORMAT_G8R8I:
case sw::FORMAT_X8B8G8R8I:
case sw::FORMAT_A8B8G8R8I:
case sw::FORMAT_R8UI:
case sw::FORMAT_G8R8UI:
case sw::FORMAT_X8B8G8R8UI:
case sw::FORMAT_A8B8G8R8UI:
case sw::FORMAT_R8I_SNORM:
case sw::FORMAT_G8R8I_SNORM:
case sw::FORMAT_X8B8G8R8I_SNORM:
case sw::FORMAT_A8B8G8R8I_SNORM:
return 8;
case sw::FORMAT_A1R5G5B5:
case sw::FORMAT_R5G6B5:
return 5;
default:
UNREACHABLE(colorFormat);
return 0;
}
}
unsigned int GetGreenSize(sw::Format colorFormat)
{
switch(colorFormat)
{
case sw::FORMAT_NULL:
return 0;
case sw::FORMAT_G16R16F:
case sw::FORMAT_B16G16R16F:
case sw::FORMAT_A16B16G16R16F:
case sw::FORMAT_G16R16I:
case sw::FORMAT_X16B16G16R16I:
case sw::FORMAT_A16B16G16R16I:
case sw::FORMAT_G16R16UI:
case sw::FORMAT_X16B16G16R16UI:
case sw::FORMAT_A16B16G16R16UI:
return 16;
case sw::FORMAT_G32R32F:
case sw::FORMAT_B32G32R32F:
case sw::FORMAT_X32B32G32R32F:
case sw::FORMAT_A32B32G32R32F:
case sw::FORMAT_G32R32I:
case sw::FORMAT_X32B32G32R32I:
case sw::FORMAT_A32B32G32R32I:
case sw::FORMAT_G32R32UI:
case sw::FORMAT_X32B32G32R32UI:
case sw::FORMAT_A32B32G32R32UI:
return 32;
case sw::FORMAT_A2B10G10R10:
case sw::FORMAT_A2R10G10B10:
return 10;
case sw::FORMAT_A8R8G8B8:
case sw::FORMAT_A8B8G8R8:
case sw::FORMAT_X8R8G8B8:
case sw::FORMAT_X8B8G8R8:
case sw::FORMAT_SRGB8_A8:
case sw::FORMAT_SRGB8_X8:
case sw::FORMAT_G8R8:
case sw::FORMAT_G8R8I:
case sw::FORMAT_X8B8G8R8I:
case sw::FORMAT_A8B8G8R8I:
case sw::FORMAT_G8R8UI:
case sw::FORMAT_X8B8G8R8UI:
case sw::FORMAT_A8B8G8R8UI:
case sw::FORMAT_G8R8I_SNORM:
case sw::FORMAT_X8B8G8R8I_SNORM:
case sw::FORMAT_A8B8G8R8I_SNORM:
return 8;
case sw::FORMAT_A1R5G5B5:
return 5;
case sw::FORMAT_R5G6B5:
return 6;
default:
UNREACHABLE(colorFormat);
return 0;
}
}
unsigned int GetBlueSize(sw::Format colorFormat)
{
switch(colorFormat)
{
case sw::FORMAT_NULL:
return 0;
case sw::FORMAT_B16G16R16F:
case sw::FORMAT_A16B16G16R16F:
case sw::FORMAT_X16B16G16R16I:
case sw::FORMAT_A16B16G16R16I:
case sw::FORMAT_X16B16G16R16UI:
case sw::FORMAT_A16B16G16R16UI:
return 16;
case sw::FORMAT_B32G32R32F:
case sw::FORMAT_X32B32G32R32F:
case sw::FORMAT_A32B32G32R32F:
case sw::FORMAT_X32B32G32R32I:
case sw::FORMAT_A32B32G32R32I:
case sw::FORMAT_X32B32G32R32UI:
case sw::FORMAT_A32B32G32R32UI:
return 32;
case sw::FORMAT_A2B10G10R10:
case sw::FORMAT_A2R10G10B10:
return 10;
case sw::FORMAT_A8R8G8B8:
case sw::FORMAT_A8B8G8R8:
case sw::FORMAT_X8R8G8B8:
case sw::FORMAT_X8B8G8R8:
case sw::FORMAT_SRGB8_A8:
case sw::FORMAT_SRGB8_X8:
case sw::FORMAT_X8B8G8R8I:
case sw::FORMAT_A8B8G8R8I:
case sw::FORMAT_X8B8G8R8UI:
case sw::FORMAT_A8B8G8R8UI:
case sw::FORMAT_X8B8G8R8I_SNORM:
case sw::FORMAT_A8B8G8R8I_SNORM:
return 8;
case sw::FORMAT_A1R5G5B5:
case sw::FORMAT_R5G6B5:
return 5;
default:
UNREACHABLE(colorFormat);
return 0;
}
}
unsigned int GetDepthSize(sw::Format depthFormat)
{
switch(depthFormat)
{
case sw::FORMAT_NULL: return 0;
// case sw::FORMAT_D16_LOCKABLE: return 16;
case sw::FORMAT_D32: return 32;
// case sw::FORMAT_D15S1: return 15;
case sw::FORMAT_D24S8: return 24;
case sw::FORMAT_D24X8: return 24;
// case sw::FORMAT_D24X4S4: return 24;
case sw::FORMAT_DF16S8:
case sw::FORMAT_D16: return 16;
case sw::FORMAT_D32F:
case sw::FORMAT_D32F_COMPLEMENTARY:
case sw::FORMAT_D32F_LOCKABLE: return 32;
case sw::FORMAT_DF24S8:
case sw::FORMAT_D24FS8: return 24;
// case sw::FORMAT_D32_LOCKABLE: return 32;
// case sw::FORMAT_S8_LOCKABLE: return 0;
case sw::FORMAT_D32FS8_SHADOW:
case sw::FORMAT_D32FS8_TEXTURE: return 32;
default:
UNREACHABLE(depthFormat);
return 0;
}
}
GLenum GetComponentType(sw::Format format, GLenum attachment)
{
// Can be one of GL_FLOAT, GL_INT, GL_UNSIGNED_INT, GL_SIGNED_NORMALIZED, or GL_UNSIGNED_NORMALIZED
switch(attachment)
{
case GL_COLOR_ATTACHMENT0:
case GL_COLOR_ATTACHMENT1:
case GL_COLOR_ATTACHMENT2:
case GL_COLOR_ATTACHMENT3:
case GL_COLOR_ATTACHMENT4:
case GL_COLOR_ATTACHMENT5:
case GL_COLOR_ATTACHMENT6:
case GL_COLOR_ATTACHMENT7:
case GL_COLOR_ATTACHMENT8:
case GL_COLOR_ATTACHMENT9:
case GL_COLOR_ATTACHMENT10:
case GL_COLOR_ATTACHMENT11:
case GL_COLOR_ATTACHMENT12:
case GL_COLOR_ATTACHMENT13:
case GL_COLOR_ATTACHMENT14:
case GL_COLOR_ATTACHMENT15:
case GL_COLOR_ATTACHMENT16:
case GL_COLOR_ATTACHMENT17:
case GL_COLOR_ATTACHMENT18:
case GL_COLOR_ATTACHMENT19:
case GL_COLOR_ATTACHMENT20:
case GL_COLOR_ATTACHMENT21:
case GL_COLOR_ATTACHMENT22:
case GL_COLOR_ATTACHMENT23:
case GL_COLOR_ATTACHMENT24:
case GL_COLOR_ATTACHMENT25:
case GL_COLOR_ATTACHMENT26:
case GL_COLOR_ATTACHMENT27:
case GL_COLOR_ATTACHMENT28:
case GL_COLOR_ATTACHMENT29:
case GL_COLOR_ATTACHMENT30:
case GL_COLOR_ATTACHMENT31:
switch(format)
{
case sw::FORMAT_R8I:
case sw::FORMAT_G8R8I:
case sw::FORMAT_X8B8G8R8I:
case sw::FORMAT_A8B8G8R8I:
case sw::FORMAT_R16I:
case sw::FORMAT_G16R16I:
case sw::FORMAT_X16B16G16R16I:
case sw::FORMAT_A16B16G16R16I:
case sw::FORMAT_R32I:
case sw::FORMAT_G32R32I:
case sw::FORMAT_X32B32G32R32I:
case sw::FORMAT_A32B32G32R32I:
return GL_INT;
case sw::FORMAT_R8UI:
case sw::FORMAT_G8R8UI:
case sw::FORMAT_X8B8G8R8UI:
case sw::FORMAT_A8B8G8R8UI:
case sw::FORMAT_R16UI:
case sw::FORMAT_G16R16UI:
case sw::FORMAT_X16B16G16R16UI:
case sw::FORMAT_A16B16G16R16UI:
case sw::FORMAT_R32UI:
case sw::FORMAT_G32R32UI:
case sw::FORMAT_X32B32G32R32UI:
case sw::FORMAT_A32B32G32R32UI:
return GL_UNSIGNED_INT;
case sw::FORMAT_R16F:
case sw::FORMAT_G16R16F:
case sw::FORMAT_B16G16R16F:
case sw::FORMAT_A16B16G16R16F:
case sw::FORMAT_R32F:
case sw::FORMAT_G32R32F:
case sw::FORMAT_B32G32R32F:
case sw::FORMAT_X32B32G32R32F:
case sw::FORMAT_A32B32G32R32F:
return GL_FLOAT;
case sw::FORMAT_R8:
case sw::FORMAT_G8R8:
case sw::FORMAT_A2B10G10R10:
case sw::FORMAT_A2R10G10B10:
case sw::FORMAT_A8R8G8B8:
case sw::FORMAT_A8B8G8R8:
case sw::FORMAT_X8R8G8B8:
case sw::FORMAT_X8B8G8R8:
case sw::FORMAT_SRGB8_A8:
case sw::FORMAT_SRGB8_X8:
case sw::FORMAT_A1R5G5B5:
case sw::FORMAT_R5G6B5:
return GL_UNSIGNED_NORMALIZED;
case sw::FORMAT_R8I_SNORM:
case sw::FORMAT_X8B8G8R8I_SNORM:
case sw::FORMAT_A8B8G8R8I_SNORM:
case sw::FORMAT_G8R8I_SNORM:
return GL_SIGNED_NORMALIZED;
default:
UNREACHABLE(format);
return GL_NONE;
}
case GL_DEPTH_ATTACHMENT:
case GL_STENCIL_ATTACHMENT:
// Only color buffers may have integer components.
return GL_FLOAT;
default:
UNREACHABLE(attachment);
return GL_NONE;
}
}
GLenum ConvertBackBufferFormat(sw::Format format)
{
switch(format)
{
case sw::FORMAT_A4R4G4B4: return GL_RGBA4;
case sw::FORMAT_A8R8G8B8: return GL_RGBA8_OES;
case sw::FORMAT_A8B8G8R8: return GL_RGBA8_OES;
case sw::FORMAT_A8R8G8B8: return GL_RGBA8;
case sw::FORMAT_A8B8G8R8: return GL_RGBA8;
case sw::FORMAT_A1R5G5B5: return GL_RGB5_A1;
case sw::FORMAT_R5G6B5: return GL_RGB565;
case sw::FORMAT_X8R8G8B8: return GL_RGB8_OES;
case sw::FORMAT_X8B8G8R8: return GL_RGB8_OES;
case sw::FORMAT_SRGB8_A8: return GL_RGBA8_OES;
case sw::FORMAT_SRGB8_X8: return GL_RGB8_OES;
case sw::FORMAT_X8R8G8B8: return GL_RGB8;
case sw::FORMAT_X8B8G8R8: return GL_RGB8;
case sw::FORMAT_SRGB8_A8: return GL_RGBA8;
case sw::FORMAT_SRGB8_X8: return GL_RGB8;
default:
UNREACHABLE(format);
}
......@@ -2149,4 +2147,4 @@ namespace sw2es
return GL_DEPTH24_STENCIL8_OES;
}
}
}
\ No newline at end of file
......@@ -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