[Mesa-dev] [PATCH] st/mesa: set the new pipe_surface::alpha_one field for RGB surfaces
Brian Paul
brianp at vmware.com
Tue Jun 28 16:37:14 UTC 2016
As I wrote in my other message yesterday, I was going to disable support
in our VMware driver for the RGBX8 formats because of difficulties with
ARB_copy_image functionality. This led to the issue of blending to RGBA
surfaces as if they were RGBX.
I guess we could set pipe_surface::format = RGBX for this case. Though
this would probably lead to some special-case code in the driver(s) (but
probably comparable to what I had done for 'alpha_one'.)
The issue is when a driver says it can't support RGBX formats, it would
still need to be prepared to handle some of those formats in the
pipe_surface::format field. As it is now, when a driver says it can't
support a particular format, it really means it and is probably
unprepared to see it anywhere. So, if we set pipe_surface::format =
RGBX in the state tracker, there's some regression risk across all
drivers. The flag I proposed wouldn't have that risk.
Anyway, I think I've found work-arounds in our driver to keep RGBX
support so that this patch isn't needed after all. I just have to
finish more piglit testing.
-Brian
On 06/28/2016 09:11 AM, Marek Olšák wrote:
> I guess you need this because your driver doesn't support LUMINANCE
> and st/mesa selects RGBA, right? In that case, you can just set RGBX
> in pipe_surface::format and you don't need another flag.
>
> It would be better to select RGBX at renderbuffer creation, but doing
> it later is fine as well.
>
> Marek
>
> On Fri, Jun 24, 2016 at 4:43 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.
>>
>> v2: also check for R, RG, LUMINANCE surfaces, per Ilia
>> ---
>> src/mesa/state_tracker/st_cb_fbo.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
>> index 9801b1f..843ff83 100644
>> --- a/src/mesa/state_tracker/st_cb_fbo.c
>> +++ b/src/mesa/state_tracker/st_cb_fbo.c
>> @@ -216,6 +216,11 @@ 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->Base._BaseFormat == GL_RG ||
>> + strb->Base._BaseFormat == GL_R ||
>> + strb->Base._BaseFormat == GL_LUMINANCE);
>> +
>> strb->surface = pipe->create_surface(pipe,
>> strb->texture,
>> &surf_tmpl);
>> @@ -463,6 +468,10 @@ 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 ||
>> + strb->Base._BaseFormat == GL_RG ||
>> + strb->Base._BaseFormat == GL_R ||
>> + strb->Base._BaseFormat == GL_LUMINANCE);
>> 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=aRQY4-PdtA1sKl095cbVP0IOaCsr4WAgTK9bl_Loek0&s=vyrVquTCLd-SUurntQWZk5fNrQUvyVGdEzFB8q5kQ_k&e=
More information about the mesa-dev
mailing list