Implements GetFramebufferAttachmentParameteriv

TRAC #11876 Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@190 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 916ffaa9
......@@ -159,6 +159,36 @@ Stencilbuffer *Framebuffer::getStencilbuffer()
return NULL;
}
GLenum Framebuffer::getColorbufferType()
{
return mColorbufferType;
}
GLenum Framebuffer::getDepthbufferType()
{
return mDepthbufferType;
}
GLenum Framebuffer::getStencilbufferType()
{
return mStencilbufferType;
}
GLuint Framebuffer::getColorbufferHandle()
{
return mColorbufferHandle;
}
GLuint Framebuffer::getDepthbufferHandle()
{
return mDepthbufferHandle;
}
GLuint Framebuffer::getStencilbufferHandle()
{
return mStencilbufferHandle;
}
GLenum Framebuffer::completeness()
{
gl::Context *context = gl::getContext();
......
......@@ -43,6 +43,14 @@ class Framebuffer
Depthbuffer *getDepthbuffer();
Stencilbuffer *getStencilbuffer();
GLenum getColorbufferType();
GLenum getDepthbufferType();
GLenum getStencilbufferType();
GLuint getColorbufferHandle();
GLuint getDepthbufferHandle();
GLuint getStencilbufferHandle();
GLenum completeness();
private:
......
......@@ -2238,7 +2238,86 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
return error(GL_INVALID_OPERATION);
}
UNIMPLEMENTED(); // FIXME
if (target != GL_FRAMEBUFFER)
{
return error(GL_INVALID_ENUM);
}
GLenum attachmentType;
GLuint attachmentHandle;
switch (attachment)
{
case GL_COLOR_ATTACHMENT0:
attachmentType = context->getFramebuffer()->getColorbufferType();
attachmentHandle = context->getFramebuffer()->getColorbufferHandle();
break;
case GL_DEPTH_ATTACHMENT:
attachmentType = context->getFramebuffer()->getDepthbufferType();
attachmentHandle = context->getFramebuffer()->getDepthbufferHandle();
break;
case GL_STENCIL_ATTACHMENT:
attachmentType = context->getFramebuffer()->getStencilbufferType();
attachmentHandle = context->getFramebuffer()->getStencilbufferHandle();
break;
default: return error(GL_INVALID_ENUM);
}
GLenum attachmentObjectType; // Type category
if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
{
attachmentObjectType = attachmentType;
}
else if (attachmentType == GL_TEXTURE_2D || es2dx::IsCubemapTextureTarget(attachmentType))
{
attachmentObjectType = GL_TEXTURE;
}
else UNREACHABLE();
switch (pname)
{
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
*params = attachmentObjectType;
break;
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
if (attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE)
{
*params = attachmentHandle;
}
else
{
return error(GL_INVALID_ENUM);
}
break;
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
if (attachmentObjectType == GL_TEXTURE)
{
*params = 0; // FramebufferTexture2D will not allow level to be set to anything else in GL ES 2.0
}
else
{
return error(GL_INVALID_ENUM);
}
break;
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
if (attachmentObjectType == GL_TEXTURE)
{
if (es2dx::IsCubemapTextureTarget(attachmentType))
{
*params = attachmentType;
}
else
{
*params = 0;
}
}
else
{
return error(GL_INVALID_ENUM);
}
break;
default:
return error(GL_INVALID_ENUM);
}
}
}
catch(std::bad_alloc&)
......
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