wined3d: Check if formats support blending when attached to an FBO.

Remove the post-pixelshader blending flag if the format doesn't. Note that the
patch doesn't enforce this restriction yet, it only adjusts the reported
format capabilities.
This commit is contained in:
Henri Verbeet 2009-07-02 10:01:35 +02:00 committed by Alexandre Julliard
parent 6feb7c62ca
commit 670d9ad90b
1 changed files with 37 additions and 0 deletions

View File

@ -570,6 +570,7 @@ static void check_fbo_compat(const WineD3D_GL_Info *gl_info, struct GlPixelForma
ENTER_GL();
while(glGetError());
glDisable(GL_BLEND);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
@ -639,6 +640,42 @@ static void check_fbo_compat(const WineD3D_GL_Info *gl_info, struct GlPixelForma
}
}
if (status == GL_FRAMEBUFFER_COMPLETE_EXT && format_desc->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)
{
GLuint rb;
if (GL_SUPPORT(EXT_PACKED_DEPTH_STENCIL))
{
GL_EXTCALL(glGenRenderbuffersEXT(1, &rb));
GL_EXTCALL(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb));
GL_EXTCALL(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, 16, 16));
GL_EXTCALL(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb));
GL_EXTCALL(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb));
checkGLcall("RB attachment");
}
glEnable(GL_BLEND);
glClear(GL_COLOR_BUFFER_BIT);
if (glGetError() == GL_INVALID_FRAMEBUFFER_OPERATION_EXT)
{
while(glGetError());
TRACE("Format doesn't support post-pixelshader blending.\n");
format_desc->Flags &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
}
if (GL_SUPPORT(EXT_PACKED_DEPTH_STENCIL))
{
GL_EXTCALL(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, 0));
GL_EXTCALL(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, 0));
GL_EXTCALL(glDeleteRenderbuffersEXT(1, &rb));
checkGLcall("RB cleanup");
}
}
glDeleteTextures(1, &tex);
LEAVE_GL();