bug 801986 - restore renderbuffer attachments on detach when necessary; r=bjacob

This commit is contained in:
Erick Dransch 2012-10-31 15:11:40 -04:00
Родитель 4ac48c6333
Коммит 8a0ed325e5
1 изменённых файлов: 26 добавлений и 6 удалений

Просмотреть файл

@ -2866,11 +2866,21 @@ public:
}
mContext->MakeContextCurrent();
WebGLuint renderbuffername = wrb ? wrb->GLName() : 0;
WebGLuint parambuffername = wrb ? wrb->GLName() : 0;
if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_DEPTH_ATTACHMENT, rbtarget, renderbuffername);
mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_STENCIL_ATTACHMENT, rbtarget, renderbuffername);
WebGLuint depthbuffername = parambuffername;
WebGLuint stencilbuffername = parambuffername;
if (!parambuffername){
depthbuffername = mDepthAttachment.Renderbuffer() ? mDepthAttachment.Renderbuffer()->GLName() : 0;
stencilbuffername = mStencilAttachment.Renderbuffer() ? mStencilAttachment.Renderbuffer()->GLName() : 0;
}
mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_DEPTH_ATTACHMENT, rbtarget, depthbuffername);
mContext->gl->fFramebufferRenderbuffer(target, LOCAL_GL_STENCIL_ATTACHMENT, rbtarget, stencilbuffername);
} else {
WebGLuint renderbuffername = parambuffername;
if(!parambuffername && (attachment == LOCAL_GL_DEPTH_ATTACHMENT || attachment == LOCAL_GL_STENCIL_ATTACHMENT)){
renderbuffername = mDepthStencilAttachment.Renderbuffer() ? mDepthStencilAttachment.Renderbuffer()->GLName() : 0;
}
mContext->gl->fFramebufferRenderbuffer(target, attachment, rbtarget, renderbuffername);
}
}
@ -2918,11 +2928,21 @@ public:
}
mContext->MakeContextCurrent();
WebGLuint texturename = wtex ? wtex->GLName() : 0;
WebGLuint paramtexturename = wtex ? wtex->GLName() : 0;
if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_DEPTH_ATTACHMENT, textarget, texturename, level);
mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_STENCIL_ATTACHMENT, textarget, texturename, level);
WebGLuint depthtexturename = paramtexturename;
WebGLuint stenciltexturename = paramtexturename;
if(!paramtexturename){
depthtexturename = mDepthAttachment.Texture() ? mDepthAttachment.Texture()->GLName() : 0;
stenciltexturename = mStencilAttachment.Texture() ? mStencilAttachment.Texture()->GLName() : 0;
}
mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_DEPTH_ATTACHMENT, textarget, depthtexturename, level);
mContext->gl->fFramebufferTexture2D(target, LOCAL_GL_STENCIL_ATTACHMENT, textarget, stenciltexturename, level);
} else {
WebGLuint texturename = paramtexturename;
if(!paramtexturename && (attachment == LOCAL_GL_DEPTH_ATTACHMENT || attachment == LOCAL_GL_STENCIL_ATTACHMENT)){
texturename = mDepthStencilAttachment.Texture() ? mDepthStencilAttachment.Texture()->GLName() : 0;
}
mContext->gl->fFramebufferTexture2D(target, attachment, textarget, texturename, level);
}