On Tuesday, December 29, 2015 6:42:58 PM PST Marek Olšák wrote:
> On Mon, Dec 28, 2015 at 11:28 PM, Kenneth Graunke <kenn...@whitecape.org> 
wrote:
> > Unigine Heaven 4.0 and Valley 1.0 use dual color blending but don't
> > specify which fragment shader output is which, so there's at best a
> > 50/50 chance of us guessing it correctly.  This is invalid.
> > 
> > Unigine fixed this in 4.1 and 1.1 versions over a year and a half ago,
> > but hasn't actually released them for whatever reason.  So, add the
> > workaround back so that it works for most people.
> > 
> > Fixes Heaven 4.0/Valley 1.0 rendering on Ivybridge.  For whatever
> > reason, Broadwell worked.  4.1 and 1.1 have always worked.
> > 
> > Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92233
> > Cc: mesa-sta...@lists.freedesktop.org
> > Cc: Marek Olšák <marek.ol...@amd.com>
> 
> Hi Ken,
> 
> We've never had a problem with this in gallium, but if it's just luck,
> I suppose it's okay to add the workaround.
> 
> In Gallium, the second color output is the same as gl_FragData[1], so
> it doesn't matter how the location is specified as long as it's clear
> which output goes second.
> 
> How difficult is it to be unlucky here? Does it depend on IR node ordering?
> 
> Reviewed-by: Marek Olšák <marek.ol...@amd.com>
> 
> Marek

Their shader has two ordinary user-defined outputs:

   out vec4 s_frag_data_0;
   out vec4 s_frag_data_1;

But they don't call glFragDataLocationIndexed() to define which output
variable is color 0 and which is color 1.  Nor do they use a layout
qualifier.  So, both variables end up with var->data.index == 0.
Which means they've told us both outputs are SRC0, and there isn't a SRC1.

We could guess based on the variable ordering - s_frag_data_0 happens
to be first (unless we reorder the IR nodes for some reason).  Or, we
could guess based on the variable names.

It's been 2.5 years since I first debugged this, so I don't recall
what the location field was set to.  If they set it to N and N + 1,
we could assume that they meant color index 0/1 based on that.  If it's
the same, we're out of luck.  (In GL, location is *supposed* to mean
the render target index, because you can in theory do MRT and dual
source blending together.  But, nobody's hardware does, AFAIK.)

--Ken

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to