On 18 April 2013 21:19, Matteo Bruni mbruni@codeweavers.com wrote:
if (!format->glInternal) continue;
gl_info->gl_ops.ext.p_glGetInternalformativ(GL_TEXTURE_2D, format->glInternal,
GL_FRAMEBUFFER_RENDERABLE, 1, &value);
if (value == GL_FULL_SUPPORT)
{
TRACE("Format %s is supported as FBO color attachment.\n", debug_d3dformat(format->id));
format->flags |= WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FBO_ATTACHABLE;
format->rtInternal = format->glInternal;
if (!(format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
query_format_flag(gl_info, format, format->glInternal, GL_FRAMEBUFFER_BLEND,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING, "post-pixelshader blending");
}
This may be a bit dangerous, since you're now potentially adding WINED3DFMT_FLAG_RENDERTARGET for formats like e.g. WINED3DFMT_R8G8B8A8_SNORM that didn't previously had it, and where it's a bit questionable if it's really going to work as intended. Also, the depth/stencil check that follows is either redundant, or we're now also potentially setting WINED3DFMT_FLAG_RENDERTARGET for depth/stencil formats. At least initially we'll probably want to stick with formats that already have WINED3DFMT_FLAG_RENDERTARGET set, and only clear it if unsupported. At a later point we may want to do something more centered around the information we get from internalformat_query2, but I suspect it will be a bit harder than just checking if there's no fixup, no conversion function, etc.
Hrm, I sent the wrong version of the patch, I had actually moved the depth/stencil check earlier (so yeah, totally agree on that part). Also you're right about WINED3DFMT_FLAG_RENDERTARGET, for some reason I thought we were setting that in check_fbo_compat() but it's clearly not the case.
I'm sending the updated patches in a bit (also dropping patches 5-7 since they are superseded by yours).