Commit Graph

68 Commits

Author SHA1 Message Date
Keith Whitwell d4b64167b5 llvmpipe: pass mask into fragment shader
Move this code back out to C for now, will generate separately.

Shader now takes a mask parameter instead of C0/C1/C2/etc.

Shader does not currently use that parameter and rasterizes whole
pixel stamps always.
2010-07-13 17:23:49 +01:00
José Fonseca 4ca3e0d84b llvmpipe: Don't reset the bin when there's a zsbuf bound.
The previous rendering may have secondary effects on the zsbuf.

Fixes the missing tiles on gearbox.
2010-06-30 10:19:50 +01:00
José Fonseca 6ce68ad3ca llvmpipe: Use struct lp_shader_input in the interpolator.
Eliminates all this identical yet slightly different code to decide how
shader inputs should be interpolated.

As bonus, don't interpolate the position twice when it is listed in the
TGSI shader inputs.
2010-06-01 21:30:57 +01:00
José Fonseca 149cb7682e llvmpipe: Don't waste time interpolating unused input channels. 2010-06-01 16:39:03 +01:00
José Fonseca 18fb9ff6d8 llvmpipe: Pass the fs variant to the rasterizer. 2010-05-30 10:30:01 +01:00
Brian Paul 151b3bb3af llvmpipe: add out of memory checking to triangle setup path 2010-05-28 12:52:41 -06:00
Brian Paul e5ee8b4fae llvmpipe: fix front/back tri culling mix-up 2010-05-17 11:43:43 -06:00
Keith Whitwell 0bd1cbcd0d gallium: convert rasterizer state to use gl-style front/back concepts
Use front/back instead of cw/ccw throughout.
Also, use offset_point/line/fill instead of offset_cw/ccw.

Brings gallium representation of this state into line with its main
user, and also what turns out to be the most common hardware
representation.

This fixes a long-standing bias in the interface towards the
architecture of the software rasterizer.
2010-05-14 13:04:42 +01:00
Brian Paul 246d39059e llvmpipe: update driver's provoking vertex code
Note that the lp_setup_vbuf.c code is very, very similar to the
corresponding code in softpipe.  It could probably be shared.
2010-05-05 18:19:30 -06:00
Brian Paul db4ccc004a llvmpipe: fix incorrect front-facing value for fragment shader
The TGSI convention is +1 for front-facing, -1 for back-facing
Fixes glean glsl1 gl_FrontFacing tests.
2010-04-20 11:44:01 -06:00
Brian Paul a59771fb53 llvmpipe: triangle function comments 2010-04-19 08:53:13 -06:00
Brian Paul 8ba14fab9a llvmpipe: print_triangle() func (disabled) 2010-04-16 09:27:58 -06:00
Brian Paul 22e6dc3870 gallivm/llvmpipe: added lp_rast_shader_inputs::facing and pass through
The triangle rasterizer sets this field to indicate front/back-facing.
It gets passed into the generated fragment code as another parameter.
Used now for stencil front/back selection but will also be used for
fragment shaders in general (see TGSI_SEMANTIC_FACE).

With this commit two-sided stenciling mostly works but there's
still a bug or two...
2010-03-18 13:06:32 -06:00
José Fonseca a80e33f407 llvmpipe: Obey rasterization rules.
Replicates softpipe.
2010-03-13 11:23:52 +00:00
José Fonseca 3160cbabcc llvmpipe: setup_context -> lp_setup_context
Otherwise IDEs and debuggers have trouble distinguishing from softpipe's
setup_context.
2010-03-13 11:23:52 +00:00
José Fonseca 4053d33703 llvmpipe: Store the original triangle coordinates in the debug build.
For debugging purposes only.
2010-03-03 19:55:49 +00:00
José Fonseca 764c172aa9 llvmpipe: Clamp both extremes of triangles to framebuffer size.
Fix segmentation fault when triangles crossed the axis.
2010-02-11 10:58:46 +00:00
Brian Paul 1d23954a08 llvmpipe: s/inline/INLINE/ 2010-01-21 19:05:54 -07:00
Brian Paul e24ea786fa llvmpipe: consolidate lp_scene_alloc_aligned() calls
Use just one call instead of four.  Good for a few more fps.
2010-01-21 19:04:55 -07:00
Brian Paul 798a9d3f94 llvmpipe: re-use a1 var in linear_coef() 2010-01-21 18:25:31 -07:00
Brian Paul ff9b55da9a llvmpipe: area is an int here, not float 2010-01-21 17:31:43 -07:00
Brian Paul a904a7b990 llvmpipe: manually unroll the inputs.step[] setup code
Good for a few more fps in some tests.
2010-01-21 16:21:33 -07:00
Brian Paul cd9d9e2436 llvmpipe: added simple perf/statistics counting facility
Currently counting number of tris, how many tiles of each size are
fully covered, partially covered or empty, etc.

Set LP_DEBUG=counters to enable.  Results are printed upon context
destruction.
2010-01-21 15:39:57 -07:00
Brian Paul 75f262b8b4 llvmpipe: updated comments 2010-01-19 09:30:13 -07:00
Brian Paul fdfe06ad80 llvmpipe: implement scissor test in triangle setup 2010-01-15 12:06:00 -07:00
Brian Paul adb48d5350 llvmpipe: remove lp_rast_triangle::min/max fields
These values aren't needed outside the do_triangle_ccw() function.
2010-01-15 11:52:14 -07:00
Brian Paul 4bef3575e6 llvmpipe: change 'in' to boolean, add comments 2010-01-15 11:25:13 -07:00
Brian Paul ca12e30d97 llvmpipe: minor comment update 2010-01-14 19:08:19 -07:00
Brian Paul f19f218e7a llvmpipe: minor assorted clean-ups 2010-01-13 18:01:45 -07:00
José Fonseca a1acbff299 llvmpipe: Reset the bin when shading a whole tile with an opaque shader. 2010-01-13 21:51:47 +00:00
Brian Paul 212f3a6cb3 llvmpipe: tweak subpixel_snap() arithmetic
This adjustment fixes some rasterization differences between llvmpipe
and softpipe (and other renderers).
2010-01-13 09:32:21 -07:00
Brian Paul 214ffad015 llvmpipe: clamp maxx,maxy to framebuffer size (in terms of tiles)
In some corner cases the right-most / bottom-most vertex can be
right on the edge of the framebuffer.  Because the maxx, maxy vals
are computed with a series of float/int, pixel/tile transformations
we can end up with maxx >= scene->x_tiles or maxy >= scene->y_tiles.
This leads to putting data into bins that never get processed, or
reset.  This becomes stale data that can lead to segfaults.

Clamping fixes this.
2010-01-12 17:08:07 -07:00
Keith Whitwell 094525fb23 llvmpipe: remove opencoded constant 2010-01-11 11:06:15 +00:00
José Fonseca 080c40ab32 Merge remote branch 'origin/master' into lp-binning
Conflicts:
	src/gallium/auxiliary/util/u_surface.c
	src/gallium/drivers/llvmpipe/Makefile
	src/gallium/drivers/llvmpipe/SConscript
	src/gallium/drivers/llvmpipe/lp_bld_arit.c
	src/gallium/drivers/llvmpipe/lp_bld_flow.c
	src/gallium/drivers/llvmpipe/lp_bld_interp.c
	src/gallium/drivers/llvmpipe/lp_clear.c
	src/gallium/drivers/llvmpipe/lp_context.c
	src/gallium/drivers/llvmpipe/lp_context.h
	src/gallium/drivers/llvmpipe/lp_draw_arrays.c
	src/gallium/drivers/llvmpipe/lp_jit.c
	src/gallium/drivers/llvmpipe/lp_jit.h
	src/gallium/drivers/llvmpipe/lp_prim_vbuf.c
	src/gallium/drivers/llvmpipe/lp_setup.c
	src/gallium/drivers/llvmpipe/lp_setup_point.c
	src/gallium/drivers/llvmpipe/lp_state.h
	src/gallium/drivers/llvmpipe/lp_state_blend.c
	src/gallium/drivers/llvmpipe/lp_state_derived.c
	src/gallium/drivers/llvmpipe/lp_state_fs.c
	src/gallium/drivers/llvmpipe/lp_state_sampler.c
	src/gallium/drivers/llvmpipe/lp_state_surface.c
	src/gallium/drivers/llvmpipe/lp_tex_cache.c
	src/gallium/drivers/llvmpipe/lp_tex_cache.h
	src/gallium/drivers/llvmpipe/lp_tex_sample.h
	src/gallium/drivers/llvmpipe/lp_tile_cache.c
2010-01-08 15:42:57 +00:00
Brian Paul ab94381930 llvmpipe: do final the pixel in/out triangle test in the fragment shader
The test to determine which of the pixels in a 2x2 quad is now done in
the fragment shader rather than in the calling C code.  This is a little
faster but there's a few more things to do.

Note that the step[] array elements are in a different order now.  Rather
than being in row-major order for the 4x4 grid, they're in "quad-major"
order.  The setup of the step arrays is a little more complicated now.
So is the course/intermediate tile test code, but some lookup tables
help with that.

Next steps:
 - early-cull 2x2 quads which are totally outside the triangle.
 - skip the in/out test for fully contained quads
 - make the in/out comparison code tighter/faster.
2009-12-16 16:10:05 -07:00
Keith Whitwell 663750d556 llvmpipe: rename bins to scene
It was pretty confusing having an entity named "bin" and another named
"bins", not least because sometimes there was a need to talk about >1
of the "bins" objects, which couldn't be pluralized any further...

Scene is a term used in a bunch of places to talk about what a binner
operates on, so it's a decent choice here.
2009-12-13 18:17:25 +00:00
Brian Paul 22b07b8be4 llvmpipe: use new lp_setup_get_current_bins() function
This stub function will interface to the queue system...
2009-12-09 12:28:59 -07:00
Brian Paul 01b1900084 llvmpipe: reorganization of binning data structions and funtions
New lp_bins struct contains all bin information.
More move bin-related code into lp_bin.[ch]
Use new/updated bin-access functions to hide implementation details.
The result is more/cleaner separation between the setup and rast components.
This will make double-buffering of the bins easier, etc.
2009-12-04 15:31:09 -07:00
Brian Paul d9dc3d5976 llvmpipe: move bin-related structures and functions into new lp_bin.[ch]
And put lp_ prefixes on some functions.
2009-12-04 12:54:37 -07:00
Brian Paul 5c7d1b592a llvmpipe: remove lp_rast_triangle::oneoverarea field
Makes lp_rast_triangle a little smaller (now 280 bytes on a 32-bit system).
2009-12-04 11:58:26 -07:00
Brian Paul b1659b9213 llvmpipe: bin state-change commands
Previously, each triangle had a pointer to the state to use for shading.
Now we insert state-change commands into the bins.  When we execute one
of those commands we just update a 'current state' pointer and use that
pointer when calling the jit shader.

When inserting state-change commands into a bin we check if the previous
command was also a state-change command and simply replace it.  This
avoids accumulating useless/redundant state-change commands.
2009-12-04 11:50:43 -07:00
Brian Paul 1796ffd3bc llvmpipe: fix typo, whitespace 2009-12-04 09:19:09 -07:00
Brian Paul 04e12e31b2 llvmpipe: dynamic allocation of triangle a0/dadx/dady arrays
Much less memory per triangle now.
2009-12-04 09:14:42 -07:00
Brian Paul 30c122a4c9 llvmpipe: new comment in do_triangle_ccw() 2009-12-03 17:27:10 -07:00
Brian Paul 7505510c7b llvmpipe: add a bunch of comments 2009-11-30 14:02:01 -07:00
Keith Whitwell 694f05ac18 llvmpipe: remove one of two definitions of TILESIZE 2009-10-21 15:21:11 +01:00
Keith Whitwell 341edde1d2 llvmpipe: remove dead code 2009-10-21 14:35:54 +01:00
Keith Whitwell cccb184209 llvmpipe: minor opts to setup_tri 2009-10-20 10:11:52 +01:00
Keith Whitwell 7b116e13a2 llvmpipe: pass mask as a linear encoding of the 4x4 block 2009-10-20 03:17:17 +01:00
Keith Whitwell 7670628061 llvmpipe: precalculate some offsets 2009-10-20 02:46:00 +01:00