[Mesa-dev] [PATCH v5 3/6] mesa/st: glsl_to_tgsi: add tests for the new temporary lifetime tracker
Gert Wollny
gw.fossdev at gmail.com
Tue Jun 27 12:10:53 UTC 2017
> > +TEST_F(LifetimeEvaluatorExactTest, SimpleMoveAddMoveTexoffset)
> > +{
> > + const vector<MockCodeline> code = {
> > + { TGSI_OPCODE_MOV, {1}, {in0}, {}},
> > + { TGSI_OPCODE_MOV, {2}, {in1}, {}},
> > + { TGSI_OPCODE_UADD, {out0}, {}, {1,2}},
>
> UADD doesn't have texoffsets.
The test just checks that src from textoffsets are picked up, but I
would appreciate if you could give me a well formed TGSI instruction
line that takes a texoffset, (I guess that TGSI_OPCODE_TEX would be the
opcode, but the TGSI documentation doesn't give a real example).
>
> Sorry to keep harping on this, but this is still incorrect.
> TGSI loops don't have an implied loop condition, so the only way to
> exit a loop is via BRK. The CONT here doesn't matter, the lifetime
> should be {4, 6}.
I'll change it, but at least I was not underestimating the lifetime.
>
> > +}
> > +
> > +/* Temporary used to switch must live through all case statememts
> > */
> > +TEST_F(LifetimeEvaluatorExactTest, UseSwitchCase)
> > +{
> > + const vector<MockCodeline> code = {
> > + {TGSI_OPCODE_MOV, {1}, {in0}, {}},
> > + {TGSI_OPCODE_SWITCH, {}, {1}, {}},
> > + { TGSI_OPCODE_CASE, {}, {1}, {}},
> > + { TGSI_OPCODE_CASE, {}, {1}, {}},
> > + { TGSI_OPCODE_BRK},
> > + { TGSI_OPCODE_DEFAULT},
> > + {TGSI_OPCODE_ENDSWITCH},
> > + { TGSI_OPCODE_END}
> > + };
> > + run (code, expectation({{-1,-1},{0, 3}}));
>
> So, SWITCH/CASE is a bit of an odd-ball, and I don't think we really
> use it, precisely because of how weird it is.
>
> I think the correct interpretation would be that all the sources on
> both the SWITCH and the corresponding CASE lines have a read access
> on the line of the switch statement.
>
> Please adjust the test accordingly (also, use different sources for
> the SWITCH and CASE statements!).
I've corrected this, to let src for SWITCH live through all case
statements (case and switch both take one argument). But you seem to be
right that the according switch code is actually emulated by IF chains
in the TGSI.
Best,
Gert
More information about the mesa-dev
mailing list