Commit 4e33fd4b authored by Mike Gabriel's avatar Mike Gabriel

Mesa: Convert some files with MSDOS EOL style to Unix EOL style.

parent 4146d1aa
...@@ -109,18 +109,18 @@ _mesa_Hint( GLenum target, GLenum mode ) ...@@ -109,18 +109,18 @@ _mesa_Hint( GLenum target, GLenum mode )
return; return;
FLUSH_VERTICES(ctx, _NEW_HINT); FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.GenerateMipmap = mode; ctx->Hint.GenerateMipmap = mode;
break; break;
/* GL_ARB_fragment_shader */ /* GL_ARB_fragment_shader */
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB:
if (!ctx->Extensions.ARB_fragment_shader) { if (!ctx->Extensions.ARB_fragment_shader) {
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)");
return; return;
} }
if (ctx->Hint.FragmentShaderDerivative == mode) if (ctx->Hint.FragmentShaderDerivative == mode)
return; return;
FLUSH_VERTICES(ctx, _NEW_HINT); FLUSH_VERTICES(ctx, _NEW_HINT);
ctx->Hint.FragmentShaderDerivative = mode; ctx->Hint.FragmentShaderDerivative = mode;
break; break;
default: default:
...@@ -148,6 +148,6 @@ void _mesa_init_hint( GLcontext * ctx ) ...@@ -148,6 +148,6 @@ void _mesa_init_hint( GLcontext * ctx )
ctx->Hint.Fog = GL_DONT_CARE; ctx->Hint.Fog = GL_DONT_CARE;
ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; ctx->Hint.ClipVolumeClipping = GL_DONT_CARE;
ctx->Hint.TextureCompression = GL_DONT_CARE; ctx->Hint.TextureCompression = GL_DONT_CARE;
ctx->Hint.GenerateMipmap = GL_DONT_CARE; ctx->Hint.GenerateMipmap = GL_DONT_CARE;
ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE; ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE;
} }
...@@ -155,14 +155,14 @@ extern void GLAPIENTRY ...@@ -155,14 +155,14 @@ extern void GLAPIENTRY
_mesa_GetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); _mesa_GetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
extern GLint GLAPIENTRY extern GLint GLAPIENTRY
_mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *); _mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *);
#endif #endif
extern void extern void
_mesa_init_shaderobjects (GLcontext *ctx); _mesa_init_shaderobjects (GLcontext *ctx);
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef SHADEROBJECTS_3DLABS_H #ifndef SHADEROBJECTS_3DLABS_H
#define SHADEROBJECTS_3DLABS_H #define SHADEROBJECTS_3DLABS_H
#include "mtypes.h" #include "mtypes.h"
extern GLhandleARB extern GLhandleARB
_mesa_3dlabs_create_shader_object (GLenum); _mesa_3dlabs_create_shader_object (GLenum);
extern GLhandleARB extern GLhandleARB
_mesa_3dlabs_create_program_object (void); _mesa_3dlabs_create_program_object (void);
extern void extern void
_mesa_init_shaderobjects_3dlabs (GLcontext *ctx); _mesa_init_shaderobjects_3dlabs (GLcontext *ctx);
#endif #endif
".syntax version_directive;\n" ".syntax version_directive;\n"
"version_directive\n" "version_directive\n"
" version_directive_1 .and .loop version_directive_2;\n" " version_directive_1 .and .loop version_directive_2;\n"
"version_directive_1\n" "version_directive_1\n"
" prior_optional_spaces .and optional_version_directive .and .true .emit $;\n" " prior_optional_spaces .and optional_version_directive .and .true .emit $;\n"
"version_directive_2\n" "version_directive_2\n"
" prior_optional_spaces .and version_directive_body .and .true .emit $;\n" " prior_optional_spaces .and version_directive_body .and .true .emit $;\n"
"optional_version_directive\n" "optional_version_directive\n"
" version_directive_body .or .true .emit 10 .emit 1;\n" " version_directive_body .or .true .emit 10 .emit 1;\n"
"version_directive_body\n" "version_directive_body\n"
" '#' .and optional_space .and \"version\" .and space .and version_number .and optional_space .and\n" " '#' .and optional_space .and \"version\" .and space .and version_number .and optional_space .and\n"
" new_line;\n" " new_line;\n"
"version_number\n" "version_number\n"
" version_number_110;\n" " version_number_110;\n"
"version_number_110\n" "version_number_110\n"
" leading_zeroes .and \"110\" .emit 10 .emit 1;\n" " leading_zeroes .and \"110\" .emit 10 .emit 1;\n"
"leading_zeroes\n" "leading_zeroes\n"
" .loop zero;\n" " .loop zero;\n"
"zero\n" "zero\n"
" '0';\n" " '0';\n"
"space\n" "space\n"
" single_space .and .loop single_space;\n" " single_space .and .loop single_space;\n"
"optional_space\n" "optional_space\n"
" .loop single_space;\n" " .loop single_space;\n"
"single_space\n" "single_space\n"
" ' ' .or '\\t';\n" " ' ' .or '\\t';\n"
"prior_optional_spaces\n" "prior_optional_spaces\n"
" .loop prior_space;\n" " .loop prior_space;\n"
"prior_space\n" "prior_space\n"
" c_style_comment_block .or cpp_style_comment_block .or space .or new_line;\n" " c_style_comment_block .or cpp_style_comment_block .or space .or new_line;\n"
"c_style_comment_block\n" "c_style_comment_block\n"
" '/' .and '*' .and c_style_comment_rest;\n" " '/' .and '*' .and c_style_comment_rest;\n"
"c_style_comment_rest\n" "c_style_comment_rest\n"
" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n" " .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
"c_style_comment_rest_1\n" "c_style_comment_rest_1\n"
" c_style_comment_end .or c_style_comment_rest_2;\n" " c_style_comment_end .or c_style_comment_rest_2;\n"
"c_style_comment_rest_2\n" "c_style_comment_rest_2\n"
" '*' .and c_style_comment_rest;\n" " '*' .and c_style_comment_rest;\n"
"c_style_comment_char_no_star\n" "c_style_comment_char_no_star\n"
" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n" " '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
"c_style_comment_end\n" "c_style_comment_end\n"
" '*' .and '/';\n" " '*' .and '/';\n"
"cpp_style_comment_block\n" "cpp_style_comment_block\n"
" '/' .and '/' .and cpp_style_comment_block_1;\n" " '/' .and '/' .and cpp_style_comment_block_1;\n"
"cpp_style_comment_block_1\n" "cpp_style_comment_block_1\n"
" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n" " cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
"cpp_style_comment_block_2\n" "cpp_style_comment_block_2\n"
" .loop cpp_style_comment_char .and new_line;\n" " .loop cpp_style_comment_char .and new_line;\n"
"cpp_style_comment_block_3\n" "cpp_style_comment_block_3\n"
" .loop cpp_style_comment_char;\n" " .loop cpp_style_comment_char;\n"
"cpp_style_comment_char\n" "cpp_style_comment_char\n"
" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" " '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
"new_line\n" "new_line\n"
" cr_lf .or lf_cr .or '\\n' .or '\\r';\n" " cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
"cr_lf\n" "cr_lf\n"
" '\\r' .and '\\n';\n" " '\\r' .and '\\n';\n"
"lf_cr\n" "lf_cr\n"
" '\\n' .and '\\r';\n" " '\\n' .and '\\r';\n"
".string __string_filter;\n" ".string __string_filter;\n"
"__string_filter\n" "__string_filter\n"
" .loop __identifier_char;\n" " .loop __identifier_char;\n"
"__identifier_char\n" "__identifier_char\n"
" 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n" " 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n"
"" ""
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_ASSEMBLE_H #if !defined SLANG_ASSEMBLE_H
#define SLANG_ASSEMBLE_H #define SLANG_ASSEMBLE_H
#include "slang_compile.h" #include "slang_compile.h"
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef enum slang_assembly_type_ typedef enum slang_assembly_type_
{ {
/* core */ /* core */
slang_asm_none, slang_asm_none,
slang_asm_float_copy, slang_asm_float_copy,
slang_asm_float_move, slang_asm_float_move,
slang_asm_float_push, slang_asm_float_push,
slang_asm_float_deref, slang_asm_float_deref,
slang_asm_float_add, slang_asm_float_add,
slang_asm_float_multiply, slang_asm_float_multiply,
slang_asm_float_divide, slang_asm_float_divide,
slang_asm_float_negate, slang_asm_float_negate,
slang_asm_float_less, slang_asm_float_less,
slang_asm_float_equal, slang_asm_float_equal,
slang_asm_float_to_int, slang_asm_float_to_int,
slang_asm_int_copy, slang_asm_int_copy,
slang_asm_int_move, slang_asm_int_move,
slang_asm_int_push, slang_asm_int_push,
slang_asm_int_deref, slang_asm_int_deref,
slang_asm_int_to_float, slang_asm_int_to_float,
slang_asm_int_to_addr, slang_asm_int_to_addr,
slang_asm_bool_copy, slang_asm_bool_copy,
slang_asm_bool_move, slang_asm_bool_move,
slang_asm_bool_push, slang_asm_bool_push,
slang_asm_bool_deref, slang_asm_bool_deref,
slang_asm_addr_copy, slang_asm_addr_copy,
slang_asm_addr_push, slang_asm_addr_push,
slang_asm_addr_deref, slang_asm_addr_deref,
slang_asm_addr_add, slang_asm_addr_add,
slang_asm_addr_multiply, slang_asm_addr_multiply,
slang_asm_jump, slang_asm_jump,
slang_asm_jump_if_zero, slang_asm_jump_if_zero,
slang_asm_enter, slang_asm_enter,
slang_asm_leave, slang_asm_leave,
slang_asm_local_alloc, slang_asm_local_alloc,
slang_asm_local_free, slang_asm_local_free,
slang_asm_local_addr, slang_asm_local_addr,
slang_asm_call, slang_asm_call,
slang_asm_return, slang_asm_return,
slang_asm_discard, slang_asm_discard,
slang_asm_exit, slang_asm_exit,
slang_asm__last slang_asm__last
} slang_assembly_type; } slang_assembly_type;
typedef struct slang_assembly_ typedef struct slang_assembly_
{ {
slang_assembly_type type; slang_assembly_type type;
GLfloat literal; GLfloat literal;
GLuint param[2]; GLuint param[2];
} slang_assembly; } slang_assembly;
typedef struct slang_assembly_file_ typedef struct slang_assembly_file_
{ {
slang_assembly *code; slang_assembly *code;
unsigned int count; unsigned int count;
} slang_assembly_file; } slang_assembly_file;
void slang_assembly_file_construct (slang_assembly_file *); void slang_assembly_file_construct (slang_assembly_file *);
void slang_assembly_file_destruct (slang_assembly_file *); void slang_assembly_file_destruct (slang_assembly_file *);
int slang_assembly_file_push (slang_assembly_file *, slang_assembly_type); int slang_assembly_file_push (slang_assembly_file *, slang_assembly_type);
int slang_assembly_file_push_label (slang_assembly_file *, slang_assembly_type, GLuint); int slang_assembly_file_push_label (slang_assembly_file *, slang_assembly_type, GLuint);
int slang_assembly_file_push_label2 (slang_assembly_file *, slang_assembly_type, GLuint, GLuint); int slang_assembly_file_push_label2 (slang_assembly_file *, slang_assembly_type, GLuint, GLuint);
int slang_assembly_file_push_literal (slang_assembly_file *, slang_assembly_type, GLfloat); int slang_assembly_file_push_literal (slang_assembly_file *, slang_assembly_type, GLfloat);
typedef struct slang_assembly_flow_control_ typedef struct slang_assembly_flow_control_
{ {
unsigned int loop_start; /* for "continue" statement */ unsigned int loop_start; /* for "continue" statement */
unsigned int loop_end; /* for "break" statement */ unsigned int loop_end; /* for "break" statement */
unsigned int function_end; /* for "return" statement */ unsigned int function_end; /* for "return" statement */
} slang_assembly_flow_control; } slang_assembly_flow_control;
typedef struct slang_assembly_name_space_ typedef struct slang_assembly_name_space_
{ {
struct slang_function_scope_ *funcs; struct slang_function_scope_ *funcs;
struct slang_struct_scope_ *structs; struct slang_struct_scope_ *structs;
struct slang_variable_scope_ *vars; struct slang_variable_scope_ *vars;
} slang_assembly_name_space; } slang_assembly_name_space;
slang_function *_slang_locate_function (const char *name, slang_operation *params, slang_function *_slang_locate_function (const char *name, slang_operation *params,
unsigned int num_params, slang_assembly_name_space *space); unsigned int num_params, slang_assembly_name_space *space);
int _slang_assemble_function (slang_assembly_file *, struct slang_function_ *, int _slang_assemble_function (slang_assembly_file *, struct slang_function_ *,
slang_assembly_name_space *); slang_assembly_name_space *);
typedef struct slang_assembly_stack_info_ typedef struct slang_assembly_stack_info_
{ {
unsigned int swizzle_mask; unsigned int swizzle_mask;
} slang_assembly_stack_info; } slang_assembly_stack_info;
int _slang_cleanup_stack (slang_assembly_file *, slang_operation *, int ref, int _slang_cleanup_stack (slang_assembly_file *, slang_operation *, int ref,
slang_assembly_name_space *); slang_assembly_name_space *);
typedef struct slang_assembly_local_info_ typedef struct slang_assembly_local_info_
{ {
unsigned int ret_size; unsigned int ret_size;
unsigned int addr_tmp; unsigned int addr_tmp;
unsigned int swizzle_tmp; unsigned int swizzle_tmp;
} slang_assembly_local_info; } slang_assembly_local_info;
int _slang_assemble_operation (slang_assembly_file *, struct slang_operation_ *, int reference, int _slang_assemble_operation (slang_assembly_file *, struct slang_operation_ *, int reference,
slang_assembly_flow_control *, slang_assembly_name_space *, slang_assembly_local_info *, slang_assembly_flow_control *, slang_assembly_name_space *, slang_assembly_local_info *,
slang_assembly_stack_info *); slang_assembly_stack_info *);
void xxx_first (slang_assembly_file *); void xxx_first (slang_assembly_file *);
void xxx_prolog (slang_assembly_file *, unsigned int); void xxx_prolog (slang_assembly_file *, unsigned int);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_ASSEMBLE_ASSIGNMENT_H #if !defined SLANG_ASSEMBLE_ASSIGNMENT_H
#define SLANG_ASSEMBLE_ASSIGNMENT_H #define SLANG_ASSEMBLE_ASSIGNMENT_H
#include "slang_assemble.h" #include "slang_assemble.h"
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
int _slang_assemble_assignment (slang_assembly_file *, slang_operation *, int _slang_assemble_assignment (slang_assembly_file *, slang_operation *,
slang_assembly_name_space *, slang_assembly_local_info *); slang_assembly_name_space *, slang_assembly_local_info *);
int _slang_assemble_assign (slang_assembly_file *, slang_operation *, const char *, int ref, int _slang_assemble_assign (slang_assembly_file *, slang_operation *, const char *, int ref,
slang_assembly_name_space *, slang_assembly_local_info *); slang_assembly_name_space *, slang_assembly_local_info *);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_ASSEMBLE_CONDITIONAL_H #if !defined SLANG_ASSEMBLE_CONDITIONAL_H
#define SLANG_ASSEMBLE_CONDITIONAL_H #define SLANG_ASSEMBLE_CONDITIONAL_H
#include "slang_assemble.h" #include "slang_assemble.h"
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op, int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op, int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
int _slang_assemble_select (slang_assembly_file *file, slang_operation *op, int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
int _slang_assemble_for (slang_assembly_file *file, slang_operation *op, int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
int _slang_assemble_do (slang_assembly_file *file, slang_operation *op, int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
int _slang_assemble_while (slang_assembly_file *file, slang_operation *op, int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
int _slang_assemble_if (slang_assembly_file *file, slang_operation *op, int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H #if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H
#define SLANG_ASSEMBLE_CONSTRUCTOR_H #define SLANG_ASSEMBLE_CONSTRUCTOR_H
#include "slang_assemble.h" #include "slang_assemble.h"
#include "slang_compile.h" #include "slang_compile.h"
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
/* /*
holds a complete information about vector swizzle - the <swizzle> array contains holds a complete information about vector swizzle - the <swizzle> array contains
vector component sources indices, where 0 is "x", 1 is "y", ... vector component sources indices, where 0 is "x", 1 is "y", ...
example: "xwz" --> { 3, { 0, 3, 2, n/u } } example: "xwz" --> { 3, { 0, 3, 2, n/u } }
*/ */
typedef struct slang_swizzle_ typedef struct slang_swizzle_
{ {
unsigned int num_components; unsigned int num_components;
unsigned int swizzle[4]; unsigned int swizzle[4];
} slang_swizzle; } slang_swizzle;
/* /*
checks if a field selector is a general swizzle (an r-value swizzle with replicated checks if a field selector is a general swizzle (an r-value swizzle with replicated
components or an l-value swizzle mask) for a vector components or an l-value swizzle mask) for a vector
returns 1 if this is the case, <swz> is filled with swizzle information returns 1 if this is the case, <swz> is filled with swizzle information
returns 0 otherwise returns 0 otherwise
*/ */
int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz); int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz);
/* /*
checks if a general swizzle is an l-value swizzle - these swizzles do not have checks if a general swizzle is an l-value swizzle - these swizzles do not have
duplicated fields and they are specified in order duplicated fields and they are specified in order
returns 1 if this is a swizzle mask returns 1 if this is a swizzle mask
returns 0 otherwise returns 0 otherwise
*/ */
int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows); int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows);
/* /*
combines two swizzles to form single swizzle combines two swizzles to form single swizzle
example: "wzyx.yx" --> "zw" example: "wzyx.yx" --> "zw"
*/ */
void _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *); void _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *);
int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op, int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info); slang_assembly_local_info *info);
int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz, int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz,
slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info); slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_ASSEMBLE_TYPEINFO_H #if !defined SLANG_ASSEMBLE_TYPEINFO_H
#define SLANG_ASSEMBLE_TYPEINFO_H #define SLANG_ASSEMBLE_TYPEINFO_H
#include "slang_assemble_constructor.h" #include "slang_assemble_constructor.h"
#include "slang_compile.h" #include "slang_compile.h"
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct slang_assembly_typeinfo_ typedef struct slang_assembly_typeinfo_
{ {
int can_be_referenced; int can_be_referenced;
int is_swizzled; int is_swizzled;
slang_swizzle swz; slang_swizzle swz;
slang_type_specifier spec; slang_type_specifier spec;
} slang_assembly_typeinfo; } slang_assembly_typeinfo;
void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *); void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *);
void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *); void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *);
/* /*
retrieves type information about an operation retrieves type information about an operation
returns 1 on success returns 1 on success
returns 0 otherwise returns 0 otherwise
*/ */
int _slang_typeof_operation (slang_operation *, slang_assembly_name_space *, int _slang_typeof_operation (slang_operation *, slang_assembly_name_space *,
slang_assembly_typeinfo *); slang_assembly_typeinfo *);
/* /*
retrieves type of a function prototype, if one exists retrieves type of a function prototype, if one exists
returns 1 on success, even if the function was not found returns 1 on success, even if the function was not found
returns 0 otherwise returns 0 otherwise
*/ */
int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params, int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params,
slang_assembly_name_space *space, slang_type_specifier *spec, int *exists); slang_assembly_name_space *space, slang_type_specifier *spec, int *exists);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
...@@ -68,8 +68,8 @@ typedef enum slang_type_specifier_type_ ...@@ -68,8 +68,8 @@ typedef enum slang_type_specifier_type_
slang_spec_sampler2DShadow, slang_spec_sampler2DShadow,
slang_spec_struct, slang_spec_struct,
slang_spec_array slang_spec_array
} slang_type_specifier_type; } slang_type_specifier_type;
slang_type_specifier_type slang_type_specifier_type_from_string (const char *); slang_type_specifier_type slang_type_specifier_type_from_string (const char *);
typedef struct slang_type_specifier_ typedef struct slang_type_specifier_
...@@ -77,11 +77,11 @@ typedef struct slang_type_specifier_ ...@@ -77,11 +77,11 @@ typedef struct slang_type_specifier_
slang_type_specifier_type type; slang_type_specifier_type type;
struct slang_struct_ *_struct; /* spec_struct */ struct slang_struct_ *_struct; /* spec_struct */
struct slang_type_specifier_ *_array; /* spec_array */ struct slang_type_specifier_ *_array; /* spec_array */
} slang_type_specifier; } slang_type_specifier;
void slang_type_specifier_construct (slang_type_specifier *); void slang_type_specifier_construct (slang_type_specifier *);
void slang_type_specifier_destruct (slang_type_specifier *); void slang_type_specifier_destruct (slang_type_specifier *);
int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *); int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *);
int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *); int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *);
typedef struct slang_fully_specified_type_ typedef struct slang_fully_specified_type_
...@@ -171,9 +171,9 @@ typedef struct slang_operation_ ...@@ -171,9 +171,9 @@ typedef struct slang_operation_
float literal; /* bool, literal_int, literal_float */ float literal; /* bool, literal_int, literal_float */
char *identifier; /* asm, identifier, call, field */ char *identifier; /* asm, identifier, call, field */
slang_variable_scope *locals; slang_variable_scope *locals;
} slang_operation; } slang_operation;
int slang_operation_construct_a (slang_operation *); int slang_operation_construct_a (slang_operation *);
void slang_operation_destruct (slang_operation *); void slang_operation_destruct (slang_operation *);
typedef struct slang_variable_ typedef struct slang_variable_
...@@ -181,10 +181,10 @@ typedef struct slang_variable_ ...@@ -181,10 +181,10 @@ typedef struct slang_variable_
slang_fully_specified_type type; slang_fully_specified_type type;
char *name; char *name;
slang_operation *array_size; /* spec_array */ slang_operation *array_size; /* spec_array */
slang_operation *initializer; slang_operation *initializer;
unsigned int address; unsigned int address;
} slang_variable; } slang_variable;
slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all); slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all);
typedef struct slang_struct_scope_ typedef struct slang_struct_scope_
...@@ -192,8 +192,8 @@ typedef struct slang_struct_scope_ ...@@ -192,8 +192,8 @@ typedef struct slang_struct_scope_
struct slang_struct_ *structs; struct slang_struct_ *structs;
unsigned int num_structs; unsigned int num_structs;
struct slang_struct_scope_ *outer_scope; struct slang_struct_scope_ *outer_scope;
} slang_struct_scope; } slang_struct_scope;
struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int); struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int);
typedef struct slang_struct_ typedef struct slang_struct_
...@@ -201,9 +201,9 @@ typedef struct slang_struct_ ...@@ -201,9 +201,9 @@ typedef struct slang_struct_
char *name; char *name;
slang_variable_scope *fields; slang_variable_scope *fields;
slang_struct_scope *structs; slang_struct_scope *structs;
} slang_struct; } slang_struct;
int slang_struct_construct_a (slang_struct *); int slang_struct_construct_a (slang_struct *);
int slang_struct_copy (slang_struct *, const slang_struct *); int slang_struct_copy (slang_struct *, const slang_struct *);
typedef enum slang_function_kind_ typedef enum slang_function_kind_
...@@ -219,7 +219,7 @@ typedef struct slang_function_ ...@@ -219,7 +219,7 @@ typedef struct slang_function_
slang_variable header; slang_variable header;
slang_variable_scope *parameters; slang_variable_scope *parameters;
unsigned int param_count; unsigned int param_count;
slang_operation *body; slang_operation *body;
unsigned int address; unsigned int address;
} slang_function; } slang_function;
......
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_EXECUTE_H #if !defined SLANG_EXECUTE_H
#define SLANG_EXECUTE_H #define SLANG_EXECUTE_H
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
#define SLANG_MACHINE_STACK_SIZE 1024 #define SLANG_MACHINE_STACK_SIZE 1024
typedef struct slang_machine_ typedef struct slang_machine_
{ {
GLuint ip; /* instruction pointer, for flow control */ GLuint ip; /* instruction pointer, for flow control */
GLuint sp; /* stack pointer, for stack access */ GLuint sp; /* stack pointer, for stack access */
GLuint bp; /* base pointer, for local variable access */ GLuint bp; /* base pointer, for local variable access */
GLuint kill; /* discard the fragment */ GLuint kill; /* discard the fragment */
GLuint exit; /* terminate the shader */ GLuint exit; /* terminate the shader */
union stack_ union stack_
{ {
GLfloat _float[SLANG_MACHINE_STACK_SIZE]; GLfloat _float[SLANG_MACHINE_STACK_SIZE];
GLfloat *_floatp[SLANG_MACHINE_STACK_SIZE]; GLfloat *_floatp[SLANG_MACHINE_STACK_SIZE];
GLuint _addr[SLANG_MACHINE_STACK_SIZE]; GLuint _addr[SLANG_MACHINE_STACK_SIZE];
GLuint *_addrp[SLANG_MACHINE_STACK_SIZE]; GLuint *_addrp[SLANG_MACHINE_STACK_SIZE];
} stack; } stack;
} slang_machine; } slang_machine;
int _slang_execute (const slang_assembly_file *); int _slang_execute (const slang_assembly_file *);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/** /**
* \file slang_preprocess.c * \file slang_preprocess.c
* slang preprocessor * slang preprocessor
* \author Michal Krol * \author Michal Krol
*/ */
#include "imports.h" #include "imports.h"
#include "grammar_mesa.h" #include "grammar_mesa.h"
#include "slang_compile.h" #include "slang_compile.h"
#include "slang_preprocess.h" #include "slang_preprocess.h"
static const char *slang_version_syn = static const char *slang_version_syn =
#include "library/slang_version_syn.h" #include "library/slang_version_syn.h"
; ;
int _slang_preprocess_version (const char *text, unsigned int *version, unsigned int *eaten, int _slang_preprocess_version (const char *text, unsigned int *version, unsigned int *eaten,
slang_info_log *log) slang_info_log *log)
{ {
grammar id; grammar id;
byte *prod, *I; byte *prod, *I;
unsigned int size; unsigned int size;
id = grammar_load_from_text ((const byte *) slang_version_syn); id = grammar_load_from_text ((const byte *) slang_version_syn);
if (id == 0) if (id == 0)
{ {
char buf[1024]; char buf[1024];
unsigned int pos; unsigned int pos;
grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos);
slang_info_log_error (log, buf); slang_info_log_error (log, buf);
return 0; return 0;
} }
if (!grammar_fast_check (id, (const byte *) text, &prod, &size, 8)) if (!grammar_fast_check (id, (const byte *) text, &prod, &size, 8))
{ {
char buf[1024]; char buf[1024];
unsigned int pos; unsigned int pos;
grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos);
slang_info_log_error (log, buf); slang_info_log_error (log, buf);
grammar_destroy (id); grammar_destroy (id);
return 0; return 0;
} }
grammar_destroy (id); grammar_destroy (id);
/* there can be multiple #version directives - grab the last one */ /* there can be multiple #version directives - grab the last one */
I = prod; I = prod;
while (I < prod + size) while (I < prod + size)
{ {
*version = *version =
(unsigned int) I[0] + (unsigned int) I[0] +
(unsigned int) I[1] * 100; (unsigned int) I[1] * 100;
*eaten = *eaten =
((unsigned int) I[2]) + ((unsigned int) I[2]) +
((unsigned int) I[3] << 8) + ((unsigned int) I[3] << 8) +
((unsigned int) I[4] << 16) + ((unsigned int) I[4] << 16) +
((unsigned int) I[5] << 24); ((unsigned int) I[5] << 24);
I += 6; I += 6;
} }
grammar_alloc_free (prod); grammar_alloc_free (prod);
return 1; return 1;
} }
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_PREPROCESS_H #if !defined SLANG_PREPROCESS_H
#define SLANG_PREPROCESS_H #define SLANG_PREPROCESS_H
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
int _slang_preprocess_version (const char *, unsigned int *, unsigned int *, slang_info_log *); int _slang_preprocess_version (const char *, unsigned int *, unsigned int *, slang_info_log *);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/** /**
* \file slang_utility.c * \file slang_utility.c
* slang utilities * slang utilities
* \author Michal Krol * \author Michal Krol
*/ */
#include "imports.h" #include "imports.h"
#include "slang_utility.h" #include "slang_utility.h"
void slang_alloc_free (void *ptr) void slang_alloc_free (void *ptr)
{ {
_mesa_free (ptr); _mesa_free (ptr);
} }
void *slang_alloc_malloc (unsigned int size) void *slang_alloc_malloc (unsigned int size)
{ {
return _mesa_malloc (size); return _mesa_malloc (size);
} }
void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size) void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
{ {
return _mesa_realloc (ptr, old_size, size); return _mesa_realloc (ptr, old_size, size);
} }
int slang_string_compare (const char *str1, const char *str2) int slang_string_compare (const char *str1, const char *str2)
{ {
return _mesa_strcmp (str1, str2); return _mesa_strcmp (str1, str2);
} }
char *slang_string_copy (char *dst, const char *src) char *slang_string_copy (char *dst, const char *src)
{ {
return _mesa_strcpy (dst, src); return _mesa_strcpy (dst, src);
} }
char *slang_string_concat (char *dst, const char *src) char *slang_string_concat (char *dst, const char *src)
{ {
return _mesa_strcpy (dst + _mesa_strlen (dst), src); return _mesa_strcpy (dst + _mesa_strlen (dst), src);
} }
char *slang_string_duplicate (const char *src) char *slang_string_duplicate (const char *src)
{ {
return _mesa_strdup (src); return _mesa_strdup (src);
} }
unsigned int slang_string_length (const char *str) unsigned int slang_string_length (const char *str)
{ {
return _mesa_strlen (str); return _mesa_strlen (str);
} }
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if !defined SLANG_UTILITY_H #if !defined SLANG_UTILITY_H
#define SLANG_UTILITY_H #define SLANG_UTILITY_H
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Compile-time assertions. If the expression is zero, try to declare an /* Compile-time assertions. If the expression is zero, try to declare an
* array of size [-1] to cause compilation error. * array of size [-1] to cause compilation error.
*/ */
#define _static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0) #define _static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0)
void slang_alloc_free (void *); void slang_alloc_free (void *);
void *slang_alloc_malloc (unsigned int); void *slang_alloc_malloc (unsigned int);
void *slang_alloc_realloc (void *, unsigned int, unsigned int); void *slang_alloc_realloc (void *, unsigned int, unsigned int);
int slang_string_compare (const char *, const char *); int slang_string_compare (const char *, const char *);
char *slang_string_copy (char *, const char *); char *slang_string_copy (char *, const char *);
char *slang_string_concat (char *, const char *); char *slang_string_concat (char *, const char *);
char *slang_string_duplicate (const char *); char *slang_string_duplicate (const char *);
unsigned int slang_string_length (const char *); unsigned int slang_string_length (const char *);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 6.3 * Version: 6.3
* *
* Copyright (C) 2005 Brian Paul All Rights Reserved. * Copyright (C) 2005 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included * The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software. * in all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * 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 * 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. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
/** /**
* \file traverse_wrap.h * \file traverse_wrap.h
* Handy TIntermTraverser class wrapper * Handy TIntermTraverser class wrapper
* \author Michal Krol * \author Michal Krol
*/ */
#ifndef __TRAVERSE_WRAP_H__ #ifndef __TRAVERSE_WRAP_H__
#define __TRAVERSE_WRAP_H__ #define __TRAVERSE_WRAP_H__
#include "Include/intermediate.h" #include "Include/intermediate.h"
/* /*
The original TIntermTraverser class that is used to walk the intermediate tree, The original TIntermTraverser class that is used to walk the intermediate tree,
is not very elegant in its design. One must define static functions with is not very elegant in its design. One must define static functions with
appropriate prototypes, construct TIntermTraverser object, and set its member appropriate prototypes, construct TIntermTraverser object, and set its member
function pointers to one's static functions. If traversal-specific data function pointers to one's static functions. If traversal-specific data
is needed, a new class must be derived, and one must up-cast the object is needed, a new class must be derived, and one must up-cast the object
passed as a parameter to the static function. passed as a parameter to the static function.
The class below eliminates this burden by providing virtual methods that are The class below eliminates this burden by providing virtual methods that are
to be overridden in the derived class. to be overridden in the derived class.
*/ */
class traverse_wrap: private TIntermTraverser class traverse_wrap: private TIntermTraverser
{ {
private: private:
static void _visitSymbol (TIntermSymbol *S, TIntermTraverser *T) { static void _visitSymbol (TIntermSymbol *S, TIntermTraverser *T) {
static_cast<traverse_wrap *> (T)->Symbol (*S); static_cast<traverse_wrap *> (T)->Symbol (*S);
} }
static void _visitConstantUnion (TIntermConstantUnion *U, TIntermTraverser *T) { static void _visitConstantUnion (TIntermConstantUnion *U, TIntermTraverser *T) {
static_cast<traverse_wrap *> (T)->ConstantUnion (*U); static_cast<traverse_wrap *> (T)->ConstantUnion (*U);
} }
static bool _visitBinary (bool preVisit, TIntermBinary *B, TIntermTraverser *T) { static bool _visitBinary (bool preVisit, TIntermBinary *B, TIntermTraverser *T) {
return static_cast<traverse_wrap *> (T)->Binary (preVisit, *B); return static_cast<traverse_wrap *> (T)->Binary (preVisit, *B);
} }
static bool _visitUnary (bool preVisit, TIntermUnary *U, TIntermTraverser *T) { static bool _visitUnary (bool preVisit, TIntermUnary *U, TIntermTraverser *T) {
return static_cast<traverse_wrap *> (T)->Unary (preVisit, *U); return static_cast<traverse_wrap *> (T)->Unary (preVisit, *U);
} }
static bool _visitSelection (bool preVisit, TIntermSelection *S, TIntermTraverser *T) { static bool _visitSelection (bool preVisit, TIntermSelection *S, TIntermTraverser *T) {
return static_cast<traverse_wrap *> (T)->Selection (preVisit, *S); return static_cast<traverse_wrap *> (T)->Selection (preVisit, *S);
} }
static bool _visitAggregate (bool preVisit, TIntermAggregate *A, TIntermTraverser *T) { static bool _visitAggregate (bool preVisit, TIntermAggregate *A, TIntermTraverser *T) {
return static_cast<traverse_wrap *> (T)->Aggregate (preVisit, *A); return static_cast<traverse_wrap *> (T)->Aggregate (preVisit, *A);
} }
static bool _visitLoop (bool preVisit, TIntermLoop *L, TIntermTraverser *T) { static bool _visitLoop (bool preVisit, TIntermLoop *L, TIntermTraverser *T) {
return static_cast<traverse_wrap *> (T)->Loop (preVisit, *L); return static_cast<traverse_wrap *> (T)->Loop (preVisit, *L);
} }
static bool _visitBranch (bool preVisit, TIntermBranch *B, TIntermTraverser *T) { static bool _visitBranch (bool preVisit, TIntermBranch *B, TIntermTraverser *T) {
return static_cast<traverse_wrap *> (T)->Branch (preVisit, *B); return static_cast<traverse_wrap *> (T)->Branch (preVisit, *B);
} }
public: public:
traverse_wrap () { traverse_wrap () {
visitSymbol = _visitSymbol; visitSymbol = _visitSymbol;
visitConstantUnion = _visitConstantUnion; visitConstantUnion = _visitConstantUnion;
visitBinary = _visitBinary; visitBinary = _visitBinary;
visitUnary = _visitUnary; visitUnary = _visitUnary;
visitSelection = _visitSelection; visitSelection = _visitSelection;
visitAggregate = _visitAggregate; visitAggregate = _visitAggregate;
visitLoop = _visitLoop; visitLoop = _visitLoop;
visitBranch = _visitBranch; visitBranch = _visitBranch;
} }
protected: protected:
virtual void Symbol (const TIntermSymbol &) { virtual void Symbol (const TIntermSymbol &) {
} }
virtual void ConstantUnion (const TIntermConstantUnion &) { virtual void ConstantUnion (const TIntermConstantUnion &) {
} }
virtual bool Binary (bool, const TIntermBinary &) { virtual bool Binary (bool, const TIntermBinary &) {
return true; return true;
} }
virtual bool Unary (bool, const TIntermUnary &) { virtual bool Unary (bool, const TIntermUnary &) {
return true; return true;
} }
virtual bool Selection (bool, const TIntermSelection &) { virtual bool Selection (bool, const TIntermSelection &) {
return true; return true;
} }
virtual bool Aggregate (bool, const TIntermAggregate &) { virtual bool Aggregate (bool, const TIntermAggregate &) {
return true; return true;
} }
virtual bool Loop (bool, const TIntermLoop &) { virtual bool Loop (bool, const TIntermLoop &) {
return true; return true;
} }
virtual bool Branch (bool, const TIntermBranch &) { virtual bool Branch (bool, const TIntermBranch &) {
return true; return true;
} }
}; };
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment