Commit Graph

31 Commits

Author SHA1 Message Date
Brian Paul
f1a59a6dd7 mesa: use new ST_CALLOC_STRUCT() macro in gallium state tracker 2009-02-12 10:14:36 -07:00
Brian Paul
1a2f4dd876 mesa: consistantly use mesa memory-functions in gallium state tracker
Use _mesa_malloc(), _mesa_free(), etc everywhere, not malloc(), free(), etc.
Still using CALLOC_STRUCT() at this point.
2009-02-12 10:11:55 -07:00
Brian Paul
8eb85f6f2a gallium: remove old assertions 2008-08-27 13:22:54 -06: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
dad8a7c90d gallium: fix a bug in vertex program output mapping
Need to translate VERT_RESULT_PSIZ, BFC0, BFC1 to TGSI shader output slots
after all other attributes have been handled.  This fixes a bug where
generic vertex program outputs (varying vars) could get mapped to the
same slot at point size or back-face colors.
2008-07-02 19:07:11 -06:00
Brian Paul
f763cc3cb5 gallium: don't free shader.tokens in get_passthrough_fs() 2008-05-08 19:32:49 -06:00
Brian Paul
1a82d9648b gallium: fix some render to texture bugs
Before, we were sometimes rendering into a stale texture because
st_finalize_texture() would discard the old texture and create a new one.

Moved st_update_framebuffer atom after texture validation so that we
can create a new renderbuffer surface if the texture changes.

Also, split texture validation into two parts: finalize_textures and
update_textures.  Do finalize_textures first to avoid getting into the
situtation where we're doing a pipe->surface_copy() mid-way through
state validation.

Some debug code still in place, but disabled...
2008-05-07 16:44:33 -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
54507125e7 Some changed for non-C99 compilers 2008-05-02 10:30:34 +00:00
Keith Whitwell
01dfa6cde1 use cso fs/vs handle functions 2008-04-21 20:52:54 +01:00
Michel Dänzer
65efe807b9 gallium: Use CSO cache for shaders. 2008-04-21 17:51:39 +01:00
Brian
a35c1ca3ad gallium: fix a few more shader-related mem leaks 2008-03-22 10:29:30 -06: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
6acd63a498 Code reorganization: update build.
Update the Makefiles and includes for the new paths.

Note that there hasn't been no separation of the Makefiles yet, and make is
jumping all over the place. That will be taken care shortly. But for now, make
should work. It was tested with linux and linux-dri. Linux-cell and linux-llvm
might require some minor tweaks.
2008-02-15 17:50:12 +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
86787043fa Fix problem in mapping vertex program outputs (found with "spring" game engine)
If the vertex program writes to an output that's not consumed by the
fragment program, map the vp output to an unused slot.
2008-01-31 14:05:04 -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
Brian
cedf6892e7 special-case PSIZE too 2007-12-19 13:16:36 -07:00
Brian
e785f190f0 Don't always declare frag shader INPUT[0] as fragment position.
We were doing this for the sake of softpipe and the tgsi intergrepter since
we always need the fragment position and W-coordinate information in order
to compute fragment interpolants.
But that's not appropriate for hardware drivers.
The tgsi interpreter now get x,y,w information from a separate tgsi_exec_vector
variable setup by softpipe.
The new pipe_shader_state->input_map[] defines how vert shader outputs map
to frag shader inputs.  It may go away though, since one can also examine
the semantic label on frag shader input[0] to figure things out.
2007-12-14 11:00:46 -07:00
Michal Krol
abd5e8e41d gallium: reorg tgsi directories. 2007-11-23 13:28:16 +00:00
Brian
cc0b55c242 simplify code which access the current vertex/fragment shaders 2007-10-29 09:25:00 -06:00
Brian
ef6940f172 Move mesa_to_tgsi.[ch] to state_tracker 2007-10-27 09:03:15 -06:00
Zack Rusin
a7e997cfc5 Get rid of ST_NEW_SHADER flag and the dependency on _NEW_PROGRAM
which is being hit all the time. Done by Keith really.
2007-10-03 10:33:38 -04:00
Brian
ca34912bf7 assert that program length > 1 (some code, plus END) 2007-10-02 16:57:19 -06:00
Brian
b13618c316 fix a few vert/frag program items to get i915 driver going again 2007-10-01 13:45:53 -06:00
Brian
ae7f200788 fix bug causing unnecessary translations 2007-09-28 20:31:24 -06: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
Brian
bad4e10af7 check for _NEW_PROGRAM mesa state (fixes arbfplight) 2007-09-26 15:34:51 -06:00
Brian
07f31a29b4 some clean-up of ST_NEW_ shader flags 2007-09-25 14:46:49 -06:00
Brian
07ef3e4245 vertex/fragment shader state and linking 2007-09-25 14:21:18 -06:00