On 18 April 2013 21:19, Matteo Bruni <mbruni(a)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.