From da7bd6a90e1fee5c16327338fd251c0f6be34e36 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 28 Jun 2010 17:31:21 -0400 Subject: mesa: initial support for ARB_geometry_shader4 laying down the foundation for everything and implementing most of the stuff. linking, gl_VerticesIn and multidimensional inputs are left. --- src/mesa/slang/library/Makefile | 5 ++- src/mesa/slang/library/SConscript | 14 +++++- src/mesa/slang/library/slang_geometry_builtin.gc | 56 ++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 src/mesa/slang/library/slang_geometry_builtin.gc (limited to 'src/mesa/slang/library') diff --git a/src/mesa/slang/library/Makefile b/src/mesa/slang/library/Makefile index 5a76774208..f546a03907 100644 --- a/src/mesa/slang/library/Makefile +++ b/src/mesa/slang/library/Makefile @@ -23,7 +23,7 @@ builtin: builtin_110 builtin_120 # builtin library sources # -builtin_110: slang_common_builtin_gc.h slang_core_gc.h slang_fragment_builtin_gc.h slang_vertex_builtin_gc.h +builtin_110: slang_common_builtin_gc.h slang_core_gc.h slang_fragment_builtin_gc.h slang_vertex_builtin_gc.h slang_geometry_builtin_gc.h builtin_120: slang_120_core_gc.h slang_builtin_120_common_gc.h slang_builtin_120_fragment_gc.h @@ -49,3 +49,6 @@ slang_fragment_builtin_gc.h: slang_fragment_builtin.gc slang_vertex_builtin_gc.h: slang_vertex_builtin.gc $(GLSL_CL) vertex slang_vertex_builtin.gc slang_vertex_builtin_gc.h +slang_geometry_builtin_gc.h: slang_geometry_builtin.gc + $(GLSL_CL) geometry slang_geometry_builtin.gc slang_geometry_builtin_gc.h + diff --git a/src/mesa/slang/library/SConscript b/src/mesa/slang/library/SConscript index 792a7953d3..5112cefb3e 100644 --- a/src/mesa/slang/library/SConscript +++ b/src/mesa/slang/library/SConscript @@ -10,21 +10,28 @@ env = env.Clone() def glsl_compile_emitter(target, source, env): env.Depends(target, glsl_compile) return (target, source) - + bld_frag = Builder( action = Action(glsl_compile[0].abspath + ' fragment $SOURCE $TARGET', '$CODEGENCODESTR'), emitter = glsl_compile_emitter, suffix = '.gc', src_suffix = '_gc.h') - + bld_vert = Builder( action = Action(glsl_compile[0].abspath + ' vertex $SOURCE $TARGET', '$CODEGENCODESTR'), emitter = glsl_compile_emitter, suffix = '.gc', src_suffix = '_gc.h') +bld_geom = Builder( + action = Action(glsl_compile[0].abspath + ' geometry $SOURCE $TARGET', '$CODEGENCODESTR'), + emitter = glsl_compile_emitter, + suffix = '.gc', + src_suffix = '_gc.h') + env['BUILDERS']['bld_frag'] = bld_frag env['BUILDERS']['bld_vert'] = bld_vert +env['BUILDERS']['bld_geom'] = bld_geom # Generate GLSL builtin library binaries env.bld_frag( @@ -39,6 +46,9 @@ env.bld_frag( env.bld_vert( '#src/mesa/slang/library/slang_vertex_builtin_gc.h', '#src/mesa/slang/library/slang_vertex_builtin.gc') +env.bld_geom( + '#src/mesa/slang/library/slang_geometry_builtin_gc.h', + '#src/mesa/slang/library/slang_geometry_builtin.gc') # Generate GLSL 1.20 builtin library binaries env.bld_frag( diff --git a/src/mesa/slang/library/slang_geometry_builtin.gc b/src/mesa/slang/library/slang_geometry_builtin.gc new file mode 100644 index 0000000000..c349a6acc0 --- /dev/null +++ b/src/mesa/slang/library/slang_geometry_builtin.gc @@ -0,0 +1,56 @@ +/* + * Mesa 3-D graphics library + * + * 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. + */ + +const int _mesa_VerticesInMax = 6; + +__fixed_input int gl_VerticesIn; +__fixed_input int gl_PrimitiveIDIn; +__fixed_output int gl_PrimitiveID; +__fixed_output int gl_Layer; + + +varying in vec4 gl_FrontColorIn[_mesa_VerticesInMax]; +varying in vec4 gl_BackColorIn[_mesa_VerticesInMax]; +varying in vec4 gl_FrontSecondaryColorIn[_mesa_VerticesInMax]; +varying in vec4 gl_BackSecondaryColorIn[_mesa_VerticesInMax]; +/*varying in vec4 gl_TexCoordIn[_mesa_VerticesInMax][gl_MaxTextureCoords];*/ +varying in float gl_FogFragCoordIn[_mesa_VerticesInMax]; +varying in vec4 gl_PositionIn[_mesa_VerticesInMax]; +varying in float gl_PointSizeIn[_mesa_VerticesInMax]; +varying in vec4 gl_ClipVertexIn[_mesa_VerticesInMax]; + +varying out vec4 gl_Position; +varying out vec4 gl_FrontColor; +varying out vec4 gl_BackColor; +varying out vec4 gl_FrontSecondaryColor; +varying out vec4 gl_BackSecondaryColor; +varying out vec4 gl_TexCoord[gl_MaxTextureCoords]; +varying out float gl_FogFragCoord; + +void EmitVertex() +{ + __asm emit_vertex; +} + +void EndPrimitive() +{ + __asm end_primitive; +} -- cgit v1.2.3