Commit Graph

97 Commits

Author SHA1 Message Date
Brian
e3ca92aa28 mesa: refactor: move _mesa_Bind/Gen/DeleteProgram() to arbprogram.c
No API-level functions now in program.c.
2008-07-21 20:33:42 -06:00
José Fonseca
18ec140ef2 mesa: Use appropriate unsigned/signed, float/integer types. 2008-06-24 11:34:46 +09:00
Brian Paul
65075da8c3 fix tempReg test in _mesa_combine_programs() 2008-05-19 16:07:10 -06:00
Brian Paul
b256273689 fix some additional program refcounting bugs
cherry-picked from master
2008-05-14 12:47:29 -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
Brian
5d1e73028a mesa: added _mesa_insert_instructions()
Also, use new _mesa_free_instructions() in a few places.
2008-04-07 11:23:43 -06:00
Brian Paul
72f2c55069 gallium: make sure to set the SamplersUsed field for bitmap/drawpixels shaders
Also, make sure that field is copied/updated in the program clone and combine functions.
Without this we weren't getting SAMP declarations in the TGSI shaders.
2008-04-04 11:20:44 -06:00
Brian Paul
cf7daba791 mesa: fix some issues in _mesa_combine_programs()
Use a temporay register to connect outputs of first program to inputs of
second program.
Also, fix bug in replace_registers(): didn't search/replace DstReg.
2008-03-25 12:30:05 -06:00
Brian
f8acc3965e use ctx->Driver.DeleteProgram() in a few more places 2008-03-22 10:27:55 -06:00
Brian
27cff4402e copy UsesKill state in _mesa_combine_programs() 2008-01-16 13:54:32 -07:00
Brian
1631a9513d free program caches 2008-01-01 10:21:21 -07:00
Brian
b26aae67f5 alloc caches for fixed-func vertex/fragment progs 2007-10-31 12:02:55 -06:00
Brian
fb9cf48259 fix InputsRead bug in _mesa_combine_programs() 2007-10-30 18:26:34 -06:00
Brian
1203f54686 make _mesa_combine_programs() params const 2007-10-30 11:32:52 -06:00
Brian
9ffd88911f Added _mesa_combine_programs() for concatenating two programs. 2007-10-30 11:32:52 -06:00
Brian
8fed2466e4 Re-implement GLSL texture sampler variables.
GLSL sampler variables indicate which texture unit to use for TEX instructions.
Previously, this was baked into the fragment/vertex program and couldn't be
readily changed once set.
Now, SamplerUnits[] array indicates which texture unit is to be used for
each sampler variable.  These values are set with glUniform1i().
This is extra state that must be passed to the fragment/vertex program
executor at runtime.
2007-10-26 19:19:51 -06:00
Brian
4477a01372 call ctx->Driver.NewProgram() instead of _mesa_new_program() 2007-07-24 09:57:26 -06:00
Brian
4cc2674aee fix instruction comment code 2007-04-21 10:05:05 -06:00
Brian
3493e867e9 free prog->Attributes in _mesa_delete_program() 2007-03-24 16:18:13 -06:00
Brian
12229f119d use _mesa_copy_instructions() 2007-03-22 09:11:26 -06:00
Brian
942ee02590 move GL_MESA_program_debug funcs to prog_debug.c 2007-02-09 15:40:00 -07:00
Brian
3209c3ed0d Implement vertex attribute binding.
Users can set explicit binding with glBindAttribLocation(), otherwise the
linker will allocate generic attribute slots.
2007-01-09 17:49:24 -07:00
Brian
21f99792a9 Moved NumTexInstructions, NumTexIndirections, etc. into gl_program since
they can now apply to vertex programs.
2007-01-09 11:00:21 -07:00
Brian
c9db223f90 move TexturesUsed[] into gl_program since vertex programs/shaders can use textures nowadays 2007-01-04 17:22:19 -07:00
Brian
2e76f0a846 check for null Parameters ptr in _mesa_clone_program() 2006-12-19 09:52:07 -07:00
Brian
0560d81ce9 Move many functions into new files. 2006-12-14 15:01:28 -07:00
Brian
b2a3a8554a New functions for cloning programs and parameter lists. 2006-12-14 13:56:58 -07:00
Brian
fe1d01cb39 Checkpoint of work for new GLSL compiler back-end. Lots of assorted changes. 2006-12-13 14:54:47 -07:00
Brian Paul
308b85f29f fix several program-related bugs (bug 9136) 2006-11-23 15:58:30 +00:00
Brian Paul
a4806c994e add STATE_INTERNAL_DRIVER, etc (Rune Petersen) 2006-11-17 15:23:32 +00:00
Brian Paul
fa941e4267 disable yesterday's _mesa_add_named_constant() change for now 2006-11-16 20:59:11 +00:00
Brian Paul
0c6723aee5 Add a size parameter to _mesa_add_unnamed_constant() and
_mesa_add_named_constant() to indicate vector size (1, 2, 3 or 4).
Always 4 for now...
2006-11-15 23:38:02 +00:00
Brian Paul
699a33ea77 Add new _mesa_lookup_parameter_constant() to search for a GLfloat4 constant
in a parameter list.
Use it in _mesa_add_named_constant() and _mesa_add_unnamed_constant() to
avoid duplication of identical constants.
2006-11-15 23:19:52 +00:00
Brian Paul
f49c0d0dfb Rename _mesa_IsProgram() to _mesa_IsProgramARB() to avoid collision with the
OpenGL 2.0 function of the same name.
2006-11-02 16:20:29 +00:00
Brian Paul
ef987aa1d7 minor clean-ups, simplifications and new comments 2006-10-31 19:53:03 +00:00
Brian Paul
a23e668d40 Move gl_vertex_program_machine struct out of mtypes.h and put into nvvertexec.h.
Massage nvvertexec.c code to work more like s_nvfragprog.c - another step
toward unifying vertex/fragment program execution.
2006-10-30 00:12:05 +00:00
Brian Paul
d6272e0617 Change _mesa_init_instruction() to initialize an array of instructions. 2006-10-29 18:03:16 +00:00
Brian Paul
8ed319796f special case END in _mesa_print_instruction() 2006-10-28 23:08:07 +00:00
Brian Paul
81968ec49d a step toward moving run-time vertex program state out of GLcontext 2006-10-10 22:45:50 +00:00
Brian Paul
39c4daa6bc Move the fp_machine struct into s_nvfragmprog.c since (except for program
debug) it's only used there.
2006-10-10 21:43:31 +00:00
Keith Whitwell
187f2cfb4a Add a new internal program parameter value STATE_TEXRECT_SCALE which
provides 1/width and 1/height of the active texture, useful for
implementing ARB_texture_rectangle support on hardware which only
supports ARB_npot-style texturing.
2006-09-20 14:30:22 +00:00
Keith Whitwell
5658810660 Export _mesa_print_alu_instruction() to allow drivers to roll their
own debug code for programs with driver-private opcodes.

Remove redundant loop in _mesa_num_inst_src_regs().
2006-09-20 12:57:54 +00:00
Brian Paul
58d080b025 Free vertex program TnlData, if any. Fixes a mem leak. 2006-08-25 19:46:31 +00:00
Brian Paul
a360bc31da Rearrange glBindProgram() code to do all error checking before changing
the binding.  Prevent a potential dangling pointer error.  SF Bug 1544507.
2006-08-25 17:18:56 +00:00
Brian Paul
9983a27cbe added _mesa_alloc_instructions() utility function 2006-08-25 15:13:25 +00:00
Brian Paul
77427a1e52 Cg tries to bind NV fragment programs to the GL_FRAGMENT_PROGRAM_ARB target
with glBindProgramARB().  I guess the GL_ARB_fragment_program specification
allows that, but Mesa didn't.
Relaxed the check with a new predicate function: compatible_program_targets().
2006-08-24 23:11:39 +00:00
Brian Paul
3b9b8de9b0 Added _mesa_realloc_instructions() utility function.
Fixed/updated comments for parameter list functions.
2006-08-24 21:57:36 +00:00
Brian Paul
4d12a05e6c Added _mesa_lookup_program() and _mesa_lookup_bufferobj() functions to avoid
a lot of casting elsewhere.
Use _mesa_lookup_texture() in tdfx driver, use _mesa_lookup_bufferobj() in r300
driver.
2006-08-23 23:10:14 +00:00
Brian Paul
122629f279 Some structure renaming. Prefix vertex/fragment-related structs with
"gl_" to match other structs.
2006-07-20 16:49:57 +00:00
Brian Paul
65a51c0d62 Roll _mesa_free_parameters() into calling function (the only caller).
Replace assert(0) with _mesa_warning().
Use new _mesa_align_realloc() function.
New comments, clean-ups.
2006-05-24 03:30:31 +00:00