Commit Graph

121 Commits

Author SHA1 Message Date
Brian Paul
5cbff0932e st/mesa: free the temporary bitmap/drawpix shader code
Fixes a per-shader memory leak when drawing glBitmaps, glDrawPixels
or glCopyPixels.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-08 08:10:22 -07:00
Vinson Lee
edc09358f7 st/mesa: Include mfeatures.h in files that perform feature tests. 2011-01-09 01:04:19 -08:00
Brian Paul
c94996f057 st/mesa: skip glDrawPixels/glBitmap-related code for ES build
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=32560
2011-01-04 08:28:17 -07:00
Dave Airlie
07498075b5 mesa/st: set the color write cbuf property for fragColor writes 2010-12-24 07:19:58 +10:00
Brian Paul
aa5ba96d29 st/mesa: s/varient/variant 2010-12-16 10:18:23 -07:00
Brian Paul
a8ca30bc58 st/mesa: fix incorrect prev pointer in destroy_program_variants() 2010-12-14 14:15:22 -07:00
Brian Paul
68c41a25b4 st/mesa: rename the varient release functions 2010-12-14 12:17:10 -07:00
Brian Paul
c21807d2f7 st/mesa: add geom program code in destroy_program_variants() 2010-12-13 17:29:56 -07:00
Brian Paul
4312569410 st/mesa: use st_fragment_program() instead of cast 2010-12-13 17:25:29 -07:00
Brian Paul
83d50c3ee1 st/mesa: minor re-indenting 2010-12-13 17:20:56 -07:00
Brian Paul
3d203b6100 Squashed commit of the following (st-mesa-per-context-shaders branch):
commit 4f106f44a32eaddb6cf3fea6ba5ee9787bff609a
Author: Brian Paul <brianp@vmware.com>
Date:   Mon Dec 13 14:06:08 2010 -0700

    st/mesa: reorganize vertex program translation code

    Now it looks like the fragment and geometry program code.
    Also remove the serial number fields from programs.  It was used to
    determine when new translations were needed.  Now the variant key is
    used for that.  And the st_program_string_notify() callback removes all
    variants when the program's code is changed.

commit e12d6791c5e4bff60bb2e6c04414b1b4d1325f3e
Author: Brian Paul <brianp@vmware.com>
Date:   Mon Dec 13 13:38:12 2010 -0700

    st/mesa: implement geometry shader varients

    Only needed in order to support per-context gallium shaders.

commit c5751c673644808ab069259a852f24c4c0e92b9d
Author: Brian Paul <brianp@vmware.com>
Date:   Sun Dec 12 15:28:57 2010 -0700

    st/mesa: restore glDraw/CopyPixels using new fragment program variants

    Clean up the logic for fragment programs for glDraw/CopyPixels.  We now
    generate fragment program variants for glDraw/CopyPixels as needed which
    do texture sampling, pixel scale/bias, pixelmap lookups, etc.

commit 7b0bb99bab6547f503a0176b5c0aef1482b02c97
Author: Brian Paul <brianp@vmware.com>
Date:   Fri Dec 10 17:03:23 2010 -0700

    st/mesa: checkpoint: implement fragment program variants

    The fragment programs variants are per-context, as the vertex programs.

    NOTE: glDrawPixels is totally broken at this point.

commit 2cc926183f957f8abac18d71276dd5bbd1f27be2
Author: Brian Paul <brianp@vmware.com>
Date:   Fri Dec 10 14:59:32 2010 -0700

    st/mesa: make vertex shader variants per-context

    Gallium shaders are per-context but OpenGL shaders aren't.  So we need
    to make a different variant for each context.

    During context tear-down we need to walk over all shaders/programs and
    free all variants for the context being destroyed.
2010-12-13 17:20:53 -07:00
Marek Olšák
c0c929cdac st/mesa: initialize key in st_vp_varient
This fixes endless vertex shader recompilations in find_translated_vp
if the shader contains an edge flag output.

NOTE: This is a candidate for the 7.9 branch.

Signed-off-by Brian Paul <brianp@vmware.com>
2010-12-05 17:38:19 +01:00
Vinson Lee
a54ab4960b st/mesa: Silence uninitialized variable warning.
Fixes this GCC warning.
state_tracker/st_program.c: In function 'st_print_shaders':
state_tracker/st_program.c:735: warning: 'sh' may be used uninitialized in this function
2010-10-28 06:08:19 -07:00
Ian Romanick
84eba3ef71 Track separate programs for each stage
The assumption is that all stages are the same program or that
varyings are passed between stages using built-in varyings.
2010-10-27 13:35:53 -07:00
Kristian Høgsberg
f9995b3075 Drop GLcontext typedef and use struct gl_context instead 2010-10-13 09:43:25 -04:00
Dave Airlie
ef8bb7ada9 st/mesa: use shader stencil export to accelerate shader drawpixels.
If the pipe driver has shader stencil export we can accelerate DrawPixels
using it. It tries to pick an S8 texture and works its way to X24S8 and S8X24
if that isn't supported.
2010-10-13 09:30:04 +10:00
Brian Paul
e22e3927b0 gallium: rework handling of sprite_coord_enable state
Implement the pipe_rasterizer_state::sprite_coord_enable field
in the draw module (and softpipe) according to what's specified
in the documentation.

The draw module can now add any number of extra vertex attributes
to a post-transformed vertex and generate texcoords for those
attributes per sprite_coord_enable.  Auto-generated texcoords
for sprites only worked for one texcoord unit before.

The frag shader gl_PointCoord input is now implemented like any
other generic/texcoord attribute.

The draw module now needs to be informed about fragment shaders
since we need to look at the fragment shader's inputs to know
which ones need auto-generated texcoords.

Only softpipe has been updated so far.
2010-09-17 18:45:13 -06:00
Marek Olšák
83baa8a6c5 st/mesa: remove output register reads inside shaders
This is a GLSL2 regression fix.
2010-08-16 02:19:18 +02:00
Vinson Lee
1b8aa2176c st/mesa: Clean up header file inclusion in st_mesa_to_tgsi.h.
st_mesa_to_tgsi.h
Replace tgsi_ureg.h with a forward declaration.
Include p_compiler.h for ubyte symbol.

st_program.c
Include tgsi_ureg.h directly.
2010-08-05 17:15:25 -07:00
Zack Rusin
425870c5fd mesa: get the translation from mesa 2d regs to tgsi working
first working version of arb_geometry_shader4
2010-07-10 02:02:35 -04:00
Zack Rusin
7c42390453 gs: inject const int gl_VerticesIn at link time 2010-07-08 00:28:29 -04:00
Zack Rusin
0d68d01347 mesa: make the arguments in the asm statemants optional
geometry shaders emit/end functions don't take any arguments
2010-06-29 21:45:41 -04:00
Zack Rusin
da7bd6a90e mesa: initial support for ARB_geometry_shader4
laying down the foundation for everything and implementing most of the
stuff.
linking, gl_VerticesIn and multidimensional inputs are left.
2010-06-28 22:53:21 -04:00
Brian Paul
ec2b92f98c mesa: rename src/mesa/shader/ to src/mesa/program/ 2010-06-10 23:23:13 -06:00
Chia-I Wu
d9f38e1a71 st/mesa: Do not use draw module in OpenGL ES build.
This removes references to symbols in draw module for OpenGL ES build.
As OpenGL ES does not support feedback/selection mode, draw module is
used in pathes that will never be reached.  However, if the symbols are
referenced, it will bloat the final shared libraries unnecessarily.
This is serious when LLVM is enabled.
2010-05-12 15:46:28 +08:00
Brian Paul
ce0844b44c st/mesa: move/improve Mesa GPU program debugging
Print the program (plus its parameters) before calling
st_translate_mesa_program() in case we die in that function.
2010-04-28 10:24:58 -06:00
Ben Skeggs
b46750d601 st/mesa: use BITFIELD64_BIT to access shader OutputsWritten in more places 2010-03-31 23:34:30 +10:00
Vinson Lee
b7eed19efe st/mesa: Fix memory leak on out-of-memory error path. 2010-02-21 15:10:50 -08:00
Brian Paul
e90bc2e2ce st/mesa: move per-fragment shader fields to local vars 2010-02-14 21:57:14 -07:00
Brian Paul
b9b4e7724e st/mesa: rename state -> tgsi, updated comments 2010-02-12 15:42:10 -07:00
Brian Paul
dd98a979b6 st/mesa: remove special-case cyl-wrap code
Cylinder wrap mode works with perspective interpolation now.
2010-02-09 15:32:56 +01:00
Brian Paul
ae4dde6598 st/mesa: check for PROG_PARAM_BIT_CYL_WRAP flag 2010-02-09 15:32:43 +01:00
Brian Paul
f1d544d6a6 st/mesa: 'fix' point coord semantic info
This fixes the progs/glsl/pointcoord.c demo.  But this isn't a proper fix.
We really need a TGSI_SEMANTIC_POINT_COORD label so that the draw module
can determine which fragment input / vertex output slot needs to be set
up with the point coordinate info.  We've been using generic slot 0 so far.

This would also require telling the draw module about fragment shaders
(something it doesn't have at this time).
2010-02-05 10:00:00 -07:00
Keith Whitwell
e1906ae98e st/mesa: remove duplicate calculation of fp input mapping
This was being calculated the same way in two different places.
Now just do it in st_translate_fragment_program().
2010-02-01 20:42:34 +00:00
Keith Whitwell
d51b04320d st/mesa: remove dead stfp input_map array
Was being calculated and not used.  Also was probably incorrect...
2010-02-01 20:33:53 +00:00
Jakob Bornecrantz
b01ffb12ed Merge branch 'mesa_7_7_branch'
Conflicts:
	src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
	src/gallium/auxiliary/util/Makefile
	src/gallium/drivers/r300/r300_state_derived.c
2010-01-14 22:31:04 +00:00
Vinson Lee
252812bf15 st/mesa: Remove unnecessary header from st_program.c. 2010-01-13 23:28:00 -08:00
Roland Scheidegger
35e8283c69 Merge branch 'gallium-edgeflags'
Conflicts:
	src/mesa/state_tracker/st_draw.c
2009-12-22 20:54:26 +01:00
Brian Paul
9eb7fc6661 Merge branch 'mesa_7_7_branch'
Conflicts:
	src/mesa/main/version.h
	src/mesa/state_tracker/st_atom_shader.c
2009-12-21 18:35:54 -07:00
Roland Scheidegger
9d938e29f2 fix debug output mising from edgeflag changes 2009-12-18 16:09:32 +01:00
Roland Scheidegger
890809d71b gallium: fix mesa to tgsi translation for edgeflags
test apps (progs/trivial/tri-edgeflags and similar) seem to work now
2009-12-18 15:54:28 +01:00
Roland Scheidegger
50caff5675 gallium: edgeflags change fixes
use correct number of vertex inputs
fix not running pipeline in case of edgeflags
changes to mesa to tgsi translation still very broken
2009-12-16 22:12:16 +01:00
Roland Scheidegger
a0127b6ced gallium: more work for edgeflags changes
fixes, cleanups, etc.
not working yet
2009-12-14 18:36:33 +01:00
Keith Whitwell
a08e348a84 gallium: first steps to treat edgeflags as regular vertex element
The idea here is to eliminate the set_edgeflags() call in pipe_context
by treating edgeflags as a regular vertex element.

Edgeflags provoke special treatment in hardware, which means we need to
label them in some way, in this case we'll be passing them through the
vertex shader and labelling the vertex shader output with a new TGSI
semantic (TGSI_SEMANTIC_EDGEFLAG).
2009-12-09 19:03:10 +01:00
Keith Whitwell
325f045c04 st/mesa: move assert on nr vs insns until after pos_invarient expansion
It is possible to have a 1-instruction vertex shader before expanding
pos_invarient.  Not sure what this assert achieved, but at least move
it where it is correct.
2009-12-18 18:39:44 +00:00
Brian Paul
8468234bfa st/mesa: fix up comment 2009-12-07 08:59:38 -07:00
Roland Scheidegger
4dcdf3b9c6 Merge commit 'origin/st-shader-varients'
Conflicts:
	src/mesa/state_tracker/st_atom_shader.c
	src/mesa/state_tracker/st_program.c
2009-11-26 01:15:25 +01:00
Ian Romanick
5606dfb572 Merge branch 'outputswritten64'
Add a GLbitfield64 type and several macros to operate on 64-bit
fields.  The OutputsWritten field of gl_program is changed to use that
type.  This results in a fair amount of fallout in drivers that use
programs.

No changes are strictly necessary at this point as all bits used are
below the 32-bit boundary.  Fairly soon several bits will be added for
clip distances written by a vertex shader.  This will cause several
bits used for varyings to be pushed above the 32-bit boundary.  This
will affect any drivers that support GLSL.

At this point, only the i965 driver has been modified to support this
eventuality.

I did this as a "squash" merge.  There were several places through the
outputswritten64 branch where things were broken.  I foresee this
causing difficulties later for bisecting.  The history is still
available in the branch.

Conflicts:
	src/mesa/drivers/dri/i965/brw_wm.h
2009-11-17 16:25:38 -08:00
Brian Paul
133501bef2 mesa: fix assorted compiler warnings 2009-11-17 16:16:30 -07:00
Keith Whitwell
07fafc7c93 mesa/st: refactor vertex and fragment shader translation
Translate vertex shaders independently of fragment shaders.

Previously tried to make fragment shader semantic indexes always start
at zero and exclude holes.  This was unnecessary but meant that vertex
shader translation had to be adjusted to take this into account.

Now use a fixed scheme for labelling special FS input semantics
(color, etc), and another fixed scheme for the generics.

With this, vertex shaders can be translated independently of the bound
fragment shader, assuming mesa has done its own job and ensured that
the vertex shader provides at least the inputs the fragment shader is
looking for.  The state-tracker didn't attempt to do anything about
this previously, so it shouldn't be needed now.
2009-11-15 11:23:30 -08:00