Removes D3D format usage from framebuffer completeness check.

TRAC #21609 Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@1303 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent d4211110
......@@ -303,7 +303,6 @@ GLenum Framebuffer::completeness()
{
GLint internalformat = colorbuffer->getInternalFormat();
GLenum format = gl::ExtractFormat(internalformat);
D3DFORMAT d3dformat = colorbuffer->getD3DFormat();
if (IsCompressed(format) ||
format == GL_ALPHA ||
......@@ -313,13 +312,13 @@ GLenum Framebuffer::completeness()
return GL_FRAMEBUFFER_UNSUPPORTED;
}
if ((dx2es::IsFloat32Format(d3dformat) && !context->supportsFloat32RenderableTextures()) ||
(dx2es::IsFloat16Format(d3dformat) && !context->supportsFloat16RenderableTextures()))
if ((gl::IsFloat32Format(internalformat) && !context->supportsFloat32RenderableTextures()) ||
(gl::IsFloat16Format(internalformat) && !context->supportsFloat16RenderableTextures()))
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
if (dx2es::IsDepthTextureFormat(d3dformat) || dx2es::IsStencilTextureFormat(d3dformat))
if (gl::IsDepthTexture(internalformat) || gl::IsStencilTexture(internalformat))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -362,7 +361,7 @@ GLenum Framebuffer::completeness()
}
else if (IsInternalTextureTarget(mDepthbufferType))
{
D3DFORMAT d3dformat = depthbuffer->getD3DFormat();
GLint internalformat = depthbuffer->getInternalFormat();
// depth texture attachments require OES/ANGLE_depth_texture
if (!context->supportsDepthTextures())
......@@ -370,7 +369,7 @@ GLenum Framebuffer::completeness()
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
if (!dx2es::IsDepthTextureFormat(d3dformat))
if (!gl::IsDepthTexture(internalformat))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -421,7 +420,7 @@ GLenum Framebuffer::completeness()
}
else if (IsInternalTextureTarget(mStencilbufferType))
{
D3DFORMAT d3dformat = stencilbuffer->getD3DFormat();
GLint internalformat = stencilbuffer->getInternalFormat();
// texture stencil attachments come along as part
// of OES_packed_depth_stencil + OES/ANGLE_depth_texture
......@@ -430,7 +429,7 @@ GLenum Framebuffer::completeness()
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
if (!dx2es::IsStencilTextureFormat(d3dformat))
if (!gl::IsStencilTexture(internalformat))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......
......@@ -288,6 +288,17 @@ bool IsDepthTexture(GLenum format)
return false;
}
bool IsStencilTexture(GLenum format)
{
if (format == GL_DEPTH_STENCIL_OES ||
format == GL_DEPTH24_STENCIL8_OES)
{
return true;
}
return false;
}
// Returns the size, in bytes, of a single texel in an Image
int ComputePixelSize(GLint internalformat)
{
......@@ -550,6 +561,36 @@ bool IsStencilRenderable(GLenum internalformat)
return false;
}
bool IsFloat32Format(GLint internalformat)
{
switch (internalformat)
{
case GL_RGBA32F_EXT:
case GL_RGB32F_EXT:
case GL_ALPHA32F_EXT:
case GL_LUMINANCE32F_EXT:
case GL_LUMINANCE_ALPHA32F_EXT:
return true;
default:
return false;
}
}
bool IsFloat16Format(GLint internalformat)
{
switch (internalformat)
{
case GL_RGBA16F_EXT:
case GL_RGB16F_EXT:
case GL_ALPHA16F_EXT:
case GL_LUMINANCE16F_EXT:
case GL_LUMINANCE_ALPHA16F_EXT:
return true;
default:
return false;
}
}
}
namespace es2dx
......@@ -982,60 +1023,6 @@ unsigned int GetDepthSize(D3DFORMAT depthFormat)
}
}
bool IsFloat32Format(D3DFORMAT surfaceFormat)
{
switch(surfaceFormat)
{
case D3DFMT_R16F:
case D3DFMT_G16R16F:
case D3DFMT_A16B16G16R16F:
return false;
case D3DFMT_R32F:
case D3DFMT_G32R32F:
case D3DFMT_A32B32G32R32F:
return true;
case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_A1R5G5B5:
case D3DFMT_R5G6B5:
return false;
default: UNREACHABLE();
}
return false;
}
bool IsFloat16Format(D3DFORMAT surfaceFormat)
{
switch(surfaceFormat)
{
case D3DFMT_R16F:
case D3DFMT_G16R16F:
case D3DFMT_A16B16G16R16F:
return true;
case D3DFMT_R32F:
case D3DFMT_G32R32F:
case D3DFMT_A32B32G32R32F:
return false;
case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_A1R5G5B5:
case D3DFMT_R5G6B5:
return false;
default: UNREACHABLE();
}
return false;
}
bool IsDepthTextureFormat(D3DFORMAT surfaceFormat)
{
return (surfaceFormat == D3DFMT_INTZ);
}
bool IsStencilTextureFormat(D3DFORMAT surfaceFormat)
{
return (surfaceFormat == D3DFMT_INTZ);
}
bool IsCompressedD3DFormat(D3DFORMAT surfaceFormat)
{
switch(surfaceFormat)
......
......@@ -40,6 +40,7 @@ GLsizei ComputeCompressedPitch(GLsizei width, GLenum format);
GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format);
bool IsCompressed(GLenum format);
bool IsDepthTexture(GLenum format);
bool IsStencilTexture(GLenum format);
bool IsCubemapTextureTarget(GLenum target);
bool IsInternalTextureTarget(GLenum target);
GLint ConvertSizedInternalFormat(GLenum format, GLenum type);
......@@ -50,6 +51,8 @@ bool IsColorRenderable(GLenum internalformat);
bool IsDepthRenderable(GLenum internalformat);
bool IsStencilRenderable(GLenum internalformat);
bool IsFloat32Format(GLint internalformat);
bool IsFloat16Format(GLint internalformat);
}
namespace es2dx
......@@ -81,10 +84,6 @@ GLuint GetGreenSize(D3DFORMAT colorFormat);
GLuint GetBlueSize(D3DFORMAT colorFormat);
GLuint GetDepthSize(D3DFORMAT depthFormat);
GLuint GetStencilSize(D3DFORMAT stencilFormat);
bool IsFloat32Format(D3DFORMAT surfaceFormat);
bool IsFloat16Format(D3DFORMAT surfaceFormat);
bool IsDepthTextureFormat(D3DFORMAT surfaceFormat);
bool IsStencilTextureFormat(D3DFORMAT surfaceFormat);
bool IsCompressedD3DFormat(D3DFORMAT format);
GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE 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