[Mesa-dev] Anti-aliasing problem using OSMesa

Cherniak, Bruce bruce.cherniak at intel.com
Mon Apr 24 17:03:55 UTC 2017


> 
> On Apr 24, 2017, at 10:16 AM, Brian Paul <brianp at vmware.com> wrote:
> 
> On 04/21/2017 12:25 AM, green we wrote:
>> I tried to use OSMesa to do offscreen rendering, refer to the osdemo and
>> the tutorial here: http://www.alecjacobson.com/weblog/?p=2827
>> There are obvious serrations on the edge of the model.
>>  I have tried these solution but all failed, can any one gieve me some
>> suggestions? the solution I have tried:
>> 1. Using post processing -- pp_jimenezmlaa
>> the result is not good enough.
>> 
>> 2. Try to using MSAA by FBO, but the multisamled fbo can't be created
>> correctly.
>>   Detail desctription here:
>> http://stackoverflow.com/questions/43532454/osmesa-gl-framebuffer-incomplete-attachment-error-when-create-a-multisampling-fb
> 
> I'm not 100% sure, but I think the Intel "swr" render works with OSMesa and supports MSAA.  That would be the only software driver that would possibly support AA FBOs.

Thanks Brian, you are correct, OpenSWR “swr” does support MSAA and OSMesa.  I haven't had opportunity to try them together yet, but this is a mode we will definitely support.  MSAA support is something that we added very recently and is available in both mesa-master and the 17.1 release branch.  It is disabled by default, but you can enable it by exporting “SWR_MSAA_MAX_COUNT=4” (1,2,4,8,16 are acceptable).

I’ll be happy to assist if you run into trouble.

>> 
>> 3. Try to modify the sampling function in mesa, according the thread:
>> https://sourceforge.net/p/mesa3d/mailman/message/24438334/ ,  set the
>> stop = 16 and add exit(__LINE__) in the function.
>> but it seems the function is not used anymore.
> 
> It's used, but only by the "legacy" swrast driver, not the llvmpipe, softpipe or swr drivers.  In any case glEnable(GL_POLYGON_SMOOTH) is not a great approach to AA.  And we don't support it with any gallium driver.
> 
> I suspect you're using either softpipe or llvmpipe.  You could try swr by setting GALLIUM_DRIVER=swr, if you build the swr driver.
> 
> -Brian
> 
>> 
>> The mesa swrast AA triangle code is in src/mesa/swrast/s_aatriangle.c
>> and s_aatritemp.h
>> The compute_coverage() functions (different versions for RGB vs. CI
>> mode) basically count how many sub-pixel samples lie inside the
>> triangle for each pixel.  A jittered 4x4 sample pattern is used.  You
>> could probably increase the number of samples to improve AA quality a
>> little.
>> -Brian
>> 
>> Thanks!
>> ------------------------------------------------------------------------
>> wegatron at hotmail.com
>> 
>> 
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list