Commit Graph

144 Commits

Author SHA1 Message Date
Ilia Mirkin 33c9ad97bf freedreno/ir3: add TXF support
Still failing a bunch of the fairly picky texelFetch tests, but the
1D(Array) ones are full passes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin e6acf3ac24 freedreno/ir3: add TXD support and expose ARB_shader_texture_lod
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin c49107c889 freedreno/ir3: add texture offset support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin 5bba74c64b freedreno/ir3: shadow comes before array
Experimentally, this makes *ArrayShadow tex-miplevel-selection tests
pass.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin 81b34e4461 freedreno/ir3: make TXQ return integers, not floats
We're still doing something wrong for array textures.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin c4e2a196c3 freedreno/ir3: add UMAD support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin 347bc197a6 freedreno/ir3: add ISSG support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin ad5db64e7e freedreno/ir3: add MOD support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin cab3cb1d71 freedreno/ir3: add UMOD support, based on UDIV
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin 8f7d01c2cb freedreno/ir3: add IDIV/UDIV support
Logic shamelessly copied from nv50 lowering pass.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-10-02 23:30:47 -04:00
Ilia Mirkin 3dd9a0d6fd freedreno/ir3: avoid fan-in sources referring to same instruction
Since the RA has to be done s.t. each one gets its own (adjacent)
register, it would complicate matters if instructions were allowed to be
repeated. This enables copy-propagation use in situations where
previously that might have happened.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-10-02 21:05:50 -04:00
Rob Clark 3aaab87563 freedreno/ir3: add some cmdline args
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-29 18:30:43 -04:00
Rob Clark 7cdd467994 freedreno/a3xx: add support to emulate GL_CLAMP
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-29 18:30:43 -04:00
Rob Clark ed48f91275 freedreno/a3xx: add flat interpolation mode
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-27 13:34:07 -04:00
Ilia Mirkin f6ff4cd517 freedreno/ir3: add TXB2 support
Handles texture(samplerCubeShadow, bias), part of GLES3 and GL3

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-22 22:06:34 -04:00
Ilia Mirkin 9b7961f9a3 freedreno/ir3: add TXQ support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-22 22:06:34 -04:00
Ilia Mirkin 9a3dcf21d7 freedreno/ir3: fix TXB/TXL to actually pull the bias/lod argument
Previously we would get a potentially computed post-swizzle coord based
on the texture target info, which would not include the bias/lod in the
last argument.

The second argument does not have to be adjacent, so adjusting the order
array did not make sense.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-22 22:06:34 -04:00
Ilia Mirkin 53678f5e6b freedreno/ir3: make texture instruction construction more dynamic
This will make life a lot easier as we add support for additional
instructions.

v2: shadow reference value is always .z or .w

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-22 22:06:34 -04:00
Rob Clark 49b8fb937f freedreno/a3xx: more texture array fixes
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-21 15:36:26 -04:00
Ilia Mirkin a420aa1b41 freedreno: add a standalone ir3_compiler binary for building TGSI
Compiler taken from the combo old/new compiler comparer + simulator.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-09-16 12:13:22 -04:00
Rob Clark ca29c4c3b0 freedreno/a3xx: 3d/array textures
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-13 15:31:58 -04:00
Ilia Mirkin d7ec3db349 freedreno/ir3: implement UMUL correctly
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:26:21 -04:00
Ilia Mirkin 436dd1e2f8 freedreno/ir3: fix UCMP handling
UCMP does not require a compare, only a select.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:26:15 -04:00
Ilia Mirkin 9f5bd154d7 freedreno/ir3: add TXL support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:26:11 -04:00
Rob Clark 459f8f3d66 freedreno/ir3: add missing put_dst
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:26:09 -04:00
Rob Clark 59ff81663a freedreno/ir3: catch incorrect usage of tmp-dst
Each get_dst() should have a matching put_dst().  Add a bit of checking
to catch mistakes.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:26:09 -04:00
Ilia Mirkin db1a94b1cc freedreno/ir3: use unsigned comparison for UIF
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:26:05 -04:00
Ilia Mirkin 11d72553c5 freedreno/ir3: negate result of USLT/etc
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:26:01 -04:00
Ilia Mirkin 8edf83b377 freedreno/ir3: add UARL support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:25:57 -04:00
Ilia Mirkin 10273f84c2 freedreno/ir3: INEG operates on src0, not src1
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:25:52 -04:00
Ilia Mirkin 572ffca050 freedreno/ir3: fix FSLT/etc handling to return 0/-1 instead of 0/1.0
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:25:47 -04:00
Rob Clark 80058c0f08 freedreno/a3xx: alpha render-target shenanigans
We need the .w component to end up in .x, since the hw appears to fetch
gl_FragColor starting with the .x coordinate regardless of MRT format.
As long as we are doing this, we might as well throw out the remaining
unneeded components.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:23:52 -04:00
Rob Clark a2c22d80d4 freedreno/ir3: fix potential segfault in RA
Triggered by shaders like:

  FRAG
  PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1
  DCL OUT[0], COLOR
  DCL CONST[0]
  DCL TEMP[0..2], LOCAL
    0: IF CONST[0].xxxx :0
    1:   MOV TEMP[0], TEMP[1]
    2: ELSE :0
    3:   MOV TEMP[0], TEMP[2]
    4: ENDIF
    5: MOV OUT[0], TEMP[0]
    6: END

not really a sane shader, although driver segfaulting is probably
not the appropriate response.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-09 19:42:18 -04:00
Rob Clark fd4884e929 freedreno/ir3: add no-copy-propagate fallback step
Most of the things the new compiler still has trouble with basically
amount to cp stage removing too many copies.  But without the cp stage,
the shaders the new compiler produces are still better (perf and
correctness) than the old compiler.  So a simple thing to do until I
have more time to work on it is first trying falling back to new
compiler without cp, before finally falling back to old compiler.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-09 19:42:18 -04:00
Rob Clark 5d8f40a53a freedreno/ir3: fix constlen with relative addressing
We can't rely on the value from the assembler if relative addressing is
used.  So instead use the max of declared-consts (which does not include
compiler immediates) and what we get from the assembler (which does).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-04 22:28:50 -04:00
Rob Clark 73ff4c5f70 freedreno/ir3: fix error in bail logic
all_delayed will also be true if we didn't attempt to schedule anything
due to no more instructions using current addr/pred.  We rely on coming
in to block_sched_undelayed() to detect and clean up when there are no
more uses of the current addr/pred, which isn't necessarily an error.

This fixes a regression introduced in b823abed.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-04 22:28:50 -04:00
Rob Clark 08ee0488e6 freedreno/ir3: bit of debug
Make it easier to figure out which compiler stage failed.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-04 22:28:50 -04:00
Carl Worth c35f14f368 Eliminate several cases of multiplication in arguments to calloc
In commit 32f2fd1c5d, several calls to
_mesa_calloc(x) were replaced with calls to calloc(1, x). This is strictly
equivalent to what the code was doing previously.

But for cases where "x" involves multiplication, now that we are explicitly
using the two-argument calloc, we can do one step better and replace:

	calloc(1, A * B);

with:

	calloc(A, B);

The advantage of the latter is that calloc will detect any overflow that would
have resulted from the multiplication and will fail the allocation, (whereas
the former would return a small allocation). So this fix can change
potentially exploitable buffer overruns into segmentation faults.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-09-03 18:37:02 -07:00
Rob Clark ef858ac770 freedreno/ir3: add DDX/DDY
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-01 18:08:21 -04:00
Rob Clark 5e5604cc28 freedreno/ir3: don't keep IR around
Once we've assembled the shader, no need to keep the intermediate
around.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-01 18:08:21 -04:00
Rob Clark c06afcede2 freedreno/ir3: fix potential null ptr deref
Fix potential segfault in debug code.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-08-30 18:02:51 -04:00
Rob Clark c99f09f4be freedreno/ir3: add TXB
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-08-30 18:02:51 -04:00
Rob Clark b823abedf8 freedreno/ir3: detect scheduler fail
There are some cases where the scheduler can get itself into impossible
situations, by scheduling the wrong write to pred or addr register
first.  (Ie. it could end up being unable to schedule any instruction if
some instruction which depends on the current addr/reg value also
depends on another addr/reg value.)

To solve this we'd need to be able to insert extra mov instructions
(which would also help when register assignment gets into impossible
situations).  To do that, we'd need to move the nop padding from sched
into legalize.

But to start with, just detect when we get into an impossible situation
and bail, rather than sitting forever in an infinite loop.  This way it
will at least fall back to the old compiler, which might even work if
you are lucky.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-08-30 18:02:50 -04:00
Rob Clark db193e5ad0 freedreno/ir3: split out shader compiler from a3xx
Move the bits we want to share between generations from fd3_program to
ir3_shader.  So overall structure is:

  fdN_shader_stateobj -> ir3_shader -> ir3_shader_variant -> ir3
                                    |- ...
                                    \- ir3_shader_variant -> ir3

So the ir3_shader becomes the topmost generation neutral object, which
manages the set of variants each of which generates, compiles, and
assembles it's own ir.

There is a bit of additional renaming to s/fd3_compiler/ir3_compiler/,
etc.

Keep the split between the gallium level stateobj and the shader helper
object because it might be a good idea to pre-compute some generation
specific register values (ie. anything that is independent of linking).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-07-25 13:29:28 -04:00