[Mesa-dev] [PATCH 2/4] st/mesa: set the new pipe_surface::alpha_one field for RGB surfaces

Ilia Mirkin imirkin at alum.mit.edu
Fri Jun 24 14:35:39 UTC 2016


On Fri, Jun 24, 2016 at 10:33 AM, Brian Paul <brianp at vmware.com> wrote:
> On 06/23/2016 08:14 PM, Ilia Mirkin wrote:
>>
>> Isn't this true for any-non-alpha-having format? I.e. _BaseFormat !=
>> GL_RGBA && _BaseFormat != GL_ALPHA && _BaseFormat !=
>> GL_LUMINANCE_ALPHA && _BaseFormat != GL_INTENSITY? (Not sure about
>> that last one tbh.)
>
>
> One would also have to check for GL_DEPTH, GL_STENCIL, etc.
>
> I could do this:
>
> surf_tmpl.alpha_one = (strb->Base._BaseFormat == GL_RGB ||
>                        strb->Base._BaseFormat == GL_LUMINANCE);
>
> OK?

And GL_R and GL_RG. With that, OK by me.

>
> -Brian
>
>
>>
>> On Thu, Jun 23, 2016 at 10:07 PM, Brian Paul <brianp at vmware.com> wrote:
>>>
>>> This indicates the alpha channel of the surface should always be one.
>>> Drivers can use this to adjust blending terms when needed.
>>> ---
>>>   src/mesa/state_tracker/st_cb_fbo.c | 3 +++
>>>   1 file changed, 3 insertions(+)
>>>
>>> diff --git a/src/mesa/state_tracker/st_cb_fbo.c
>>> b/src/mesa/state_tracker/st_cb_fbo.c
>>> index 9801b1f..012d7d7 100644
>>> --- a/src/mesa/state_tracker/st_cb_fbo.c
>>> +++ b/src/mesa/state_tracker/st_cb_fbo.c
>>> @@ -216,6 +216,8 @@ st_renderbuffer_alloc_storage(struct gl_context *
>>> ctx,
>>>         return FALSE;
>>>
>>>      u_surface_default_template(&surf_tmpl, strb->texture);
>>> +   surf_tmpl.alpha_one = (strb->Base._BaseFormat == GL_RGB);
>>> +
>>>      strb->surface = pipe->create_surface(pipe,
>>>                                           strb->texture,
>>>                                           &surf_tmpl);
>>> @@ -463,6 +465,7 @@ st_update_renderbuffer_surface(struct st_context *st,
>>>         /* create a new pipe_surface */
>>>         struct pipe_surface surf_tmpl;
>>>         memset(&surf_tmpl, 0, sizeof(surf_tmpl));
>>> +      surf_tmpl.alpha_one = (strb->Base._BaseFormat == GL_RGB);
>>>         surf_tmpl.format = format;
>>>         surf_tmpl.u.tex.level = level;
>>>         surf_tmpl.u.tex.first_layer = first_layer;
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=CwIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=kvdVcRjAk7qsXocZK-F6PElHKQOO3yCLrLjh399YZ9I&s=dNrJyXuvhm5nyV0jB0u87Qx4SVms6il0A0Iun_oo56Y&e=
>
>


More information about the mesa-dev mailing list