Commit Graph

53 Commits

Author SHA1 Message Date
José Fonseca af82ff556c gallivm: Fix lp_build_exp2 order 4-5 polynomial coefficients and bump order.
Not sure how I computed these, but they were wrong (which explains why
bumping the polynomial order before never improved precision).

This allows to pass the EXP test cases of PSPrecision/VSPrecision DCTs.
2011-07-22 18:52:09 -07:00
José Fonseca 47d6d44a23 gallivm: Increase lp_build_rsqrt() precision.
Add an iteration step, which makes rqsqrt precision go from 12bits to
24, and fixes RSQ/NRM test case of PSPrecision/VSPrevision DCTs.

There are no uses of this function outside shader translation.
2011-07-22 18:52:09 -07:00
José Fonseca 1ac86e249e gallivm: Fix lp_build_exp/lp_build_log.
Never used so far -- we only used the base 2 variants -- which is why
it went unnoticed so far.
2011-07-22 18:52:09 -07:00
Brian Paul 6299f241e9 gallivm/llvmpipe: remove lp_build_context::builder
The field was redundant.  Use the gallivm->builder value instead.
2010-12-02 18:11:16 -07:00
Brian Paul efc82aef35 gallivm/llvmpipe: squash merge of the llvm-context branch
This branch defines a gallivm_state structure which contains the
LLVMBuilderRef, LLVMContextRef, etc.  All data structures built with
this object can be periodically freed during a "garbage collection"
operation.

The gallivm_state object has to be passed to most of the builder
functions where LLVMBuilderRef used to be used.

Conflicts:
	src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
	src/gallium/drivers/llvmpipe/lp_state_setup.c
2010-11-30 16:35:12 -07:00
José Fonseca ac17c62ece gallivm: Add a note about SSE4.1's nearest mode rounding. 2010-10-18 09:32:35 -07:00
Brian Paul 50f221a01b gallivm: remove newlines 2010-10-12 19:04:05 -06:00
José Fonseca 81a09c8a97 gallivm: Less code duplication in log computation. 2010-10-09 12:12:59 +01:00
Roland Scheidegger cb3af2b434 gallivm: faster iround implementation for sse2
sse2 supports round to nearest directly (or rather, assuming default nearest
rounding mode in MXCSR). Use intrinsic to use this rather than round (sse41)
or bit manipulation whenever possible.
2010-10-09 00:36:37 +02:00
Roland Scheidegger 0ed8c56bfe gallivm: fix trunc/itrunc comment
trunc of -1.5 is -1.0 not 1.0...
2010-10-09 00:36:37 +02:00
José Fonseca af05f61576 gallivm: Combined ifloor & fract helper.
The only way to ensure we don't do redundant FP <-> SI conversions.
2010-10-06 18:47:01 +01:00
José Fonseca 012d57737b gallivm: Fast implementation of iround(log2(x))
Not tested yet, but should be correct.
2010-10-06 18:46:59 +01:00
José Fonseca 4648846bd6 gallivm: Use a faster (and less accurate) log2 in lod computation. 2010-10-06 18:46:29 +01:00
José Fonseca df3505b193 gallivm: Take the type signedness in consideration in round/ceil/floor. 2010-10-06 18:46:08 +01:00
José Fonseca e3ccfd4e03 gallivm: Use SSE4.1's ROUNDSS/ROUNDSD for scalar rounding. 2010-09-29 22:29:23 +01:00
José Fonseca 162b0efff6 gallivm: Add unorm support to lp_build_lerp()
Unfortunately this can cause segfault with LLVM 2.6, if x is a constant.
2010-09-22 15:02:39 +01:00
José Fonseca dcc5d7f672 gallivm: Add a new debug flag to warn about performance issues. 2010-09-11 13:29:29 +01:00
José Fonseca e18c7f68b4 gallivm: Fix lp_build_sum_vector.
The result is scalar, so when argument is zero/undef we can pass vector
zero/undef.

Also, support the scalar case.
2010-08-30 13:26:29 +01:00
Marek Olšák 89b2897220 util: remove util_is_pot in favor of util_is_power_of_two
The function was duplicated.
2010-08-29 06:16:25 +02:00
José Fonseca 0d96cbe4a5 gallivm: Emit DIVPS instead of RCPPS.
See comments for detailed rationale.

Thanks to Michal Krol and Zack Rusin for detecting and investigating this
in detail.
2010-08-21 21:58:22 +01:00
José Fonseca eacb624a4a gallivm: Refactor the Newton-Rapshon steps, and disable once again.
It causes a very ugly corruption on the Earth's halo on Google Earth.
2010-08-14 18:03:13 +01:00
José Fonseca b481a1237e gallivm: Fix and enable the extra Newton/Raphson step in lp_build_rcp().
Thanks to Michal for spotting this.
2010-08-11 18:45:26 +01:00
nobled 20b3e40f16 gallivm: Fix bitwise operations for floats, division for integers
http://bugs.freedesktop.org/29407

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2010-08-10 10:24:26 +01:00
nobled a44a6960fa gallivm: Even more type checking
http://bugs.freedesktop.org/29407

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2010-08-10 10:24:26 +01:00
José Fonseca 6e1f9bc8f6 gallivm: More type checks. 2010-08-09 17:31:18 +01:00
José Fonseca 8a3a971743 gallivm: Don't call LLVMBuildFNeg on llvm-2.6.
It didn't exist yet.
2010-08-09 17:31:18 +01:00
nobled fc9a49b638 gallivm: Always use floating-point operators for floating-point types
This fixes the assert added in LLVM 2.8:
assert(getType()->isIntOrIntVectorTy() &&
       "Tried to create an integer operation on a non-integer type!")

But it also fixes some subtle bugs, since we should've been doing this
since LLVM 2.6 anyway.

Includes a modified patch from steckdenis@yahoo.fr for the
FNeg instructions in emit_fetch(); thanks for pointing those out.

http://bugs.freedesktop.org/29404
http://bugs.freedesktop.org/29407

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2010-08-09 17:31:18 +01:00
José Fonseca d827972816 gallivm: Add type checks for the basic operations. 2010-08-08 21:02:59 +01:00
Vinson Lee 01985390be gallivm: Remove unnecessary header. 2010-07-06 15:45:31 -07:00
Brian Paul e834c48100 gallivm: finish implementation of lp_build_iceil()
Plus fix minor error in lp_build_iceil() by tweaking the offset value.
And add a bunch of comments for the round(), trunc(), floor(), ceil()
functions.
2010-07-06 11:36:37 -06:00
Vinson Lee 80689ae615 gallivm: Remove unnecessary headers. 2010-05-26 11:13:23 -07:00
Qicheng Christopher Li 3c929e5544 gallivm: Efficient implementation of sin/cos.
Based on Julien Pommier's SSE and SSE2 algorithms.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
2010-05-24 13:45:21 +01:00
José Fonseca 533ec3f667 gallivm: Silent warning. 2010-05-10 21:23:39 +01:00
José Fonseca e3205b0540 gallivm: cosf/sinf are macros on MSVC.
So taking the function address does not work.
2010-05-10 08:31:54 +01:00
José Fonseca ff7542ab90 gallivm: Actually do floor/ceil/trunc for scalars.
Also start axing the code duplication for scalar case. The olution is to
treat the scalar case specially in a few innermost functions, and leave
outer functions untouched.
2010-05-08 23:29:05 +01:00
José Fonseca c376dadbb0 gallivm: Use a minimax polynomial for exp2 in range [0,1] instead [-0.5,5].
The advantage of range[-0.5, 0.5] is that it doesn't require floor (for
which intrinsics are only available in SSE4.1).

But the EXP opcode pretty much forces us to use floor, and there is a
good floor approximation around truncation available anyway.

This fixes EXP failures in VShader DCT.
2010-05-08 23:29:05 +01:00
José Fonseca e9fc5b463f gallivm: The the JIT engine to use our sinf()/cosf() on Windows.
A quick hack to get the right results, as there are many DCT tests
which use these opcodes to generate data to test other opcodes.
2010-05-08 18:36:22 +01:00
José Fonseca a9d1a85f81 gallicm: Newton-Raphson step to improve precision.
Disabled as it doesn't make VS/PSPrecision DCT happy, and it would
unnecessarily slow some cases where it is not needed.
2010-05-04 00:22:16 +01:00
José Fonseca 992fc62d59 gallivm: Disable llvm.cos.v4f32 and llvm.sin.v4f32 instrinsics on Windows.
Runtime linking doesn't quite work.

Just comment then out for now to prevent crashes. These will go away in
the future because calling 4 times CRT's cosf()/sinf() is over-precise
and under-performing.
2010-04-27 14:27:24 +01:00
José Fonseca 35a920e83b gallivm: LLVMConstBitCast -> LLVMBuildBitCast
As the argument in general might not be a constant.
2010-04-24 10:06:27 +01:00
Zack Rusin 63aa9b505a gallivm: make sure we return the correct type when approximating log's 2010-04-22 13:57:18 -04:00
Brian Paul 185be3a87a gallivm/llvmpipe: rename some constant building functions 2010-03-15 18:16:56 -06:00
Brian Paul d25d3cc008 gallivm: fix typo/bug in lp_build_sgn()
We were never returning -1 as a result.  This fixes some inverted/flipped
faces with cube mapping.
2010-03-15 11:30:05 -06:00
Brian Paul f9d753787e gallivm: fix incorrect floor(), itrunc()
LLVMBuildFPTrunc() should be used for double->float conversion, not
float->int conversion.

There should be a better way to compute floor(), ceil(), etc that doesn't
involve float->int->float conversion.
2010-03-15 10:29:10 -06:00
Brian Paul a6196ce8be gallivm: support non-vector float in lp_build_sgn() 2010-03-12 16:55:28 -07:00
Brian Paul 0b3bb6318e gallivm: added lp_build_sum_vector() 2010-03-11 16:26:12 -07:00
Brian Paul a599f552f2 gallivm: handle scalar floats in lp_build_floor() and lp_build_iround() 2010-03-10 18:09:49 -07:00
Brian Paul 2ccae040a4 gallivm: checkpoint: nearest mipmap filtering
The LOD is computed from texcoord partial derivatives and used to
select a mipmap level.  Still some bugs in texel fetching.  Lots of
rough edges and unfinished parts but the basics are in place.

Lots of changes to the lp_bld_arit.c code to support non-vector/scalar
datatypes.
2010-03-09 09:40:41 -07:00
Brian Paul 516bad2272 gallivm: added lp_build_fract() 2010-03-04 10:53:27 -07:00
Brian Paul 6464d81e77 gallivm: added lp_build_set_sign() 2010-03-04 10:53:26 -07:00