summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-06-23 22:30:26 -0600
committerBrian Paul <[email protected]>2010-06-23 22:30:26 -0600
commitca12aefdacd22fb42e3f1d3852db4c12de886554 (patch)
treeb7462a02c678d3d755896c22a0f7f8387cb148c0 /src
parentf2122d47248e59a0f23c15d7f647d7e2072c8d79 (diff)
parentec2b92f98c2e7f161521b447cc1d9a36bce3707c (diff)
Merge branch 'shader-file-reorg'
1. Move all GL entrypoint functions and files into src/mesa/main/ This includes the ARB vp/vp, NV vp/fp, ATI fragshader and GLSL bits that were in src/mesa/shader/ 2. Move src/mesa/shader/slang/ to src/mesa/slang/ to reduce the tree depth 3. Rename src/mesa/shader/ to src/mesa/program/ since all the remaining files are concerned with GPU programs. 4. Misc code refactoring. In particular, I got rid of most of the GLSL-related ctx->Driver hook functions. None of the drivers used them. Conflicts: src/mesa/drivers/dri/i965/brw_context.c
Diffstat (limited to 'src')
-rw-r--r--src/mesa/Makefile4
-rw-r--r--src/mesa/Makefile.mgw4
-rw-r--r--src/mesa/SConscript96
-rw-r--r--src/mesa/drivers/common/driverfuncs.c10
-rw-r--r--src/mesa/drivers/common/meta.c6
-rw-r--r--src/mesa/drivers/dri/common/dri_metaops.c4
-rw-r--r--src/mesa/drivers/dri/i915/i915_fragprog.c10
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_line.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_point.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_tri.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_unfilled.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_util.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs_emit.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_optimize.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_util.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_fp.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_pass0.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/gen6_vs_state.c4
-rw-r--r--src/mesa/drivers/dri/i965/gen6_wm_state.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_fragshader.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c10
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_shader.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c12
-rw-r--r--src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c4
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c2
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.h2
-rw-r--r--src/mesa/drivers/dri/r600/r700_fragprog.c6
-rw-r--r--src/mesa/drivers/dri/r600/r700_oglprog.c2
-rw-r--r--src/mesa/drivers/dri/r600/r700_state.c4
-rw-r--r--src/mesa/drivers/dri/r600/r700_vertprog.c8
-rw-r--r--src/mesa/drivers/glslcompiler/glslcompiler.c4
-rw-r--r--src/mesa/main/api_exec.c12
-rw-r--r--src/mesa/main/arbprogram.c (renamed from src/mesa/shader/arbprogram.c)10
-rw-r--r--src/mesa/main/arbprogram.h (renamed from src/mesa/shader/arbprogram.h)4
-rw-r--r--src/mesa/main/atifragshader.c (renamed from src/mesa/shader/atifragshader.c)2
-rw-r--r--src/mesa/main/atifragshader.h (renamed from src/mesa/shader/atifragshader.h)0
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/dd.h54
-rw-r--r--src/mesa/main/dlist.c10
-rw-r--r--src/mesa/main/ffvertex_prog.c12
-rw-r--r--src/mesa/main/get.c2
-rw-r--r--src/mesa/main/nvprogram.c (renamed from src/mesa/shader/nvprogram.c)14
-rw-r--r--src/mesa/main/nvprogram.h (renamed from src/mesa/shader/nvprogram.h)0
-rw-r--r--src/mesa/main/shaderapi.c (renamed from src/mesa/shader/shader_api.c)1180
-rw-r--r--src/mesa/main/shaderapi.h166
-rw-r--r--src/mesa/main/shaderobj.c386
-rw-r--r--src/mesa/main/shaderobj.h (renamed from src/mesa/shader/shader_api.h)75
-rw-r--r--src/mesa/main/shaders.c932
-rw-r--r--src/mesa/main/shaders.h274
-rw-r--r--src/mesa/main/shared.c14
-rw-r--r--src/mesa/main/state.c4
-rw-r--r--src/mesa/main/texenvprogram.c14
-rw-r--r--src/mesa/main/texobj.c2
-rw-r--r--src/mesa/main/texparam.c2
-rw-r--r--src/mesa/main/texstate.c2
-rw-r--r--src/mesa/main/transformfeedback.c6
-rw-r--r--src/mesa/main/uniforms.c (renamed from src/mesa/shader/uniforms.c)435
-rw-r--r--src/mesa/main/uniforms.h158
-rw-r--r--src/mesa/program/.gitignore (renamed from src/mesa/shader/.gitignore)0
-rw-r--r--src/mesa/program/Makefile (renamed from src/mesa/shader/Makefile)0
-rw-r--r--src/mesa/program/arbprogparse.c (renamed from src/mesa/shader/arbprogparse.c)0
-rw-r--r--src/mesa/program/arbprogparse.h (renamed from src/mesa/shader/arbprogparse.h)0
-rw-r--r--src/mesa/program/descrip.mms (renamed from src/mesa/shader/descrip.mms)0
-rw-r--r--src/mesa/program/hash_table.c (renamed from src/mesa/shader/hash_table.c)0
-rw-r--r--src/mesa/program/hash_table.h (renamed from src/mesa/shader/hash_table.h)0
-rw-r--r--src/mesa/program/lex.yy.c (renamed from src/mesa/shader/lex.yy.c)363
-rw-r--r--src/mesa/program/nvfragparse.c (renamed from src/mesa/shader/nvfragparse.c)0
-rw-r--r--src/mesa/program/nvfragparse.h (renamed from src/mesa/shader/nvfragparse.h)0
-rw-r--r--src/mesa/program/nvvertparse.c (renamed from src/mesa/shader/nvvertparse.c)2
-rw-r--r--src/mesa/program/nvvertparse.h (renamed from src/mesa/shader/nvvertparse.h)0
-rw-r--r--src/mesa/program/prog_cache.c (renamed from src/mesa/shader/prog_cache.c)4
-rw-r--r--src/mesa/program/prog_cache.h (renamed from src/mesa/shader/prog_cache.h)0
-rw-r--r--src/mesa/program/prog_execute.c (renamed from src/mesa/shader/prog_execute.c)0
-rw-r--r--src/mesa/program/prog_execute.h (renamed from src/mesa/shader/prog_execute.h)0
-rw-r--r--src/mesa/program/prog_instruction.c (renamed from src/mesa/shader/prog_instruction.c)0
-rw-r--r--src/mesa/program/prog_instruction.h (renamed from src/mesa/shader/prog_instruction.h)0
-rw-r--r--src/mesa/program/prog_noise.c (renamed from src/mesa/shader/prog_noise.c)0
-rw-r--r--src/mesa/program/prog_noise.h (renamed from src/mesa/shader/prog_noise.h)0
-rw-r--r--src/mesa/program/prog_optimize.c (renamed from src/mesa/shader/prog_optimize.c)0
-rw-r--r--src/mesa/program/prog_optimize.h (renamed from src/mesa/shader/prog_optimize.h)0
-rw-r--r--src/mesa/program/prog_parameter.c (renamed from src/mesa/shader/prog_parameter.c)0
-rw-r--r--src/mesa/program/prog_parameter.h (renamed from src/mesa/shader/prog_parameter.h)0
-rw-r--r--src/mesa/program/prog_parameter_layout.c (renamed from src/mesa/shader/prog_parameter_layout.c)0
-rw-r--r--src/mesa/program/prog_parameter_layout.h (renamed from src/mesa/shader/prog_parameter_layout.h)0
-rw-r--r--src/mesa/program/prog_print.c (renamed from src/mesa/shader/prog_print.c)0
-rw-r--r--src/mesa/program/prog_print.h (renamed from src/mesa/shader/prog_print.h)0
-rw-r--r--src/mesa/program/prog_statevars.c (renamed from src/mesa/shader/prog_statevars.c)0
-rw-r--r--src/mesa/program/prog_statevars.h (renamed from src/mesa/shader/prog_statevars.h)0
-rw-r--r--src/mesa/program/prog_uniform.c (renamed from src/mesa/shader/prog_uniform.c)0
-rw-r--r--src/mesa/program/prog_uniform.h (renamed from src/mesa/shader/prog_uniform.h)0
-rw-r--r--src/mesa/program/program.c (renamed from src/mesa/shader/program.c)0
-rw-r--r--src/mesa/program/program.h (renamed from src/mesa/shader/program.h)0
-rw-r--r--src/mesa/program/program_lexer.l (renamed from src/mesa/shader/program_lexer.l)11
-rw-r--r--src/mesa/program/program_parse.tab.c (renamed from src/mesa/shader/program_parse.tab.c)16
-rw-r--r--src/mesa/program/program_parse.tab.h (renamed from src/mesa/shader/program_parse.tab.h)0
-rw-r--r--src/mesa/program/program_parse.y (renamed from src/mesa/shader/program_parse.y)16
-rw-r--r--src/mesa/program/program_parse_extra.c (renamed from src/mesa/shader/program_parse_extra.c)0
-rw-r--r--src/mesa/program/program_parser.h (renamed from src/mesa/shader/program_parser.h)0
-rw-r--r--src/mesa/program/programopt.c (renamed from src/mesa/shader/programopt.c)0
-rw-r--r--src/mesa/program/programopt.h (renamed from src/mesa/shader/programopt.h)0
-rw-r--r--src/mesa/program/symbol_table.c (renamed from src/mesa/shader/symbol_table.c)0
-rw-r--r--src/mesa/program/symbol_table.h (renamed from src/mesa/shader/symbol_table.h)0
-rw-r--r--src/mesa/shader/uniforms.h33
-rw-r--r--src/mesa/slang/descrip.mms (renamed from src/mesa/shader/slang/descrip.mms)0
-rw-r--r--src/mesa/slang/library/.gitignore (renamed from src/mesa/shader/slang/library/.gitignore)0
-rw-r--r--src/mesa/slang/library/Makefile (renamed from src/mesa/shader/slang/library/Makefile)4
-rw-r--r--src/mesa/slang/library/SConscript (renamed from src/mesa/shader/slang/library/SConscript)28
-rw-r--r--src/mesa/slang/library/slang_120_core.gc (renamed from src/mesa/shader/slang/library/slang_120_core.gc)0
-rw-r--r--src/mesa/slang/library/slang_builtin_120_common.gc (renamed from src/mesa/shader/slang/library/slang_builtin_120_common.gc)0
-rw-r--r--src/mesa/slang/library/slang_builtin_120_fragment.gc (renamed from src/mesa/shader/slang/library/slang_builtin_120_fragment.gc)0
-rw-r--r--src/mesa/slang/library/slang_common_builtin.gc (renamed from src/mesa/shader/slang/library/slang_common_builtin.gc)0
-rw-r--r--src/mesa/slang/library/slang_core.gc (renamed from src/mesa/shader/slang/library/slang_core.gc)0
-rw-r--r--src/mesa/slang/library/slang_fragment_builtin.gc (renamed from src/mesa/shader/slang/library/slang_fragment_builtin.gc)0
-rw-r--r--src/mesa/slang/library/slang_vertex_builtin.gc (renamed from src/mesa/shader/slang/library/slang_vertex_builtin.gc)0
-rw-r--r--src/mesa/slang/slang_builtin.c (renamed from src/mesa/shader/slang/slang_builtin.c)12
-rw-r--r--src/mesa/slang/slang_builtin.h (renamed from src/mesa/shader/slang/slang_builtin.h)2
-rw-r--r--src/mesa/slang/slang_codegen.c (renamed from src/mesa/shader/slang/slang_codegen.c)10
-rw-r--r--src/mesa/slang/slang_codegen.h (renamed from src/mesa/shader/slang/slang_codegen.h)0
-rw-r--r--src/mesa/slang/slang_compile.c (renamed from src/mesa/shader/slang/slang_compile.c)10
-rw-r--r--src/mesa/slang/slang_compile.h (renamed from src/mesa/shader/slang/slang_compile.h)0
-rw-r--r--src/mesa/slang/slang_compile_function.c (renamed from src/mesa/shader/slang/slang_compile_function.c)0
-rw-r--r--src/mesa/slang/slang_compile_function.h (renamed from src/mesa/shader/slang/slang_compile_function.h)0
-rw-r--r--src/mesa/slang/slang_compile_operation.c (renamed from src/mesa/shader/slang/slang_compile_operation.c)0
-rw-r--r--src/mesa/slang/slang_compile_operation.h (renamed from src/mesa/shader/slang/slang_compile_operation.h)0
-rw-r--r--src/mesa/slang/slang_compile_struct.c (renamed from src/mesa/shader/slang/slang_compile_struct.c)0
-rw-r--r--src/mesa/slang/slang_compile_struct.h (renamed from src/mesa/shader/slang/slang_compile_struct.h)0
-rw-r--r--src/mesa/slang/slang_compile_variable.c (renamed from src/mesa/shader/slang/slang_compile_variable.c)0
-rw-r--r--src/mesa/slang/slang_compile_variable.h (renamed from src/mesa/shader/slang/slang_compile_variable.h)0
-rw-r--r--src/mesa/slang/slang_emit.c (renamed from src/mesa/shader/slang/slang_emit.c)8
-rw-r--r--src/mesa/slang/slang_emit.h (renamed from src/mesa/shader/slang/slang_emit.h)0
-rw-r--r--src/mesa/slang/slang_ir.c (renamed from src/mesa/shader/slang/slang_ir.c)4
-rw-r--r--src/mesa/slang/slang_ir.h (renamed from src/mesa/shader/slang/slang_ir.h)0
-rw-r--r--src/mesa/slang/slang_label.c (renamed from src/mesa/shader/slang/slang_label.c)0
-rw-r--r--src/mesa/slang/slang_label.h (renamed from src/mesa/shader/slang/slang_label.h)2
-rw-r--r--src/mesa/slang/slang_link.c (renamed from src/mesa/shader/slang/slang_link.c)18
-rw-r--r--src/mesa/slang/slang_link.h (renamed from src/mesa/shader/slang/slang_link.h)0
-rw-r--r--src/mesa/slang/slang_log.c (renamed from src/mesa/shader/slang/slang_log.c)0
-rw-r--r--src/mesa/slang/slang_log.h (renamed from src/mesa/shader/slang/slang_log.h)0
-rw-r--r--src/mesa/slang/slang_mem.c (renamed from src/mesa/shader/slang/slang_mem.c)0
-rw-r--r--src/mesa/slang/slang_mem.h (renamed from src/mesa/shader/slang/slang_mem.h)0
-rw-r--r--src/mesa/slang/slang_print.c (renamed from src/mesa/shader/slang/slang_print.c)0
-rw-r--r--src/mesa/slang/slang_print.h (renamed from src/mesa/shader/slang/slang_print.h)0
-rw-r--r--src/mesa/slang/slang_simplify.c (renamed from src/mesa/shader/slang/slang_simplify.c)0
-rw-r--r--src/mesa/slang/slang_simplify.h (renamed from src/mesa/shader/slang/slang_simplify.h)0
-rw-r--r--src/mesa/slang/slang_storage.c (renamed from src/mesa/shader/slang/slang_storage.c)0
-rw-r--r--src/mesa/slang/slang_storage.h (renamed from src/mesa/shader/slang/slang_storage.h)0
-rw-r--r--src/mesa/slang/slang_typeinfo.c (renamed from src/mesa/shader/slang/slang_typeinfo.c)2
-rw-r--r--src/mesa/slang/slang_typeinfo.h (renamed from src/mesa/shader/slang/slang_typeinfo.h)0
-rw-r--r--src/mesa/slang/slang_utility.c (renamed from src/mesa/shader/slang/slang_utility.c)0
-rw-r--r--src/mesa/slang/slang_utility.h (renamed from src/mesa/shader/slang/slang_utility.h)0
-rw-r--r--src/mesa/slang/slang_vartable.c (renamed from src/mesa/shader/slang/slang_vartable.c)4
-rw-r--r--src/mesa/slang/slang_vartable.h (renamed from src/mesa/shader/slang/slang_vartable.h)0
-rw-r--r--src/mesa/sources.mak96
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c4
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c8
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c2
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c2
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c6
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c6
-rw-r--r--src/mesa/state_tracker/st_cb_drawtex.c4
-rw-r--r--src/mesa/state_tracker/st_cb_program.c14
-rw-r--r--src/mesa/state_tracker/st_context.c4
-rw-r--r--src/mesa/state_tracker/st_context.h2
-rw-r--r--src/mesa/state_tracker/st_debug.c2
-rw-r--r--src/mesa/state_tracker/st_draw.c2
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c4
-rw-r--r--src/mesa/state_tracker/st_program.c4
-rw-r--r--src/mesa/state_tracker/st_program.h2
-rw-r--r--src/mesa/swrast/s_atifragshader.c2
-rw-r--r--src/mesa/swrast/s_context.c4
-rw-r--r--src/mesa/swrast/s_context.h2
-rw-r--r--src/mesa/swrast/s_fragprog.c2
-rw-r--r--src/mesa/swrast/s_texcombine.c2
-rw-r--r--src/mesa/swrast/s_triangle.c2
-rw-r--r--src/mesa/tnl/t_vb_program.c6
192 files changed, 2357 insertions, 2435 deletions
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 4f81768924a..3e0f010671c 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -116,7 +116,7 @@ asm_subdirs:
######################################################################
# GLSL built-in library
glsl_builtin:
- (cd shader/slang/library && $(MAKE)) || exit 1 ;
+ (cd slang/library && $(MAKE)) || exit 1 ;
######################################################################
@@ -234,7 +234,7 @@ clean: clean-es1 clean-es2
-rm -f depend depend.bak libmesa.a libmesagallium.a
-rm -f drivers/*/*.o
-rm -f *.pc
- -rm -f shader/slang/library/*_gc.h
+ -rm -f slang/library/*_gc.h
-@cd drivers/dri && $(MAKE) clean
-@cd drivers/x11 && $(MAKE) clean
-@cd drivers/osmesa && $(MAKE) clean
diff --git a/src/mesa/Makefile.mgw b/src/mesa/Makefile.mgw
index b90384d04a7..fc0ff28d697 100644
--- a/src/mesa/Makefile.mgw
+++ b/src/mesa/Makefile.mgw
@@ -216,8 +216,8 @@ clean:
-$(call UNLINK,main/*.o)
-$(call UNLINK,math/*.o)
-$(call UNLINK,vbo/*.o)
- -$(call UNLINK,shader/*.o)
- -$(call UNLINK,shader/slang/*.o)
+ -$(call UNLINK,program/*.o)
+ -$(call UNLINK,slang/*.o)
-$(call UNLINK,sparc/*.o)
-$(call UNLINK,ppc/*.o)
-$(call UNLINK,swrast/*.o)
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 34b7f4e8b7c..79e9b4553b7 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -31,6 +31,8 @@ if env['platform'] != 'winddk':
'main/api_noop.c',
'main/api_validate.c',
'main/accum.c',
+ 'main/arbprogram.c',
+ 'main/atifragshader.c',
'main/attrib.c',
'main/arrayobj.c',
'main/blend.c',
@@ -73,6 +75,7 @@ if env['platform'] != 'winddk':
'main/mipmap.c',
'main/mm.c',
'main/multisample.c',
+ 'main/nvprogram.c',
'main/pixel.c',
'main/pixelstore.c',
'main/points.c',
@@ -83,7 +86,8 @@ if env['platform'] != 'winddk':
'main/remap.c',
'main/renderbuffer.c',
'main/scissor.c',
- 'main/shaders.c',
+ 'main/shaderapi.c',
+ 'main/shaderobj.c',
'main/shared.c',
'main/state.c',
'main/stencil.c',
@@ -104,6 +108,7 @@ if env['platform'] != 'winddk':
'main/texstate.c',
'main/texstore.c',
'main/transformfeedback.c',
+ 'main/uniforms.c',
'main/varray.c',
'main/version.c',
'main/viewport.c',
@@ -192,63 +197,58 @@ if env['platform'] != 'winddk':
'state_tracker/st_texture.c',
]
- shader_sources = [
- 'shader/arbprogparse.c',
- 'shader/arbprogram.c',
- 'shader/atifragshader.c',
- 'shader/hash_table.c',
- 'shader/lex.yy.c',
- 'shader/nvfragparse.c',
- 'shader/nvprogram.c',
- 'shader/nvvertparse.c',
- 'shader/program.c',
- 'shader/program_parse.tab.c',
- 'shader/program_parse_extra.c',
- 'shader/prog_cache.c',
- 'shader/prog_execute.c',
- 'shader/prog_instruction.c',
- 'shader/prog_noise.c',
- 'shader/prog_optimize.c',
- 'shader/prog_parameter.c',
- 'shader/prog_parameter_layout.c',
- 'shader/prog_print.c',
- 'shader/prog_statevars.c',
- 'shader/prog_uniform.c',
- 'shader/programopt.c',
- 'shader/symbol_table.c',
- 'shader/shader_api.c',
- 'shader/uniforms.c',
+ program_sources = [
+ 'program/arbprogparse.c',
+ 'program/hash_table.c',
+ 'program/lex.yy.c',
+ 'program/nvfragparse.c',
+ 'program/nvvertparse.c',
+ 'program/program.c',
+ 'program/program_parse.tab.c',
+ 'program/program_parse_extra.c',
+ 'program/prog_cache.c',
+ 'program/prog_execute.c',
+ 'program/prog_instruction.c',
+ 'program/prog_noise.c',
+ 'program/prog_optimize.c',
+ 'program/prog_parameter.c',
+ 'program/prog_parameter_layout.c',
+ 'program/prog_print.c',
+ 'program/prog_statevars.c',
+ 'program/prog_uniform.c',
+ 'program/programopt.c',
+ 'program/symbol_table.c',
]
slang_sources = [
- 'shader/slang/slang_builtin.c',
- 'shader/slang/slang_codegen.c',
- 'shader/slang/slang_compile.c',
- 'shader/slang/slang_compile_function.c',
- 'shader/slang/slang_compile_operation.c',
- 'shader/slang/slang_compile_struct.c',
- 'shader/slang/slang_compile_variable.c',
- 'shader/slang/slang_emit.c',
- 'shader/slang/slang_ir.c',
- 'shader/slang/slang_label.c',
- 'shader/slang/slang_link.c',
- 'shader/slang/slang_log.c',
- 'shader/slang/slang_mem.c',
- 'shader/slang/slang_print.c',
- 'shader/slang/slang_simplify.c',
- 'shader/slang/slang_storage.c',
- 'shader/slang/slang_typeinfo.c',
- 'shader/slang/slang_vartable.c',
- 'shader/slang/slang_utility.c',
+ 'slang/slang_builtin.c',
+ 'slang/slang_codegen.c',
+ 'slang/slang_compile.c',
+ 'slang/slang_compile_function.c',
+ 'slang/slang_compile_operation.c',
+ 'slang/slang_compile_struct.c',
+ 'slang/slang_compile_variable.c',
+ 'slang/slang_emit.c',
+ 'slang/slang_ir.c',
+ 'slang/slang_label.c',
+ 'slang/slang_link.c',
+ 'slang/slang_log.c',
+ 'slang/slang_mem.c',
+ 'slang/slang_print.c',
+ 'slang/slang_simplify.c',
+ 'slang/slang_storage.c',
+ 'slang/slang_typeinfo.c',
+ 'slang/slang_vartable.c',
+ 'slang/slang_utility.c',
]
mesa_sources = (
main_sources +
math_sources +
+ program_sources +
vbo_sources +
vf_sources +
statetracker_sources +
- shader_sources +
slang_sources
)
@@ -327,7 +327,7 @@ if env['platform'] != 'winddk':
# build dir) to the include path
env.Append(CPPPATH = [matypes[0].dir])
- SConscript('shader/slang/library/SConscript')
+ SConscript('slang/library/SConscript')
#
# Libraries
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index ca5eb5c7552..227710fb025 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -31,6 +31,7 @@
#include "main/mipmap.h"
#include "main/queryobj.h"
#include "main/renderbuffer.h"
+#include "main/shaderobj.h"
#include "main/texcompress.h"
#include "main/texformat.h"
#include "main/texgetimage.h"
@@ -51,8 +52,7 @@
#include "main/transformfeedback.h"
#endif
-#include "shader/program.h"
-#include "shader/shader_api.h"
+#include "program/program.h"
#include "tnl/tnl.h"
#include "swrast/swrast.h"
@@ -208,6 +208,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->DeleteArrayObject = _mesa_delete_array_object;
driver->BindArrayObject = NULL;
+ _mesa_init_shader_object_functions(driver);
+
#if FEATURE_EXT_transform_feedback
_mesa_init_transform_feedback_functions(driver);
#endif
@@ -231,10 +233,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->EndList = NULL;
driver->BeginCallList = NULL;
driver->EndCallList = NULL;
-
-
- /* XXX temporary here */
- _mesa_init_glsl_driver_functions(driver);
}
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 35255833821..c548e104203 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -34,6 +34,7 @@
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/imports.h"
+#include "main/arbprogram.h"
#include "main/arrayobj.h"
#include "main/blend.h"
#include "main/bufferobj.h"
@@ -51,7 +52,7 @@
#include "main/polygon.h"
#include "main/readpix.h"
#include "main/scissor.h"
-#include "main/shaders.h"
+#include "main/shaderapi.h"
#include "main/state.h"
#include "main/stencil.h"
#include "main/texobj.h"
@@ -61,8 +62,7 @@
#include "main/texstate.h"
#include "main/varray.h"
#include "main/viewport.h"
-#include "shader/program.h"
-#include "shader/arbprogram.h"
+#include "program/program.h"
#include "swrast/swrast.h"
#include "drivers/common/meta.h"
diff --git a/src/mesa/drivers/dri/common/dri_metaops.c b/src/mesa/drivers/dri/common/dri_metaops.c
index dfb7d640409..86e59a8e51c 100644
--- a/src/mesa/drivers/dri/common/dri_metaops.c
+++ b/src/mesa/drivers/dri/common/dri_metaops.c
@@ -26,6 +26,7 @@
*
**************************************************************************/
+#include "main/arbprogram.h"
#include "main/arrayobj.h"
#include "main/bufferobj.h"
#include "main/enable.h"
@@ -33,8 +34,7 @@
#include "main/texstate.h"
#include "main/varray.h"
#include "main/viewport.h"
-#include "shader/arbprogram.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "dri_metaops.h"
void
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index e60157f3777..f1505dc5e73 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -29,11 +29,11 @@
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/program.h"
-#include "shader/programopt.h"
-#include "shader/prog_print.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/program.h"
+#include "program/programopt.h"
+#include "program/prog_print.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c
index ceb62a31162..4b9117bb0b1 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_line.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_line.c
@@ -32,7 +32,7 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "intel_batchbuffer.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_point.c b/src/mesa/drivers/dri/i965/brw_clip_point.c
index 7f47634dca8..b994a32bc3b 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_point.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_point.c
@@ -32,7 +32,7 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "intel_batchbuffer.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c
index 916a99ea004..fd425b39ad6 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_tri.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c
@@ -32,7 +32,7 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "intel_batchbuffer.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
index f36d22fdbf8..afd93f8be0b 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
@@ -32,7 +32,7 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "intel_batchbuffer.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c b/src/mesa/drivers/dri/i965/brw_clip_util.c
index 2148bc8244a..9708d7e6186 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_util.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_util.c
@@ -33,7 +33,7 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "intel_batchbuffer.h"
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index d13b9ae298b..6d064b822e5 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -34,7 +34,6 @@
#include "main/api_noop.h"
#include "main/macros.h"
#include "main/simple_list.h"
-
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_draw.h"
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 6c0b79f7241..8196d8ca625 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -35,9 +35,9 @@
#include "main/context.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
#include "intel_batchbuffer.h"
#include "intel_regions.h"
#include "brw_context.h"
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index 3a32ad26c12..a6fcd832f7d 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -35,7 +35,7 @@
#include "brw_structs.h"
#include "brw_defines.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6))
#define BRW_GET_SWZ(swz, idx) (((swz) >> ((idx)*2)) & 0x3)
diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c
index 99a6f6be113..a01d5576f8c 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c
@@ -34,7 +34,7 @@
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "intel_batchbuffer.h"
#include "brw_defines.h"
diff --git a/src/mesa/drivers/dri/i965/brw_optimize.c b/src/mesa/drivers/dri/i965/brw_optimize.c
index e79b3ddea35..a364b158209 100644
--- a/src/mesa/drivers/dri/i965/brw_optimize.c
+++ b/src/mesa/drivers/dri/i965/brw_optimize.c
@@ -26,8 +26,8 @@
*/
#include "main/macros.h"
-#include "shader/program.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_print.h"
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_eu.h"
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index bd560acdadf..aeed24d4e14 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -31,10 +31,10 @@
#include "main/imports.h"
#include "main/enums.h"
-#include "shader/prog_parameter.h"
-#include "shader/program.h"
-#include "shader/programopt.h"
-#include "shader/shader_api.h"
+#include "main/shaderobj.h"
+#include "program/prog_parameter.h"
+#include "program/program.h"
+#include "program/programopt.h"
#include "tnl/tnl.h"
#include "brw_context.h"
diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h
index a0680a56f2c..e525c730d3f 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.h
+++ b/src/mesa/drivers/dri/i965/brw_sf.h
@@ -34,7 +34,7 @@
#define BRW_SF_H
-#include "shader/program.h"
+#include "program/program.h"
#include "brw_context.h"
#include "brw_eu.h"
diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c
index bba9249d1b4..1db2a210d45 100644
--- a/src/mesa/drivers/dri/i965/brw_util.c
+++ b/src/mesa/drivers/dri/i965/brw_util.c
@@ -31,7 +31,7 @@
#include "main/mtypes.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_parameter.h"
#include "brw_util.h"
#include "brw_defines.h"
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 3c12f11ea78..9a832af9a97 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -34,8 +34,8 @@
#include "brw_vs.h"
#include "brw_util.h"
#include "brw_state.h"
-#include "shader/prog_print.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_parameter.h"
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index 6493744f3eb..9338a6b7dbf 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -36,7 +36,7 @@
#include "brw_context.h"
#include "brw_eu.h"
-#include "shader/program.h"
+#include "program/program.h"
struct brw_vs_prog_key {
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 0b44deeb634..3b87fdcfc4a 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -31,9 +31,9 @@
#include "main/macros.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
#include "brw_context.h"
#include "brw_vs.h"
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index be9e415cb07..0250a68d292 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -31,7 +31,7 @@
#include "main/mtypes.h"
#include "main/texstore.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_parameter.h"
#include "brw_context.h"
#include "brw_state.h"
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index 277b6de4425..f40977fab8d 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -34,7 +34,7 @@
#define BRW_WM_H
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "brw_context.h"
#include "brw_eu.h"
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index d73c3915824..0bef874b887 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -37,9 +37,9 @@
#include "brw_wm.h"
#include "brw_util.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
/** An invalid texture target */
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index fe3c89b7212..575f89b17fa 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -1,7 +1,7 @@
#include "main/macros.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_optimize.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_optimize.h"
#include "brw_context.h"
#include "brw_eu.h"
#include "brw_wm.h"
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
index 60bd92ed223..05de85a957e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -32,7 +32,7 @@
#include "brw_context.h"
#include "brw_wm.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_parameter.h"
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 77898dbbe72..17b016b569b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -32,7 +32,7 @@
#include "main/mtypes.h"
#include "main/texstore.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_parameter.h"
#include "intel_mipmap_tree.h"
#include "intel_batchbuffer.h"
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index 5916a139946..4080a9dedfd 100644
--- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -29,8 +29,8 @@
#include "brw_state.h"
#include "brw_defines.h"
#include "brw_util.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
#include "intel_batchbuffer.h"
static void
diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index ed1a72f03ba..863c85449d9 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -29,8 +29,8 @@
#include "brw_state.h"
#include "brw_defines.h"
#include "brw_util.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
#include "intel_batchbuffer.h"
static void
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 076fee89bdd..0e2fe893fed 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -26,6 +26,7 @@
**************************************************************************/
#include "main/glheader.h"
+#include "main/arbprogram.h"
#include "main/enums.h"
#include "main/image.h"
#include "main/colormac.h"
@@ -44,7 +45,6 @@
#include "main/attrib.h"
#include "main/enable.h"
#include "main/viewport.h"
-#include "shader/arbprogram.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
diff --git a/src/mesa/drivers/dri/r200/r200_fragshader.c b/src/mesa/drivers/dri/r200/r200_fragshader.c
index 85c1b7bdd19..2a9268dd343 100644
--- a/src/mesa/drivers/dri/r200/r200_fragshader.c
+++ b/src/mesa/drivers/dri/r200/r200_fragshader.c
@@ -26,11 +26,11 @@
**************************************************************************/
#include "main/glheader.h"
+#include "main/atifragshader.h"
#include "main/macros.h"
#include "main/enums.h"
#include "tnl/t_context.h"
-#include "shader/atifragshader.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "r200_context.h"
#include "r200_ioctl.h"
#include "r200_tex.h"
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index 12f869d96f8..5d268319f3f 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -33,11 +33,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
-#include "shader/programopt.h"
+#include "program/program.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
+#include "program/programopt.h"
#include "tnl/tnl.h"
#include "r200_context.h"
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index fbb609b9f61..99540e3354f 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -43,7 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_common.h"
#include "main/mtypes.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "compiler/radeon_code.h"
struct r300_context;
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 7be2f74b5b2..95f4306f604 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -38,8 +38,8 @@
#include "r300_fragprog_common.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
#include "compiler/radeon_compiler.h"
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c
index 9c24166ec5b..a9bddf05779 100644
--- a/src/mesa/drivers/dri/r300/r300_shader.c
+++ b/src/mesa/drivers/dri/r300/r300_shader.c
@@ -27,7 +27,7 @@
#include "main/glheader.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "tnl/tnl.h"
#include "r300_context.h"
#include "r300_fragprog_common.h"
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index fa33be49989..0113eecaa3a 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -49,8 +49,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "drivers/common/meta.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index a1fe3780294..67d8b2b3286 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -31,12 +31,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/program.h"
-#include "shader/programopt.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
+#include "program/program.h"
+#include "program/programopt.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
#include "tnl/tnl.h"
#include "compiler/radeon_compiler.h"
diff --git a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c
index 9f9dec840b4..471a3723cb9 100644
--- a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c
+++ b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c
@@ -28,8 +28,8 @@
#include "radeon_mesa_to_rc.h"
#include "main/mtypes.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
#include "compiler/radeon_compiler.h"
#include "compiler/radeon_program.h"
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index de5c5d89fea..88d6b06df56 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -32,7 +32,7 @@
#include "main/mtypes.h"
#include "main/imports.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_parameter.h"
#include "radeon_debug.h"
#include "r600_context.h"
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index 2d3c32487e6..dbc6cdb1903 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -28,7 +28,7 @@
#define _R700_ASSEMBLER_H_
#include "main/mtypes.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "r700_chip.h"
#include "r700_shaderinst.h"
diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c
index fbb808e0662..aab1a7947ab 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -32,9 +32,9 @@
#include <math.h>
#include "main/imports.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
-#include "shader/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
+#include "program/program.h"
#include "r600_context.h"
#include "r600_cmdbuf.h"
diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c
index b7124e644a3..83517925115 100644
--- a/src/mesa/drivers/dri/r600/r700_oglprog.c
+++ b/src/mesa/drivers/dri/r600/r700_oglprog.c
@@ -29,7 +29,7 @@
#include "main/glheader.h"
#include "main/imports.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "tnl/tnl.h"
#include "r600_context.h"
diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index ac64bbf874f..5ea8918611c 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -41,8 +41,8 @@
#include "main/framebuffer.h"
#include "drivers/common/meta.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
#include "vbo/vbo.h"
#include "r600_context.h"
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c
index 14dd2a5482c..32f538f1c37 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -35,14 +35,14 @@
#include "main/mtypes.h"
#include "tnl/t_context.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
#include "radeon_debug.h"
#include "r600_context.h"
#include "r600_cmdbuf.h"
-#include "shader/programopt.h"
+#include "program/programopt.h"
#include "r700_debug.h"
#include "r700_vertprog.h"
diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c
index d58f32b2930..5166600bed8 100644
--- a/src/mesa/drivers/glslcompiler/glslcompiler.c
+++ b/src/mesa/drivers/glslcompiler/glslcompiler.c
@@ -50,8 +50,8 @@
#include "main/extensions.h"
#include "main/framebuffer.h"
#include "main/shaders.h"
-#include "shader/shader_api.h"
-#include "shader/prog_print.h"
+#include "program/shader_api.h"
+#include "program/prog_print.h"
#include "drivers/common/driverfuncs.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 06df97dfede..37d1ba45060 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -34,9 +34,9 @@
#include "api_loopback.h"
#include "api_exec.h"
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-#include "shader/arbprogram.h"
+#include "arbprogram.h"
#endif
-#include "shader/atifragshader.h"
+#include "atifragshader.h"
#include "attrib.h"
#include "blend.h"
#if FEATURE_ARB_vertex_buffer_object
@@ -92,13 +92,14 @@
#include "varray.h"
#include "viewport.h"
#if FEATURE_NV_vertex_program
-#include "shader/nvprogram.h"
+#include "nvprogram.h"
#endif
#if FEATURE_NV_fragment_program
-#include "shader/nvprogram.h"
+#include "nvprogram.h"
#endif
#if FEATURE_ARB_shader_objects
-#include "shaders.h"
+#include "shaderapi.h"
+#include "uniforms.h"
#endif
#if FEATURE_ARB_sync
#include "syncobj.h"
@@ -347,6 +348,7 @@ _mesa_create_exec_table(void)
#if FEATURE_ARB_shader_objects
_mesa_init_shader_dispatch(exec);
+ _mesa_init_shader_uniform_dispatch(exec);
#endif
/* 2. GL_EXT_blend_color */
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/main/arbprogram.c
index 8c0b94488e8..26d781954ed 100644
--- a/src/mesa/shader/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -35,11 +35,11 @@
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
-#include "arbprogram.h"
-#include "arbprogparse.h"
-#include "nvfragparse.h"
-#include "nvvertparse.h"
-#include "program.h"
+#include "main/arbprogram.h"
+#include "program/arbprogparse.h"
+#include "program/nvfragparse.h"
+#include "program/nvvertparse.h"
+#include "program/program.h"
diff --git a/src/mesa/shader/arbprogram.h b/src/mesa/main/arbprogram.h
index df16513e398..787ffd62f4b 100644
--- a/src/mesa/shader/arbprogram.h
+++ b/src/mesa/main/arbprogram.h
@@ -27,6 +27,10 @@
#define ARBPROGRAM_H
+#include "compiler.h"
+#include "glheader.h"
+
+
extern void GLAPIENTRY
_mesa_BindProgram(GLenum target, GLuint id);
diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/main/atifragshader.c
index 21bb9589cb0..550f50b7a00 100644
--- a/src/mesa/shader/atifragshader.c
+++ b/src/mesa/main/atifragshader.c
@@ -29,7 +29,7 @@
#include "main/enums.h"
#include "main/mtypes.h"
#include "main/dispatch.h"
-#include "atifragshader.h"
+#include "main/atifragshader.h"
#if FEATURE_ATI_fragment_shader
diff --git a/src/mesa/shader/atifragshader.h b/src/mesa/main/atifragshader.h
index 31c335ec815..31c335ec815 100644
--- a/src/mesa/shader/atifragshader.h
+++ b/src/mesa/main/atifragshader.h
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e140a21b354..0afd77d3759 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -118,6 +118,7 @@
#include "remap.h"
#include "scissor.h"
#include "shared.h"
+#include "shaderobj.h"
#include "simple_list.h"
#include "state.h"
#include "stencil.h"
@@ -129,9 +130,8 @@
#include "version.h"
#include "viewport.h"
#include "vtxfmt.h"
-#include "shader/program.h"
-#include "shader/prog_print.h"
-#include "shader/shader_api.h"
+#include "program/program.h"
+#include "program/prog_print.h"
#if _HAVE_FULL_GL
#include "math/m_matrix.h"
#endif
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 53e44533cb3..825073ca886 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -828,54 +828,12 @@ struct dd_function_table {
* \name GLSL-related functions (ARB extensions and OpenGL 2.x)
*/
/*@{*/
- void (*AttachShader)(GLcontext *ctx, GLuint program, GLuint shader);
- void (*BindAttribLocation)(GLcontext *ctx, GLuint program, GLuint index,
- const GLcharARB *name);
- void (*CompileShader)(GLcontext *ctx, GLuint shader);
- GLuint (*CreateShader)(GLcontext *ctx, GLenum type);
- GLuint (*CreateProgram)(GLcontext *ctx);
- void (*DeleteProgram2)(GLcontext *ctx, GLuint program);
- void (*DeleteShader)(GLcontext *ctx, GLuint shader);
- void (*DetachShader)(GLcontext *ctx, GLuint program, GLuint shader);
- void (*GetActiveAttrib)(GLcontext *ctx, GLuint program, GLuint index,
- GLsizei maxLength, GLsizei * length, GLint * size,
- GLenum * type, GLcharARB * name);
- void (*GetActiveUniform)(GLcontext *ctx, GLuint program, GLuint index,
- GLsizei maxLength, GLsizei *length, GLint *size,
- GLenum *type, GLcharARB *name);
- void (*GetAttachedShaders)(GLcontext *ctx, GLuint program, GLsizei maxCount,
- GLsizei *count, GLuint *obj);
- GLint (*GetAttribLocation)(GLcontext *ctx, GLuint program,
- const GLcharARB *name);
- GLuint (*GetHandle)(GLcontext *ctx, GLenum pname);
- void (*GetProgramiv)(GLcontext *ctx, GLuint program,
- GLenum pname, GLint *params);
- void (*GetProgramInfoLog)(GLcontext *ctx, GLuint program, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
- void (*GetShaderiv)(GLcontext *ctx, GLuint shader,
- GLenum pname, GLint *params);
- void (*GetShaderInfoLog)(GLcontext *ctx, GLuint shader, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
- void (*GetShaderSource)(GLcontext *ctx, GLuint shader, GLsizei maxLength,
- GLsizei *length, GLcharARB *sourceOut);
- void (*GetUniformfv)(GLcontext *ctx, GLuint program, GLint location,
- GLfloat *params);
- void (*GetUniformiv)(GLcontext *ctx, GLuint program, GLint location,
- GLint *params);
- GLint (*GetUniformLocation)(GLcontext *ctx, GLuint program,
- const GLcharARB *name);
- GLboolean (*IsProgram)(GLcontext *ctx, GLuint name);
- GLboolean (*IsShader)(GLcontext *ctx, GLuint name);
- void (*LinkProgram)(GLcontext *ctx, GLuint program);
- void (*ShaderSource)(GLcontext *ctx, GLuint shader, const GLchar *source);
- void (*Uniform)(GLcontext *ctx, GLint location, GLsizei count,
- const GLvoid *values, GLenum type);
- void (*UniformMatrix)(GLcontext *ctx, GLint cols, GLint rows,
- GLint location, GLsizei count,
- GLboolean transpose, const GLfloat *values);
- void (*UseProgram)(GLcontext *ctx, GLuint program);
- void (*ValidateProgram)(GLcontext *ctx, GLuint program);
- /* XXX many more to come */
+ struct gl_shader *(*NewShader)(GLcontext *ctx, GLuint name, GLenum type);
+ void (*DeleteShader)(GLcontext *ctx, struct gl_shader *shader);
+ struct gl_shader_program *(*NewShaderProgram)(GLcontext *ctx, GLuint name);
+ void (*DeleteShaderProgram)(GLcontext *ctx,
+ struct gl_shader_program *shProg);
+ void (*UseProgram)(GLcontext *ctx, struct gl_shader_program *shProg);
/*@}*/
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 37a97513453..727414d529f 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -34,6 +34,9 @@
#include "api_arrayelt.h"
#include "api_exec.h"
#include "api_loopback.h"
+#if FEATURE_ATI_fragment_shader
+#include "atifragshader.h"
+#endif
#include "config.h"
#include "mfeatures.h"
#if FEATURE_ARB_vertex_buffer_object
@@ -56,13 +59,10 @@
#include "mtypes.h"
#include "varray.h"
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-#include "shader/arbprogram.h"
+#include "arbprogram.h"
#endif
#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
-#include "shader/nvprogram.h"
-#endif
-#if FEATURE_ATI_fragment_shader
-#include "shader/atifragshader.h"
+#include "nvprogram.h"
#endif
#include "math/m_matrix.h"
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 70ac47f36d7..92fec09bad0 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -38,12 +38,12 @@
#include "main/macros.h"
#include "main/enums.h"
#include "main/ffvertex_prog.h"
-#include "shader/program.h"
-#include "shader/prog_cache.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
+#include "program/program.h"
+#include "program/prog_cache.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
/** Max of number of lights and texture coord units */
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 03f2707f4f0..c121957aead 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -667,7 +667,7 @@ static const struct value_desc values[] = {
{ GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
offsetof(GLcontext, Const.Max3DTextureLevels), NO_EXTRA },
- /* GL_ARB_fragment_shader/OES_standard_derivatives */
+ /* GL_ARB_fragment_program/OES_standard_derivatives */
{ GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB,
CONTEXT_ENUM(Hint.FragmentShaderDerivative), extra_ARB_fragment_shader },
#endif /* FEATURE_GL || FEATURE_ES2 */
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/main/nvprogram.c
index 19020be42c7..100ff2c4ab8 100644
--- a/src/mesa/shader/nvprogram.c
+++ b/src/mesa/main/nvprogram.c
@@ -42,13 +42,13 @@
#include "main/hash.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "program.h"
-#include "prog_parameter.h"
-#include "prog_instruction.h"
-#include "nvfragparse.h"
-#include "nvvertparse.h"
-#include "arbprogparse.h"
-#include "nvprogram.h"
+#include "main/nvprogram.h"
+#include "program/arbprogparse.h"
+#include "program/nvfragparse.h"
+#include "program/nvvertparse.h"
+#include "program/program.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
diff --git a/src/mesa/shader/nvprogram.h b/src/mesa/main/nvprogram.h
index 8ee59661bd0..8ee59661bd0 100644
--- a/src/mesa/shader/nvprogram.h
+++ b/src/mesa/main/nvprogram.h
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/main/shaderapi.c
index c414e89825f..0bd44154f26 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/main/shaderapi.c
@@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 7.6
*
* Copyright (C) 2004-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ * Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -24,12 +23,13 @@
*/
/**
- * \file shader_api.c
- * Implementation of GLSL-related API functions
+ * \file shaderapi.c
* \author Brian Paul
- */
-
-/**
+ *
+ * Implementation of GLSL-related API functions.
+ * The glUniform* functions are in uniforms.c
+ *
+ *
* XXX things to do:
* 1. Check that the right error code is generated for all _mesa_error() calls.
* 2. Insert FLUSH_VERTICES calls in various places
@@ -38,337 +38,19 @@
#include "main/glheader.h"
#include "main/context.h"
+#include "main/dispatch.h"
#include "main/hash.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_uniform.h"
-#include "shader/shader_api.h"
-#include "shader/uniforms.h"
-#include "shader/slang/slang_compile.h"
-#include "shader/slang/slang_link.h"
-
-
-/**
- * Allocate a new gl_shader_program object, initialize it.
- */
-static struct gl_shader_program *
-_mesa_new_shader_program(GLcontext *ctx, GLuint name)
-{
- struct gl_shader_program *shProg;
- shProg = CALLOC_STRUCT(gl_shader_program);
- if (shProg) {
- shProg->Type = GL_SHADER_PROGRAM_MESA;
- shProg->Name = name;
- shProg->RefCount = 1;
- shProg->Attributes = _mesa_new_parameter_list();
- }
- return shProg;
-}
-
-
-/**
- * Clear (free) the shader program state that gets produced by linking.
- */
-void
-_mesa_clear_shader_program_data(GLcontext *ctx,
- struct gl_shader_program *shProg)
-{
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
-
- if (shProg->Uniforms) {
- _mesa_free_uniform_list(shProg->Uniforms);
- shProg->Uniforms = NULL;
- }
-
- if (shProg->Varying) {
- _mesa_free_parameter_list(shProg->Varying);
- shProg->Varying = NULL;
- }
-}
-
-
-/**
- * Free all the data that hangs off a shader program object, but not the
- * object itself.
- */
-void
-_mesa_free_shader_program_data(GLcontext *ctx,
- struct gl_shader_program *shProg)
-{
- GLuint i;
-
- assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
-
- _mesa_clear_shader_program_data(ctx, shProg);
-
- if (shProg->Attributes) {
- _mesa_free_parameter_list(shProg->Attributes);
- shProg->Attributes = NULL;
- }
-
- /* detach shaders */
- for (i = 0; i < shProg->NumShaders; i++) {
- _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL);
- }
- shProg->NumShaders = 0;
-
- if (shProg->Shaders) {
- free(shProg->Shaders);
- shProg->Shaders = NULL;
- }
-
- if (shProg->InfoLog) {
- free(shProg->InfoLog);
- shProg->InfoLog = NULL;
- }
-
- /* Transform feedback varying vars */
- for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
- free(shProg->TransformFeedback.VaryingNames[i]);
- }
- free(shProg->TransformFeedback.VaryingNames);
- shProg->TransformFeedback.VaryingNames = NULL;
- shProg->TransformFeedback.NumVarying = 0;
-}
-
-
-/**
- * Free/delete a shader program object.
- */
-void
-_mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
-{
- _mesa_free_shader_program_data(ctx, shProg);
-
- free(shProg);
-}
-
-
-/**
- * Set ptr to point to shProg.
- * If ptr is pointing to another object, decrement its refcount (and delete
- * if refcount hits zero).
- * Then set ptr to point to shProg, incrementing its refcount.
- */
-/* XXX this could be static */
-void
-_mesa_reference_shader_program(GLcontext *ctx,
- struct gl_shader_program **ptr,
- struct gl_shader_program *shProg)
-{
- assert(ptr);
- if (*ptr == shProg) {
- /* no-op */
- return;
- }
- if (*ptr) {
- /* Unreference the old shader program */
- GLboolean deleteFlag = GL_FALSE;
- struct gl_shader_program *old = *ptr;
-
- ASSERT(old->RefCount > 0);
- old->RefCount--;
-#if 0
- printf("ShaderProgram %p ID=%u RefCount-- to %d\n",
- (void *) old, old->Name, old->RefCount);
-#endif
- deleteFlag = (old->RefCount == 0);
-
- if (deleteFlag) {
- _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
- _mesa_free_shader_program(ctx, old);
- }
-
- *ptr = NULL;
- }
- assert(!*ptr);
-
- if (shProg) {
- shProg->RefCount++;
-#if 0
- printf("ShaderProgram %p ID=%u RefCount++ to %d\n",
- (void *) shProg, shProg->Name, shProg->RefCount);
-#endif
- *ptr = shProg;
- }
-}
-
-
-/**
- * Lookup a GLSL program object.
- */
-struct gl_shader_program *
-_mesa_lookup_shader_program(GLcontext *ctx, GLuint name)
-{
- struct gl_shader_program *shProg;
- if (name) {
- shProg = (struct gl_shader_program *)
- _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
- /* Note that both gl_shader and gl_shader_program objects are kept
- * in the same hash table. Check the object's type to be sure it's
- * what we're expecting.
- */
- if (shProg && shProg->Type != GL_SHADER_PROGRAM_MESA) {
- return NULL;
- }
- return shProg;
- }
- return NULL;
-}
-
-
-/**
- * As above, but record an error if program is not found.
- */
-struct gl_shader_program *
-_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name,
- const char *caller)
-{
- if (!name) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
- return NULL;
- }
- else {
- struct gl_shader_program *shProg = (struct gl_shader_program *)
- _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
- if (!shProg) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
- return NULL;
- }
- if (shProg->Type != GL_SHADER_PROGRAM_MESA) {
- _mesa_error(ctx, GL_INVALID_OPERATION, caller);
- return NULL;
- }
- return shProg;
- }
-}
+#include "main/shaderapi.h"
+#include "main/shaderobj.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_uniform.h"
+#include "slang/slang_compile.h"
+#include "slang/slang_link.h"
-
-
-/**
- * Allocate a new gl_shader object, initialize it.
- */
-struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
-{
- struct gl_shader *shader;
- assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
- shader = CALLOC_STRUCT(gl_shader);
- if (shader) {
- shader->Type = type;
- shader->Name = name;
- shader->RefCount = 1;
- }
- return shader;
-}
-
-
-void
-_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh)
-{
- if (sh->Source)
- free((void *) sh->Source);
- if (sh->InfoLog)
- free(sh->InfoLog);
- _mesa_reference_program(ctx, &sh->Program, NULL);
- free(sh);
-}
-
-
-/**
- * Set ptr to point to sh.
- * If ptr is pointing to another shader, decrement its refcount (and delete
- * if refcount hits zero).
- * Then set ptr to point to sh, incrementing its refcount.
- */
-/* XXX this could be static */
-void
-_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
- struct gl_shader *sh)
-{
- assert(ptr);
- if (*ptr == sh) {
- /* no-op */
- return;
- }
- if (*ptr) {
- /* Unreference the old shader */
- GLboolean deleteFlag = GL_FALSE;
- struct gl_shader *old = *ptr;
-
- ASSERT(old->RefCount > 0);
- old->RefCount--;
- /*printf("SHADER DECR %p (%d) to %d\n",
- (void*) old, old->Name, old->RefCount);*/
- deleteFlag = (old->RefCount == 0);
-
- if (deleteFlag) {
- _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
- _mesa_free_shader(ctx, old);
- }
-
- *ptr = NULL;
- }
- assert(!*ptr);
-
- if (sh) {
- /* reference new */
- sh->RefCount++;
- /*printf("SHADER INCR %p (%d) to %d\n",
- (void*) sh, sh->Name, sh->RefCount);*/
- *ptr = sh;
- }
-}
-
-
-/**
- * Lookup a GLSL shader object.
- */
-struct gl_shader *
-_mesa_lookup_shader(GLcontext *ctx, GLuint name)
-{
- if (name) {
- struct gl_shader *sh = (struct gl_shader *)
- _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
- /* Note that both gl_shader and gl_shader_program objects are kept
- * in the same hash table. Check the object's type to be sure it's
- * what we're expecting.
- */
- if (sh && sh->Type == GL_SHADER_PROGRAM_MESA) {
- return NULL;
- }
- return sh;
- }
- return NULL;
-}
-
-
-/**
- * As above, but record an error if shader is not found.
- */
-static struct gl_shader *
-_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller)
-{
- if (!name) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
- return NULL;
- }
- else {
- struct gl_shader *sh = (struct gl_shader *)
- _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
- if (!sh) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
- return NULL;
- }
- if (sh->Type == GL_SHADER_PROGRAM_MESA) {
- _mesa_error(ctx, GL_INVALID_OPERATION, caller);
- return NULL;
- }
- return sh;
- }
-}
+/** Define this to enable shader substitution (see below) */
+#define SHADER_SUBST 0
/**
@@ -404,29 +86,10 @@ get_shader_flags(void)
/**
- * Find the length of the longest transform feedback varying name
- * which was specified with glTransformFeedbackVaryings().
- */
-static GLint
-longest_feedback_varying_name(const struct gl_shader_program *shProg)
-{
- GLuint i;
- GLint max = 0;
- for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
- GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]);
- if (len > max)
- max = len;
- }
- return max;
-}
-
-
-
-/**
* Initialize context's shader state.
*/
void
-_mesa_init_shader_state(GLcontext * ctx)
+_mesa_init_shader_state(GLcontext *ctx)
{
/* Device drivers may override these to control what kind of instructions
* are generated by the GLSL compiler.
@@ -456,6 +119,64 @@ _mesa_free_shader_state(GLcontext *ctx)
/**
+ * Return the size of the given GLSL datatype, in floats (components).
+ */
+GLint
+_mesa_sizeof_glsl_type(GLenum type)
+{
+ switch (type) {
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_BOOL:
+ case GL_SAMPLER_1D:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_1D_SHADOW:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_RECT_ARB:
+ case GL_SAMPLER_2D_RECT_SHADOW_ARB:
+ case GL_SAMPLER_1D_ARRAY_EXT:
+ case GL_SAMPLER_2D_ARRAY_EXT:
+ case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
+ case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
+ case GL_SAMPLER_CUBE_SHADOW_EXT:
+ return 1;
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_BOOL_VEC2:
+ return 2;
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_BOOL_VEC3:
+ return 3;
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ case GL_BOOL_VEC4:
+ return 4;
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT2x4:
+ return 8; /* two float[4] vectors */
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT3x4:
+ return 12; /* three float[4] vectors */
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ return 16; /* four float[4] vectors */
+ default:
+ _mesa_problem(NULL, "Invalid type in _mesa_sizeof_glsl_type()");
+ return 1;
+ }
+}
+
+
+/**
* Copy string from <src> to <dst>, up to maxLength characters, returning
* length of <dst> in <length>.
* \param src the strings source
@@ -477,8 +198,28 @@ _mesa_copy_string(GLchar *dst, GLsizei maxLength,
}
+
+/**
+ * Find the length of the longest transform feedback varying name
+ * which was specified with glTransformFeedbackVaryings().
+ */
+static GLint
+longest_feedback_varying_name(const struct gl_shader_program *shProg)
+{
+ GLuint i;
+ GLint max = 0;
+ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
+ GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]);
+ if (len > max)
+ max = len;
+ }
+ return max;
+}
+
+
+
static GLboolean
-_mesa_is_program(GLcontext *ctx, GLuint name)
+is_program(GLcontext *ctx, GLuint name)
{
struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name);
return shProg ? GL_TRUE : GL_FALSE;
@@ -486,7 +227,7 @@ _mesa_is_program(GLcontext *ctx, GLuint name)
static GLboolean
-_mesa_is_shader(GLcontext *ctx, GLuint name)
+is_shader(GLcontext *ctx, GLuint name)
{
struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
return shader ? GL_TRUE : GL_FALSE;
@@ -494,10 +235,10 @@ _mesa_is_shader(GLcontext *ctx, GLuint name)
/**
- * Called via ctx->Driver.AttachShader()
+ * Attach shader to a shader program.
*/
static void
-_mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
+attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
{
struct gl_shader_program *shProg;
struct gl_shader *sh;
@@ -544,8 +285,7 @@ _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
static GLint
-_mesa_get_attrib_location(GLcontext *ctx, GLuint program,
- const GLchar *name)
+get_attrib_location(GLcontext *ctx, GLuint program, const GLchar *name)
{
struct gl_shader_program *shProg
= _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
@@ -578,8 +318,8 @@ _mesa_get_attrib_location(GLcontext *ctx, GLuint program,
static void
-_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
- const GLchar *name)
+bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
+ const GLchar *name)
{
struct gl_shader_program *shProg;
const GLint size = -1; /* unknown size */
@@ -608,7 +348,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
if (shProg->LinkStatus) {
/* get current index/location for the attribute */
- oldIndex = _mesa_get_attrib_location(ctx, program, name);
+ oldIndex = get_attrib_location(ctx, program, name);
}
else {
oldIndex = -1;
@@ -629,7 +369,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
static GLuint
-_mesa_create_shader(GLcontext *ctx, GLenum type)
+create_shader(GLcontext *ctx, GLenum type)
{
struct gl_shader *sh;
GLuint name;
@@ -639,7 +379,7 @@ _mesa_create_shader(GLcontext *ctx, GLenum type)
switch (type) {
case GL_FRAGMENT_SHADER:
case GL_VERTEX_SHADER:
- sh = _mesa_new_shader(ctx, name, type);
+ sh = ctx->Driver.NewShader(ctx, name, type);
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)");
@@ -653,13 +393,14 @@ _mesa_create_shader(GLcontext *ctx, GLenum type)
static GLuint
-_mesa_create_program(GLcontext *ctx)
+create_shader_program(GLcontext *ctx)
{
GLuint name;
struct gl_shader_program *shProg;
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
- shProg = _mesa_new_shader_program(ctx, name);
+
+ shProg = ctx->Driver.NewShaderProgram(ctx, name);
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
@@ -674,7 +415,7 @@ _mesa_create_program(GLcontext *ctx)
* DeleteProgramARB.
*/
static void
-_mesa_delete_program2(GLcontext *ctx, GLuint name)
+delete_shader_program(GLcontext *ctx, GLuint name)
{
/*
* NOTE: deleting shaders/programs works a bit differently than
@@ -698,7 +439,7 @@ _mesa_delete_program2(GLcontext *ctx, GLuint name)
static void
-_mesa_delete_shader(GLcontext *ctx, GLuint shader)
+delete_shader(GLcontext *ctx, GLuint shader)
{
struct gl_shader *sh;
@@ -714,7 +455,7 @@ _mesa_delete_shader(GLcontext *ctx, GLuint shader)
static void
-_mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
+detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
{
struct gl_shader_program *shProg;
GLuint n;
@@ -769,9 +510,9 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
/* not found */
{
GLenum err;
- if (_mesa_is_shader(ctx, shader))
+ if (is_shader(ctx, shader))
err = GL_INVALID_OPERATION;
- else if (_mesa_is_program(ctx, shader))
+ else if (is_program(ctx, shader))
err = GL_INVALID_OPERATION;
else
err = GL_INVALID_VALUE;
@@ -781,68 +522,10 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
}
-/**
- * Return the size of the given GLSL datatype, in floats (components).
- */
-GLint
-_mesa_sizeof_glsl_type(GLenum type)
-{
- switch (type) {
- case GL_FLOAT:
- case GL_INT:
- case GL_BOOL:
- case GL_SAMPLER_1D:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_1D_SHADOW:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_2D_RECT_ARB:
- case GL_SAMPLER_2D_RECT_SHADOW_ARB:
- case GL_SAMPLER_1D_ARRAY_EXT:
- case GL_SAMPLER_2D_ARRAY_EXT:
- case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
- case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
- case GL_SAMPLER_CUBE_SHADOW_EXT:
- return 1;
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- case GL_BOOL_VEC2:
- return 2;
- case GL_FLOAT_VEC3:
- case GL_INT_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- case GL_BOOL_VEC3:
- return 3;
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- case GL_BOOL_VEC4:
- return 4;
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT2x4:
- return 8; /* two float[4] vectors */
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT3x2:
- case GL_FLOAT_MAT3x4:
- return 12; /* three float[4] vectors */
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT4x2:
- case GL_FLOAT_MAT4x3:
- return 16; /* four float[4] vectors */
- default:
- _mesa_problem(NULL, "Invalid type in _mesa_sizeof_glsl_type()");
- return 1;
- }
-}
-
-
static void
-_mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
- GLsizei maxLength, GLsizei *length, GLint *size,
- GLenum *type, GLchar *nameOut)
+get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
+ GLsizei maxLength, GLsizei *length, GLint *size,
+ GLenum *type, GLchar *nameOut)
{
const struct gl_program_parameter_list *attribs = NULL;
struct gl_shader_program *shProg;
@@ -872,11 +555,11 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
/**
- * Called via ctx->Driver.GetAttachedShaders().
+ * Return list of shaders attached to shader program.
*/
static void
-_mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
- GLsizei *count, GLuint *obj)
+get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
+ GLsizei *count, GLuint *obj)
{
struct gl_shader_program *shProg =
_mesa_lookup_shader_program_err(ctx, program, "glGetAttachedShaders");
@@ -891,9 +574,11 @@ _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
}
-/** glGetHandleARB() - return ID/name of currently bound shader program */
+/**
+ * glGetHandleARB() - return ID/name of currently bound shader program.
+ */
static GLuint
-_mesa_get_handle(GLcontext *ctx, GLenum pname)
+get_handle(GLcontext *ctx, GLenum pname)
{
if (pname == GL_PROGRAM_OBJECT_ARB) {
if (ctx->Shader.CurrentProgram)
@@ -914,8 +599,7 @@ _mesa_get_handle(GLcontext *ctx, GLenum pname)
* programs (see glGetProgramivARB).
*/
static void
-_mesa_get_programiv(GLcontext *ctx, GLuint program,
- GLenum pname, GLint *params)
+get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params)
{
const struct gl_program_parameter_list *attribs;
struct gl_shader_program *shProg
@@ -982,11 +666,14 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program,
}
-/** glGetShaderiv() - get GLSL shader state */
+/**
+ * glGetShaderiv() - get GLSL shader state
+ */
static void
-_mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
+get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
{
- struct gl_shader *shader = _mesa_lookup_shader_err(ctx, name, "glGetShaderiv");
+ struct gl_shader *shader =
+ _mesa_lookup_shader_err(ctx, name, "glGetShaderiv");
if (!shader) {
return;
@@ -1016,8 +703,8 @@ _mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
static void
-_mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog)
+get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
+ GLsizei *length, GLchar *infoLog)
{
struct gl_shader_program *shProg
= _mesa_lookup_shader_program(ctx, program);
@@ -1030,8 +717,8 @@ _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
static void
-_mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog)
+get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
+ GLsizei *length, GLchar *infoLog)
{
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
if (!sh) {
@@ -1043,11 +730,11 @@ _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
/**
- * Called via ctx->Driver.GetShaderSource().
+ * Return shader source code.
*/
static void
-_mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
- GLsizei *length, GLchar *sourceOut)
+get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
+ GLsizei *length, GLchar *sourceOut)
{
struct gl_shader *sh;
sh = _mesa_lookup_shader_err(ctx, shader, "glGetShaderSource");
@@ -1059,10 +746,10 @@ _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
/**
- * Called via ctx->Driver.ShaderSource()
+ * Set/replace shader source code.
*/
static void
-_mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
+shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
{
struct gl_shader *sh;
@@ -1083,10 +770,10 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
/**
- * Called via ctx->Driver.CompileShader()
+ * Compile a shader.
*/
static void
-_mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
+compile_shader(GLcontext *ctx, GLuint shaderObj)
{
struct gl_shader *sh;
@@ -1105,10 +792,10 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
/**
- * Called via ctx->Driver.LinkProgram()
+ * Link a program's shaders.
*/
static void
-_mesa_link_program(GLcontext *ctx, GLuint program)
+link_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
struct gl_transform_feedback_object *obj =
@@ -1181,7 +868,7 @@ print_shader_info(const struct gl_shader_program *shProg)
/**
- * Called via ctx->Driver.UseProgram()
+ * Use the named shader program for subsequent rendering.
*/
void
_mesa_use_program(GLcontext *ctx, GLuint program)
@@ -1226,41 +913,9 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
_mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg);
}
-}
-
-
-
-/**
- * Update the vertex/fragment program's TexturesUsed array.
- *
- * This needs to be called after glUniform(set sampler var) is called.
- * A call to glUniform(samplerVar, value) causes a sampler to point to a
- * particular texture unit. We know the sampler's texture target
- * (1D/2D/3D/etc) from compile time but the sampler's texture unit is
- * set by glUniform() calls.
- *
- * So, scan the program->SamplerUnits[] and program->SamplerTargets[]
- * information to update the prog->TexturesUsed[] values.
- * Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX,
- * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc.
- * We'll use that info for state validation before rendering.
- */
-void
-_mesa_update_shader_textures_used(struct gl_program *prog)
-{
- GLuint s;
- memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
-
- for (s = 0; s < MAX_SAMPLERS; s++) {
- if (prog->SamplersUsed & (1 << s)) {
- GLuint unit = prog->SamplerUnits[s];
- GLuint tgt = prog->SamplerTargets[s];
- assert(unit < MAX_TEXTURE_IMAGE_UNITS);
- assert(tgt < NUM_TEXTURE_TARGETS);
- prog->TexturesUsed[unit] |= (1 << tgt);
- }
- }
+ if (ctx->Driver.UseProgram)
+ ctx->Driver.UseProgram(ctx, shProg);
}
@@ -1322,10 +977,10 @@ validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg)
* \param errMsg returns error message if validation fails.
* \return GL_TRUE if valid, GL_FALSE if invalid (and set errMsg)
*/
-GLboolean
-_mesa_validate_shader_program(GLcontext *ctx,
- const struct gl_shader_program *shProg,
- char *errMsg)
+static GLboolean
+validate_shader_program(GLcontext *ctx,
+ const struct gl_shader_program *shProg,
+ char *errMsg)
{
const struct gl_vertex_program *vp = shProg->VertexProgram;
const struct gl_fragment_program *fp = shProg->FragmentProgram;
@@ -1369,7 +1024,7 @@ _mesa_validate_shader_program(GLcontext *ctx,
* Called via glValidateProgram()
*/
static void
-_mesa_validate_program(GLcontext *ctx, GLuint program)
+validate_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
char errMsg[100];
@@ -1379,7 +1034,7 @@ _mesa_validate_program(GLcontext *ctx, GLuint program)
return;
}
- shProg->Validated = _mesa_validate_shader_program(ctx, shProg, errMsg);
+ shProg->Validated = validate_shader_program(ctx, shProg, errMsg);
if (!shProg->Validated) {
/* update info log */
if (shProg->InfoLog) {
@@ -1390,35 +1045,508 @@ _mesa_validate_program(GLcontext *ctx, GLuint program)
}
+
+void GLAPIENTRY
+_mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ attach_shader(ctx, program, shader);
+}
+
+
+void GLAPIENTRY
+_mesa_AttachShader(GLuint program, GLuint shader)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ attach_shader(ctx, program, shader);
+}
+
+
+void GLAPIENTRY
+_mesa_BindAttribLocationARB(GLhandleARB program, GLuint index,
+ const GLcharARB *name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ bind_attrib_location(ctx, program, index, name);
+}
+
+
+void GLAPIENTRY
+_mesa_CompileShaderARB(GLhandleARB shaderObj)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ compile_shader(ctx, shaderObj);
+}
+
+
+GLuint GLAPIENTRY
+_mesa_CreateShader(GLenum type)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return create_shader(ctx, type);
+}
+
+
+GLhandleARB GLAPIENTRY
+_mesa_CreateShaderObjectARB(GLenum type)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return create_shader(ctx, type);
+}
+
+
+GLuint GLAPIENTRY
+_mesa_CreateProgram(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return create_shader_program(ctx);
+}
+
+
+GLhandleARB GLAPIENTRY
+_mesa_CreateProgramObjectARB(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return create_shader_program(ctx);
+}
+
+
+void GLAPIENTRY
+_mesa_DeleteObjectARB(GLhandleARB obj)
+{
+ if (obj) {
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_program(ctx, obj)) {
+ delete_shader_program(ctx, obj);
+ }
+ else if (is_shader(ctx, obj)) {
+ delete_shader(ctx, obj);
+ }
+ else {
+ /* error? */
+ }
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_DeleteProgram(GLuint name)
+{
+ if (name) {
+ GET_CURRENT_CONTEXT(ctx);
+ delete_shader_program(ctx, name);
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_DeleteShader(GLuint name)
+{
+ if (name) {
+ GET_CURRENT_CONTEXT(ctx);
+ delete_shader(ctx, name);
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ detach_shader(ctx, program, shader);
+}
+
+
+void GLAPIENTRY
+_mesa_DetachShader(GLuint program, GLuint shader)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ detach_shader(ctx, program, shader);
+}
+
+
+void GLAPIENTRY
+_mesa_GetActiveAttribARB(GLhandleARB program, GLuint index,
+ GLsizei maxLength, GLsizei * length, GLint * size,
+ GLenum * type, GLcharARB * name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_active_attrib(ctx, program, index, maxLength, length, size, type, name);
+}
+
+
+void GLAPIENTRY
+_mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
+ GLsizei * count, GLhandleARB * obj)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_attached_shaders(ctx, container, maxCount, count, obj);
+}
+
+
+void GLAPIENTRY
+_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
+ GLsizei *count, GLuint *obj)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_attached_shaders(ctx, program, maxCount, count, obj);
+}
+
+
+GLint GLAPIENTRY
+_mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return get_attrib_location(ctx, program, name);
+}
+
+
+void GLAPIENTRY
+_mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length,
+ GLcharARB * infoLog)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ if (is_program(ctx, object)) {
+ get_program_info_log(ctx, object, maxLength, length, infoLog);
+ }
+ else if (is_shader(ctx, object)) {
+ get_shader_info_log(ctx, object, maxLength, length, infoLog);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInfoLogARB");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetObjectParameterivARB(GLhandleARB object, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ /* Implement in terms of GetProgramiv, GetShaderiv */
+ if (is_program(ctx, object)) {
+ if (pname == GL_OBJECT_TYPE_ARB) {
+ *params = GL_PROGRAM_OBJECT_ARB;
+ }
+ else {
+ get_programiv(ctx, object, pname, params);
+ }
+ }
+ else if (is_shader(ctx, object)) {
+ if (pname == GL_OBJECT_TYPE_ARB) {
+ *params = GL_SHADER_OBJECT_ARB;
+ }
+ else {
+ get_shaderiv(ctx, object, pname, params);
+ }
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname,
+ GLfloat *params)
+{
+ GLint iparams[1]; /* XXX is one element enough? */
+ _mesa_GetObjectParameterivARB(object, pname, iparams);
+ params[0] = (GLfloat) iparams[0];
+}
+
+
+void GLAPIENTRY
+_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_programiv(ctx, program, pname, params);
+}
+
+
+void GLAPIENTRY
+_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_shaderiv(ctx, shader, pname, params);
+}
+
+
+void GLAPIENTRY
+_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
+ GLsizei *length, GLchar *infoLog)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_program_info_log(ctx, program, bufSize, length, infoLog);
+}
+
+
+void GLAPIENTRY
+_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
+ GLsizei *length, GLchar *infoLog)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_shader_info_log(ctx, shader, bufSize, length, infoLog);
+}
+
+
+void GLAPIENTRY
+_mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength,
+ GLsizei *length, GLcharARB *sourceOut)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_shader_source(ctx, shader, maxLength, length, sourceOut);
+}
+
+
+GLhandleARB GLAPIENTRY
+_mesa_GetHandleARB(GLenum pname)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return get_handle(ctx, pname);
+}
+
+
+GLboolean GLAPIENTRY
+_mesa_IsProgram(GLuint name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return is_program(ctx, name);
+}
+
+
+GLboolean GLAPIENTRY
+_mesa_IsShader(GLuint name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return is_shader(ctx, name);
+}
+
+
+void GLAPIENTRY
+_mesa_LinkProgramARB(GLhandleARB programObj)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ link_program(ctx, programObj);
+}
+
+
+
/**
- * Plug in Mesa's GLSL functions into the device driver function table.
+ * Read shader source code from a file.
+ * Useful for debugging to override an app's shader.
+ */
+static GLcharARB *
+read_shader(const char *fname)
+{
+ const int max = 50*1000;
+ FILE *f = fopen(fname, "r");
+ GLcharARB *buffer, *shader;
+ int len;
+
+ if (!f) {
+ return NULL;
+ }
+
+ buffer = (char *) malloc(max);
+ len = fread(buffer, 1, max, f);
+ buffer[len] = 0;
+
+ fclose(f);
+
+ shader = _mesa_strdup(buffer);
+ free(buffer);
+
+ return shader;
+}
+
+
+/**
+ * Called via glShaderSource() and glShaderSourceARB() API functions.
+ * Basically, concatenate the source code strings into one long string
+ * and pass it to _mesa_shader_source().
+ */
+void GLAPIENTRY
+_mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
+ const GLcharARB ** string, const GLint * length)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint *offsets;
+ GLsizei i, totalLength;
+ GLcharARB *source;
+ GLuint checksum;
+
+ if (!shaderObj || string == NULL) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
+ return;
+ }
+
+ /*
+ * This array holds offsets of where the appropriate string ends, thus the
+ * last element will be set to the total length of the source code.
+ */
+ offsets = (GLint *) malloc(count * sizeof(GLint));
+ if (offsets == NULL) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
+ return;
+ }
+
+ for (i = 0; i < count; i++) {
+ if (string[i] == NULL) {
+ free((GLvoid *) offsets);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)");
+ return;
+ }
+ if (length == NULL || length[i] < 0)
+ offsets[i] = strlen(string[i]);
+ else
+ offsets[i] = length[i];
+ /* accumulate string lengths */
+ if (i > 0)
+ offsets[i] += offsets[i - 1];
+ }
+
+ /* Total length of source string is sum off all strings plus two.
+ * One extra byte for terminating zero, another extra byte to silence
+ * valgrind warnings in the parser/grammer code.
+ */
+ totalLength = offsets[count - 1] + 2;
+ source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB));
+ if (source == NULL) {
+ free((GLvoid *) offsets);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
+ return;
+ }
+
+ for (i = 0; i < count; i++) {
+ GLint start = (i > 0) ? offsets[i - 1] : 0;
+ memcpy(source + start, string[i],
+ (offsets[i] - start) * sizeof(GLcharARB));
+ }
+ source[totalLength - 1] = '\0';
+ source[totalLength - 2] = '\0';
+
+ if (SHADER_SUBST) {
+ /* Compute the shader's source code checksum then try to open a file
+ * named newshader_<CHECKSUM>. If it exists, use it in place of the
+ * original shader source code. For debugging.
+ */
+ char filename[100];
+ GLcharARB *newSource;
+
+ checksum = _mesa_str_checksum(source);
+
+ _mesa_snprintf(filename, sizeof(filename), "newshader_%d", checksum);
+
+ newSource = read_shader(filename);
+ if (newSource) {
+ fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
+ shaderObj, checksum, filename);
+ free(source);
+ source = newSource;
+ }
+ }
+
+ shader_source(ctx, shaderObj, source);
+
+ if (SHADER_SUBST) {
+ struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj);
+ if (sh)
+ sh->SourceChecksum = checksum; /* save original checksum */
+ }
+
+ free(offsets);
+}
+
+
+void GLAPIENTRY
+_mesa_UseProgramObjectARB(GLhandleARB program)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ _mesa_use_program(ctx, program);
+}
+
+
+void GLAPIENTRY
+_mesa_ValidateProgramARB(GLhandleARB program)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ validate_program(ctx, program);
+}
+
+#ifdef FEATURE_ES2
+
+void GLAPIENTRY
+_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
+ GLint* range, GLint* precision)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
+}
+
+
+void GLAPIENTRY
+_mesa_ReleaseShaderCompiler(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
+}
+
+
+void GLAPIENTRY
+_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
+ const void* binary, GLint length)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
+}
+
+#endif /* FEATURE_ES2 */
+
+
+/**
+ * Plug in shader-related functions into API dispatch table.
*/
void
-_mesa_init_glsl_driver_functions(struct dd_function_table *driver)
-{
- driver->AttachShader = _mesa_attach_shader;
- driver->BindAttribLocation = _mesa_bind_attrib_location;
- driver->CompileShader = _mesa_compile_shader;
- driver->CreateProgram = _mesa_create_program;
- driver->CreateShader = _mesa_create_shader;
- driver->DeleteProgram2 = _mesa_delete_program2;
- driver->DeleteShader = _mesa_delete_shader;
- driver->DetachShader = _mesa_detach_shader;
- driver->GetActiveAttrib = _mesa_get_active_attrib;
- driver->GetAttachedShaders = _mesa_get_attached_shaders;
- driver->GetAttribLocation = _mesa_get_attrib_location;
- driver->GetHandle = _mesa_get_handle;
- driver->GetProgramiv = _mesa_get_programiv;
- driver->GetProgramInfoLog = _mesa_get_program_info_log;
- driver->GetShaderiv = _mesa_get_shaderiv;
- driver->GetShaderInfoLog = _mesa_get_shader_info_log;
- driver->GetShaderSource = _mesa_get_shader_source;
- driver->IsProgram = _mesa_is_program;
- driver->IsShader = _mesa_is_shader;
- driver->LinkProgram = _mesa_link_program;
- driver->ShaderSource = _mesa_shader_source;
- driver->UseProgram = _mesa_use_program;
- driver->ValidateProgram = _mesa_validate_program;
-
- _mesa_init_uniform_functions(driver);
+_mesa_init_shader_dispatch(struct _glapi_table *exec)
+{
+ /* GL_ARB_vertex/fragment_shader */
+ SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
+ SET_GetHandleARB(exec, _mesa_GetHandleARB);
+ SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
+ SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
+ SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
+ SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
+ SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
+ SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
+ SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
+ SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
+ SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
+ SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
+ SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
+ SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
+ SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
+ SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
+
+ /* OpenGL 2.0 */
+ SET_AttachShader(exec, _mesa_AttachShader);
+ SET_CreateProgram(exec, _mesa_CreateProgram);
+ SET_CreateShader(exec, _mesa_CreateShader);
+ SET_DeleteProgram(exec, _mesa_DeleteProgram);
+ SET_DeleteShader(exec, _mesa_DeleteShader);
+ SET_DetachShader(exec, _mesa_DetachShader);
+ SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
+ SET_GetProgramiv(exec, _mesa_GetProgramiv);
+ SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
+ SET_GetShaderiv(exec, _mesa_GetShaderiv);
+ SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
+ SET_IsProgram(exec, _mesa_IsProgram);
+ SET_IsShader(exec, _mesa_IsShader);
+
+#if FEATURE_ARB_vertex_shader
+ SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
+ SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
+ SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
+#endif
}
+
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
new file mode 100644
index 00000000000..ec0c09a0e38
--- /dev/null
+++ b/src/mesa/main/shaderapi.h
@@ -0,0 +1,166 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2004-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef SHADERAPI_H
+#define SHADERAPI_H
+
+
+#include "glheader.h"
+#include "mtypes.h"
+
+
+extern GLint
+_mesa_sizeof_glsl_type(GLenum type);
+
+extern void
+_mesa_copy_string(GLchar *dst, GLsizei maxLength,
+ GLsizei *length, const GLchar *src);
+
+extern void
+_mesa_use_program(GLcontext *ctx, GLuint program);
+
+
+extern void
+_mesa_init_shader_dispatch(struct _glapi_table *exec);
+
+
+
+extern void GLAPIENTRY
+_mesa_AttachObjectARB(GLhandleARB, GLhandleARB);
+
+extern void GLAPIENTRY
+_mesa_CompileShaderARB(GLhandleARB);
+
+extern GLhandleARB GLAPIENTRY
+_mesa_CreateProgramObjectARB(void);
+
+extern GLhandleARB GLAPIENTRY
+_mesa_CreateShaderObjectARB(GLenum type);
+
+extern void GLAPIENTRY
+_mesa_DeleteObjectARB(GLhandleARB obj);
+
+extern void GLAPIENTRY
+_mesa_DetachObjectARB(GLhandleARB, GLhandleARB);
+
+extern void GLAPIENTRY
+_mesa_GetAttachedObjectsARB(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
+
+extern GLhandleARB GLAPIENTRY
+_mesa_GetHandleARB(GLenum pname);
+
+extern void GLAPIENTRY
+_mesa_GetInfoLogARB(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
+
+extern void GLAPIENTRY
+_mesa_GetObjectParameterfvARB(GLhandleARB, GLenum, GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_GetObjectParameterivARB(GLhandleARB, GLenum, GLint *);
+
+extern void GLAPIENTRY
+_mesa_GetShaderSourceARB(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
+
+extern GLboolean GLAPIENTRY
+_mesa_IsProgram(GLuint name);
+
+extern GLboolean GLAPIENTRY
+_mesa_IsShader(GLuint name);
+
+extern void GLAPIENTRY
+_mesa_LinkProgramARB(GLhandleARB programObj);
+
+extern void GLAPIENTRY
+_mesa_ShaderSourceARB(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_UseProgramObjectARB(GLhandleARB);
+
+extern void GLAPIENTRY
+_mesa_ValidateProgramARB(GLhandleARB);
+
+
+extern void GLAPIENTRY
+_mesa_BindAttribLocationARB(GLhandleARB, GLuint, const GLcharARB *);
+
+extern void GLAPIENTRY
+_mesa_GetActiveAttribARB(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *,
+ GLenum *, GLcharARB *);
+
+extern GLint GLAPIENTRY
+_mesa_GetAttribLocationARB(GLhandleARB, const GLcharARB *);
+
+
+
+extern void GLAPIENTRY
+_mesa_AttachShader(GLuint program, GLuint shader);
+
+extern GLuint GLAPIENTRY
+_mesa_CreateShader(GLenum);
+
+extern GLuint GLAPIENTRY
+_mesa_CreateProgram(void);
+
+extern void GLAPIENTRY
+_mesa_DeleteProgram(GLuint program);
+
+extern void GLAPIENTRY
+_mesa_DeleteShader(GLuint shader);
+
+extern void GLAPIENTRY
+_mesa_DetachShader(GLuint program, GLuint shader);
+
+extern void GLAPIENTRY
+_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
+ GLsizei *count, GLuint *obj);
+
+extern void GLAPIENTRY
+_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
+ GLsizei *length, GLchar *infoLog);
+
+extern void GLAPIENTRY
+_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params);
+
+extern void GLAPIENTRY
+_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
+ GLsizei *length, GLchar *infoLog);
+
+
+extern void GLAPIENTRY
+_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
+ GLint *range, GLint *precision);
+
+extern void GLAPIENTRY
+_mesa_ReleaseShaderCompiler(void);
+
+extern void GLAPIENTRY
+_mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum binaryformat,
+ const void* binary, GLint length);
+
+
+#endif /* SHADERAPI_H */
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
new file mode 100644
index 00000000000..d4d2349d4b6
--- /dev/null
+++ b/src/mesa/main/shaderobj.c
@@ -0,0 +1,386 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2004-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file shaderobj.c
+ * \author Brian Paul
+ *
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/dispatch.h"
+#include "main/hash.h"
+#include "main/shaderobj.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_uniform.h"
+
+
+/**********************************************************************/
+/*** Shader object functions ***/
+/**********************************************************************/
+
+
+/**
+ * Set ptr to point to sh.
+ * If ptr is pointing to another shader, decrement its refcount (and delete
+ * if refcount hits zero).
+ * Then set ptr to point to sh, incrementing its refcount.
+ */
+void
+_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
+ struct gl_shader *sh)
+{
+ assert(ptr);
+ if (*ptr == sh) {
+ /* no-op */
+ return;
+ }
+ if (*ptr) {
+ /* Unreference the old shader */
+ GLboolean deleteFlag = GL_FALSE;
+ struct gl_shader *old = *ptr;
+
+ ASSERT(old->RefCount > 0);
+ old->RefCount--;
+ /*printf("SHADER DECR %p (%d) to %d\n",
+ (void*) old, old->Name, old->RefCount);*/
+ deleteFlag = (old->RefCount == 0);
+
+ if (deleteFlag) {
+ _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
+ ctx->Driver.DeleteShader(ctx, old);
+ }
+
+ *ptr = NULL;
+ }
+ assert(!*ptr);
+
+ if (sh) {
+ /* reference new */
+ sh->RefCount++;
+ /*printf("SHADER INCR %p (%d) to %d\n",
+ (void*) sh, sh->Name, sh->RefCount);*/
+ *ptr = sh;
+ }
+}
+
+
+/**
+ * Allocate a new gl_shader object, initialize it.
+ * Called via ctx->Driver.NewShader()
+ */
+static struct gl_shader *
+_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
+{
+ struct gl_shader *shader;
+ assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
+ shader = CALLOC_STRUCT(gl_shader);
+ if (shader) {
+ shader->Type = type;
+ shader->Name = name;
+ shader->RefCount = 1;
+ }
+ return shader;
+}
+
+
+/**
+ * Delete a shader object.
+ * Called via ctx->Driver.DeleteShader().
+ */
+static void
+__mesa_delete_shader(GLcontext *ctx, struct gl_shader *sh)
+{
+ if (sh->Source)
+ free((void *) sh->Source);
+ if (sh->InfoLog)
+ free(sh->InfoLog);
+ _mesa_reference_program(ctx, &sh->Program, NULL);
+ free(sh);
+}
+
+
+/**
+ * Lookup a GLSL shader object.
+ */
+struct gl_shader *
+_mesa_lookup_shader(GLcontext *ctx, GLuint name)
+{
+ if (name) {
+ struct gl_shader *sh = (struct gl_shader *)
+ _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
+ /* Note that both gl_shader and gl_shader_program objects are kept
+ * in the same hash table. Check the object's type to be sure it's
+ * what we're expecting.
+ */
+ if (sh && sh->Type == GL_SHADER_PROGRAM_MESA) {
+ return NULL;
+ }
+ return sh;
+ }
+ return NULL;
+}
+
+
+/**
+ * As above, but record an error if shader is not found.
+ */
+struct gl_shader *
+_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller)
+{
+ if (!name) {
+ _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ return NULL;
+ }
+ else {
+ struct gl_shader *sh = (struct gl_shader *)
+ _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
+ if (!sh) {
+ _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ return NULL;
+ }
+ if (sh->Type == GL_SHADER_PROGRAM_MESA) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, caller);
+ return NULL;
+ }
+ return sh;
+ }
+}
+
+
+
+/**********************************************************************/
+/*** Shader Program object functions ***/
+/**********************************************************************/
+
+
+/**
+ * Set ptr to point to shProg.
+ * If ptr is pointing to another object, decrement its refcount (and delete
+ * if refcount hits zero).
+ * Then set ptr to point to shProg, incrementing its refcount.
+ */
+void
+_mesa_reference_shader_program(GLcontext *ctx,
+ struct gl_shader_program **ptr,
+ struct gl_shader_program *shProg)
+{
+ assert(ptr);
+ if (*ptr == shProg) {
+ /* no-op */
+ return;
+ }
+ if (*ptr) {
+ /* Unreference the old shader program */
+ GLboolean deleteFlag = GL_FALSE;
+ struct gl_shader_program *old = *ptr;
+
+ ASSERT(old->RefCount > 0);
+ old->RefCount--;
+#if 0
+ printf("ShaderProgram %p ID=%u RefCount-- to %d\n",
+ (void *) old, old->Name, old->RefCount);
+#endif
+ deleteFlag = (old->RefCount == 0);
+
+ if (deleteFlag) {
+ _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
+ ctx->Driver.DeleteShaderProgram(ctx, old);
+ }
+
+ *ptr = NULL;
+ }
+ assert(!*ptr);
+
+ if (shProg) {
+ shProg->RefCount++;
+#if 0
+ printf("ShaderProgram %p ID=%u RefCount++ to %d\n",
+ (void *) shProg, shProg->Name, shProg->RefCount);
+#endif
+ *ptr = shProg;
+ }
+}
+
+
+/**
+ * Allocate a new gl_shader_program object, initialize it.
+ * Called via ctx->Driver.NewShaderProgram()
+ */
+static struct gl_shader_program *
+_mesa_new_shader_program(GLcontext *ctx, GLuint name)
+{
+ struct gl_shader_program *shProg;
+ shProg = CALLOC_STRUCT(gl_shader_program);
+ if (shProg) {
+ shProg->Type = GL_SHADER_PROGRAM_MESA;
+ shProg->Name = name;
+ shProg->RefCount = 1;
+ shProg->Attributes = _mesa_new_parameter_list();
+ }
+ return shProg;
+}
+
+
+/**
+ * Clear (free) the shader program state that gets produced by linking.
+ */
+void
+_mesa_clear_shader_program_data(GLcontext *ctx,
+ struct gl_shader_program *shProg)
+{
+ _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
+ _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
+
+ if (shProg->Uniforms) {
+ _mesa_free_uniform_list(shProg->Uniforms);
+ shProg->Uniforms = NULL;
+ }
+
+ if (shProg->Varying) {
+ _mesa_free_parameter_list(shProg->Varying);
+ shProg->Varying = NULL;
+ }
+}
+
+
+/**
+ * Free all the data that hangs off a shader program object, but not the
+ * object itself.
+ */
+void
+_mesa_free_shader_program_data(GLcontext *ctx,
+ struct gl_shader_program *shProg)
+{
+ GLuint i;
+
+ assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
+
+ _mesa_clear_shader_program_data(ctx, shProg);
+
+ if (shProg->Attributes) {
+ _mesa_free_parameter_list(shProg->Attributes);
+ shProg->Attributes = NULL;
+ }
+
+ /* detach shaders */
+ for (i = 0; i < shProg->NumShaders; i++) {
+ _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL);
+ }
+ shProg->NumShaders = 0;
+
+ if (shProg->Shaders) {
+ free(shProg->Shaders);
+ shProg->Shaders = NULL;
+ }
+
+ if (shProg->InfoLog) {
+ free(shProg->InfoLog);
+ shProg->InfoLog = NULL;
+ }
+
+ /* Transform feedback varying vars */
+ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
+ free(shProg->TransformFeedback.VaryingNames[i]);
+ }
+ free(shProg->TransformFeedback.VaryingNames);
+ shProg->TransformFeedback.VaryingNames = NULL;
+ shProg->TransformFeedback.NumVarying = 0;
+}
+
+
+/**
+ * Free/delete a shader program object.
+ * Called via ctx->Driver.DeleteShaderProgram().
+ */
+static void
+__mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
+{
+ _mesa_free_shader_program_data(ctx, shProg);
+
+ free(shProg);
+}
+
+
+/**
+ * Lookup a GLSL program object.
+ */
+struct gl_shader_program *
+_mesa_lookup_shader_program(GLcontext *ctx, GLuint name)
+{
+ struct gl_shader_program *shProg;
+ if (name) {
+ shProg = (struct gl_shader_program *)
+ _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
+ /* Note that both gl_shader and gl_shader_program objects are kept
+ * in the same hash table. Check the object's type to be sure it's
+ * what we're expecting.
+ */
+ if (shProg && shProg->Type != GL_SHADER_PROGRAM_MESA) {
+ return NULL;
+ }
+ return shProg;
+ }
+ return NULL;
+}
+
+
+/**
+ * As above, but record an error if program is not found.
+ */
+struct gl_shader_program *
+_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name,
+ const char *caller)
+{
+ if (!name) {
+ _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ return NULL;
+ }
+ else {
+ struct gl_shader_program *shProg = (struct gl_shader_program *)
+ _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
+ if (!shProg) {
+ _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ return NULL;
+ }
+ if (shProg->Type != GL_SHADER_PROGRAM_MESA) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, caller);
+ return NULL;
+ }
+ return shProg;
+ }
+}
+
+
+void
+_mesa_init_shader_object_functions(struct dd_function_table *driver)
+{
+ driver->NewShader = _mesa_new_shader;
+ driver->DeleteShader = __mesa_delete_shader;
+ driver->NewShaderProgram = _mesa_new_shader_program;
+ driver->DeleteShaderProgram = __mesa_delete_shader_program;
+}
diff --git a/src/mesa/shader/shader_api.h b/src/mesa/main/shaderobj.h
index 9743a23ce63..d6b37b45963 100644
--- a/src/mesa/shader/shader_api.h
+++ b/src/mesa/main/shaderobj.h
@@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 7.6
+ * Version: 6.5.3
*
- * Copyright (C) 2004-2006 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ * Copyright (C) 2004-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -24,47 +23,25 @@
*/
-#ifndef SHADER_API_H
-#define SHADER_API_H
+#ifndef SHADEROBJ_H
+#define SHADEROBJ_H
-#include "main/glheader.h"
-#include "main/mtypes.h"
-
-
-/**
- * Internal functions
- */
-
-extern void
-_mesa_init_shader_state(GLcontext * ctx);
-
-extern void
-_mesa_free_shader_state(GLcontext *ctx);
+#include "glheader.h"
+#include "mtypes.h"
extern void
-_mesa_copy_string(GLchar *dst, GLsizei maxLength,
- GLsizei *length, const GLchar *src);
-
-extern GLint
-_mesa_sizeof_glsl_type(GLenum type);
+_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
+ struct gl_shader *sh);
+extern struct gl_shader *
+_mesa_lookup_shader(GLcontext *ctx, GLuint name);
-/*
-extern struct gl_shader_program *
-_mesa_new_shader_program(GLcontext *ctx, GLuint name);
-*/
-extern void
-_mesa_clear_shader_program_data(GLcontext *ctx,
- struct gl_shader_program *shProg);
+extern struct gl_shader *
+_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller);
-extern void
-_mesa_free_shader_program_data(GLcontext *ctx,
- struct gl_shader_program *shProg);
-extern void
-_mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg);
extern void
_mesa_reference_shader_program(GLcontext *ctx,
@@ -74,40 +51,28 @@ _mesa_reference_shader_program(GLcontext *ctx,
extern struct gl_shader_program *
_mesa_lookup_shader_program(GLcontext *ctx, GLuint name);
-
extern struct gl_shader_program *
_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name,
const char *caller);
-extern struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
-
extern void
-_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh);
+_mesa_clear_shader_program_data(GLcontext *ctx,
+ struct gl_shader_program *shProg);
extern void
-_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
- struct gl_shader *sh);
+_mesa_free_shader_program_data(GLcontext *ctx,
+ struct gl_shader_program *shProg);
-extern struct gl_shader *
-_mesa_lookup_shader(GLcontext *ctx, GLuint name);
extern void
-_mesa_update_shader_textures_used(struct gl_program *prog);
-
+_mesa_init_shader_object_functions(struct dd_function_table *driver);
extern void
-_mesa_use_program(GLcontext *ctx, GLuint program);
-
-
-extern GLboolean
-_mesa_validate_shader_program(GLcontext *ctx,
- const struct gl_shader_program *shProg,
- char *errMsg);
+_mesa_init_shader_state(GLcontext *ctx);
extern void
-_mesa_init_glsl_driver_functions(struct dd_function_table *driver);
+_mesa_free_shader_state(GLcontext *ctx);
-#endif /* SHADER_API_H */
+#endif /* SHADEROBJ_H */
diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c
deleted file mode 100644
index 65f1ee3efbd..00000000000
--- a/src/mesa/main/shaders.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * Copyright (C) 2004-2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "shaders.h"
-#include "shader/shader_api.h"
-#include "main/dispatch.h"
-
-
-/** Define this to enable shader substitution (see below) */
-#define SHADER_SUBST 0
-
-
-
-/**
- * These are basically just wrappers/adaptors for calling the
- * ctx->Driver.foobar() GLSL-related functions.
- *
- * Things are biased toward the OpenGL 2.0 functions rather than the
- * ARB extensions (i.e. the ARB functions are layered on the 2.0 functions).
- *
- * The general idea here is to allow enough modularity such that a
- * completely different GLSL implemenation can be plugged in and co-exist
- * with Mesa's native GLSL code.
- */
-
-
-
-void GLAPIENTRY
-_mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.AttachShader(ctx, program, shader);
-}
-
-
-void GLAPIENTRY
-_mesa_AttachShader(GLuint program, GLuint shader)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.AttachShader(ctx, program, shader);
-}
-
-
-void GLAPIENTRY
-_mesa_BindAttribLocationARB(GLhandleARB program, GLuint index,
- const GLcharARB *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.BindAttribLocation(ctx, program, index, name);
-}
-
-
-void GLAPIENTRY
-_mesa_CompileShaderARB(GLhandleARB shaderObj)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.CompileShader(ctx, shaderObj);
-}
-
-
-GLuint GLAPIENTRY
-_mesa_CreateShader(GLenum type)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.CreateShader(ctx, type);
-}
-
-
-GLhandleARB GLAPIENTRY
-_mesa_CreateShaderObjectARB(GLenum type)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.CreateShader(ctx, type);
-}
-
-
-GLuint GLAPIENTRY
-_mesa_CreateProgram(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.CreateProgram(ctx);
-}
-
-
-GLhandleARB GLAPIENTRY
-_mesa_CreateProgramObjectARB(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.CreateProgram(ctx);
-}
-
-
-void GLAPIENTRY
-_mesa_DeleteObjectARB(GLhandleARB obj)
-{
- if (obj) {
- GET_CURRENT_CONTEXT(ctx);
- if (ctx->Driver.IsProgram(ctx, obj)) {
- ctx->Driver.DeleteProgram2(ctx, obj);
- }
- else if (ctx->Driver.IsShader(ctx, obj)) {
- ctx->Driver.DeleteShader(ctx, obj);
- }
- else {
- /* error? */
- }
- }
-}
-
-
-void GLAPIENTRY
-_mesa_DeleteProgram(GLuint name)
-{
- if (name) {
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.DeleteProgram2(ctx, name);
- }
-}
-
-
-void GLAPIENTRY
-_mesa_DeleteShader(GLuint name)
-{
- if (name) {
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.DeleteShader(ctx, name);
- }
-}
-
-
-void GLAPIENTRY
-_mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.DetachShader(ctx, program, shader);
-}
-
-
-void GLAPIENTRY
-_mesa_DetachShader(GLuint program, GLuint shader)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.DetachShader(ctx, program, shader);
-}
-
-
-void GLAPIENTRY
-_mesa_GetActiveAttribARB(GLhandleARB program, GLuint index,
- GLsizei maxLength, GLsizei * length, GLint * size,
- GLenum * type, GLcharARB * name)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetActiveAttrib(ctx, program, index, maxLength, length, size,
- type, name);
-}
-
-
-void GLAPIENTRY
-_mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
- GLsizei maxLength, GLsizei * length, GLint * size,
- GLenum * type, GLcharARB * name)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetActiveUniform(ctx, program, index, maxLength, length, size,
- type, name);
-}
-
-
-void GLAPIENTRY
-_mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
- GLsizei * count, GLhandleARB * obj)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetAttachedShaders(ctx, container, maxCount, count, obj);
-}
-
-
-void GLAPIENTRY
-_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
- GLsizei *count, GLuint *obj)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetAttachedShaders(ctx, program, maxCount, count, obj);
-}
-
-
-GLint GLAPIENTRY
-_mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.GetAttribLocation(ctx, program, name);
-}
-
-
-void GLAPIENTRY
-_mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length,
- GLcharARB * infoLog)
-{
- GET_CURRENT_CONTEXT(ctx);
- /* Implement in terms of GetProgramInfoLog, GetShaderInfoLog */
- if (ctx->Driver.IsProgram(ctx, object)) {
- ctx->Driver.GetProgramInfoLog(ctx, object, maxLength, length, infoLog);
- }
- else if (ctx->Driver.IsShader(ctx, object)) {
- ctx->Driver.GetShaderInfoLog(ctx, object, maxLength, length, infoLog);
- }
- else {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInfoLogARB");
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetObjectParameterivARB(GLhandleARB object, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- /* Implement in terms of GetProgramiv, GetShaderiv */
- if (ctx->Driver.IsProgram(ctx, object)) {
- if (pname == GL_OBJECT_TYPE_ARB) {
- *params = GL_PROGRAM_OBJECT_ARB;
- }
- else {
- ctx->Driver.GetProgramiv(ctx, object, pname, params);
- }
- }
- else if (ctx->Driver.IsShader(ctx, object)) {
- if (pname == GL_OBJECT_TYPE_ARB) {
- *params = GL_SHADER_OBJECT_ARB;
- }
- else {
- ctx->Driver.GetShaderiv(ctx, object, pname, params);
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB");
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname,
- GLfloat *params)
-{
- GLint iparams[1]; /* XXX is one element enough? */
- _mesa_GetObjectParameterivARB(object, pname, iparams);
- params[0] = (GLfloat) iparams[0];
-}
-
-
-void GLAPIENTRY
-_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetProgramiv(ctx, program, pname, params);
-}
-
-
-void GLAPIENTRY
-_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetShaderiv(ctx, shader, pname, params);
-}
-
-
-void GLAPIENTRY
-_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetProgramInfoLog(ctx, program, bufSize, length, infoLog);
-}
-
-
-void GLAPIENTRY
-_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetShaderInfoLog(ctx, shader, bufSize, length, infoLog);
-}
-
-
-void GLAPIENTRY
-_mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength,
- GLsizei *length, GLcharARB *sourceOut)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetShaderSource(ctx, shader, maxLength, length, sourceOut);
-}
-
-
-void GLAPIENTRY
-_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat * params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetUniformfv(ctx, program, location, params);
-}
-
-
-void GLAPIENTRY
-_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.GetUniformiv(ctx, program, location, params);
-}
-
-
-
-#if 0
-GLint GLAPIENTRY
-_mesa_GetUniformLocation(GLuint program, const GLcharARB *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.GetUniformLocation(ctx, program, name);
-}
-#endif
-
-
-GLhandleARB GLAPIENTRY
-_mesa_GetHandleARB(GLenum pname)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.GetHandle(ctx, pname);
-}
-
-
-GLint GLAPIENTRY
-_mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.GetUniformLocation(ctx, programObj, name);
-}
-
-
-GLboolean GLAPIENTRY
-_mesa_IsProgram(GLuint name)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.IsProgram(ctx, name);
-}
-
-
-GLboolean GLAPIENTRY
-_mesa_IsShader(GLuint name)
-{
- GET_CURRENT_CONTEXT(ctx);
- return ctx->Driver.IsShader(ctx, name);
-}
-
-
-void GLAPIENTRY
-_mesa_LinkProgramARB(GLhandleARB programObj)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.LinkProgram(ctx, programObj);
-}
-
-
-
-/**
- * Read shader source code from a file.
- * Useful for debugging to override an app's shader.
- */
-static GLcharARB *
-_mesa_read_shader(const char *fname)
-{
- const int max = 50*1000;
- FILE *f = fopen(fname, "r");
- GLcharARB *buffer, *shader;
- int len;
-
- if (!f) {
- return NULL;
- }
-
- buffer = (char *) malloc(max);
- len = fread(buffer, 1, max, f);
- buffer[len] = 0;
-
- fclose(f);
-
- shader = _mesa_strdup(buffer);
- free(buffer);
-
- return shader;
-}
-
-
-/**
- * Called via glShaderSource() and glShaderSourceARB() API functions.
- * Basically, concatenate the source code strings into one long string
- * and pass it to ctx->Driver.ShaderSource().
- */
-void GLAPIENTRY
-_mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
- const GLcharARB ** string, const GLint * length)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint *offsets;
- GLsizei i, totalLength;
- GLcharARB *source;
- GLuint checksum;
-
- if (!shaderObj || string == NULL) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
- return;
- }
-
- /*
- * This array holds offsets of where the appropriate string ends, thus the
- * last element will be set to the total length of the source code.
- */
- offsets = (GLint *) malloc(count * sizeof(GLint));
- if (offsets == NULL) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
- return;
- }
-
- for (i = 0; i < count; i++) {
- if (string[i] == NULL) {
- free((GLvoid *) offsets);
- _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)");
- return;
- }
- if (length == NULL || length[i] < 0)
- offsets[i] = strlen(string[i]);
- else
- offsets[i] = length[i];
- /* accumulate string lengths */
- if (i > 0)
- offsets[i] += offsets[i - 1];
- }
-
- /* Total length of source string is sum off all strings plus two.
- * One extra byte for terminating zero, another extra byte to silence
- * valgrind warnings in the parser/grammer code.
- */
- totalLength = offsets[count - 1] + 2;
- source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB));
- if (source == NULL) {
- free((GLvoid *) offsets);
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
- return;
- }
-
- for (i = 0; i < count; i++) {
- GLint start = (i > 0) ? offsets[i - 1] : 0;
- memcpy(source + start, string[i],
- (offsets[i] - start) * sizeof(GLcharARB));
- }
- source[totalLength - 1] = '\0';
- source[totalLength - 2] = '\0';
-
- if (SHADER_SUBST) {
- /* Compute the shader's source code checksum then try to open a file
- * named newshader_<CHECKSUM>. If it exists, use it in place of the
- * original shader source code. For debugging.
- */
- char filename[100];
- GLcharARB *newSource;
-
- checksum = _mesa_str_checksum(source);
-
- _mesa_snprintf(filename, sizeof(filename), "newshader_%d", checksum);
-
- newSource = _mesa_read_shader(filename);
- if (newSource) {
- fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
- shaderObj, checksum, filename);
- free(source);
- source = newSource;
- }
- }
-
- ctx->Driver.ShaderSource(ctx, shaderObj, source);
-
- if (SHADER_SUBST) {
- struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj);
- if (sh)
- sh->SourceChecksum = checksum; /* save original checksum */
- }
-
- free(offsets);
-}
-
-
-void GLAPIENTRY
-_mesa_Uniform1fARB(GLint location, GLfloat v0)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, 1, &v0, GL_FLOAT);
-}
-
-void GLAPIENTRY
-_mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLfloat v[2];
- v[0] = v0;
- v[1] = v1;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC2);
-}
-
-void GLAPIENTRY
-_mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLfloat v[3];
- v[0] = v0;
- v[1] = v1;
- v[2] = v2;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC3);
-}
-
-void GLAPIENTRY
-_mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
- GLfloat v3)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLfloat v[4];
- v[0] = v0;
- v[1] = v1;
- v[2] = v2;
- v[3] = v3;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC4);
-}
-
-void GLAPIENTRY
-_mesa_Uniform1iARB(GLint location, GLint v0)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, 1, &v0, GL_INT);
-}
-
-void GLAPIENTRY
-_mesa_Uniform2iARB(GLint location, GLint v0, GLint v1)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint v[2];
- v[0] = v0;
- v[1] = v1;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC2);
-}
-
-void GLAPIENTRY
-_mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint v[3];
- v[0] = v0;
- v[1] = v1;
- v[2] = v2;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC3);
-}
-
-void GLAPIENTRY
-_mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLint v[4];
- v[0] = v0;
- v[1] = v1;
- v[2] = v2;
- v[3] = v3;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC4);
-}
-
-void GLAPIENTRY
-_mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT);
-}
-
-void GLAPIENTRY
-_mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC2);
-}
-
-void GLAPIENTRY
-_mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC3);
-}
-
-void GLAPIENTRY
-_mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC4);
-}
-
-void GLAPIENTRY
-_mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_INT);
-}
-
-void GLAPIENTRY
-_mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC2);
-}
-
-void GLAPIENTRY
-_mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC3);
-}
-
-void GLAPIENTRY
-_mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC4);
-}
-
-
-/** OpenGL 3.0 GLuint-valued functions **/
-void GLAPIENTRY
-_mesa_Uniform1ui(GLint location, GLuint v0)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, 1, &v0, GL_UNSIGNED_INT);
-}
-
-void GLAPIENTRY
-_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint v[2];
- v[0] = v0;
- v[1] = v1;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC2);
-}
-
-void GLAPIENTRY
-_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint v[3];
- v[0] = v0;
- v[1] = v1;
- v[2] = v2;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC3);
-}
-
-void GLAPIENTRY
-_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint v[4];
- v[0] = v0;
- v[1] = v1;
- v[2] = v2;
- v[3] = v3;
- ctx->Driver.Uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC4);
-}
-
-void GLAPIENTRY
-_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_UNSIGNED_INT);
-}
-
-void GLAPIENTRY
-_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC2);
-}
-
-void GLAPIENTRY
-_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC3);
-}
-
-void GLAPIENTRY
-_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.Uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC4);
-}
-
-
-
-void GLAPIENTRY
-_mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 2, 2, location, count, transpose, value);
-}
-
-void GLAPIENTRY
-_mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 3, 3, location, count, transpose, value);
-}
-
-void GLAPIENTRY
-_mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat * value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 4, 4, location, count, transpose, value);
-}
-
-
-/**
- * Non-square UniformMatrix are OpenGL 2.1
- */
-void GLAPIENTRY
-_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 2, 3, location, count, transpose, value);
-}
-
-void GLAPIENTRY
-_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 3, 2, location, count, transpose, value);
-}
-
-void GLAPIENTRY
-_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 2, 4, location, count, transpose, value);
-}
-
-void GLAPIENTRY
-_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 4, 2, location, count, transpose, value);
-}
-
-void GLAPIENTRY
-_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 3, 4, location, count, transpose, value);
-}
-
-void GLAPIENTRY
-_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.UniformMatrix(ctx, 4, 3, location, count, transpose, value);
-}
-
-
-void GLAPIENTRY
-_mesa_UseProgramObjectARB(GLhandleARB program)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, _NEW_PROGRAM);
- ctx->Driver.UseProgram(ctx, program);
-}
-
-
-void GLAPIENTRY
-_mesa_ValidateProgramARB(GLhandleARB program)
-{
- GET_CURRENT_CONTEXT(ctx);
- ctx->Driver.ValidateProgram(ctx, program);
-}
-
-#if FEATURE_ES2
-
-void GLAPIENTRY
-_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
- GLint* range, GLint* precision)
-{
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
-}
-
-
-void GLAPIENTRY
-_mesa_ReleaseShaderCompiler(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
-}
-
-
-void GLAPIENTRY
-_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
- const void* binary, GLint length)
-{
- GET_CURRENT_CONTEXT(ctx);
- _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
-}
-
-#endif
-
-
-/**
- * Plug in shader-related functions into API dispatch table.
- */
-void
-_mesa_init_shader_dispatch(struct _glapi_table *exec)
-{
-#if FEATURE_GL
- /* GL_ARB_vertex/fragment_shader */
- SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
- SET_GetHandleARB(exec, _mesa_GetHandleARB);
- SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
- SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
- SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
- SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
- SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
- SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
- SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
- SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
- SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
- SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
- SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
- SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
- SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
- SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
- SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
- SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
- SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
- SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
- SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
- SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
- SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
- SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
- SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
- SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
- SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
- SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
- SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
- SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
- SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
- SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
- SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
- SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
- SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
- SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
- SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
- SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
- SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
-
- /* OpenGL 2.0 */
- SET_AttachShader(exec, _mesa_AttachShader);
- SET_CreateProgram(exec, _mesa_CreateProgram);
- SET_CreateShader(exec, _mesa_CreateShader);
- SET_DeleteProgram(exec, _mesa_DeleteProgram);
- SET_DeleteShader(exec, _mesa_DeleteShader);
- SET_DetachShader(exec, _mesa_DetachShader);
- SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
- SET_GetProgramiv(exec, _mesa_GetProgramiv);
- SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
- SET_GetShaderiv(exec, _mesa_GetShaderiv);
- SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
- SET_IsProgram(exec, _mesa_IsProgram);
- SET_IsShader(exec, _mesa_IsShader);
-
- /* OpenGL 2.1 */
- SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
- SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
- SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
- SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
- SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
- SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
-
-#if FEATURE_ARB_vertex_shader
- SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
- SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
- SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
-#endif
-
- /* OpenGL 3.0 */
- /* XXX finish dispatch */
- (void) _mesa_Uniform1ui;
- (void) _mesa_Uniform2ui;
- (void) _mesa_Uniform3ui;
- (void) _mesa_Uniform4ui;
- (void) _mesa_Uniform1uiv;
- (void) _mesa_Uniform2uiv;
- (void) _mesa_Uniform3uiv;
- (void) _mesa_Uniform4uiv;
-#endif /* FEATURE_GL */
-}
diff --git a/src/mesa/main/shaders.h b/src/mesa/main/shaders.h
deleted file mode 100644
index af65b2d01a7..00000000000
--- a/src/mesa/main/shaders.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.3
- *
- * Copyright (C) 2004-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef SHADERS_H
-#define SHADERS_H
-
-
-#include "glheader.h"
-#include "mtypes.h"
-
-extern void
-_mesa_init_shader_dispatch(struct _glapi_table *exec);
-
-extern void GLAPIENTRY
-_mesa_DeleteObjectARB(GLhandleARB obj);
-
-extern GLhandleARB GLAPIENTRY
-_mesa_GetHandleARB(GLenum pname);
-
-extern void GLAPIENTRY
-_mesa_DetachObjectARB (GLhandleARB, GLhandleARB);
-
-extern GLhandleARB GLAPIENTRY
-_mesa_CreateShaderObjectARB (GLenum);
-
-extern void GLAPIENTRY
-_mesa_ShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_CompileShaderARB (GLhandleARB);
-
-extern GLhandleARB GLAPIENTRY
-_mesa_CreateProgramObjectARB (void);
-
-extern void GLAPIENTRY
-_mesa_AttachObjectARB (GLhandleARB, GLhandleARB);
-
-extern void GLAPIENTRY
-_mesa_LinkProgramARB (GLhandleARB);
-
-extern void GLAPIENTRY
-_mesa_UseProgramObjectARB (GLhandleARB);
-
-extern void GLAPIENTRY
-_mesa_ValidateProgramARB (GLhandleARB);
-
-extern void GLAPIENTRY
-_mesa_Uniform1fARB (GLint, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform2fARB (GLint, GLfloat, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform3fARB (GLint, GLfloat, GLfloat, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-
-extern void GLAPIENTRY
-_mesa_Uniform1iARB (GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform2iARB (GLint, GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform3iARB (GLint, GLint, GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform4iARB (GLint, GLint, GLint, GLint, GLint);
-
-extern void GLAPIENTRY
-_mesa_Uniform1fvARB (GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform2fvARB (GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform3fvARB (GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform4fvARB (GLint, GLsizei, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_Uniform1ivARB (GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform2ivARB (GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform3ivARB (GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform4ivARB (GLint, GLsizei, const GLint *);
-
-extern void GLAPIENTRY
-_mesa_Uniform1ui(GLint location, GLuint v0);
-
-extern void GLAPIENTRY
-_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1);
-
-extern void GLAPIENTRY
-_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
-
-extern void GLAPIENTRY
-_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-extern void GLAPIENTRY
-_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value);
-
-extern void GLAPIENTRY
-_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value);
-
-extern void GLAPIENTRY
-_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value);
-
-extern void GLAPIENTRY
-_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value);
-
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_GetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_GetObjectParameterivARB (GLhandleARB, GLenum, GLint *);
-
-extern void GLAPIENTRY
-_mesa_GetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-
-extern void GLAPIENTRY
-_mesa_GetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
-
-extern GLint GLAPIENTRY
-_mesa_GetUniformLocationARB (GLhandleARB, const GLcharARB *);
-
-extern void GLAPIENTRY
-_mesa_GetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-
-extern void GLAPIENTRY
-_mesa_GetUniformfvARB (GLhandleARB, GLint, GLfloat *);
-
-extern void GLAPIENTRY
-_mesa_GetUniformivARB (GLhandleARB, GLint, GLint *);
-
-extern void GLAPIENTRY
-_mesa_GetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-
-#if FEATURE_ARB_vertex_shader
-
-extern void GLAPIENTRY
-_mesa_BindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *);
-
-extern void GLAPIENTRY
-_mesa_GetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-
-extern GLint GLAPIENTRY
-_mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *);
-
-#endif /* FEATURE_ARB_vertex_shader */
-
-
-/* 2.0 */
-extern void GLAPIENTRY
-_mesa_AttachShader(GLuint program, GLuint shader);
-
-extern GLuint GLAPIENTRY
-_mesa_CreateShader(GLenum);
-
-extern GLuint GLAPIENTRY
-_mesa_CreateProgram(void);
-
-extern void GLAPIENTRY
-_mesa_DeleteProgram(GLuint program);
-
-extern void GLAPIENTRY
-_mesa_DeleteShader(GLuint shader);
-
-extern void GLAPIENTRY
-_mesa_DetachShader(GLuint program, GLuint shader);
-
-extern void GLAPIENTRY
-_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
- GLsizei *count, GLuint *obj);
-
-extern void GLAPIENTRY
-_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
-
-extern void GLAPIENTRY
-_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
-
-extern GLboolean GLAPIENTRY
-_mesa_IsProgram(GLuint program);
-
-extern GLboolean GLAPIENTRY
-_mesa_IsShader(GLuint shader);
-
-
-
-/* 2.1 */
-extern void GLAPIENTRY
-_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value);
-
-extern void GLAPIENTRY
-_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
- const GLfloat *value);
-
-/* GLES 2.0 */
-extern void GLAPIENTRY
-_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
- GLint* range, GLint* precision);
-
-extern void GLAPIENTRY
-_mesa_ReleaseShaderCompiler(void);
-
-extern void GLAPIENTRY
-_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
- const void* binary, GLint length);
-
-#endif /* SHADERS_H */
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index e364e24048f..f9d10f3bbea 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -33,14 +33,14 @@
#include "mtypes.h"
#include "hash.h"
#include "arrayobj.h"
+#if FEATURE_ATI_fragment_shader
+#include "atifragshader.h"
+#endif
#include "bufferobj.h"
#include "shared.h"
-#include "shader/program.h"
-#include "shader/shader_api.h"
+#include "program/program.h"
#include "dlist.h"
-#if FEATURE_ATI_fragment_shader
-#include "shader/atifragshader.h"
-#endif
+#include "shaderobj.h"
#if FEATURE_ARB_sync
#include "syncobj.h"
#endif
@@ -228,12 +228,12 @@ delete_shader_cb(GLuint id, void *data, void *userData)
GLcontext *ctx = (GLcontext *) userData;
struct gl_shader *sh = (struct gl_shader *) data;
if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) {
- _mesa_free_shader(ctx, sh);
+ ctx->Driver.DeleteShader(ctx, sh);
}
else {
struct gl_shader_program *shProg = (struct gl_shader_program *) data;
ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA);
- _mesa_free_shader_program(ctx, shProg);
+ ctx->Driver.DeleteShaderProgram(ctx, shProg);
}
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index b971cc976ee..2239ea4a85b 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -41,8 +41,8 @@
#include "light.h"
#include "matrix.h"
#include "pixel.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
#include "state.h"
#include "stencil.h"
#include "texenvprogram.h"
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 964ba13c700..30963bdf7d0 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -28,13 +28,13 @@
#include "glheader.h"
#include "imports.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_cache.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
-#include "shader/programopt.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_cache.h"
+#include "program/prog_instruction.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
+#include "program/programopt.h"
#include "texenvprogram.h"
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index de37e340393..1df165cf6a8 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -40,7 +40,7 @@
#include "teximage.h"
#include "texobj.h"
#include "mtypes.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index ca03404f12f..745a0aeec9d 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -39,7 +39,7 @@
#include "main/texparam.h"
#include "main/teximage.h"
#include "main/texstate.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
/**
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index fce17c2b660..dae173d1bde 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -528,7 +528,7 @@ update_texture_state( GLcontext *ctx )
/* Get the bitmask of texture target enables.
* enableBits will be a mask of the TEXTURE_*_BIT flags indicating
* which texture targets are enabled (fixed function) or referenced
- * by a fragment shader/program. When multiple flags are set, we'll
+ * by a fragment program/program. When multiple flags are set, we'll
* settle on the one with highest priority (see below).
*/
if (vprog) {
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 050ebf02701..6126f1286d8 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -35,10 +35,12 @@
#include "context.h"
#include "hash.h"
#include "transformfeedback.h"
+#include "shaderapi.h"
+#include "shaderobj.h"
#include "main/dispatch.h"
-#include "shader/prog_parameter.h"
-#include "shader/shader_api.h"
+#include "program/prog_parameter.h"
+//#include "program/shader_api.h"
#if FEATURE_EXT_transform_feedback
diff --git a/src/mesa/shader/uniforms.c b/src/mesa/main/uniforms.c
index b1fb90d020b..aac4177f408 100644
--- a/src/mesa/shader/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -37,11 +37,13 @@
#include "main/glheader.h"
#include "main/context.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
-#include "shader/prog_uniform.h"
-#include "shader/shader_api.h"
-#include "uniforms.h"
+#include "main/dispatch.h"
+#include "main/shaderapi.h"
+#include "main/shaderobj.h"
+#include "main/uniforms.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
+#include "program/prog_uniform.h"
@@ -141,7 +143,7 @@ get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index)
/**
- * Called via ctx->Driver.GetActiveUniform().
+ * Called by glGetActiveUniform().
*/
static void
_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
@@ -367,7 +369,7 @@ split_location_offset(GLint *location, GLint *offset)
/**
- * Called via ctx->Driver.GetUniformfv().
+ * Called via glGetUniformfv().
*/
static void
_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
@@ -399,7 +401,7 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
/**
- * Called via ctx->Driver.GetUniformiv().
+ * Called via glGetUniformiv().
* \sa _mesa_get_uniformfv, only difference is a cast.
*/
static void
@@ -432,7 +434,7 @@ _mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location,
/**
- * Called via ctx->Driver.GetUniformLocation().
+ * Called via glGetUniformLocation().
*
* The return value will encode two values, the uniform location and an
* offset (used for arrays, structs).
@@ -508,6 +510,41 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
}
+
+/**
+ * Update the vertex/fragment program's TexturesUsed array.
+ *
+ * This needs to be called after glUniform(set sampler var) is called.
+ * A call to glUniform(samplerVar, value) causes a sampler to point to a
+ * particular texture unit. We know the sampler's texture target
+ * (1D/2D/3D/etc) from compile time but the sampler's texture unit is
+ * set by glUniform() calls.
+ *
+ * So, scan the program->SamplerUnits[] and program->SamplerTargets[]
+ * information to update the prog->TexturesUsed[] values.
+ * Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX,
+ * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc.
+ * We'll use that info for state validation before rendering.
+ */
+void
+_mesa_update_shader_textures_used(struct gl_program *prog)
+{
+ GLuint s;
+
+ memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
+
+ for (s = 0; s < MAX_SAMPLERS; s++) {
+ if (prog->SamplersUsed & (1 << s)) {
+ GLuint unit = prog->SamplerUnits[s];
+ GLuint tgt = prog->SamplerTargets[s];
+ assert(unit < MAX_TEXTURE_IMAGE_UNITS);
+ assert(tgt < NUM_TEXTURE_TARGETS);
+ prog->TexturesUsed[unit] |= (1 << tgt);
+ }
+ }
+}
+
+
/**
* Check if the type given by userType is allowed to set a uniform of the
* target type. Generally, equivalence is required, but setting Boolean
@@ -697,7 +734,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
/**
- * Called via ctx->Driver.Uniform().
+ * Called via glUniform*() functions.
*/
static void
_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
@@ -859,7 +896,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
/**
- * Called by ctx->Driver.UniformMatrix().
+ * Called by glUniformMatrix*() functions.
* Note: cols=2, rows=4 ==> array[2] of vec4
*/
static void
@@ -924,14 +961,374 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
}
+void GLAPIENTRY
+_mesa_Uniform1fARB(GLint location, GLfloat v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, 1, &v0, GL_FLOAT);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[2];
+ v[0] = v0;
+ v[1] = v1;
+ _mesa_uniform(ctx, location, 1, v, GL_FLOAT_VEC2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ _mesa_uniform(ctx, location, 1, v, GL_FLOAT_VEC3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
+ GLfloat v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLfloat v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ _mesa_uniform(ctx, location, 1, v, GL_FLOAT_VEC4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1iARB(GLint location, GLint v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, 1, &v0, GL_INT);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2iARB(GLint location, GLint v0, GLint v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[2];
+ v[0] = v0;
+ v[1] = v1;
+ _mesa_uniform(ctx, location, 1, v, GL_INT_VEC2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ _mesa_uniform(ctx, location, 1, v, GL_INT_VEC3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLint v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ _mesa_uniform(ctx, location, 1, v, GL_INT_VEC4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_FLOAT);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_FLOAT_VEC2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_FLOAT_VEC3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_FLOAT_VEC4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_INT);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_INT_VEC2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_INT_VEC3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_INT_VEC4);
+}
+
+
+/** OpenGL 3.0 GLuint-valued functions **/
+void GLAPIENTRY
+_mesa_Uniform1ui(GLint location, GLuint v0)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, 1, &v0, GL_UNSIGNED_INT);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint v[2];
+ v[0] = v0;
+ v[1] = v1;
+ _mesa_uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ _mesa_uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
+ _mesa_uniform(ctx, location, 1, v, GL_UNSIGNED_INT_VEC4);
+}
+
+void GLAPIENTRY
+_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT);
+}
+
+void GLAPIENTRY
+_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC2);
+}
+
+void GLAPIENTRY
+_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC3);
+}
+
+void GLAPIENTRY
+_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform(ctx, location, count, value, GL_UNSIGNED_INT_VEC4);
+}
+
+
+void GLAPIENTRY
+_mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 2, 2, location, count, transpose, value);
+}
+
+void GLAPIENTRY
+_mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 3, 3, location, count, transpose, value);
+}
+
+void GLAPIENTRY
+_mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat * value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 4, 4, location, count, transpose, value);
+}
+
+
+/**
+ * Non-square UniformMatrix are OpenGL 2.1
+ */
+void GLAPIENTRY
+_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 2, 3, location, count, transpose, value);
+}
+
+void GLAPIENTRY
+_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 3, 2, location, count, transpose, value);
+}
+
+void GLAPIENTRY
+_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 2, 4, location, count, transpose, value);
+}
+
+void GLAPIENTRY
+_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 4, 2, location, count, transpose, value);
+}
+
+void GLAPIENTRY
+_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 3, 4, location, count, transpose, value);
+}
+
+void GLAPIENTRY
+_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_uniform_matrix(ctx, 4, 3, location, count, transpose, value);
+}
+
+
+void GLAPIENTRY
+_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_get_uniformfv(ctx, program, location, params);
+}
+
+
+void GLAPIENTRY
+_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_get_uniformiv(ctx, program, location, params);
+}
+
+
+GLint GLAPIENTRY
+_mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ return _mesa_get_uniform_location(ctx, programObj, name);
+}
+
+
+void GLAPIENTRY
+_mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
+ GLsizei maxLength, GLsizei * length, GLint * size,
+ GLenum * type, GLcharARB * name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_get_active_uniform(ctx, program, index, maxLength, length, size,
+ type, name);
+}
+
+
+/**
+ * Plug in shader uniform-related functions into API dispatch table.
+ */
void
-_mesa_init_uniform_functions(struct dd_function_table *driver)
-{
- driver->GetActiveUniform = _mesa_get_active_uniform;
- driver->GetUniformfv = _mesa_get_uniformfv;
- driver->GetUniformiv = _mesa_get_uniformiv;
- driver->GetUniformLocation = _mesa_get_uniform_location;
- driver->Uniform = _mesa_uniform;
- driver->UniformMatrix = _mesa_uniform_matrix;
+_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec)
+{
+ SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
+ SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
+ SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
+ SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
+ SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
+ SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
+ SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
+ SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
+ SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
+ SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
+ SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
+ SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
+ SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
+ SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
+ SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
+ SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
+ SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
+ SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
+ SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
+
+ SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
+ SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
+ SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
+ SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
+
+ /* OpenGL 2.1 */
+ SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
+ SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
+ SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
+ SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
+ SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
+ SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
+
+ /* OpenGL 3.0 */
+ /* XXX finish dispatch */
+ (void) _mesa_Uniform1ui;
+ (void) _mesa_Uniform2ui;
+ (void) _mesa_Uniform3ui;
+ (void) _mesa_Uniform4ui;
+ (void) _mesa_Uniform1uiv;
+ (void) _mesa_Uniform2uiv;
+ (void) _mesa_Uniform3uiv;
+ (void) _mesa_Uniform4uiv;
}
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
new file mode 100644
index 00000000000..29f77cb35a0
--- /dev/null
+++ b/src/mesa/main/uniforms.h
@@ -0,0 +1,158 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef UNIFORMS_H
+#define UNIFORMS_H
+
+
+extern void GLAPIENTRY
+_mesa_Uniform1fARB(GLint, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform2fARB(GLint, GLfloat, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform3fARB(GLint, GLfloat, GLfloat, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform4fARB(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
+
+extern void GLAPIENTRY
+_mesa_Uniform1iARB(GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform2iARB(GLint, GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform3iARB(GLint, GLint, GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform4iARB(GLint, GLint, GLint, GLint, GLint);
+
+extern void GLAPIENTRY
+_mesa_Uniform1fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform2fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform3fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform4fvARB(GLint, GLsizei, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_Uniform1ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform2ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform3ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform4ivARB(GLint, GLsizei, const GLint *);
+
+extern void GLAPIENTRY
+_mesa_Uniform1ui(GLint location, GLuint v0);
+
+extern void GLAPIENTRY
+_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1);
+
+extern void GLAPIENTRY
+_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
+
+extern void GLAPIENTRY
+_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+
+extern void GLAPIENTRY
+_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value);
+
+extern void GLAPIENTRY
+_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value);
+
+extern void GLAPIENTRY
+_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value);
+
+extern void GLAPIENTRY
+_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value);
+
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix2fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix3fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix4fvARB(GLint, GLsizei, GLboolean, const GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value);
+
+extern void GLAPIENTRY
+_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
+ const GLfloat *value);
+
+
+extern void GLAPIENTRY
+_mesa_GetActiveUniformARB(GLhandleARB, GLuint, GLsizei, GLsizei *,
+ GLint *, GLenum *, GLcharARB *);
+
+extern void GLAPIENTRY
+_mesa_GetUniformfvARB(GLhandleARB, GLint, GLfloat *);
+
+extern void GLAPIENTRY
+_mesa_GetUniformivARB(GLhandleARB, GLint, GLint *);
+
+extern GLint GLAPIENTRY
+_mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *);
+
+
+
+extern void
+_mesa_update_shader_textures_used(struct gl_program *prog);
+
+
+extern void
+_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec);
+
+#endif /* UNIFORMS_H */
diff --git a/src/mesa/shader/.gitignore b/src/mesa/program/.gitignore
index 086fd9a705c..086fd9a705c 100644
--- a/src/mesa/shader/.gitignore
+++ b/src/mesa/program/.gitignore
diff --git a/src/mesa/shader/Makefile b/src/mesa/program/Makefile
index 400a543bdab..400a543bdab 100644
--- a/src/mesa/shader/Makefile
+++ b/src/mesa/program/Makefile
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/program/arbprogparse.c
index 6373529e4e8..6373529e4e8 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
diff --git a/src/mesa/shader/arbprogparse.h b/src/mesa/program/arbprogparse.h
index 980d39fb9fe..980d39fb9fe 100644
--- a/src/mesa/shader/arbprogparse.h
+++ b/src/mesa/program/arbprogparse.h
diff --git a/src/mesa/shader/descrip.mms b/src/mesa/program/descrip.mms
index 59730020d0c..59730020d0c 100644
--- a/src/mesa/shader/descrip.mms
+++ b/src/mesa/program/descrip.mms
diff --git a/src/mesa/shader/hash_table.c b/src/mesa/program/hash_table.c
index fa6ba2bfdfc..fa6ba2bfdfc 100644
--- a/src/mesa/shader/hash_table.c
+++ b/src/mesa/program/hash_table.c
diff --git a/src/mesa/shader/hash_table.h b/src/mesa/program/hash_table.h
index 7b302f5dbee..7b302f5dbee 100644
--- a/src/mesa/shader/hash_table.h
+++ b/src/mesa/program/hash_table.h
diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/program/lex.yy.c
index 4c5c644a6ed..5b3cae76506 100644
--- a/src/mesa/shader/lex.yy.c
+++ b/src/mesa/program/lex.yy.c
@@ -1034,12 +1034,11 @@ static yyconst flex_int16_t yy_chk[1368] =
*/
#include "main/glheader.h"
#include "main/imports.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_statevars.h"
-
-#include "shader/symbol_table.h"
-#include "shader/program_parser.h"
-#include "shader/program_parse.tab.h"
+#include "program/prog_instruction.h"
+#include "program/prog_statevars.h"
+#include "program/symbol_table.h"
+#include "program/program_parser.h"
+#include "program/program_parse.tab.h"
#define require_ARB_vp (yyextra->mode == ARB_vertex)
#define require_ARB_fp (yyextra->mode == ARB_fragment)
@@ -1152,7 +1151,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
} while(0);
#define YY_EXTRA_TYPE struct asm_parser_state *
-#line 1156 "lex.yy.c"
+#line 1155 "lex.yy.c"
#define INITIAL 0
@@ -1297,7 +1296,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -1393,10 +1392,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 157 "program_lexer.l"
+#line 156 "program_lexer.l"
-#line 1400 "lex.yy.c"
+#line 1399 "lex.yy.c"
yylval = yylval_param;
@@ -1485,17 +1484,17 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 159 "program_lexer.l"
+#line 158 "program_lexer.l"
{ return ARBvp_10; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 160 "program_lexer.l"
+#line 159 "program_lexer.l"
{ return ARBfp_10; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 161 "program_lexer.l"
+#line 160 "program_lexer.l"
{
yylval->integer = at_address;
return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS);
@@ -1503,692 +1502,692 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 165 "program_lexer.l"
+#line 164 "program_lexer.l"
{ return ALIAS; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 166 "program_lexer.l"
+#line 165 "program_lexer.l"
{ return ATTRIB; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 167 "program_lexer.l"
+#line 166 "program_lexer.l"
{ return END; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 168 "program_lexer.l"
+#line 167 "program_lexer.l"
{ return OPTION; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 169 "program_lexer.l"
+#line 168 "program_lexer.l"
{ return OUTPUT; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 170 "program_lexer.l"
+#line 169 "program_lexer.l"
{ return PARAM; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 171 "program_lexer.l"
+#line 170 "program_lexer.l"
{ yylval->integer = at_temp; return TEMP; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 173 "program_lexer.l"
+#line 172 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, ABS, 3); }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 174 "program_lexer.l"
+#line 173 "program_lexer.l"
{ return_opcode( 1, BIN_OP, ADD, 3); }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 175 "program_lexer.l"
+#line 174 "program_lexer.l"
{ return_opcode(require_ARB_vp, ARL, ARL, 3); }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 177 "program_lexer.l"
+#line 176 "program_lexer.l"
{ return_opcode(require_ARB_fp, TRI_OP, CMP, 3); }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 178 "program_lexer.l"
+#line 177 "program_lexer.l"
{ return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 180 "program_lexer.l"
+#line 179 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 181 "program_lexer.l"
+#line 180 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 182 "program_lexer.l"
+#line 181 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DP3, 3); }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 183 "program_lexer.l"
+#line 182 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DP4, 3); }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 184 "program_lexer.l"
+#line 183 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DPH, 3); }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 185 "program_lexer.l"
+#line 184 "program_lexer.l"
{ return_opcode( 1, BIN_OP, DST, 3); }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 187 "program_lexer.l"
+#line 186 "program_lexer.l"
{ return_opcode( 1, SCALAR_OP, EX2, 3); }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 188 "program_lexer.l"
+#line 187 "program_lexer.l"
{ return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 190 "program_lexer.l"
+#line 189 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, FLR, 3); }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 191 "program_lexer.l"
+#line 190 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, FRC, 3); }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 193 "program_lexer.l"
+#line 192 "program_lexer.l"
{ return_opcode(require_ARB_fp, KIL, KIL, 3); }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 195 "program_lexer.l"
+#line 194 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, LIT, 3); }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 196 "program_lexer.l"
+#line 195 "program_lexer.l"
{ return_opcode( 1, SCALAR_OP, LG2, 3); }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 197 "program_lexer.l"
+#line 196 "program_lexer.l"
{ return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 198 "program_lexer.l"
+#line 197 "program_lexer.l"
{ return_opcode(require_ARB_fp, TRI_OP, LRP, 3); }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 200 "program_lexer.l"
+#line 199 "program_lexer.l"
{ return_opcode( 1, TRI_OP, MAD, 3); }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 201 "program_lexer.l"
+#line 200 "program_lexer.l"
{ return_opcode( 1, BIN_OP, MAX, 3); }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 202 "program_lexer.l"
+#line 201 "program_lexer.l"
{ return_opcode( 1, BIN_OP, MIN, 3); }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 203 "program_lexer.l"
+#line 202 "program_lexer.l"
{ return_opcode( 1, VECTOR_OP, MOV, 3); }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 204 "program_lexer.l"
+#line 203 "program_lexer.l"
{ return_opcode( 1, BIN_OP, MUL, 3); }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 206 "program_lexer.l"
+#line 205 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 207 "program_lexer.l"
+#line 206 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 208 "program_lexer.l"
+#line 207 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 209 "program_lexer.l"
+#line 208 "program_lexer.l"
{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 210 "program_lexer.l"
+#line 209 "program_lexer.l"
{ return_opcode( 1, BINSC_OP, POW, 3); }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 212 "program_lexer.l"
+#line 211 "program_lexer.l"
{ return_opcode( 1, SCALAR_OP, RCP, 3); }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 213 "program_lexer.l"
+#line 212 "program_lexer.l"
{ return_opcode(require_NV_fp, BIN_OP, RFL, 3); }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 214 "program_lexer.l"
+#line 213 "program_lexer.l"
{ return_opcode( 1, SCALAR_OP, RSQ, 3); }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 216 "program_lexer.l"
+#line 215 "program_lexer.l"
{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 217 "program_lexer.l"
+#line 216 "program_lexer.l"
{ return_opcode(require_NV_fp, BIN_OP, SEQ, 3); }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 218 "program_lexer.l"
+#line 217 "program_lexer.l"
{ return_opcode(require_NV_fp, BIN_OP, SFL, 3); }
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 219 "program_lexer.l"
+#line 218 "program_lexer.l"
{ return_opcode( 1, BIN_OP, SGE, 3); }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 220 "program_lexer.l"
+#line 219 "program_lexer.l"
{ return_opcode(require_NV_fp, BIN_OP, SGT, 3); }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 221 "program_lexer.l"
+#line 220 "program_lexer.l"
{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 222 "program_lexer.l"
+#line 221 "program_lexer.l"
{ return_opcode(require_NV_fp, BIN_OP, SLE, 3); }
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 223 "program_lexer.l"
+#line 222 "program_lexer.l"
{ return_opcode( 1, BIN_OP, SLT, 3); }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 224 "program_lexer.l"
+#line 223 "program_lexer.l"
{ return_opcode(require_NV_fp, BIN_OP, SNE, 3); }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 225 "program_lexer.l"
+#line 224 "program_lexer.l"
{ return_opcode(require_NV_fp, BIN_OP, STR, 3); }
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 226 "program_lexer.l"
+#line 225 "program_lexer.l"
{ return_opcode( 1, BIN_OP, SUB, 3); }
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 227 "program_lexer.l"
+#line 226 "program_lexer.l"
{ return_opcode( 1, SWZ, SWZ, 3); }
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 229 "program_lexer.l"
+#line 228 "program_lexer.l"
{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); }
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 230 "program_lexer.l"
+#line 229 "program_lexer.l"
{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); }
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 231 "program_lexer.l"
+#line 230 "program_lexer.l"
{ return_opcode(require_NV_fp, TXD_OP, TXD, 3); }
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 232 "program_lexer.l"
+#line 231 "program_lexer.l"
{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); }
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 234 "program_lexer.l"
+#line 233 "program_lexer.l"
{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); }
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 235 "program_lexer.l"
+#line 234 "program_lexer.l"
{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); }
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 236 "program_lexer.l"
+#line 235 "program_lexer.l"
{ return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); }
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 237 "program_lexer.l"
+#line 236 "program_lexer.l"
{ return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); }
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 239 "program_lexer.l"
+#line 238 "program_lexer.l"
{ return_opcode(require_NV_fp, TRI_OP, X2D, 3); }
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 240 "program_lexer.l"
+#line 239 "program_lexer.l"
{ return_opcode( 1, BIN_OP, XPD, 3); }
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 242 "program_lexer.l"
+#line 241 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); }
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 243 "program_lexer.l"
+#line 242 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); }
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 244 "program_lexer.l"
+#line 243 "program_lexer.l"
{ return PROGRAM; }
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 245 "program_lexer.l"
+#line 244 "program_lexer.l"
{ return STATE; }
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 246 "program_lexer.l"
+#line 245 "program_lexer.l"
{ return RESULT; }
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 248 "program_lexer.l"
+#line 247 "program_lexer.l"
{ return AMBIENT; }
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 249 "program_lexer.l"
+#line 248 "program_lexer.l"
{ return ATTENUATION; }
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 250 "program_lexer.l"
+#line 249 "program_lexer.l"
{ return BACK; }
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 251 "program_lexer.l"
+#line 250 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, CLIP); }
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 252 "program_lexer.l"
+#line 251 "program_lexer.l"
{ return COLOR; }
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 253 "program_lexer.l"
+#line 252 "program_lexer.l"
{ return_token_or_DOT(require_ARB_fp, DEPTH); }
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 254 "program_lexer.l"
+#line 253 "program_lexer.l"
{ return DIFFUSE; }
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 255 "program_lexer.l"
+#line 254 "program_lexer.l"
{ return DIRECTION; }
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 256 "program_lexer.l"
+#line 255 "program_lexer.l"
{ return EMISSION; }
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 257 "program_lexer.l"
+#line 256 "program_lexer.l"
{ return ENV; }
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 258 "program_lexer.l"
+#line 257 "program_lexer.l"
{ return EYE; }
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 259 "program_lexer.l"
+#line 258 "program_lexer.l"
{ return FOGCOORD; }
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 260 "program_lexer.l"
+#line 259 "program_lexer.l"
{ return FOG; }
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 261 "program_lexer.l"
+#line 260 "program_lexer.l"
{ return FRONT; }
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 262 "program_lexer.l"
+#line 261 "program_lexer.l"
{ return HALF; }
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 263 "program_lexer.l"
+#line 262 "program_lexer.l"
{ return INVERSE; }
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 264 "program_lexer.l"
+#line 263 "program_lexer.l"
{ return INVTRANS; }
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 265 "program_lexer.l"
+#line 264 "program_lexer.l"
{ return LIGHT; }
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 266 "program_lexer.l"
+#line 265 "program_lexer.l"
{ return LIGHTMODEL; }
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 267 "program_lexer.l"
+#line 266 "program_lexer.l"
{ return LIGHTPROD; }
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 268 "program_lexer.l"
+#line 267 "program_lexer.l"
{ return LOCAL; }
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 269 "program_lexer.l"
+#line 268 "program_lexer.l"
{ return MATERIAL; }
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 270 "program_lexer.l"
+#line 269 "program_lexer.l"
{ return MAT_PROGRAM; }
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 271 "program_lexer.l"
+#line 270 "program_lexer.l"
{ return MATRIX; }
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 272 "program_lexer.l"
+#line 271 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); }
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 273 "program_lexer.l"
+#line 272 "program_lexer.l"
{ return MODELVIEW; }
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 274 "program_lexer.l"
+#line 273 "program_lexer.l"
{ return MVP; }
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 275 "program_lexer.l"
+#line 274 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, NORMAL); }
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 276 "program_lexer.l"
+#line 275 "program_lexer.l"
{ return OBJECT; }
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 277 "program_lexer.l"
+#line 276 "program_lexer.l"
{ return PALETTE; }
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 278 "program_lexer.l"
+#line 277 "program_lexer.l"
{ return PARAMS; }
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 279 "program_lexer.l"
+#line 278 "program_lexer.l"
{ return PLANE; }
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 280 "program_lexer.l"
+#line 279 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, POINT_TOK); }
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 281 "program_lexer.l"
+#line 280 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, POINTSIZE); }
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 282 "program_lexer.l"
+#line 281 "program_lexer.l"
{ return POSITION; }
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 283 "program_lexer.l"
+#line 282 "program_lexer.l"
{ return PRIMARY; }
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 284 "program_lexer.l"
+#line 283 "program_lexer.l"
{ return PROJECTION; }
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 285 "program_lexer.l"
+#line 284 "program_lexer.l"
{ return_token_or_DOT(require_ARB_fp, RANGE); }
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 286 "program_lexer.l"
+#line 285 "program_lexer.l"
{ return ROW; }
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 287 "program_lexer.l"
+#line 286 "program_lexer.l"
{ return SCENECOLOR; }
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 288 "program_lexer.l"
+#line 287 "program_lexer.l"
{ return SECONDARY; }
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 289 "program_lexer.l"
+#line 288 "program_lexer.l"
{ return SHININESS; }
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 290 "program_lexer.l"
+#line 289 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, SIZE_TOK); }
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 291 "program_lexer.l"
+#line 290 "program_lexer.l"
{ return SPECULAR; }
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 292 "program_lexer.l"
+#line 291 "program_lexer.l"
{ return SPOT; }
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 293 "program_lexer.l"
+#line 292 "program_lexer.l"
{ return TEXCOORD; }
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 294 "program_lexer.l"
+#line 293 "program_lexer.l"
{ return_token_or_DOT(require_ARB_fp, TEXENV); }
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 295 "program_lexer.l"
+#line 294 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, TEXGEN); }
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 296 "program_lexer.l"
+#line 295 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); }
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 297 "program_lexer.l"
+#line 296 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); }
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 298 "program_lexer.l"
+#line 297 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); }
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 299 "program_lexer.l"
+#line 298 "program_lexer.l"
{ return TEXTURE; }
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 300 "program_lexer.l"
+#line 299 "program_lexer.l"
{ return TRANSPOSE; }
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 301 "program_lexer.l"
+#line 300 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); }
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 302 "program_lexer.l"
+#line 301 "program_lexer.l"
{ return_token_or_DOT(require_ARB_vp, WEIGHT); }
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 304 "program_lexer.l"
+#line 303 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); }
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 305 "program_lexer.l"
+#line 304 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); }
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 306 "program_lexer.l"
+#line 305 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); }
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 307 "program_lexer.l"
+#line 306 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); }
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 308 "program_lexer.l"
+#line 307 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); }
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 309 "program_lexer.l"
+#line 308 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); }
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 310 "program_lexer.l"
+#line 309 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); }
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 311 "program_lexer.l"
+#line 310 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); }
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 312 "program_lexer.l"
+#line 311 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); }
YY_BREAK
case 135:
YY_RULE_SETUP
-#line 313 "program_lexer.l"
+#line 312 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); }
YY_BREAK
case 136:
YY_RULE_SETUP
-#line 314 "program_lexer.l"
+#line 313 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); }
YY_BREAK
case 137:
YY_RULE_SETUP
-#line 315 "program_lexer.l"
+#line 314 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); }
YY_BREAK
case 138:
YY_RULE_SETUP
-#line 316 "program_lexer.l"
+#line 315 "program_lexer.l"
{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); }
YY_BREAK
case 139:
YY_RULE_SETUP
-#line 318 "program_lexer.l"
+#line 317 "program_lexer.l"
{ return handle_ident(yyextra, yytext, yylval); }
YY_BREAK
case 140:
YY_RULE_SETUP
-#line 320 "program_lexer.l"
+#line 319 "program_lexer.l"
{ return DOT_DOT; }
YY_BREAK
case 141:
YY_RULE_SETUP
-#line 322 "program_lexer.l"
+#line 321 "program_lexer.l"
{
yylval->integer = strtol(yytext, NULL, 10);
return INTEGER;
@@ -2196,7 +2195,7 @@ YY_RULE_SETUP
YY_BREAK
case 142:
YY_RULE_SETUP
-#line 326 "program_lexer.l"
+#line 325 "program_lexer.l"
{
yylval->real = _mesa_strtof(yytext, NULL);
return REAL;
@@ -2208,7 +2207,7 @@ case 143:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 330 "program_lexer.l"
+#line 329 "program_lexer.l"
{
yylval->real = _mesa_strtof(yytext, NULL);
return REAL;
@@ -2216,7 +2215,7 @@ YY_RULE_SETUP
YY_BREAK
case 144:
YY_RULE_SETUP
-#line 334 "program_lexer.l"
+#line 333 "program_lexer.l"
{
yylval->real = _mesa_strtof(yytext, NULL);
return REAL;
@@ -2224,7 +2223,7 @@ YY_RULE_SETUP
YY_BREAK
case 145:
YY_RULE_SETUP
-#line 338 "program_lexer.l"
+#line 337 "program_lexer.l"
{
yylval->real = _mesa_strtof(yytext, NULL);
return REAL;
@@ -2232,7 +2231,7 @@ YY_RULE_SETUP
YY_BREAK
case 146:
YY_RULE_SETUP
-#line 343 "program_lexer.l"
+#line 342 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
yylval->swiz_mask.mask = WRITEMASK_XYZW;
@@ -2241,7 +2240,7 @@ YY_RULE_SETUP
YY_BREAK
case 147:
YY_RULE_SETUP
-#line 349 "program_lexer.l"
+#line 348 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XY
@@ -2251,7 +2250,7 @@ YY_RULE_SETUP
YY_BREAK
case 148:
YY_RULE_SETUP
-#line 355 "program_lexer.l"
+#line 354 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XZW;
@@ -2260,7 +2259,7 @@ YY_RULE_SETUP
YY_BREAK
case 149:
YY_RULE_SETUP
-#line 360 "program_lexer.l"
+#line 359 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_YZW;
@@ -2269,7 +2268,7 @@ YY_RULE_SETUP
YY_BREAK
case 150:
YY_RULE_SETUP
-#line 366 "program_lexer.l"
+#line 365 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_X
@@ -2279,7 +2278,7 @@ YY_RULE_SETUP
YY_BREAK
case 151:
YY_RULE_SETUP
-#line 372 "program_lexer.l"
+#line 371 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_Y
@@ -2289,7 +2288,7 @@ YY_RULE_SETUP
YY_BREAK
case 152:
YY_RULE_SETUP
-#line 378 "program_lexer.l"
+#line 377 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_ZW;
@@ -2298,7 +2297,7 @@ YY_RULE_SETUP
YY_BREAK
case 153:
YY_RULE_SETUP
-#line 384 "program_lexer.l"
+#line 383 "program_lexer.l"
{
const unsigned s = swiz_from_char(yytext[1]);
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
@@ -2308,7 +2307,7 @@ YY_RULE_SETUP
YY_BREAK
case 154:
YY_RULE_SETUP
-#line 391 "program_lexer.l"
+#line 390 "program_lexer.l"
{
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
swiz_from_char(yytext[2]),
@@ -2320,7 +2319,7 @@ YY_RULE_SETUP
YY_BREAK
case 155:
YY_RULE_SETUP
-#line 400 "program_lexer.l"
+#line 399 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_NOOP;
yylval->swiz_mask.mask = WRITEMASK_XYZW;
@@ -2329,7 +2328,7 @@ YY_RULE_SETUP
YY_BREAK
case 156:
YY_RULE_SETUP
-#line 406 "program_lexer.l"
+#line 405 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XY
@@ -2339,7 +2338,7 @@ YY_RULE_SETUP
YY_BREAK
case 157:
YY_RULE_SETUP
-#line 412 "program_lexer.l"
+#line 411 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_XZW;
@@ -2348,7 +2347,7 @@ YY_RULE_SETUP
YY_BREAK
case 158:
YY_RULE_SETUP
-#line 417 "program_lexer.l"
+#line 416 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_YZW;
@@ -2357,7 +2356,7 @@ YY_RULE_SETUP
YY_BREAK
case 159:
YY_RULE_SETUP
-#line 423 "program_lexer.l"
+#line 422 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_X
@@ -2367,7 +2366,7 @@ YY_RULE_SETUP
YY_BREAK
case 160:
YY_RULE_SETUP
-#line 429 "program_lexer.l"
+#line 428 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_Y
@@ -2377,7 +2376,7 @@ YY_RULE_SETUP
YY_BREAK
case 161:
YY_RULE_SETUP
-#line 435 "program_lexer.l"
+#line 434 "program_lexer.l"
{
yylval->swiz_mask.swizzle = SWIZZLE_INVAL;
yylval->swiz_mask.mask = WRITEMASK_ZW;
@@ -2386,7 +2385,7 @@ YY_RULE_SETUP
YY_BREAK
case 162:
YY_RULE_SETUP
-#line 441 "program_lexer.l"
+#line 440 "program_lexer.l"
{
const unsigned s = swiz_from_char(yytext[1]);
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s);
@@ -2396,7 +2395,7 @@ YY_RULE_SETUP
YY_BREAK
case 163:
YY_RULE_SETUP
-#line 449 "program_lexer.l"
+#line 448 "program_lexer.l"
{
if (require_ARB_vp) {
return TEXGEN_R;
@@ -2410,7 +2409,7 @@ YY_RULE_SETUP
YY_BREAK
case 164:
YY_RULE_SETUP
-#line 460 "program_lexer.l"
+#line 459 "program_lexer.l"
{
yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]),
swiz_from_char(yytext[2]),
@@ -2422,13 +2421,13 @@ YY_RULE_SETUP
YY_BREAK
case 165:
YY_RULE_SETUP
-#line 469 "program_lexer.l"
+#line 468 "program_lexer.l"
{ return DOT; }
YY_BREAK
case 166:
/* rule 166 can match eol */
YY_RULE_SETUP
-#line 471 "program_lexer.l"
+#line 470 "program_lexer.l"
{
yylloc->first_line++;
yylloc->first_column = 1;
@@ -2439,7 +2438,7 @@ YY_RULE_SETUP
YY_BREAK
case 167:
YY_RULE_SETUP
-#line 478 "program_lexer.l"
+#line 477 "program_lexer.l"
/* eat whitespace */ ;
YY_BREAK
case 168:
@@ -2447,20 +2446,20 @@ case 168:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 479 "program_lexer.l"
+#line 478 "program_lexer.l"
/* eat comments */ ;
YY_BREAK
case 169:
YY_RULE_SETUP
-#line 480 "program_lexer.l"
+#line 479 "program_lexer.l"
{ return yytext[0]; }
YY_BREAK
case 170:
YY_RULE_SETUP
-#line 481 "program_lexer.l"
+#line 480 "program_lexer.l"
ECHO;
YY_BREAK
-#line 2464 "lex.yy.c"
+#line 2463 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -3635,7 +3634,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 481 "program_lexer.l"
+#line 480 "program_lexer.l"
diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/program/nvfragparse.c
index 0de3c5804d2..0de3c5804d2 100644
--- a/src/mesa/shader/nvfragparse.c
+++ b/src/mesa/program/nvfragparse.c
diff --git a/src/mesa/shader/nvfragparse.h b/src/mesa/program/nvfragparse.h
index 544ab80c56c..544ab80c56c 100644
--- a/src/mesa/shader/nvfragparse.h
+++ b/src/mesa/program/nvfragparse.h
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/program/nvvertparse.c
index 7332fc4780b..e2afcfd4ce6 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/program/nvvertparse.c
@@ -40,7 +40,7 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/imports.h"
-#include "nvprogram.h"
+#include "main/nvprogram.h"
#include "nvvertparse.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
diff --git a/src/mesa/shader/nvvertparse.h b/src/mesa/program/nvvertparse.h
index 9919e22388d..9919e22388d 100644
--- a/src/mesa/shader/nvvertparse.h
+++ b/src/mesa/program/nvvertparse.h
diff --git a/src/mesa/shader/prog_cache.c b/src/mesa/program/prog_cache.c
index e5b602fc093..8af689754bb 100644
--- a/src/mesa/shader/prog_cache.c
+++ b/src/mesa/program/prog_cache.c
@@ -29,8 +29,8 @@
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/imports.h"
-#include "shader/prog_cache.h"
-#include "shader/program.h"
+#include "program/prog_cache.h"
+#include "program/program.h"
struct cache_item
diff --git a/src/mesa/shader/prog_cache.h b/src/mesa/program/prog_cache.h
index 4e1ccac03ff..4e1ccac03ff 100644
--- a/src/mesa/shader/prog_cache.h
+++ b/src/mesa/program/prog_cache.h
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/program/prog_execute.c
index f85c6513f31..f85c6513f31 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/program/prog_execute.h
index adefc5439de..adefc5439de 100644
--- a/src/mesa/shader/prog_execute.h
+++ b/src/mesa/program/prog_execute.h
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/program/prog_instruction.c
index 81099cb99c5..81099cb99c5 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/program/prog_instruction.c
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/program/prog_instruction.h
index 28c797a4ba8..28c797a4ba8 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/program/prog_instruction.h
diff --git a/src/mesa/shader/prog_noise.c b/src/mesa/program/prog_noise.c
index 1713ddb5f34..1713ddb5f34 100644
--- a/src/mesa/shader/prog_noise.c
+++ b/src/mesa/program/prog_noise.c
diff --git a/src/mesa/shader/prog_noise.h b/src/mesa/program/prog_noise.h
index c4779479f9b..c4779479f9b 100644
--- a/src/mesa/shader/prog_noise.h
+++ b/src/mesa/program/prog_noise.h
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/program/prog_optimize.c
index 2941a17da3f..2941a17da3f 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/program/prog_optimize.c
diff --git a/src/mesa/shader/prog_optimize.h b/src/mesa/program/prog_optimize.h
index 43894a27237..43894a27237 100644
--- a/src/mesa/shader/prog_optimize.h
+++ b/src/mesa/program/prog_optimize.h
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/program/prog_parameter.c
index aac488c79ab..aac488c79ab 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/program/prog_parameter.h
index cc3378ae201..cc3378ae201 100644
--- a/src/mesa/shader/prog_parameter.h
+++ b/src/mesa/program/prog_parameter.h
diff --git a/src/mesa/shader/prog_parameter_layout.c b/src/mesa/program/prog_parameter_layout.c
index a8885738321..a8885738321 100644
--- a/src/mesa/shader/prog_parameter_layout.c
+++ b/src/mesa/program/prog_parameter_layout.c
diff --git a/src/mesa/shader/prog_parameter_layout.h b/src/mesa/program/prog_parameter_layout.h
index 99a7b6c7266..99a7b6c7266 100644
--- a/src/mesa/shader/prog_parameter_layout.h
+++ b/src/mesa/program/prog_parameter_layout.h
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/program/prog_print.c
index 05aae83f0c1..05aae83f0c1 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/program/prog_print.c
diff --git a/src/mesa/shader/prog_print.h b/src/mesa/program/prog_print.h
index 9ab74560169..9ab74560169 100644
--- a/src/mesa/shader/prog_print.h
+++ b/src/mesa/program/prog_print.h
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/program/prog_statevars.c
index ead3ece95d4..ead3ece95d4 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/program/prog_statevars.h
index 1753471ffb6..1753471ffb6 100644
--- a/src/mesa/shader/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/program/prog_uniform.c
index c408a8492c6..c408a8492c6 100644
--- a/src/mesa/shader/prog_uniform.c
+++ b/src/mesa/program/prog_uniform.c
diff --git a/src/mesa/shader/prog_uniform.h b/src/mesa/program/prog_uniform.h
index 22a2bfd9701..22a2bfd9701 100644
--- a/src/mesa/shader/prog_uniform.h
+++ b/src/mesa/program/prog_uniform.h
diff --git a/src/mesa/shader/program.c b/src/mesa/program/program.c
index a6ada8a048b..a6ada8a048b 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/program/program.c
diff --git a/src/mesa/shader/program.h b/src/mesa/program/program.h
index af9f4170d1b..af9f4170d1b 100644
--- a/src/mesa/shader/program.h
+++ b/src/mesa/program/program.h
diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/program/program_lexer.l
index fe18272cdba..5730c6d761b 100644
--- a/src/mesa/shader/program_lexer.l
+++ b/src/mesa/program/program_lexer.l
@@ -23,12 +23,11 @@
*/
#include "main/glheader.h"
#include "main/imports.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_statevars.h"
-
-#include "shader/symbol_table.h"
-#include "shader/program_parser.h"
-#include "shader/program_parse.tab.h"
+#include "program/prog_instruction.h"
+#include "program/prog_statevars.h"
+#include "program/symbol_table.h"
+#include "program/program_parser.h"
+#include "program/program_parse.tab.h"
#define require_ARB_vp (yyextra->mode == ARB_vertex)
#define require_ARB_fp (yyextra->mode == ARB_fragment)
diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/program/program_parse.tab.c
index 7da7226c328..6421d1f58aa 100644
--- a/src/mesa/shader/program_parse.tab.c
+++ b/src/mesa/program/program_parse.tab.c
@@ -98,14 +98,14 @@
#include "main/mtypes.h"
#include "main/imports.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_parameter_layout.h"
-#include "shader/prog_statevars.h"
-#include "shader/prog_instruction.h"
-
-#include "shader/symbol_table.h"
-#include "shader/program_parser.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_parameter_layout.h"
+#include "program/prog_statevars.h"
+#include "program/prog_instruction.h"
+
+#include "program/symbol_table.h"
+#include "program/program_parser.h"
extern void *yy_scan_string(char *);
extern void yy_delete_buffer(void *);
diff --git a/src/mesa/shader/program_parse.tab.h b/src/mesa/program/program_parse.tab.h
index 045241d9e77..045241d9e77 100644
--- a/src/mesa/shader/program_parse.tab.h
+++ b/src/mesa/program/program_parse.tab.h
diff --git a/src/mesa/shader/program_parse.y b/src/mesa/program/program_parse.y
index a2f34b863b5..861927c744c 100644
--- a/src/mesa/shader/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -27,14 +27,14 @@
#include "main/mtypes.h"
#include "main/imports.h"
-#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_parameter_layout.h"
-#include "shader/prog_statevars.h"
-#include "shader/prog_instruction.h"
-
-#include "shader/symbol_table.h"
-#include "shader/program_parser.h"
+#include "program/program.h"
+#include "program/prog_parameter.h"
+#include "program/prog_parameter_layout.h"
+#include "program/prog_statevars.h"
+#include "program/prog_instruction.h"
+
+#include "program/symbol_table.h"
+#include "program/program_parser.h"
extern void *yy_scan_string(char *);
extern void yy_delete_buffer(void *);
diff --git a/src/mesa/shader/program_parse_extra.c b/src/mesa/program/program_parse_extra.c
index ae98b782b70..ae98b782b70 100644
--- a/src/mesa/shader/program_parse_extra.c
+++ b/src/mesa/program/program_parse_extra.c
diff --git a/src/mesa/shader/program_parser.h b/src/mesa/program/program_parser.h
index be952d4b9c8..be952d4b9c8 100644
--- a/src/mesa/shader/program_parser.h
+++ b/src/mesa/program/program_parser.h
diff --git a/src/mesa/shader/programopt.c b/src/mesa/program/programopt.c
index fb2ebe6338f..fb2ebe6338f 100644
--- a/src/mesa/shader/programopt.c
+++ b/src/mesa/program/programopt.c
diff --git a/src/mesa/shader/programopt.h b/src/mesa/program/programopt.h
index 21fac07849a..21fac07849a 100644
--- a/src/mesa/shader/programopt.h
+++ b/src/mesa/program/programopt.h
diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/program/symbol_table.c
index 6a5d6868974..6a5d6868974 100644
--- a/src/mesa/shader/symbol_table.c
+++ b/src/mesa/program/symbol_table.c
diff --git a/src/mesa/shader/symbol_table.h b/src/mesa/program/symbol_table.h
index 0c054ef1396..0c054ef1396 100644
--- a/src/mesa/shader/symbol_table.h
+++ b/src/mesa/program/symbol_table.h
diff --git a/src/mesa/shader/uniforms.h b/src/mesa/shader/uniforms.h
deleted file mode 100644
index 52984dedadb..00000000000
--- a/src/mesa/shader/uniforms.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef UNIFORMS_H
-#define UNIFORMS_H
-
-
-extern void
-_mesa_init_uniform_functions(struct dd_function_table *driver);
-
-
-#endif /* UNIFORMS_H */
diff --git a/src/mesa/shader/slang/descrip.mms b/src/mesa/slang/descrip.mms
index 674b786ac08..674b786ac08 100644
--- a/src/mesa/shader/slang/descrip.mms
+++ b/src/mesa/slang/descrip.mms
diff --git a/src/mesa/shader/slang/library/.gitignore b/src/mesa/slang/library/.gitignore
index 02a89fc7df7..02a89fc7df7 100644
--- a/src/mesa/shader/slang/library/.gitignore
+++ b/src/mesa/slang/library/.gitignore
diff --git a/src/mesa/shader/slang/library/Makefile b/src/mesa/slang/library/Makefile
index c6964512bfe..5a767742081 100644
--- a/src/mesa/shader/slang/library/Makefile
+++ b/src/mesa/slang/library/Makefile
@@ -1,6 +1,6 @@
-# src/mesa/shader/slang/library/Makefile
+# src/mesa/slang/library/Makefile
-TOP = ../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
diff --git a/src/mesa/shader/slang/library/SConscript b/src/mesa/slang/library/SConscript
index 0b25467a4e8..792a7953d34 100644
--- a/src/mesa/shader/slang/library/SConscript
+++ b/src/mesa/slang/library/SConscript
@@ -28,25 +28,25 @@ env['BUILDERS']['bld_vert'] = bld_vert
# Generate GLSL builtin library binaries
env.bld_frag(
- '#src/mesa/shader/slang/library/slang_core_gc.h',
- '#src/mesa/shader/slang/library/slang_core.gc')
+ '#src/mesa/slang/library/slang_core_gc.h',
+ '#src/mesa/slang/library/slang_core.gc')
env.bld_frag(
- '#src/mesa/shader/slang/library/slang_common_builtin_gc.h',
- '#src/mesa/shader/slang/library/slang_common_builtin.gc')
+ '#src/mesa/slang/library/slang_common_builtin_gc.h',
+ '#src/mesa/slang/library/slang_common_builtin.gc')
env.bld_frag(
- '#src/mesa/shader/slang/library/slang_fragment_builtin_gc.h',
- '#src/mesa/shader/slang/library/slang_fragment_builtin.gc')
+ '#src/mesa/slang/library/slang_fragment_builtin_gc.h',
+ '#src/mesa/slang/library/slang_fragment_builtin.gc')
env.bld_vert(
- '#src/mesa/shader/slang/library/slang_vertex_builtin_gc.h',
- '#src/mesa/shader/slang/library/slang_vertex_builtin.gc')
+ '#src/mesa/slang/library/slang_vertex_builtin_gc.h',
+ '#src/mesa/slang/library/slang_vertex_builtin.gc')
# Generate GLSL 1.20 builtin library binaries
env.bld_frag(
- '#src/mesa/shader/slang/library/slang_120_core_gc.h',
- '#src/mesa/shader/slang/library/slang_120_core.gc')
+ '#src/mesa/slang/library/slang_120_core_gc.h',
+ '#src/mesa/slang/library/slang_120_core.gc')
env.bld_frag(
- '#src/mesa/shader/slang/library/slang_builtin_120_common_gc.h',
- '#src/mesa/shader/slang/library/slang_builtin_120_common.gc')
+ '#src/mesa/slang/library/slang_builtin_120_common_gc.h',
+ '#src/mesa/slang/library/slang_builtin_120_common.gc')
env.bld_frag(
- '#src/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h',
- '#src/mesa/shader/slang/library/slang_builtin_120_fragment.gc')
+ '#src/mesa/slang/library/slang_builtin_120_fragment_gc.h',
+ '#src/mesa/slang/library/slang_builtin_120_fragment.gc')
diff --git a/src/mesa/shader/slang/library/slang_120_core.gc b/src/mesa/slang/library/slang_120_core.gc
index 04c5ec2ec5c..04c5ec2ec5c 100644
--- a/src/mesa/shader/slang/library/slang_120_core.gc
+++ b/src/mesa/slang/library/slang_120_core.gc
diff --git a/src/mesa/shader/slang/library/slang_builtin_120_common.gc b/src/mesa/slang/library/slang_builtin_120_common.gc
index c6264c3b471..c6264c3b471 100644
--- a/src/mesa/shader/slang/library/slang_builtin_120_common.gc
+++ b/src/mesa/slang/library/slang_builtin_120_common.gc
diff --git a/src/mesa/shader/slang/library/slang_builtin_120_fragment.gc b/src/mesa/slang/library/slang_builtin_120_fragment.gc
index 7d516046a18..7d516046a18 100644
--- a/src/mesa/shader/slang/library/slang_builtin_120_fragment.gc
+++ b/src/mesa/slang/library/slang_builtin_120_fragment.gc
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/slang/library/slang_common_builtin.gc
index d75354deffe..d75354deffe 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/slang/library/slang_common_builtin.gc
diff --git a/src/mesa/shader/slang/library/slang_core.gc b/src/mesa/slang/library/slang_core.gc
index 0a0d15903bc..0a0d15903bc 100644
--- a/src/mesa/shader/slang/library/slang_core.gc
+++ b/src/mesa/slang/library/slang_core.gc
diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin.gc b/src/mesa/slang/library/slang_fragment_builtin.gc
index 54a80ea0e06..54a80ea0e06 100644
--- a/src/mesa/shader/slang/library/slang_fragment_builtin.gc
+++ b/src/mesa/slang/library/slang_fragment_builtin.gc
diff --git a/src/mesa/shader/slang/library/slang_vertex_builtin.gc b/src/mesa/slang/library/slang_vertex_builtin.gc
index 0c67c2ef20d..0c67c2ef20d 100644
--- a/src/mesa/shader/slang/library/slang_vertex_builtin.gc
+++ b/src/mesa/slang/library/slang_vertex_builtin.gc
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/slang/slang_builtin.c
index b7bf4e06dc8..610e793c1d9 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/slang/slang_builtin.c
@@ -31,12 +31,12 @@
#include "main/imports.h"
#include "main/mtypes.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
-#include "shader/slang/slang_ir.h"
-#include "shader/slang/slang_builtin.h"
+#include "program/program.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
+#include "slang/slang_ir.h"
+#include "slang/slang_builtin.h"
/** special state token (see below) */
diff --git a/src/mesa/shader/slang/slang_builtin.h b/src/mesa/slang/slang_builtin.h
index c3021ca33c7..b04b584041b 100644
--- a/src/mesa/shader/slang/slang_builtin.h
+++ b/src/mesa/slang/slang_builtin.h
@@ -26,7 +26,7 @@
#ifndef SLANG_BUILTIN_H
#define SLANG_BUILTIN_H
-#include "shader/prog_parameter.h"
+#include "program/prog_parameter.h"
#include "slang_utility.h"
#include "slang_ir.h"
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/slang/slang_codegen.c
index 0504d47765f..18a0932e4fc 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/slang/slang_codegen.c
@@ -40,11 +40,11 @@
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
+#include "program/program.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
#include "slang_typeinfo.h"
#include "slang_builtin.h"
#include "slang_codegen.h"
diff --git a/src/mesa/shader/slang/slang_codegen.h b/src/mesa/slang/slang_codegen.h
index 461633fe346..461633fe346 100644
--- a/src/mesa/shader/slang/slang_codegen.h
+++ b/src/mesa/slang/slang_codegen.h
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/slang/slang_compile.c
index b6b1f3c9906..af672599ed9 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/slang/slang_compile.c
@@ -30,11 +30,11 @@
#include "main/imports.h"
#include "main/context.h"
-#include "shader/program.h"
-#include "shader/programopt.h"
-#include "shader/prog_optimize.h"
-#include "shader/prog_print.h"
-#include "shader/prog_parameter.h"
+#include "program/program.h"
+#include "program/programopt.h"
+#include "program/prog_optimize.h"
+#include "program/prog_print.h"
+#include "program/prog_parameter.h"
#include "../../glsl/pp/sl_pp_public.h"
#include "../../glsl/cl/sl_cl_parse.h"
#include "slang_codegen.h"
diff --git a/src/mesa/shader/slang/slang_compile.h b/src/mesa/slang/slang_compile.h
index 7fb549d33d2..7fb549d33d2 100644
--- a/src/mesa/shader/slang/slang_compile.h
+++ b/src/mesa/slang/slang_compile.h
diff --git a/src/mesa/shader/slang/slang_compile_function.c b/src/mesa/slang/slang_compile_function.c
index 4dd885176d4..4dd885176d4 100644
--- a/src/mesa/shader/slang/slang_compile_function.c
+++ b/src/mesa/slang/slang_compile_function.c
diff --git a/src/mesa/shader/slang/slang_compile_function.h b/src/mesa/slang/slang_compile_function.h
index a5445ec2537..a5445ec2537 100644
--- a/src/mesa/shader/slang/slang_compile_function.h
+++ b/src/mesa/slang/slang_compile_function.h
diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/slang/slang_compile_operation.c
index 5441d60df59..5441d60df59 100644
--- a/src/mesa/shader/slang/slang_compile_operation.c
+++ b/src/mesa/slang/slang_compile_operation.c
diff --git a/src/mesa/shader/slang/slang_compile_operation.h b/src/mesa/slang/slang_compile_operation.h
index 1f15c198963..1f15c198963 100644
--- a/src/mesa/shader/slang/slang_compile_operation.h
+++ b/src/mesa/slang/slang_compile_operation.h
diff --git a/src/mesa/shader/slang/slang_compile_struct.c b/src/mesa/slang/slang_compile_struct.c
index e6c38730d7d..e6c38730d7d 100644
--- a/src/mesa/shader/slang/slang_compile_struct.c
+++ b/src/mesa/slang/slang_compile_struct.c
diff --git a/src/mesa/shader/slang/slang_compile_struct.h b/src/mesa/slang/slang_compile_struct.h
index 90c5512f4d3..90c5512f4d3 100644
--- a/src/mesa/shader/slang/slang_compile_struct.h
+++ b/src/mesa/slang/slang_compile_struct.h
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/slang/slang_compile_variable.c
index 23c08a9039d..23c08a9039d 100644
--- a/src/mesa/shader/slang/slang_compile_variable.c
+++ b/src/mesa/slang/slang_compile_variable.c
diff --git a/src/mesa/shader/slang/slang_compile_variable.h b/src/mesa/slang/slang_compile_variable.h
index 5c9d248b354..5c9d248b354 100644
--- a/src/mesa/shader/slang/slang_compile_variable.h
+++ b/src/mesa/slang/slang_compile_variable.h
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/slang/slang_emit.c
index 4d4c611dfe4..9997d5b0a07 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/slang/slang_emit.c
@@ -38,10 +38,10 @@
#include "main/imports.h"
#include "main/context.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
#include "slang_builtin.h"
#include "slang_emit.h"
#include "slang_mem.h"
diff --git a/src/mesa/shader/slang/slang_emit.h b/src/mesa/slang/slang_emit.h
index ab4c202d673..ab4c202d673 100644
--- a/src/mesa/shader/slang/slang_emit.h
+++ b/src/mesa/slang/slang_emit.h
diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/slang/slang_ir.c
index c223004b22b..e9aef9878ef 100644
--- a/src/mesa/shader/slang/slang_ir.c
+++ b/src/mesa/slang/slang_ir.c
@@ -27,8 +27,8 @@
#include "main/context.h"
#include "slang_ir.h"
#include "slang_mem.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_print.h"
+#include "program/prog_instruction.h"
+#include "program/prog_print.h"
static const slang_ir_info IrInfo[] = {
diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/slang/slang_ir.h
index 166b4e80436..166b4e80436 100644
--- a/src/mesa/shader/slang/slang_ir.h
+++ b/src/mesa/slang/slang_ir.h
diff --git a/src/mesa/shader/slang/slang_label.c b/src/mesa/slang/slang_label.c
index 8e3a8ebc1aa..8e3a8ebc1aa 100644
--- a/src/mesa/shader/slang/slang_label.c
+++ b/src/mesa/slang/slang_label.c
diff --git a/src/mesa/shader/slang/slang_label.h b/src/mesa/slang/slang_label.h
index 87068ae7a7f..4d04df18d25 100644
--- a/src/mesa/shader/slang/slang_label.h
+++ b/src/mesa/slang/slang_label.h
@@ -3,7 +3,7 @@
#include "main/imports.h"
#include "main/mtypes.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
struct slang_label_
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/slang/slang_link.c
index 2d003ef9c36..2f47cba1ce3 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/slang/slang_link.c
@@ -32,13 +32,15 @@
#include "main/imports.h"
#include "main/context.h"
#include "main/macros.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
-#include "shader/prog_uniform.h"
-#include "shader/shader_api.h"
+#include "main/shaderapi.h"
+#include "main/shaderobj.h"
+#include "main/uniforms.h"
+#include "program/program.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
+#include "program/prog_uniform.h"
#include "slang_builtin.h"
#include "slang_link.h"
@@ -873,7 +875,7 @@ get_main_shader(GLcontext *ctx,
!shader->Main ||
shader->UnresolvedRefs) {
link_error(shProg, "Unresolved symbols");
- _mesa_free_shader(ctx, shader);
+ ctx->Driver.DeleteShader(ctx, shader);
return NULL;
}
}
diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/slang/slang_link.h
index 2b44d20787a..2b44d20787a 100644
--- a/src/mesa/shader/slang/slang_link.h
+++ b/src/mesa/slang/slang_link.h
diff --git a/src/mesa/shader/slang/slang_log.c b/src/mesa/slang/slang_log.c
index 9ff21417bc5..9ff21417bc5 100644
--- a/src/mesa/shader/slang/slang_log.c
+++ b/src/mesa/slang/slang_log.c
diff --git a/src/mesa/shader/slang/slang_log.h b/src/mesa/slang/slang_log.h
index dcaba0285a7..dcaba0285a7 100644
--- a/src/mesa/shader/slang/slang_log.h
+++ b/src/mesa/slang/slang_log.h
diff --git a/src/mesa/shader/slang/slang_mem.c b/src/mesa/slang/slang_mem.c
index 5eaa7c44272..5eaa7c44272 100644
--- a/src/mesa/shader/slang/slang_mem.c
+++ b/src/mesa/slang/slang_mem.c
diff --git a/src/mesa/shader/slang/slang_mem.h b/src/mesa/slang/slang_mem.h
index b5bfae24791..b5bfae24791 100644
--- a/src/mesa/shader/slang/slang_mem.h
+++ b/src/mesa/slang/slang_mem.h
diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/slang/slang_print.c
index 6b34f395fdf..6b34f395fdf 100644
--- a/src/mesa/shader/slang/slang_print.c
+++ b/src/mesa/slang/slang_print.c
diff --git a/src/mesa/shader/slang/slang_print.h b/src/mesa/slang/slang_print.h
index 46605c80610..46605c80610 100644
--- a/src/mesa/shader/slang/slang_print.h
+++ b/src/mesa/slang/slang_print.h
diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/slang/slang_simplify.c
index 13b9ca3c877..13b9ca3c877 100644
--- a/src/mesa/shader/slang/slang_simplify.c
+++ b/src/mesa/slang/slang_simplify.c
diff --git a/src/mesa/shader/slang/slang_simplify.h b/src/mesa/slang/slang_simplify.h
index 8689c23b1a0..8689c23b1a0 100644
--- a/src/mesa/shader/slang/slang_simplify.h
+++ b/src/mesa/slang/slang_simplify.h
diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/slang/slang_storage.c
index 656e15670d3..656e15670d3 100644
--- a/src/mesa/shader/slang/slang_storage.c
+++ b/src/mesa/slang/slang_storage.c
diff --git a/src/mesa/shader/slang/slang_storage.h b/src/mesa/slang/slang_storage.h
index 1876a36dd63..1876a36dd63 100644
--- a/src/mesa/shader/slang/slang_storage.h
+++ b/src/mesa/slang/slang_storage.h
diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/slang/slang_typeinfo.c
index 0f96768b02e..d039a12e986 100644
--- a/src/mesa/shader/slang/slang_typeinfo.c
+++ b/src/mesa/slang/slang_typeinfo.c
@@ -29,7 +29,7 @@
*/
#include "main/imports.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "slang_typeinfo.h"
#include "slang_compile.h"
#include "slang_log.h"
diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/slang/slang_typeinfo.h
index 9a6407a31bf..9a6407a31bf 100644
--- a/src/mesa/shader/slang/slang_typeinfo.h
+++ b/src/mesa/slang/slang_typeinfo.h
diff --git a/src/mesa/shader/slang/slang_utility.c b/src/mesa/slang/slang_utility.c
index c1d57409a43..c1d57409a43 100644
--- a/src/mesa/shader/slang/slang_utility.c
+++ b/src/mesa/slang/slang_utility.c
diff --git a/src/mesa/shader/slang/slang_utility.h b/src/mesa/slang/slang_utility.h
index 2c0d0bcbb2a..2c0d0bcbb2a 100644
--- a/src/mesa/shader/slang/slang_utility.h
+++ b/src/mesa/slang/slang_utility.h
diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/slang/slang_vartable.c
index e07e3a226a5..83716315788 100644
--- a/src/mesa/shader/slang/slang_vartable.c
+++ b/src/mesa/slang/slang_vartable.c
@@ -1,7 +1,7 @@
#include "main/imports.h"
-#include "shader/program.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_print.h"
#include "slang_compile.h"
#include "slang_compile_variable.h"
#include "slang_emit.h"
diff --git a/src/mesa/shader/slang/slang_vartable.h b/src/mesa/slang/slang_vartable.h
index 94bcd63f45a..94bcd63f45a 100644
--- a/src/mesa/shader/slang/slang_vartable.h
+++ b/src/mesa/slang/slang_vartable.h
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index ddd63cea0b4..f01b60c4fc8 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -12,6 +12,8 @@ MAIN_SOURCES = \
main/api_noop.c \
main/api_validate.c \
main/accum.c \
+ main/arbprogram.c \
+ main/atifragshader.c \
main/attrib.c \
main/arrayobj.c \
main/blend.c \
@@ -55,6 +57,7 @@ MAIN_SOURCES = \
main/mipmap.c \
main/mm.c \
main/multisample.c \
+ main/nvprogram.c \
main/pixel.c \
main/pixelstore.c \
main/points.c \
@@ -66,7 +69,8 @@ MAIN_SOURCES = \
main/remap.c \
main/renderbuffer.c \
main/scissor.c \
- main/shaders.c \
+ main/shaderapi.c \
+ main/shaderobj.c \
main/shared.c \
main/state.c \
main/stencil.c \
@@ -88,6 +92,7 @@ MAIN_SOURCES = \
main/texstate.c \
main/texstore.c \
main/transformfeedback.c \
+ main/uniforms.c \
main/varray.c \
main/version.c \
main/viewport.c \
@@ -223,53 +228,48 @@ STATETRACKER_SOURCES = \
state_tracker/st_program.c \
state_tracker/st_texture.c
-SHADER_SOURCES = \
- shader/arbprogparse.c \
- shader/arbprogram.c \
- shader/atifragshader.c \
- shader/hash_table.c \
- shader/lex.yy.c \
- shader/nvfragparse.c \
- shader/nvprogram.c \
- shader/nvvertparse.c \
- shader/program.c \
- shader/program_parse.tab.c \
- shader/program_parse_extra.c \
- shader/prog_cache.c \
- shader/prog_execute.c \
- shader/prog_instruction.c \
- shader/prog_noise.c \
- shader/prog_optimize.c \
- shader/prog_parameter.c \
- shader/prog_parameter_layout.c \
- shader/prog_print.c \
- shader/prog_statevars.c \
- shader/prog_uniform.c \
- shader/programopt.c \
- shader/symbol_table.c \
- shader/shader_api.c \
- shader/uniforms.c
+PROGRAM_SOURCES = \
+ program/arbprogparse.c \
+ program/hash_table.c \
+ program/lex.yy.c \
+ program/nvfragparse.c \
+ program/nvvertparse.c \
+ program/program.c \
+ program/program_parse.tab.c \
+ program/program_parse_extra.c \
+ program/prog_cache.c \
+ program/prog_execute.c \
+ program/prog_instruction.c \
+ program/prog_noise.c \
+ program/prog_optimize.c \
+ program/prog_parameter.c \
+ program/prog_parameter_layout.c \
+ program/prog_print.c \
+ program/prog_statevars.c \
+ program/prog_uniform.c \
+ program/programopt.c \
+ program/symbol_table.c
SLANG_SOURCES = \
- shader/slang/slang_builtin.c \
- shader/slang/slang_codegen.c \
- shader/slang/slang_compile.c \
- shader/slang/slang_compile_function.c \
- shader/slang/slang_compile_operation.c \
- shader/slang/slang_compile_struct.c \
- shader/slang/slang_compile_variable.c \
- shader/slang/slang_emit.c \
- shader/slang/slang_ir.c \
- shader/slang/slang_label.c \
- shader/slang/slang_link.c \
- shader/slang/slang_log.c \
- shader/slang/slang_mem.c \
- shader/slang/slang_print.c \
- shader/slang/slang_simplify.c \
- shader/slang/slang_storage.c \
- shader/slang/slang_typeinfo.c \
- shader/slang/slang_vartable.c \
- shader/slang/slang_utility.c
+ slang/slang_builtin.c \
+ slang/slang_codegen.c \
+ slang/slang_compile.c \
+ slang/slang_compile_function.c \
+ slang/slang_compile_operation.c \
+ slang/slang_compile_struct.c \
+ slang/slang_compile_variable.c \
+ slang/slang_emit.c \
+ slang/slang_ir.c \
+ slang/slang_label.c \
+ slang/slang_link.c \
+ slang/slang_log.c \
+ slang/slang_mem.c \
+ slang/slang_print.c \
+ slang/slang_simplify.c \
+ slang/slang_storage.c \
+ slang/slang_typeinfo.c \
+ slang/slang_vartable.c \
+ slang/slang_utility.c
ASM_C_SOURCES = \
x86/common_x86.c \
@@ -320,7 +320,7 @@ MESA_SOURCES = \
$(MATH_XFORM_SOURCES) \
$(VBO_SOURCES) \
$(TNL_SOURCES) \
- $(SHADER_SOURCES) \
+ $(PROGRAM_SOURCES) \
$(SWRAST_SOURCES) \
$(SWRAST_SETUP_SOURCES) \
$(COMMON_DRIVER_SOURCES)\
@@ -333,7 +333,7 @@ MESA_GALLIUM_SOURCES = \
$(MATH_SOURCES) \
$(VBO_SOURCES) \
$(STATETRACKER_SOURCES) \
- $(SHADER_SOURCES) \
+ $(PROGRAM_SOURCES) \
ppc/common_ppc.c \
x86/common_x86.c \
$(SLANG_SOURCES)
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 28439103b23..38fadb20163 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -32,8 +32,8 @@
*/
#include "main/imports.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index b8644faaf83..b88c74fa03a 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -36,10 +36,10 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
#include "st_context.h"
#include "st_format.h"
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index ad151edf3bd..dcaad83a3c3 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -37,7 +37,7 @@
#include "main/imports.h"
#include "main/mtypes.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 895681cb230..5a650b305d8 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -33,7 +33,7 @@
#include "main/macros.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "st_context.h"
#include "st_atom.h"
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 5aca1105eeb..ba600ccef6d 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -34,8 +34,8 @@
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
-#include "shader/program.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_print.h"
#include "st_context.h"
#include "st_atom.h"
@@ -49,7 +49,7 @@
#include "util/u_inlines.h"
#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "cso_cache/cso_context.h"
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index b15792504af..ea2414c4a00 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -36,7 +36,7 @@
#include "main/glheader.h"
#include "main/formats.h"
#include "main/macros.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_cb_accum.h"
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index f74d8cd42d0..69a3dd45e80 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -36,8 +36,8 @@
#include "main/macros.h"
#include "main/texformat.h"
#include "main/texstore.h"
-#include "shader/program.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_print.h"
#include "st_debug.h"
#include "st_context.h"
@@ -58,7 +58,7 @@
#include "util/u_draw_quad.h"
#include "util/u_format.h"
#include "util/u_math.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "cso_cache/cso_context.h"
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index 3d99d6c8a11..b191a7f8902 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -16,8 +16,8 @@
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
-#include "shader/program.h"
-#include "shader/prog_print.h"
+#include "program/program.h"
+#include "program/prog_print.h"
#include "st_context.h"
#include "st_atom.h"
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 2361b2eddfe..c39ae3e4c42 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -33,10 +33,11 @@
#include "main/glheader.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
-#include "shader/program.h"
-#include "shader/shader_api.h"
+#include "main/shaderapi.h"
+#include "main/shaderobj.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
+#include "program/program.h"
#include "cso_cache/cso_context.h"
#include "draw/draw_context.h"
@@ -75,15 +76,12 @@ static void st_bind_program( GLcontext *ctx,
* Called via ctx->Driver.UseProgram() to bind a linked GLSL program
* (vertex shader + fragment shader).
*/
-static void st_use_program( GLcontext *ctx,
- GLuint program )
+static void st_use_program( GLcontext *ctx, struct gl_shader_program *shProg)
{
struct st_context *st = st_context(ctx);
st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
-
- _mesa_use_program(ctx, program);
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 0bf030e9876..4b809b61143 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -27,8 +27,8 @@
#include "main/imports.h"
#include "main/context.h"
+#include "main/shaderobj.h"
#include "vbo/vbo.h"
-#include "shader/shader_api.h"
#include "glapi/glapi.h"
#include "st_context.h"
#include "st_debug.h"
@@ -254,7 +254,7 @@ void st_destroy_context( struct st_context *st )
void st_init_driver_functions(struct dd_function_table *functions)
{
- _mesa_init_glsl_driver_functions(functions);
+ _mesa_init_shader_object_functions(functions);
st_init_accum_functions(functions);
st_init_blit_functions(functions);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index efff55a9057..4edfb2ae856 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -29,7 +29,7 @@
#define ST_CONTEXT_H
#include "main/mtypes.h"
-#include "shader/prog_cache.h"
+#include "program/prog_cache.h"
#include "pipe/p_state.h"
#include "state_tracker/st_api.h"
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index 0b3768341ef..ebf6ec6e7e2 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -27,7 +27,7 @@
#include "main/context.h"
-#include "shader/prog_print.h"
+#include "program/prog_print.h"
#include "pipe/p_state.h"
#include "pipe/p_shader_tokens.h"
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index eb2e5b2bbf7..eed8e2aa5d8 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -43,7 +43,7 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
-#include "shader/prog_uniform.h"
+#include "program/prog_uniform.h"
#include "vbo/vbo.h"
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 35016d80e6b..49b7b5d1c10 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -38,8 +38,8 @@
#include "tgsi/tgsi_ureg.h"
#include "st_mesa_to_tgsi.h"
#include "st_context.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_parameter.h"
+#include "program/prog_instruction.h"
+#include "program/prog_parameter.h"
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3c865028a7a..3ea325bb42a 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -33,8 +33,8 @@
#include "main/imports.h"
#include "main/mtypes.h"
-#include "shader/prog_print.h"
-#include "shader/programopt.h"
+#include "program/prog_print.h"
+#include "program/programopt.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 1b3f75ca27c..d4b7151e929 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -35,7 +35,7 @@
#define ST_PROGRAM_H
#include "main/mtypes.h"
-#include "shader/program.h"
+#include "program/program.h"
#include "pipe/p_shader_tokens.h"
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 0f06cdf9f9d..fa280e72e40 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -23,7 +23,7 @@
#include "main/colormac.h"
#include "main/context.h"
#include "main/macros.h"
-#include "shader/atifragshader.h"
+#include "main/atifragshader.h"
#include "swrast/s_atifragshader.h"
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 751966348b1..6d2d17c61d9 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -32,8 +32,8 @@
#include "main/colormac.h"
#include "main/mtypes.h"
#include "main/teximage.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_statevars.h"
#include "swrast.h"
#include "s_blend.h"
#include "s_context.h"
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 9059f9b5ecb..c9755e6da18 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -44,7 +44,7 @@
#define S_CONTEXT_H
#include "main/mtypes.h"
-#include "shader/prog_execute.h"
+#include "program/prog_execute.h"
#include "swrast.h"
#include "s_span.h"
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 7c1de62e878..413f136cd59 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -25,7 +25,7 @@
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "s_fragprog.h"
#include "s_span.h"
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index f322663ad41..2ac0aaa246d 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -29,7 +29,7 @@
#include "main/colormac.h"
#include "main/image.h"
#include "main/imports.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "s_context.h"
#include "s_texcombine.h"
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 812dddf15c6..d1b369bcdf0 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -35,7 +35,7 @@
#include "main/imports.h"
#include "main/macros.h"
#include "main/texformat.h"
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
#include "s_aatriangle.h"
#include "s_context.h"
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 0137e52fc40..614c67d05eb 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -36,9 +36,9 @@
#include "main/context.h"
#include "main/macros.h"
#include "main/imports.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_statevars.h"
-#include "shader/prog_execute.h"
+#include "program/prog_instruction.h"
+#include "program/prog_statevars.h"
+#include "program/prog_execute.h"
#include "swrast/s_context.h"
#include "tnl/tnl.h"