Commit Graph

54 Commits

Author SHA1 Message Date
Brian Paul
68c41a25b4 st/mesa: rename the varient release functions 2010-12-14 12:17:10 -07:00
Brian Paul
b830b62a47 st/mesa: program struct comments 2010-12-13 17:28:02 -07:00
Brian Paul
6c669d0c07 st/mesa: rename variable 2010-12-13 17:25:10 -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
Kristian Høgsberg
f9995b3075 Drop GLcontext typedef and use struct gl_context instead 2010-10-13 09:43:25 -04:00
Vinson Lee
f717fd25cc st/mesa: Clean up header file inclusion in st_program.h.
st_program.h
Remove p_shader_tokens.h
Include st_context.h for st_context symbol.
Include p_state.h for PIPE_MAX_SHADER_INPUTS symbol.
Remove unnecessary forward declarations.

st_cb_bitmap.c
st_cb_clear.c
Include p_shader_tokens.h now that st_program.h doesn't include it.
2010-08-05 18:21:09 -07: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
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
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
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
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
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
Brian Paul
678f80b347 gallium: added st_print_shaders() function to help w/ debugging 2008-11-06 15:00:01 -07:00
Brian Paul
e3f3e22cf7 gallium: fix vertex program output translation/mapping bug
In some cases, the vertex program output's semantic info didn't match up
with the fragment program's input semantic info.  This info is now explicitly
passed into the st_translate_fragment_program() function.
2008-08-18 16:10:01 -06:00
Brian Paul
00eb309c31 gallium: move, increase ST_MAX_SHADER_TOKENS 2008-07-03 17:21:22 -06:00
Brian Paul
a56a59ce74 gallium: implement full reference counting for vertex/fragment programs
Use _mesa_reference_vert/fragprog() wherever we assign program pointers.
Fixes a memory corruption bug found with glean/api2 test.
Another memory bug involving shaders yet to be fixed...

Picked from gallium-0.1
2008-05-07 08:55:33 -06:00
Alan Hourihane
7e4bc84dfc inline -> INLINE 2008-05-02 10:31:46 +00:00
Brian Paul
33f3938d2d gallium: fix some bitmap frag shader issues
If texturing happens to be enabled when glBitmap() is called, need to be
careful about choosing a sampler unit, etc.
2008-04-22 18:43:05 -06:00
Brian Paul
b456f1374f gallium: st_translate_fragment_program() is void now
The return value was never used.
2008-04-22 14:44:07 -06:00
Keith Whitwell
01dfa6cde1 use cso fs/vs handle functions 2008-04-21 20:52:54 +01:00
Brian Paul
22a3d02254 gallium: free bitmap fragment shaders, misc clean-up 2008-03-24 11:56:05 -06:00
Brian Paul
fa9e7e9a8d gallium: remove semantic info from pipe_shader_state
Brian's patch to clean up the shader interfaces.
2008-03-13 18:10:26 +00:00
Brian
339e7ec680 gallium: rework CSO-related code in state tracker
Use the code in cso_context.c rather than st_cache.c.
Basically, binding of state objects now goes through the CSO module.
But Vertex/fragment shaders go through pipe->bind_fs/vs_state() since they're
not cached by the CSO module at this time.

Also, update softpipe driver to handle NULL state objects in various places.
This happens during context destruction.  May need to update other drivers...
2008-03-11 18:55:58 -06:00
Brian
ecd50ef58b gallium: remove input_map[] from pipe_shader_state 2008-02-26 08:43:07 -07:00
José Fonseca
f430d95a36 Use gallium's rtasm module. 2008-02-19 14:01:49 +09:00
Brian
9677336845 gallium: rename st_fragment_program's fs field to cso to match st_vertex_program 2008-02-12 16:10:11 -07:00
Brian
ac95fee4ff Fix problems with vertex shaders and the private draw module.
The CSO returned by pipe->create_vs_state() can't be passed to the
private draw module.  That was causing glRasterPos to blow up.
Add a 'draw_shader' field to st_vertex_program for use with the private
draw module.
Change st_context->state.vs type from cso_vertex_shader to st_vertex_program.
2008-01-14 19:13:34 -07:00
Michal Krol
abd5e8e41d gallium: reorg tgsi directories. 2007-11-23 13:28:16 +00:00
Brian
fa7a589876 Size of input_to_index array should be VERT_ATTRIB_MAX.
This fixes an out of bounds array write that was causing the glsl/bump demo to render incorrectly.
2007-10-10 10:33:38 -06:00
Michel Dänzer
344464bf2e Track fragment and vertex shader code generation via pipe shader state objects.
Unfortunately, the generated fragment shader code is effectively unusable until
it handles quad->mask.
2007-10-03 20:33:23 +02:00
Brian
636480cc9c Instead of linked program pairs, keep a list of vertex programs translated for each fragment program. 2007-09-28 15:39:39 -06:00
Zack Rusin
a1a989f0be Redoing the way we handle vertex shaders for the draw module. 2007-09-28 12:29:22 -04:00
Zack Rusin
901577e07f Revert "Redoing the way we handle vertex shaders for the draw module."
This reverts commit 6dcfddb8e2.
2007-09-28 12:28:16 -04:00
Zack Rusin
6dcfddb8e2 Redoing the way we handle vertex shaders for the draw module. 2007-09-28 09:12:20 -04:00
Keith Whitwell
65e3af51ef Enable codegen based whenever __i386__ is defined. 2007-09-27 07:56:23 +01:00
Brian
40c543eb71 Translate mesa vertex/fragment programs to TGSI programs at same time to do proper linking.
Previously, programs were translated independently during validation.
The problem is the translation to TGSI format, which packs shader
input/outputs into continuous slots, depends on which vertex program is
being paired with which fragment shader.  Now, we look at the outputs
of the vertex program in conjunction with the inputs of the fragment shader
to be sure the attributes match up correctly.

The new 'linked_program_pair' class keeps track of the associations
between vertex and fragment shaders.  It's also the place where the TGSI
tokens are kept since they're no longer per-program state but per-linkage.

Still a few loose ends, like implementing some kind of hash/lookup table
for linked_program_pairs.
2007-09-25 14:29:11 -06:00
michal
c0dd02219d Enable SSE2 for FS. 2007-09-24 12:32:26 +01:00
Brian
086734502a Checkpoint: vertex attribute clean-up.
Remove/disable the attrib/slot mapping arrays in a few places.
Work in progress...
2007-09-20 13:43:23 -06:00
Zack Rusin
daf5b0f41b Switch fragment/vertex shaders to the new caching semantics.
Allow driver custom allocation within cached objects. The shaders
are currently twiced (by cso layer and by the program itself).
2007-09-20 07:50:33 -04:00
Brian
37cf13ed9a Checkpoint: replacement of TGSI_ATTRIB_x tokens with input/output semantics.
TGSI_ATTRIB_x tokens still present and used in a few places.
Expanded set of TGSI_SEMANTIC_x tokens for describing the meaning
of inputs/outputs.  These tokens are in a crude state ATM.
Lots of #if 0 / disabled code to be removed yet, etc...
Softpipe and i915 drivers should be in working condition but not heavily tested.
2007-09-19 18:53:59 -06:00
Brian
bb611c5f1f Checkpoint: rework shader input/output register mapping.
This is a step toward removing TGSI_ATTRIB_ tokens.
Basically, when translating Mesa programs to TGSI programs, pass in input and
output register re-maps, plus interpolation info.
There's some known breakage (cubemap.c) so more to be done...
2007-09-18 19:38:35 -06:00
Zack Rusin
ccd63b54cf Convert shader to an immutable state object. 2007-09-18 13:24:44 -04:00
Keith Whitwell
07d97e80e6 checkpoint in constant tracking rework 2007-08-25 22:01:32 +01:00
michal
4fd7bc00f0 Hook-up SSE2 to VS. 2007-08-24 17:51:12 +01:00
Keith Whitwell
c89502bb4e Fixup include paths after rename 2007-08-24 10:01:20 +01:00
Brian
c0bb4ba9e6 Rework of shader constant buffers.
They're now totally independent of the actual shaders.
Also, implemented in terms of pipe_buffer_handles/objects.
2007-08-22 12:26:46 -06:00
Brian
de653b4c9b Begin added vertex shader state/support.
Renamed pipe_fs_state to pipe_shader_state since it can be used for both
vertex and fragment shader info.
2007-08-16 13:33:43 -06:00