[Mesa-dev] [PATCH 2/3] hud: try L8 texture for font if I8 format isn't supported
Marek Olšák
maraeo at gmail.com
Mon Apr 1 18:13:12 PDT 2013
I use a simple texturing fragment shader and the equation "src*a +
dst*(1-a)" for blending.
Sorry A8 is probably wrong too, because the text would be black (it's
(0,0,0,A), not (1,1,1,A)). I'll write a patch to use swizzling in the
fragment shader instead.
Marek
On Tue, Apr 2, 2013 at 2:33 AM, Brian Paul <brianp at vmware.com> wrote:
> On 04/01/2013 06:18 PM, Marek Olšák wrote:
>
>> Have you checked the font is rendered correctly?
>>
>
> Yeah, it works fine.
>
>
>
> The font should be
>> transparent and the blend function reads the alpha channel to
>> determine the transparency, so A8 would be a better option. If that
>> isn't an option either, the fragment shader should do .xxxx swizzling.
>>
>
> Hmmm, I just tried A8 and it text is missing.
>
> I figured you were using a KIL-based fragment shader for the text as in
> the state tracker's glBitmap code.
>
> I'll look closer later...
>
> -Brian
>
>
>
>>
>> On Tue, Apr 2, 2013 at 12:46 AM, Brian Paul <brian.e.paul at gmail.com
>> <mailto:brian.e.paul at gmail.com**>> wrote:
>>
>> From: Brian Paul <brianp at vmware.com <mailto:brianp at vmware.com>>
>>
>>
>> ---
>> src/gallium/auxiliary/hud/**font.c | 17 +++++++++++++----
>> 1 file changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/hud/**font.c
>> b/src/gallium/auxiliary/hud/**font.c
>> index 5c4a4d0..6747874 100644
>> --- a/src/gallium/auxiliary/hud/**font.c
>> +++ b/src/gallium/auxiliary/hud/**font.c
>> @@ -377,17 +377,26 @@ util_font_create_fixed_8x13(**struct
>> pipe_context *pipe,
>> struct pipe_resource tex_templ, *tex;
>> struct pipe_transfer *transfer = NULL;
>> char *map;
>> + enum pipe_format tex_format;
>> int i;
>>
>> - if (!screen->is_format_supported(**screen, PIPE_FORMAT_I8_UNORM,
>> - PIPE_TEXTURE_RECT, 0,
>> - PIPE_BIND_SAMPLER_VIEW)) {
>> + if (screen->is_format_supported(**screen, PIPE_FORMAT_I8_UNORM,
>> + PIPE_TEXTURE_RECT, 0,
>> + PIPE_BIND_SAMPLER_VIEW)) {
>> + tex_format = PIPE_FORMAT_I8_UNORM;
>> + }
>> + else if (screen->is_format_supported(**screen,
>> PIPE_FORMAT_L8_UNORM,
>> + PIPE_TEXTURE_RECT, 0,
>> + PIPE_BIND_SAMPLER_VIEW)) {
>> + tex_format = PIPE_FORMAT_L8_UNORM;
>> + }
>> + else {
>> return FALSE;
>> }
>>
>> memset(&tex_templ, 0, sizeof(tex_templ));
>> tex_templ.target = PIPE_TEXTURE_RECT;
>> - tex_templ.format = PIPE_FORMAT_I8_UNORM;
>> + tex_templ.format = tex_format;
>> tex_templ.width0 = 128;
>> tex_templ.height0 = 256;
>> tex_templ.depth0 = 1;
>> --
>> 1.7.9.5
>>
>> ______________________________**_________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org <mailto:mesa-dev at lists.**
>> freedesktop.org <mesa-dev at lists.freedesktop.org>>
>> http://lists.freedesktop.org/**mailman/listinfo/mesa-dev<http://lists.freedesktop.org/mailman/listinfo/mesa-dev>
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/**mailman/listinfo/mesa-dev<http://lists.freedesktop.org/mailman/listinfo/mesa-dev>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130402/7afd3bac/attachment-0001.html>
More information about the mesa-dev
mailing list