Commit graph

8509 commits

Author SHA1 Message Date
Bill Currie
52ab4f64f9 Add code for loading vertex colors.
And correct an oopsie in bledweights.
2012-05-15 21:08:44 +09:00
Bill Currie
724427a976 Add component-wise vector and quaternion division.
Mostly for non-uniform scaling.
2012-05-15 21:08:44 +09:00
Bill Currie
215d2e9747 Add a function to decompose a matrix.
The function gives rotation(quaternion), scale, shear, and translation (all
three as vectors), shear is (XY, XZ, YZ).
2012-05-15 21:08:44 +09:00
Bill Currie
1be9384f10 Load the iqm vertex and triangle data.
Still have the meshes, joints and animations to go.
2012-05-15 21:08:43 +09:00
Bill Currie
890223ef8e Correct the definition of DualQuatNorm.
I'd gotten the norm and magnitude mixed up (partly because the document I
was following got the names mixed up), and then munged the formulas
together.
2012-05-15 21:08:43 +09:00
Bill Currie
8aabb704d2 Add tests for inverting a dual quad transform. 2012-05-15 21:08:43 +09:00
Bill Currie
f874aeb941 Add support for duals and dual quaternions.
Not everything is unit-tested, but the currently important stuff is.
2012-05-15 21:08:43 +09:00
Bill Currie
3b938592c3 Dump some gl limits. 2012-05-15 21:08:43 +09:00
Bill Currie
26a878da48 Stub out the iqm loader. 2012-05-15 21:08:43 +09:00
Bill Currie
e6c0512f31 Ensure dstring has space for terminating 0.
It seems (some versions of) windows vsnprintf don't count the terminating 0
when limiting the number of chars written to the buffer. Nor do they
guarantee the output string will be terminated.
2012-05-10 14:48:43 +09:00
Bill Currie
0036a5e113 Ensure edict_size is never 0.
Avoids division by / in NUM_FOR_EDICT
2012-05-06 21:35:42 +09:00
Bill Currie
1dd5cccda2 Correct some more error messages. 2012-05-06 18:52:05 +09:00
Bill Currie
a0788c6cdf Implement constant folding for unary operators.
Including conversions between float and int :)
2012-05-06 18:49:07 +09:00
Bill Currie
f781e9078c Correct some typos in error messages. 2012-05-06 18:43:18 +09:00
Bill Currie
954e03c3f7 Report the correct function name for the largest locals.
I must have been tired when I adapted that code.

* taniwha dons brown paper bag
2012-05-06 13:02:11 +09:00
Bill Currie
95a06c20b2 Move qfcc's libs and headers to ${prefix}/share
On discussion with Despair, share makes more sense than lib as they are
really cross-platform (though qfcc itself is not).
2012-05-05 19:34:35 +09:00
Bill Currie
9b07f9adcd Change the default renderer to gl.
Until glsl starts looking good, anyway.
2012-05-05 18:39:25 +09:00
Bill Currie
55ecf94f2d Don't draw arrows leaving return statements.
Return statements never flow to the next block (or any other block, for
that matter), so drawing arrows leaving them not only messes up dot's
graphs, but is quite missleading.
2012-05-05 18:04:10 +09:00
Bill Currie
099d9ec3f2 Move the increment of order out of the loop.
I don't know what gcc's optimizations would do with it, but it seems quite
reasonable to pull the code out of the loop by hand.
2012-05-05 18:01:00 +09:00
Bill Currie
cf5c9f067f Make GL_DrawAliasShadow const correct.
Despair's having troubles with segfaults that I can't reproduce. If it's a
strict aliasing problem, this might help.
2012-05-05 17:55:30 +09:00
Bill Currie
56410ddc58 Prevent merged if/goto losing its way.
When mering if/goto (ie, if skipping a goto), the rest of the dead code
remover is used to delete the goto. That part of the code unuses the goto's
label. The if was getting the goto's label without the lable's used count
being incremented (the usaged temporarily increases by one). I have no idea
why the problem showed up randomly, but this seems to fix it (it fixes /a/
bug, anyway).
2012-05-04 22:35:20 +09:00
Bill Currie
953e789db2 Handle movement of the final block.
Moving a final block caused segfaults and weird flow graph corruptions.
2012-05-04 19:48:32 +09:00
Bill Currie
e8c17c68e6 Fix a segfault when the switch expression errors. 2012-05-04 18:13:11 +09:00
Bill Currie
5df25133b3 Implement code movement for unconditional jumps.
That is, when the destination of the jump is reachable via only the jump.
2012-05-04 18:00:05 +09:00
Bill Currie
33bfac0508 Process all basic blocks for jump threading.
I'd copied the for loop from the dead block removal code, but jump
threading doesn't need to look at the following block...
2012-05-04 14:10:30 +09:00
Bill Currie
f169a7732d Factor out label unuse.
I expect to need this more often in the future.
2012-05-04 14:01:39 +09:00
Bill Currie
d2da3b8246 Update old test for new syntax. 2012-05-04 11:04:58 +09:00
Bill Currie
75aa28cfac Mark all subsequent blocks as reachable after if/goto merge.
If an if/goto merge is done in the first dead block pass, no blocks after
the merge have their rechable flag set because they've never been tested.
2012-05-04 10:58:18 +09:00
Bill Currie
8ddd58f951 Fix the dropping of the block after the merged if/goto.
The naive implementation of the if/goto merging was letting the old target
of the if get dropped because the block would lose its label and thus be
judged unreachable because the preceeding goto block was still in the list.
Instead, when the if/goto are "merged", mark the goto block as unreachable,
the following block as reachable, and break out of the analysis loop to
force the removal of the goto block. Since the dead block removal function
loops until no action is taken, all other dead blocks will be removed.
2012-05-04 10:07:55 +09:00
Bill Currie
e866619de6 Output basic block flow diagrams to files.
The output can be controlled via --block-dot (not yet documented). The
files a named <sourcefile>.<function>.<stage>.dot. Currently, stage will be
one of "initial" (after expression to statement conversion), "thread"
(after jump threading), "dead" (after dead block removal), "final" (final
state before actual code emission).
2012-05-04 09:45:51 +09:00
Bill Currie
3da44ace52 Merge if and goto blocks when if only skips over the goto. 2012-05-03 22:21:32 +09:00
Bill Currie
6afdfb5fac Unuse label expressions that are no longer necessary. 2012-05-03 22:20:00 +09:00
Bill Currie
402a578bf8 Add some more helper functions.
Things were getting messy with the strcmps.
2012-05-03 22:17:23 +09:00
Bill Currie
88bed3644e Rename some helper functions. 2012-05-03 22:11:52 +09:00
Bill Currie
159f1bafea Add a little more info to statement flow diagrams.
The relative block number and the label user count are printed now.
2012-05-03 22:09:49 +09:00
Bill Currie
6900907129 Remove dead labels when jump threading.
This lets the dead block removal do a better job.
2012-05-03 19:32:44 +09:00
Bill Currie
ab73a267cd Do not unconditionally remove labels from blocks.
Labels can be shared between multiple flow-control instructions, so use the
label's used counter to determine when to remove the label. This was
causing problems with the jump threading.
2012-05-03 19:22:57 +09:00
Bill Currie
c79620f04c Make statement blocks more identifiable. 2012-05-03 19:10:44 +09:00
Bill Currie
43b5edf46b Implement jump threading.
First real optimization :)
2012-05-03 17:42:58 +09:00
Bill Currie
78a9ba2557 Make expression alias chains not-a-bug.
The common cause seems to be casting a cast (very common, and I'm not sure
just realiasing the expression would be right). It does't cause any harm
(particularly, it doesn't trigger alias def chains), so I won't worry about
it.
2012-05-03 13:57:31 +09:00
Bill Currie
006882407d Fix the source of alias def chains.
The actual bug might still be elsewhere, but at least now I know the alias
chains were coming from accessing .return and .param_N, which are unions
(not directly usable by the progs engine). Emitting a reference to a union
(or struct) would create an alias def, but an alias expression was created
in the expression tree to simplify return/param access. The double layer
(sometimes 3 or 4) alias isn't really neaded, so rather than layering the
aliases, just re-alias the alaised def.
2012-05-03 13:28:16 +09:00
Bill Currie
ec98e3e206 Mark alias def chains as a bug. 2012-05-03 13:27:30 +09:00
Bill Currie
5f676c367f Add a non-error diagnostic that can't be silenced.
It is inteded for flagging buggy conditions in the compiler, particularly
after having fixed the original bug (in case something comes back from the
dead).
2012-05-03 13:24:24 +09:00
Bill Currie
3306039da2 Print the destination type for alias expression bubbles. 2012-05-03 11:55:19 +09:00
Bill Currie
cb8fe4eb38 Correct a "spelling" error. 2012-05-03 11:54:36 +09:00
Bill Currie
e267e0a664 Allow control of progdefs.h CRC writing.
CRC writing defaults to off for non-v6 progs, but on for v6 progs. The
--progdefs option forces CRC writing.
2012-05-03 00:22:24 +09:00
Bill Currie
44fcd76475 Add some missing command line option docs. 2012-05-03 00:03:13 +09:00
Bill Currie
15de69d868 Use dstring for progdefs.h writing.
And finally get qfcc into the thing :P
2012-05-02 23:39:49 +09:00
Bill Currie
04b9b3a11d Fix progdefs.h writing. 2012-05-02 22:44:45 +09:00
Bill Currie
ce278b2fbf Ensure .zero does not get a vector field for v6 progs.
v6 progs expects .zero to be only 1 word. The code actually tried to keep
vector out of .zero, but it seems I'd rearranged the structure defintion
without updating the code that kills the vector field. Problem spotted by
divVerent.
2012-05-02 22:29:17 +09:00