Commit graph

33228 commits

Author SHA1 Message Date
Eric Anholt
9b075cb9fa ir_to_mesa: When emitting a pixel kill, flag that we did so.
Both i965 and swrast rely on UsesKill to determine whether to do early
depth writes.  Fixes glsl-fs-discard-02.

Bug #29835.
2010-08-31 15:43:49 -07:00
Keith Whitwell
e38d2f7163 llvmpipe: slightly simplify build_mask 2010-08-31 23:31:45 +01:00
Keith Whitwell
0aa3a09ced llvmpipe: combine linear mask calculation 2010-08-31 23:31:45 +01:00
Keith Whitwell
d8c92a1eea llvmpipe: intrinsics versions of build_mask functions 2010-08-31 23:31:44 +01:00
Ian Romanick
a6c3cd5ca6 glsl2: Write vector constructor constants in a single assignment
Make two passes over the constructor parameters.  Write all of the
constants in a single write, then write the non-constants one at a
time.  This causes the fragment shader

varying float g;
void main()
{
	gl_FragColor = vec4(0.0, g, 0.0, 1.0);
}

to generate

(function main
  (signature void (parameters )
    (
      (declare (temporary ) vec4 vec_ctor@0x8580058)
      (assign (constant bool (1)) (xzw) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058)  (swiz xxxx (var_ref g@0x8580218) ))
      (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0)  (var_ref vec_ctor@0x8580058) )
    ))
)

instead of

(function main
  (signature void (parameters )
    (
      (declare (temporary ) vec4 vec_ctor@0x8580058)
      (assign (constant bool (1)) (x) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058)  (swiz xxxx (var_ref g@0x8580218) ))
      (assign (constant bool (1)) (z) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (w) (var_ref vec_ctor@0x8580058)  (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
      (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0)  (var_ref vec_ctor@0x8580058) )
    ))
)

A similar optimization could be done for matrix constructors, but it
is a little more complicate there.
2010-08-31 14:44:13 -07:00
Eric Anholt
99f3c9caa3 ir_to_mesa: Sort the uniform list we're adding to Parameters[] order.
Fixes glsl-uniform-linking-1 and failure to link a shader in Unigine.
An alternative here would be to just ditch using _mesa_add_parameter
and build the initial params list on our own, but that would require
two walks of the list as well.

Bug #29822
2010-08-31 11:34:29 -07:00
nobled
2a78807db7 ir_to_mesa: Fix struct/class confusion 2010-08-31 11:34:29 -07:00
Eric Anholt
7406898441 ir_to_mesa: Set up our instruction nodes with zeroed data.
cond_update wasn't being set by emit_op3, leading to valgrind
complaints, and failures in several piglit tests when built with
clang.
2010-08-31 11:34:29 -07:00
Kenneth Graunke
1eea96326f ast_to_hir: Add support for bit-wise operators (but not shifts).
Previously, using bit-wise operators in some larger expression would
crash on a NULL pointer dereference.  This code at least doesn't crash.

Fixes piglit test bitwise-01.frag.
2010-08-31 11:00:34 -07:00
Chia-I Wu
3fbbd70e80 st/egl: Enable EGL_MESA_drm_display. 2010-08-31 15:52:33 +08:00
Chia-I Wu
8cdeff8444 egl: Mark EGL_MESA_screen_surface as obsolete.
EGL_MESA_drm_{display,image} can achieve the same functionality.
2010-08-31 15:25:22 +08:00
Dave Airlie
b87b6e5bf7 r600g: fix up depth write swizzles.
For some reason r600c, emits extra instructions in the FP to do the depth write output swizzle,
I'm not sure this is required, so here I'm doing it in the exports.

this fixes the mesa trivial demos tri-depthwrite and tri-depthwrite2, it doesn't fix
the glsl1 gl_FragDepth writing test however.
2010-08-31 16:15:04 +10:00
Dave Airlie
ad202678fc r600g: fix fp-fragment-position test. 2010-08-31 15:13:24 +10:00
Dave Airlie
580781babe r600g: fix typo in last commit 2010-08-31 15:13:21 +10:00
Dave Airlie
5d66a8606d r600g: fix position input to fragment shader.
this fixes a few if the fs shader tests, 10 more piglits
2010-08-31 14:55:32 +10:00
Dave Airlie
4e61f085d0 r600g: remove unneeded function call from scs 2010-08-31 14:55:32 +10:00
Marek Olšák
4f189b3bf5 ir_to_mesa: use RSQ+MUL instead of RSQ+RCP for SQRT
sqrt(x) = 1/rsq(x) = x*rsq(x)

This optimization already was in the old GLSL compiler.

Acked on irc by Eric Anholt.
2010-08-31 06:36:52 +02:00
Kenneth Graunke
2619b1c96f linker: Require an exact matching signature when looking for prototypes.
Fixes piglit test glsl-override-builtin.  The linker incorrectly found
the prototype for the float signature, rather than adding a new
prototype with the int return type.  This caused ir_calls with type int
to have their callees set to the float signature, triggering an assert.
2010-08-30 21:04:13 -07:00
Dave Airlie
d3fa92584b r600g: make LIT work properly
this is a bit of a workaround, something is wrong with the literal emits here
so we just use the trig copy function to copy the immd to a temp at start of op.

fix VP/FP LIT tests
2010-08-31 12:59:10 +10:00
Zhenyu Wang
24ff42e7d5 i965: fix depth test on sandybridge
This includes several corrections for fixing depth test on sandybridge.
Fix wrong bits definition in depth stencil state. Fix wrong order of
state buffer offset in 3DSTATE_CC_STATE_POINTERS command. Correctly use
buffer width parameter in depth buffer setting.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
2010-08-31 09:58:18 +08:00
Dave Airlie
be7816f2b7 r600g: fixup trig functions when input is a literal
So as the trig functions used up the literal spots for the PI work, if the arg0 was an immediate
we'd hit failure, so copy the literal before starting.

add some tracking of max temp used to avoid trashing temp regs.

5 more piglits, fp1 COS,SCS,SIN tests
2010-08-31 11:44:34 +10:00
Dave Airlie
ee0153f891 r600g: make sure LIT splits constants 2010-08-31 10:47:08 +10:00
Dave Airlie
9bbc54a10d r600g: fix constant splitting
constant splitting was broken for multi-constant cases, fixes fp1 CMP+MAD, vp1 CMP.
2010-08-31 10:47:03 +10:00
Dave Airlie
85e401d8bf r600g: fix LIT tests 2010-08-31 10:46:58 +10:00
Dave Airlie
5ea238b799 r600g: add missing literals
Also add an error if we hit this problem again, we need to do this better
possibly tying the literal addition to the last flag.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-31 09:43:48 +10:00
Ian Romanick
df869d9163 linker: Handle varying arrays, matrices, and arrays of matrices
Fixes piglit test case glsl-array-varying-01.
2010-08-30 16:02:51 -07:00
Jon TURNEY
e637f8b40c Add talloc to osmesa library dependencies
also link osmesa with C++ standard libraries, as it now contains C++ code

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2010-08-30 13:41:39 -07:00
Eric Anholt
8b3d36d563 glsl: Clear the static values of builtin function profiles at release.
When releasing the builtin functions, we were just freeing the memory,
not telling the builtin function loader that we had freed its memory.
I wish I had done ARB_ES2_compatibility so we had regression testing
of this path.  Fixes segfault on changing video options in nexuiz.
2010-08-30 13:12:24 -07:00
Ian Romanick
33fe364e5a glsl2: Commit generated files changed by previous commit 2010-08-30 12:52:42 -07:00
Ian Romanick
bea3963f59 glsl2: Parse #pragma lines
All pragmas are currently ignored.  Also, the error messages when a
pragma is used incorrectly (i.e., '#pragma debug(on)' inside a
function) are crap, but I think this is sufficient for now.

Fixes piglit test cases pragma-0[1-8].(vert|frag).
2010-08-30 12:52:42 -07:00
Kenneth Graunke
9b0ba68b44 Fix inverted version checks in check_extra.
Previously, if an attribute was enabled by either a specific GL version
or an extension, the check would require -both- to be enabled.  This bug
was not discovered earlier because version checks are currently only ever
used on their own.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2010-08-30 12:29:22 -07:00
Jerome Glisse
de0b76cab2 r600g: precompute some of the hw state
Idea is to build hw state at pipe state creation and
reuse them while keeping a non PM4 packet interface
btw winsys & pipe driver. This commit also force rebuild
of pm4 packet on each call to radeon_state_pm4 which
in turn slow down everythings, this will be addressed.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2010-08-30 15:00:55 -04:00
Jerome Glisse
0bba7796a3 r600g: fix depth buffer decompression after states rework
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2010-08-30 15:00:55 -04:00
Dave Airlie
69c30f5d6d r600g: fixup states generation in winsys.
The current states code had an unhealthy relationship between
that had to somehow magically align themselves, editing either
place meant renumbering all states after the one you were on,
and it was pretty unapproachable code.

This replaces the huge types structures with a simple type + sub
type struct, which is keyed on an stype enum in radeon.h. Each
stype can have a per-shader type subclassing (4 types supported,
PS/VS/GS/FS), and also has a number of states per-subtype. So you
have 256 constants per 4 shaders per one CONSTANT stype.

The interface from the driver is changed to pass in the tuple,
(stype, id, shader_type), and we look for this. If
radeon_state_shader ever shows up on profile, it could use a
hashtable based on stype/shader_type to speed things up.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-30 15:00:55 -04:00
Luca Barbieri
699c82e30c glapi: fix generator which got out of sync with the codebase
The __GLapi typedef was removed in c356f5867f,
but the code generator hasn't been updated.
2010-08-30 20:51:49 +02:00
Eric Anholt
5360c48317 i965: Clear the cached constant buffer entry in the VS at control flow.
Fixes the 7 regressions with constant buffers forced on with piglit -t
glsl (glsl-vs-if-*).
2010-08-30 11:19:30 -07:00
Eric Anholt
3bae20bbc9 i965: Align the number of payload regs to 2 again in 16-wide mode.
Fixes a regression in point-line-no-cull and glean/paths tests since
501c9dc627.
2010-08-30 10:47:05 -07:00
Cedric Vivier
e1aa3c234f i965: Apply the rest of the old-libdrm guard patch.
Bug #29855
2010-08-30 10:42:20 -07:00
Eric Anholt
1fcb5a9858 i965: Add support for loops to the new FS backend.
This includes a handy little safety check to prevent the loop from
going "too long", as permitted by the spec.  I haven't gone out of my
way to test it, though…

Fixes 20 more piglit tests.
2010-08-30 10:26:05 -07:00
Eric Anholt
352dff62f8 i965: Make brw_CONT and brw_BREAK take the pop count.
We always need to set it, so pass it in.
2010-08-30 10:26:05 -07:00
Eric Anholt
b0a933a4d9 i965: Add "discard" support to the new FS backend.
Fixes 3 testcases related to discard.
2010-08-30 10:26:05 -07:00
Eric Anholt
4ff25c2106 i965: Fix the new implementation of ir_unop_sign to match brw_wm_emit.c
Like the comparison operations, this suffered from CMP only setting
the low bit.  Doing the AND instructions would be the same instruction
count as the more obvious conditional moves, so do cond moves.

Fixes glsl-fs-sign and 6 other cases, like trig functions that use
sign() internally.
2010-08-30 10:26:05 -07:00
Eric Anholt
40aadafa91 i965: Add support for texturing with bias to i965 FS backend.
Fixes 5 piglit tests for bias.  Note that LOD is a 1.30 feature and
not yet supported.
2010-08-30 10:26:05 -07:00
José Fonseca
f3eebb8465 glut: Silence missing initializer warning. 2010-08-30 14:12:01 +01:00
José Fonseca
4841c0a15a mesa: Return after assertion failure.
Addresses the warnings:
warning: ‘target’ may be used uninitialized in this function
warning: ‘target_string’ may be used uninitialized in this function
2010-08-30 13:59:24 +01:00
José Fonseca
0a6c908e0d gallivm: Compute the 4 texel offsets for linear filtering en ensemble. 2010-08-30 13:58:09 +01:00
José Fonseca
ccd8b935e4 glsl: Silence unused variable warning. 2010-08-30 13:53:15 +01:00
José Fonseca
128237927d mesa: Fix _mesa_lookup_parameter_constant's return value.
Fixes gcc warning

  In function ‘_mesa_add_unnamed_constant’:
  warning: ‘pos’ may be used uninitialized in this function

but also what appears to be a bug.
2010-08-30 13:48:21 +01:00
José Fonseca
e4c3e7f9d8 gallivm: Disable LLVM's pretty stack trace dumper.
By default LLVM adds a signal handler to output a pretty stack trace.
This signal handler is never removed, causing problems when unloading
the shared object where the gallium driver resides.

Thanks to Chris Li for finding this.
2010-08-30 13:27:28 +01:00
José Fonseca
7a08dbcf55 gallivm: Correct copy'n'pasted comments. 2010-08-30 13:27:03 +01:00