mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 11:30:21 +01:00
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
This commit is contained in:
commit
ca12aefdac
193 changed files with 2613 additions and 2691 deletions
14
Makefile
14
Makefile
|
|
@ -243,13 +243,13 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/src/mesa/main/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/math/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/math/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/*.[chly] \
|
||||
$(DIRECTORY)/src/mesa/shader/Makefile \
|
||||
$(DIRECTORY)/src/mesa/shader/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/*.gc \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/Makefile \
|
||||
$(DIRECTORY)/src/mesa/program/*.[chly] \
|
||||
$(DIRECTORY)/src/mesa/program/Makefile \
|
||||
$(DIRECTORY)/src/mesa/program/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/slang/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/slang/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/slang/library/*.gc \
|
||||
$(DIRECTORY)/src/mesa/slang/library/Makefile \
|
||||
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/swrast/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#define BRW_SF_H
|
||||
|
||||
|
||||
#include "shader/program.h"
|
||||
#include "program/program.h"
|
||||
#include "brw_context.h"
|
||||
#include "brw_eu.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "brw_context.h"
|
||||
#include "brw_wm.h"
|
||||
#include "shader/prog_parameter.h"
|
||||
#include "program/prog_parameter.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
||||
|
||||
|
|
@ -27,6 +27,10 @@
|
|||
#define ARBPROGRAM_H
|
||||
|
||||
|
||||
#include "compiler.h"
|
||||
#include "glheader.h"
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BindProgram(GLenum target, GLuint id);
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load diff
166
src/mesa/main/shaderapi.h
Normal file
166
src/mesa/main/shaderapi.h
Normal file
|
|
@ -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 */
|
||||
386
src/mesa/main/shaderobj.c
Normal file
386
src/mesa/main/shaderobj.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
|
||||
struct gl_shader *sh);
|
||||
|
||||
extern GLint
|
||||
_mesa_sizeof_glsl_type(GLenum type);
|
||||
extern struct gl_shader *
|
||||
_mesa_lookup_shader(GLcontext *ctx, GLuint name);
|
||||
|
||||
extern struct gl_shader *
|
||||
_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller);
|
||||
|
||||
|
||||
/*
|
||||
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 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_clear_shader_program_data(GLcontext *ctx,
|
||||
struct gl_shader_program *shProg);
|
||||
|
||||
extern void
|
||||
_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh);
|
||||
_mesa_free_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);
|
||||
|
||||
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 */
|
||||
|
|
@ -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 */
|
||||
}
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include "teximage.h"
|
||||
#include "texobj.h"
|
||||
#include "mtypes.h"
|
||||
#include "shader/prog_instruction.h"
|
||||
#include "program/prog_instruction.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
_mesa_init_uniform_functions(struct dd_function_table *driver)
|
||||
void GLAPIENTRY
|
||||
_mesa_Uniform1fARB(GLint location, GLfloat v0)
|
||||
{
|
||||
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;
|
||||
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_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;
|
||||
}
|
||||
158
src/mesa/main/uniforms.h
Normal file
158
src/mesa/main/uniforms.h
Normal file
|
|
@ -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 */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue