Commit Graph

29 Commits

Author SHA1 Message Date
Eric Anholt d7a0502a54 vc4: Add support for the FACE semantic.
Fixes glsl-fs-frontfacing.
2014-10-01 17:03:35 -07:00
Eric Anholt 64122b16ce vc4: Dump constant uniform values in VC4_DEBUG=qir.
Definitely helps when trying to understand and optimize a program.
2014-09-29 11:33:34 -07:00
Eric Anholt 2e48b286bf vc4: Add support for 8-bit unorm/snorm vertex inputs. 2014-09-23 13:40:10 -07:00
Eric Anholt dcd03e7476 vc4: Use the same method as for FRAG_Z to handle fragcoord W.
I need to get the non-reciprocal version of W for interpolation, anyway.
2014-09-19 11:09:04 -07:00
Eric Anholt 19589147ef vc4: Add support for stencil operations.
While depth test state is passed through the fragment shader as sideband,
data, the stencil test state has to be set by the fragment shader itself.

Many tests are still failing, but this gets most of hiz/ passing.
2014-09-18 17:46:43 -07:00
Eric Anholt 44b8eb743d vc4: Allow dead code elimination of instructions that read uniforms. 2014-09-17 14:21:24 -07:00
Eric Anholt 2264925f85 vc4: Add support for computed depth writes.
Fixes piglit glsl-1.10-fragdepth and early-z.
2014-09-16 13:03:41 -07:00
Eric Anholt aae4223fbd vc4: Restructure depth input/output in fragment shaders.
The goal here is to have an argument for the depth write opcode so that I
can do computed depth.  In the process, this makes the calculations that
will be emitted more obvious in the QIR.
2014-09-16 13:03:32 -07:00
Eric Anholt 2147dd9681 vc4: Fix memory leaks of struct qinst. 2014-09-15 13:12:27 -07:00
Eric Anholt f78ee1b280 vc4: Fix memory leaks of some vc4_compile contents. 2014-09-15 13:12:27 -07:00
Eric Anholt d952a98c53 vc4: Expose r4 to register allocation.
We potentially need to be careful that use of a value stored in r4 isn't
copy-propagated (or something) across another r4 write.  That doesn't
appear to happen currently, and this makes the dataflow more obvious.  It
also opens up not unpacking the r4 value, which will be useful for depth
textures.
2014-09-09 20:38:39 -07:00
Eric Anholt 4bca922878 vc4: Merge qcompile and tgsi_to_qir
The split between these two didn't make much sense.  I'm going to want the
chance to look at uniform contents in optimization passes, and the QPU
emit I think is going to end up rewriting the uniforms stream.
2014-09-04 17:00:54 -07:00
Eric Anholt 55d2a16262 vc4: Add a CSE optimization pass.
Debugging a regression in discard support was just too full of duplicate
instructions, so I decided to remove them instead of re-analyzing each of
them as I dumped their outputs in simulation.
2014-09-04 11:39:51 -07:00
Eric Anholt 80b27ca2cd vc4: Switch to using native integers.
There were troubles with bools without using native integers
(st_glsl_to_tgsi seemed to think bool true was 1.0f sometimes, when as a
uniform it's stored as ~0), and since I've got native integers other than
divide, I might as well just support them.
2014-09-04 11:39:51 -07:00
Eric Anholt 874dfa8b2e vc4: Expose compares at a lower level in QIR.
Before, we had some special opcodes like CMP and SNE that emitted multiple
instructions.  Now, we reduce those operations significantly, giving
optimization more to look at for reducing redundant operations.

The downside is that QOP_SF is pretty special -- we're going to have to
track it separately when we're doing instruction scheduling, and we want
to peephole it into the instruction generating the destination write in
most cases (and not allocate the destination reg, probably.  Unless it's
used for some other purpose, as well).
2014-09-04 11:39:51 -07:00
Eric Anholt e51e20c35e vc4: Add support for fragment discards.
Fixes piglit glsl-fs-discard-01 and -03, and allows a lot of mesa demos to
start running.  glsl-fs-discard-02 has a problem where the first tile is
not getting stored on the first render.
2014-08-22 10:16:58 -07:00
Eric Anholt b0a1e401a9 vc4: Include stdio/stdlib in headers so I don't have to include it per file.
There are a few tools I want to have always available, and fprintf() and
abort() are among them.
2014-08-22 10:16:57 -07:00
Eric Anholt 7c65b714ed vc4: Add support for blending.
Passes blendminmax and blendsquare.  glean's more serious blendFunc fails
in simulation due to binner memory overflow (I really need to work around
that), and fbo-blending-formats fails due to Mesa refusing one of the
getter requests, even before it could fail due to the driver not actually
supporting different formats yet.
2014-08-15 12:01:32 -07:00
Eric Anholt e63598aecb vc4: Add support for gl_FragCoord.
This isn't passing all tests (glsl-fs-fragcoord-zw-ortho, for example),
but it does get a bunch more tests passing.

v2: Rebase on helpers change.
2014-08-11 14:47:54 -07:00
Eric Anholt 4160ac5ee4 vc4: Add support for depth clears and tests within a tile.
This doesn't load/store the Z contents across submits yet.  It also
disables early Z, since it's going to require tracking of Z functions
across multiple state updates to track the early Z direction and whether
it can be used.

v2: Move the key setup to before the search for the key.
2014-08-11 14:45:31 -07:00
Eric Anholt 66c6c40127 vc4: Add support for texturing (under simulation)
Only rgba8888 works, and only a single texture unit, and it's only under
simulation because I haven't built the kernel interface yet.

v2: Rebase on helpers.
v3: Fold in the don't-break-the-arm-build fix.
2014-08-11 14:40:45 -07:00
Eric Anholt bf542cd372 vc4: Add support for the TGSI TRUNC opcode.
v2: Rebase on helpers.
2014-08-08 18:59:47 -07:00
Eric Anholt ec9da314ba vc4: Add copy propagation between temps.
We put in a bunch of extra MOVs for program outputs, and this can clean
those up.  We should do uniforms, too, though.

v2: Fix missing flagging of progress when we actually optimize.  Caught by
    Aaron Watry.
2014-08-08 18:59:47 -07:00
Eric Anholt d9d1c14430 vc4: Add dead code elimination.
This cleans up a bunch of noise in the compiled coordinate shaders (since
we don't need the varying outputs), and also from writemasked instructions
with negated src operands.
2014-08-08 18:59:47 -07:00
Eric Anholt 1d23d55ae9 vc4: Add an initial pass of algebraic optimization.
There was a lot of extra noise in my piglit shader dumps because of silly
CMPs.
2014-08-08 18:59:47 -07:00
Eric Anholt 4c53087c67 vc4: Add support for CMP.
This took a couple of tries, and this is the squash of those attempts.

v2: Fix register file conflicts on the args in the
    destination-is-accumulator case.
v3: Rebase on helper change and qir_inst4 change.
2014-08-08 18:59:47 -07:00
Eric Anholt c293927511 vc4: Add WIP support for varyings.
It doesn't do all the interpolation yet, but more tests can run now.

v2: Rebase on helpers.
2014-08-08 18:59:46 -07:00
Eric Anholt 2e35981d4d vc4: Add support for SNE/SEQ/SGE/SLT. 2014-08-08 18:59:46 -07:00
Eric Anholt 792d1c92df vc4: Switch to actually generating vertex and fragment shader code from TGSI.
This introduces an IR (QIR, for QPU IR) to do optimization on.  It's a
scalar, SSA IR in general.  It looks like optimization is pretty easy this
way, though I haven't figured out if it's going to be good for our weird
register allocation or not (or if I want to reduce to basically QPU
instructions first), and I've got some problems with it having some
multi-QPU-instruction opcodes (SEQ and CMP, for example) which I probably
want to break down.

Of course, this commit mostly doesn't work, since many other things are
still hardwired, like the VBO data.

v2: Rewrite to use a bunch of helpers (qir_OPCODE) for emitting QIR
    instructions into temporary values, and make qir_inst4 take the 4 args
    separately instead of an array (all later callers wanted individual
    args).
2014-08-08 18:59:46 -07:00