Commit Graph

47 Commits

Author SHA1 Message Date
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
Brian
6da9234fd4 New st_init_*_functions() to initialize the driver functions table.
We need to do these initializations before initializing the Mesa context
because context init involves creating texture/program/etc objects.
2007-08-06 20:53:28 +01:00
Brian
43d7c1fe9d Basic fragment programs run now.
Handling of constants might change.  For now, the st_fragment_program struct
contains a pipe_constant_buffer (not a pointer).
2007-07-24 12:27:38 -06:00
Keith Whitwell
4824c342c8 Trigger tgsi compilation for fragment programs.
Not sure the generated program looks correct though...
2007-07-19 20:24:55 +01:00
Keith Whitwell
6393cda676 Renamed softpipe directories and files to something less confusing.
softpipe/state_tracker --> state_tracker/
softpipe/              --> pipe/
softpipe/generic       --> pipe/softpipe/

I don't think pipe is a great name, but I disliked all the others too.
Luckily it's fairly easy to rename with git, so this can be revisited
later.
2007-06-14 18:11:48 +01:00