[Mesa-dev] [PATCH] r600g: implement two-sided lighting

Roland Scheidegger sroland at vmware.com
Thu Jan 5 12:06:12 PST 2012


Am 05.01.2012 17:27, schrieb Alex Deucher:
> On Thu, Jan 5, 2012 at 11:10 AM, Andre Maasikas <amaasikas at gmail.com> wrote:
>> On Thu, Jan 5, 2012 at 4:58 PM, Marek Olšák <maraeo at gmail.com> wrote:
>>> On Thu, Jan 5, 2012 at 9:13 AM, Vadim Girlin <vadimgirlin at gmail.com> wrote:
>>>> Rendering in two-sided mode is performed in separate passes for front and
>>>> back faces, corresponding colors are selected by semantic ids.
>>>
>>> Are you sure that r600 cannot do two-sided color selection in
>>> hardware? I find it really surprising.
>>>
>> Not fully automatically afaik, but i guess one can load facing bit
>> (FRONT_FACE_ENA?)
>> into PS and from there on decide which color to use. This would however require
>> shader rewrite/modification
>>
> 
> I'll ask the hw guys.

I think it would make some sense if the hw didn't support this directly.
After all newer APIs always work like that (face register and
appropriate pixel shader).
If the hw can't do it I think shader modification is definitely the way
to go (and the svga driver does this). Maybe the state tracker could do
it (optionally of course) if several different hw is affected (or some
utility function somewhere). Though it might be some work to get it
right (I think for instance you can't have more than 2 color input regs
in the pixel shader, hence if you have both specular and diffuse
front/back colors some values need to be texcoords).

Roland


More information about the mesa-dev mailing list