[Mesa-dev] [PATCH 2/2] st/mesa: try PIPE_BIND_RENDER_TARGET when choosing float texture formats

Roland Scheidegger sroland at vmware.com
Wed Sep 30 19:22:42 PDT 2015


Am 01.10.2015 um 02:08 schrieb Erik Faye-Lund:
> On Tue, Sep 29, 2015 at 7:50 PM, Brian Paul <brianp at vmware.com> wrote:
>>
>> I was actually thinking of expanding this change to cover _all_ color formats but wanted to take a small step first.  What do you think?
>>
> 
> I have some patches in this area sitting around here:
> 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kusma_mesa_commits_color-5Frenderable-5Ffix&d=BQIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=JJfAoybLwtKPe5g_lGrb_1yJNsBrPGags6fvOHUfCYI&s=HXZB_aCqV7WMqIZK30XrbaPj_cgI3RsA15Uk2UlDbkA&e= 
> 
> In particular:
> 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kusma_mesa_commit_4b72b20dc80a79133c037c7c68413034b228bf66&d=BQIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=JJfAoybLwtKPe5g_lGrb_1yJNsBrPGags6fvOHUfCYI&s=4zmifuFepRbmCBk_aMomjHW4Ir1lgLK5FsLG_h3oks8&e= 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kusma_mesa_commit_ac5f4575bd11c817c03e7dbc5939f5c0d952d3f1&d=BQIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=JJfAoybLwtKPe5g_lGrb_1yJNsBrPGags6fvOHUfCYI&s=7gkVB73TMEiR6NcQWISkxfeQ0yhe9Kamf1HG6guU5Pk&e= 
> 
> The first one needs fixing up by using _mesa_base_tex_format instead
> of adding it's own implementation.

I'm not quite convinced. In my opinion, if an app asks explicitly for
some weird format (say, even not totally weird, like r4g4b4a4) for a
texture, and then really wants to render to it, it is quite well
prepared for failing fbo completeness tests. It would be unreasonable to
promote such requests to rgba8 just for this. The same applies for
anything luminance/intensity/alpha/la imho - again, just blowing up the
texture by a size of 4 for the (very unlikely) case it may get rendered
to doesn't sound like a good idea, the app really should be prepared for
this (and try with some rgb format on its own if it really wants to
render into) - there was lots of hw which couldn't do that when fbos
were new.
(Albeit I only glanced over the patches at least that's what I think
will happen.)

Roland

> 
>> On 09/29/2015 11:46 AM, Roland Scheidegger wrote:
>>>
>>> If that was due to some rgb vs. rgbx thing (that is, could texture from
>>> rgb but only render to rgbx) I wonder if the same logic shouldn't also
>>> apply to the integer formats.
>>> But either way (I guess the app should check fbo completeness in any
>>> case so strictly speaking for correctness this isn't really required)
>>>
>>> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
>>>
>>> Am 29.09.2015 um 17:39 schrieb Brian Paul:
>>>>
>>>> For 8-bit RGB(A) texture formats we set the PIPE_BIND_RENDER_TARGET flag
>>>> to try to get a hardware format which also supports rendering (for FBO
>>>> textures).  Do the same thing for floating point formats.
>>>>
>>>> This allows the Redway Flat demo to run.
>>>> ---
>>>>   src/mesa/state_tracker/st_format.c | 6 +++++-
>>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
>>>> index 0c94428..144b7d6 100644
>>>> --- a/src/mesa/state_tracker/st_format.c
>>>> +++ b/src/mesa/state_tracker/st_format.c
>>>> @@ -1963,7 +1963,11 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
>>>>      else if (internalFormat == 3 || internalFormat == 4 ||
>>>>               internalFormat == GL_RGB || internalFormat == GL_RGBA ||
>>>>               internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
>>>> -            internalFormat == GL_BGRA)
>>>> +            internalFormat == GL_BGRA ||
>>>> +            internalFormat == GL_RGB16F ||
>>>> +            internalFormat == GL_RGBA16F ||
>>>> +            internalFormat == GL_RGB32F ||
>>>> +            internalFormat == GL_RGBA32F)
>>>>          bindings |= PIPE_BIND_RENDER_TARGET;
>>>>
>>>>      /* GLES allows the driver to choose any format which matches
>>>>
>>>
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=JJfAoybLwtKPe5g_lGrb_1yJNsBrPGags6fvOHUfCYI&s=L2cZ3ni2GN1tmEwoe0oe-9PxF84DxQndOki2ZEaUZC8&e= 



More information about the mesa-dev mailing list