Replace builtin_types.h generation with the generated output.
The script to generate it was longer and more obfuscated than the output.
This commit is contained in:
parent
82ad90f8cf
commit
8d3e59f1f3
|
@ -14,7 +14,6 @@ stamp-h1
|
|||
Makefile
|
||||
*.o
|
||||
*~
|
||||
builtin_types.h
|
||||
glsl_lexer.cpp
|
||||
glsl_parser.output
|
||||
glsl_parser.cpp
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS = glsl
|
||||
glsl_SOURCES = symbol_table.c hash_table.c glsl_types.cpp \
|
||||
glsl_SOURCES = \
|
||||
builtin_types.h \
|
||||
symbol_table.c hash_table.c glsl_types.cpp \
|
||||
glsl_parser.ypp glsl_lexer.lpp glsl_parser_extras.cpp \
|
||||
ast_expr.cpp ast_to_hir.cpp ast_function.cpp ast_type.cpp \
|
||||
ir.cpp hir_field_selection.cpp builtin_function.cpp \
|
||||
|
@ -35,13 +37,10 @@ glsl_SOURCES = symbol_table.c hash_table.c glsl_types.cpp \
|
|||
ir_function_inlining.cpp \
|
||||
ir_if_simplification.cpp
|
||||
|
||||
BUILT_SOURCES = glsl_parser.h builtin_types.h glsl_parser.cpp glsl_lexer.cpp
|
||||
BUILT_SOURCES = glsl_parser.h glsl_parser.cpp glsl_lexer.cpp
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
glsl_parser.h: glsl_parser.cpp
|
||||
|
||||
.lpp.cpp:
|
||||
$(LEXCOMPILE) --outfile="$@" $<
|
||||
|
||||
builtin_types.h: builtin_types.sh
|
||||
bash ./builtin_types.sh > builtin_types.h
|
||||
|
|
|
@ -0,0 +1,251 @@
|
|||
/*
|
||||
* Copyright © 2009 Intel Corporation
|
||||
*
|
||||
* 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 (including the next
|
||||
* paragraph) 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 OR COPYRIGHT HOLDERS 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 Elements
|
||||
#define Elements(x) (sizeof(x)/sizeof(*(x)))
|
||||
#endif
|
||||
|
||||
static const struct glsl_type _error_type =
|
||||
glsl_type(GLSL_TYPE_ERROR, 0, 0, "");
|
||||
|
||||
static const struct glsl_type void_type =
|
||||
glsl_type(GLSL_TYPE_VOID, 0, 0, "void");
|
||||
|
||||
const glsl_type *const glsl_type::error_type = & _error_type;
|
||||
|
||||
/** \name Core built-in types
|
||||
*
|
||||
* These types exist in all versions of GLSL.
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
static const struct glsl_type builtin_core_types[] = {
|
||||
glsl_type( GLSL_TYPE_BOOL, 1, 1, "bool"),
|
||||
glsl_type( GLSL_TYPE_BOOL, 2, 1, "bvec2"),
|
||||
glsl_type( GLSL_TYPE_BOOL, 3, 1, "bvec3"),
|
||||
glsl_type( GLSL_TYPE_BOOL, 4, 1, "bvec4"),
|
||||
glsl_type( GLSL_TYPE_INT, 1, 1, "int"),
|
||||
glsl_type( GLSL_TYPE_INT, 2, 1, "ivec2"),
|
||||
glsl_type( GLSL_TYPE_INT, 3, 1, "ivec3"),
|
||||
glsl_type( GLSL_TYPE_INT, 4, 1, "ivec4"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 1, 1, "float"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 2, 1, "vec2"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 3, 1, "vec3"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 4, 1, "vec4"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 2, 2, "mat2"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 3, 3, "mat3"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 4, 4, "mat4"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT, "sampler1D"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT, "sampler1DShadow"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT, "sampler2D"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT, "sampler2DShadow"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT, "sampler3D"),
|
||||
glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT, "samplerCube"),
|
||||
};
|
||||
|
||||
const glsl_type *const glsl_type::bool_type = & builtin_core_types[0];
|
||||
const glsl_type *const glsl_type::int_type = & builtin_core_types[4];
|
||||
const glsl_type *const glsl_type::float_type = & builtin_core_types[8];
|
||||
const glsl_type *const glsl_type::mat2_type = & builtin_core_types[12];
|
||||
const glsl_type *const glsl_type::mat3_type = & builtin_core_types[13];
|
||||
const glsl_type *const glsl_type::mat4_type = & builtin_core_types[14];
|
||||
/*@}*/
|
||||
|
||||
/** \name GLSL structures that have not been deprecated.
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = {
|
||||
{ & builtin_core_types[ 8], "near" },
|
||||
{ & builtin_core_types[ 8], "far" },
|
||||
{ & builtin_core_types[ 8], "diff" },
|
||||
};
|
||||
|
||||
static const struct glsl_type builtin_structure_types[] = {
|
||||
glsl_type(gl_DepthRangeParameters_fields,
|
||||
Elements(gl_DepthRangeParameters_fields),
|
||||
"gl_DepthRangeParameters"),
|
||||
};
|
||||
/*@}*/
|
||||
|
||||
/** \name GLSL 1.00 / 1.10 structures that are deprecated in GLSL 1.30
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
static const struct glsl_struct_field gl_PointParameters_fields[] = {
|
||||
{ & builtin_core_types[ 8], "size" },
|
||||
{ & builtin_core_types[ 8], "sizeMin" },
|
||||
{ & builtin_core_types[ 8], "sizeMax" },
|
||||
{ & builtin_core_types[ 8], "fadeThresholdSize" },
|
||||
{ & builtin_core_types[ 8], "distanceConstantAttenuation" },
|
||||
{ & builtin_core_types[ 8], "distanceLinearAttenuation" },
|
||||
{ & builtin_core_types[ 8], "distanceQuadraticAttenuation" },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_MaterialParameters_fields[] = {
|
||||
{ & builtin_core_types[11], "emission" },
|
||||
{ & builtin_core_types[11], "ambient" },
|
||||
{ & builtin_core_types[11], "diffuse" },
|
||||
{ & builtin_core_types[11], "specular" },
|
||||
{ & builtin_core_types[ 8], "shininess" },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightSourceParameters_fields[] = {
|
||||
{ & builtin_core_types[11], "ambient" },
|
||||
{ & builtin_core_types[11], "diffuse" },
|
||||
{ & builtin_core_types[11], "specular" },
|
||||
{ & builtin_core_types[11], "position" },
|
||||
{ & builtin_core_types[11], "halfVector" },
|
||||
{ & builtin_core_types[10], "spotDirection" },
|
||||
{ & builtin_core_types[ 8], "spotExponent" },
|
||||
{ & builtin_core_types[ 8], "spotCutoff" },
|
||||
{ & builtin_core_types[ 8], "spotCosCutoff" },
|
||||
{ & builtin_core_types[ 8], "constantAttenuation" },
|
||||
{ & builtin_core_types[ 8], "linearAttenuation" },
|
||||
{ & builtin_core_types[ 8], "quadraticAttenuation" },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightModelParameters_fields[] = {
|
||||
{ & builtin_core_types[11], "ambient" },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightModelProducts_fields[] = {
|
||||
{ & builtin_core_types[11], "sceneColor" },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightProducts_fields[] = {
|
||||
{ & builtin_core_types[11], "ambient" },
|
||||
{ & builtin_core_types[11], "diffuse" },
|
||||
{ & builtin_core_types[11], "specular" },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_FogParameters_fields[] = {
|
||||
{ & builtin_core_types[11], "color" },
|
||||
{ & builtin_core_types[ 8], "density" },
|
||||
{ & builtin_core_types[ 8], "start" },
|
||||
{ & builtin_core_types[ 8], "end" },
|
||||
{ & builtin_core_types[ 8], "scale" },
|
||||
};
|
||||
|
||||
static const struct glsl_type builtin_110_deprecated_structure_types[] = {
|
||||
glsl_type(gl_PointParameters_fields,
|
||||
Elements(gl_PointParameters_fields),
|
||||
"gl_PointParameters"),
|
||||
glsl_type(gl_MaterialParameters_fields,
|
||||
Elements(gl_MaterialParameters_fields),
|
||||
"gl_MaterialParameters"),
|
||||
glsl_type(gl_LightSourceParameters_fields,
|
||||
Elements(gl_LightSourceParameters_fields),
|
||||
"gl_LightSourceParameters"),
|
||||
glsl_type(gl_LightModelParameters_fields,
|
||||
Elements(gl_LightModelParameters_fields),
|
||||
"gl_LightModelParameters"),
|
||||
glsl_type(gl_LightModelProducts_fields,
|
||||
Elements(gl_LightModelProducts_fields),
|
||||
"gl_LightModelProducts"),
|
||||
glsl_type(gl_LightProducts_fields,
|
||||
Elements(gl_LightProducts_fields),
|
||||
"gl_LightProducts"),
|
||||
glsl_type(gl_FogParameters_fields,
|
||||
Elements(gl_FogParameters_fields),
|
||||
"gl_FogParameters"),
|
||||
};
|
||||
/*@}*/
|
||||
|
||||
/** \name Types added in GLSL 1.20
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
static const struct glsl_type builtin_120_types[] = {
|
||||
glsl_type( GLSL_TYPE_FLOAT, 3, 2, "mat2x3"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 4, 2, "mat2x4"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 2, 3, "mat3x2"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 4, 3, "mat3x4"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 2, 4, "mat4x2"),
|
||||
glsl_type( GLSL_TYPE_FLOAT, 3, 4, "mat4x3"),
|
||||
};
|
||||
const glsl_type *const glsl_type::mat2x3_type = & builtin_120_types[0];
|
||||
const glsl_type *const glsl_type::mat2x4_type = & builtin_120_types[1];
|
||||
const glsl_type *const glsl_type::mat3x2_type = & builtin_120_types[2];
|
||||
const glsl_type *const glsl_type::mat3x4_type = & builtin_120_types[3];
|
||||
const glsl_type *const glsl_type::mat4x2_type = & builtin_120_types[4];
|
||||
const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5];
|
||||
/*@}*/
|
||||
|
||||
/** \name Types added in GLSL 1.30
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
static const struct glsl_type builtin_130_types[] = {
|
||||
glsl_type( GLSL_TYPE_UINT, 1, 1, "uint"),
|
||||
glsl_type( GLSL_TYPE_UINT, 2, 1, "uvec2"),
|
||||
glsl_type( GLSL_TYPE_UINT, 3, 1, "uvec3"),
|
||||
glsl_type( GLSL_TYPE_UINT, 4, 1, "uvec4"),
|
||||
|
||||
/* 1D and 2D texture arrays */
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT, "isampler1DArray"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT, "usampler1DArray"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT, "isampler2DArray"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT, "usampler2DArray"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"),
|
||||
|
||||
/* cube shadow samplers */
|
||||
glsl_type(GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT, "samplerCubeShadow"),
|
||||
|
||||
/* signed and unsigned integer samplers */
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT, "isampler1D"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT, "usampler1D"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT, "isampler2D"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT, "usampler2D"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT, "isampler3D"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT, "usampler3D"),
|
||||
glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT, "isamplerCube"),
|
||||
glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT, "usamplerCube"),
|
||||
};
|
||||
|
||||
const glsl_type *const glsl_type::uint_type = & builtin_130_types[0];
|
||||
/*@}*/
|
||||
|
||||
/** \name Sampler types added by GL_ARB_texture_rectangle
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
static const struct glsl_type builtin_ARB_texture_rectangle_types[] = {
|
||||
glsl_type(GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"),
|
||||
glsl_type(GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT, "sampler2DRectShadow"),
|
||||
};
|
||||
/*@}*/
|
||||
|
||||
/** \name Sampler types added by GL_EXT_texture_buffer_object
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
static const struct glsl_type builtin_EXT_texture_buffer_object_types[] = {
|
||||
glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT, "samplerBuffer"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT, "isamplerBuffer"),
|
||||
glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT, "usamplerBuffer"),
|
||||
};
|
||||
/*@}*/
|
348
builtin_types.sh
348
builtin_types.sh
|
@ -1,348 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright © 2009 Intel Corporation
|
||||
#
|
||||
# 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 (including the next
|
||||
# paragraph) 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 OR COPYRIGHT HOLDERS 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.
|
||||
|
||||
# gen_integral_type <name> <base_type> <vector elements> <matrix rows>
|
||||
function gen_integral_type
|
||||
{
|
||||
printf ' glsl_type( %17s, %u, %u, "%s"),\n' $2 $3 $4 $1
|
||||
index=$((index + 1))
|
||||
}
|
||||
|
||||
# gen_struct_type <name>
|
||||
function gen_struct_type
|
||||
{
|
||||
elements=$(printf "%s_fields" $1)
|
||||
printf ' glsl_type(%s,\n Elements(%s),\n "%s"),\n' \
|
||||
$elements $elements $1
|
||||
}
|
||||
|
||||
# gen_sampler_type <name> <dimensions> <shadow> <array> <type>
|
||||
function gen_sampler_type
|
||||
{
|
||||
name=$(printf "sampler%s" $1)
|
||||
|
||||
if [ $4 -eq 1 ]; then
|
||||
name=$(printf "%sArray" $name)
|
||||
fi
|
||||
|
||||
if [ $3 -eq 1 ]; then
|
||||
name=$(printf "%sShadow" $name)
|
||||
fi
|
||||
|
||||
if [ $5 == GLSL_TYPE_INT ]; then
|
||||
name=$(printf "i%s" $name)
|
||||
elif [ $5 == GLSL_TYPE_UINT ]; then
|
||||
name=$(printf "u%s" $name)
|
||||
fi
|
||||
|
||||
printf ' glsl_type(%21s, %u, %u, %15s, "%s"),\n' \
|
||||
$2 $3 $4 $5 $name
|
||||
}
|
||||
|
||||
function gen_header
|
||||
{
|
||||
if [ x$1 == x ]; then
|
||||
name="builtin_types"
|
||||
else
|
||||
name="builtin_${1}_types"
|
||||
fi
|
||||
|
||||
printf "\nstatic const struct glsl_type %s[] = {\n" $name
|
||||
}
|
||||
|
||||
function gen_footer
|
||||
{
|
||||
printf "};\n"
|
||||
}
|
||||
|
||||
function gen_struct_field_header
|
||||
{
|
||||
printf "\nstatic const struct glsl_struct_field %s_fields[] = {\n" $1
|
||||
}
|
||||
|
||||
function gen_struct_field_footer
|
||||
{
|
||||
printf "};\n"
|
||||
}
|
||||
|
||||
function gen_struct_field
|
||||
{
|
||||
printf ' { & %s[%2u], "%s" },\n' $1 $2 "$3"
|
||||
}
|
||||
|
||||
cat <<EOF
|
||||
/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! See builtin_types.sh. */
|
||||
/*
|
||||
* Copyright © 2009 Intel Corporation
|
||||
*
|
||||
* 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 (including the next
|
||||
* paragraph) 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 OR COPYRIGHT HOLDERS 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 Elements
|
||||
#define Elements(x) (sizeof(x)/sizeof(*(x)))
|
||||
#endif
|
||||
|
||||
static const struct glsl_type _error_type =
|
||||
glsl_type(GLSL_TYPE_ERROR, 0, 0, "");
|
||||
|
||||
static const struct glsl_type void_type =
|
||||
glsl_type(GLSL_TYPE_VOID, 0, 0, "void");
|
||||
|
||||
const glsl_type *const glsl_type::error_type = & _error_type;
|
||||
|
||||
EOF
|
||||
|
||||
echo '/** \name Core built-in types'
|
||||
echo ' *'
|
||||
echo ' * These types exist in all versions of GLSL.'
|
||||
echo ' */'
|
||||
echo '/*@{*/'
|
||||
gen_header "core"
|
||||
|
||||
index=0;
|
||||
bool_index=$index
|
||||
gen_integral_type "bool" "GLSL_TYPE_BOOL" 1 1
|
||||
for i in 2 3 4; do
|
||||
gen_integral_type "bvec$i" "GLSL_TYPE_BOOL" $i 1
|
||||
done
|
||||
|
||||
int_index=$index
|
||||
gen_integral_type "int" "GLSL_TYPE_INT" 1 1
|
||||
for i in 2 3 4; do
|
||||
gen_integral_type "ivec$i" "GLSL_TYPE_INT" $i 1
|
||||
done
|
||||
|
||||
float_index=$index
|
||||
gen_integral_type "float" "GLSL_TYPE_FLOAT" 1 1
|
||||
for i in 2 3 4; do
|
||||
gen_integral_type "vec$i" "GLSL_TYPE_FLOAT" $i 1
|
||||
done
|
||||
|
||||
matX_index=$index
|
||||
for i in 2 3 4; do
|
||||
gen_integral_type "mat$i" "GLSL_TYPE_FLOAT" $i $i
|
||||
done
|
||||
|
||||
for i in "1D" "2D"; do
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 0 0 "GLSL_TYPE_FLOAT"
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 1 0 "GLSL_TYPE_FLOAT"
|
||||
done
|
||||
|
||||
gen_sampler_type "3D" "GLSL_SAMPLER_DIM_3D" 0 0 "GLSL_TYPE_FLOAT"
|
||||
gen_sampler_type "Cube" "GLSL_SAMPLER_DIM_CUBE" 0 0 "GLSL_TYPE_FLOAT"
|
||||
|
||||
gen_footer
|
||||
|
||||
echo
|
||||
echo 'const glsl_type *const glsl_type::bool_type = & builtin_core_types['$bool_index'];'
|
||||
echo 'const glsl_type *const glsl_type::int_type = & builtin_core_types['$int_index'];'
|
||||
echo 'const glsl_type *const glsl_type::float_type = & builtin_core_types['$float_index'];'
|
||||
echo 'const glsl_type *const glsl_type::mat2_type = & builtin_core_types['$(($matX_index + 0))'];'
|
||||
echo 'const glsl_type *const glsl_type::mat3_type = & builtin_core_types['$(($matX_index + 1))'];'
|
||||
echo 'const glsl_type *const glsl_type::mat4_type = & builtin_core_types['$(($matX_index + 2))'];'
|
||||
echo '/*@}*/'
|
||||
|
||||
echo
|
||||
echo '/** \name GLSL structures that have not been deprecated.'
|
||||
echo ' */'
|
||||
echo '/*@{*/'
|
||||
gen_struct_field_header gl_DepthRangeParameters
|
||||
gen_struct_field builtin_core_types 8 "near"
|
||||
gen_struct_field builtin_core_types 8 "far"
|
||||
gen_struct_field builtin_core_types 8 "diff"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_header "structure"
|
||||
gen_struct_type gl_DepthRangeParameters
|
||||
gen_footer
|
||||
echo '/*@}*/'
|
||||
|
||||
echo
|
||||
echo '/** \name GLSL 1.00 / 1.10 structures that are deprecated in GLSL 1.30'
|
||||
echo ' */'
|
||||
echo '/*@{*/'
|
||||
gen_struct_field_header gl_PointParameters
|
||||
gen_struct_field builtin_core_types 8 "size"
|
||||
gen_struct_field builtin_core_types 8 "sizeMin"
|
||||
gen_struct_field builtin_core_types 8 "sizeMax"
|
||||
gen_struct_field builtin_core_types 8 "fadeThresholdSize"
|
||||
gen_struct_field builtin_core_types 8 "distanceConstantAttenuation"
|
||||
gen_struct_field builtin_core_types 8 "distanceLinearAttenuation"
|
||||
gen_struct_field builtin_core_types 8 "distanceQuadraticAttenuation"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_struct_field_header gl_MaterialParameters
|
||||
gen_struct_field builtin_core_types 11 "emission"
|
||||
gen_struct_field builtin_core_types 11 "ambient"
|
||||
gen_struct_field builtin_core_types 11 "diffuse"
|
||||
gen_struct_field builtin_core_types 11 "specular"
|
||||
gen_struct_field builtin_core_types 8 "shininess"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_struct_field_header gl_LightSourceParameters
|
||||
gen_struct_field builtin_core_types 11 "ambient"
|
||||
gen_struct_field builtin_core_types 11 "diffuse"
|
||||
gen_struct_field builtin_core_types 11 "specular"
|
||||
gen_struct_field builtin_core_types 11 "position"
|
||||
gen_struct_field builtin_core_types 11 "halfVector"
|
||||
gen_struct_field builtin_core_types 10 "spotDirection"
|
||||
gen_struct_field builtin_core_types 8 "spotExponent"
|
||||
gen_struct_field builtin_core_types 8 "spotCutoff"
|
||||
gen_struct_field builtin_core_types 8 "spotCosCutoff"
|
||||
gen_struct_field builtin_core_types 8 "constantAttenuation"
|
||||
gen_struct_field builtin_core_types 8 "linearAttenuation"
|
||||
gen_struct_field builtin_core_types 8 "quadraticAttenuation"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_struct_field_header gl_LightModelParameters
|
||||
gen_struct_field builtin_core_types 11 "ambient"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_struct_field_header gl_LightModelProducts
|
||||
gen_struct_field builtin_core_types 11 "sceneColor"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_struct_field_header gl_LightProducts
|
||||
gen_struct_field builtin_core_types 11 "ambient"
|
||||
gen_struct_field builtin_core_types 11 "diffuse"
|
||||
gen_struct_field builtin_core_types 11 "specular"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_struct_field_header gl_FogParameters
|
||||
gen_struct_field builtin_core_types 11 "color"
|
||||
gen_struct_field builtin_core_types 8 "density"
|
||||
gen_struct_field builtin_core_types 8 "start"
|
||||
gen_struct_field builtin_core_types 8 "end"
|
||||
gen_struct_field builtin_core_types 8 "scale"
|
||||
gen_struct_field_footer
|
||||
|
||||
gen_header "110_deprecated_structure"
|
||||
gen_struct_type gl_PointParameters
|
||||
gen_struct_type gl_MaterialParameters
|
||||
gen_struct_type gl_LightSourceParameters
|
||||
gen_struct_type gl_LightModelParameters
|
||||
gen_struct_type gl_LightModelProducts
|
||||
gen_struct_type gl_LightProducts
|
||||
gen_struct_type gl_FogParameters
|
||||
gen_footer
|
||||
echo '/*@}*/'
|
||||
|
||||
|
||||
echo
|
||||
echo '/** \name Types added in GLSL 1.20'
|
||||
echo ' */'
|
||||
echo '/*@{*/'
|
||||
gen_header "120"
|
||||
for c in 2 3 4; do
|
||||
for r in 2 3 4; do
|
||||
if [ $c -ne $r ]; then
|
||||
gen_integral_type "mat${c}x${r}" "GLSL_TYPE_FLOAT" $r $c
|
||||
fi
|
||||
done
|
||||
done
|
||||
gen_footer
|
||||
|
||||
echo 'const glsl_type *const glsl_type::mat2x3_type = & builtin_120_types[0];'
|
||||
echo 'const glsl_type *const glsl_type::mat2x4_type = & builtin_120_types[1];'
|
||||
echo 'const glsl_type *const glsl_type::mat3x2_type = & builtin_120_types[2];'
|
||||
echo 'const glsl_type *const glsl_type::mat3x4_type = & builtin_120_types[3];'
|
||||
echo 'const glsl_type *const glsl_type::mat4x2_type = & builtin_120_types[4];'
|
||||
echo 'const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5];'
|
||||
echo '/*@}*/'
|
||||
echo
|
||||
echo '/** \name Types added in GLSL 1.30'
|
||||
echo ' */'
|
||||
echo '/*@{*/'
|
||||
gen_header "130"
|
||||
index=0;
|
||||
uint_index=$index
|
||||
gen_integral_type "uint" "GLSL_TYPE_UINT" 1 1
|
||||
for i in 2 3 4; do
|
||||
gen_integral_type "uvec$i" "GLSL_TYPE_UINT" $i 1
|
||||
done
|
||||
|
||||
echo
|
||||
echo " /* 1D and 2D texture arrays */"
|
||||
for i in "1D" "2D"; do
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 0 1 "GLSL_TYPE_FLOAT"
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 0 1 "GLSL_TYPE_INT"
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 0 1 "GLSL_TYPE_UINT"
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 1 1 "GLSL_TYPE_FLOAT"
|
||||
done
|
||||
|
||||
echo
|
||||
echo " /* cube shadow samplers */"
|
||||
gen_sampler_type "Cube" "GLSL_SAMPLER_DIM_CUBE" 1 0 "GLSL_TYPE_FLOAT"
|
||||
|
||||
echo
|
||||
echo " /* signed and unsigned integer samplers */"
|
||||
for i in "1D" "2D" "3D"; do
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 0 0 "GLSL_TYPE_INT"
|
||||
gen_sampler_type $i "GLSL_SAMPLER_DIM_$i" 0 0 "GLSL_TYPE_UINT"
|
||||
done
|
||||
|
||||
gen_sampler_type "Cube" "GLSL_SAMPLER_DIM_CUBE" 0 0 "GLSL_TYPE_INT"
|
||||
gen_sampler_type "Cube" "GLSL_SAMPLER_DIM_CUBE" 0 0 "GLSL_TYPE_UINT"
|
||||
|
||||
gen_footer
|
||||
echo ''
|
||||
echo 'const glsl_type *const glsl_type::uint_type = & builtin_130_types['$uint_index'];'
|
||||
echo '/*@}*/'
|
||||
|
||||
echo
|
||||
echo '/** \name Sampler types added by GL_ARB_texture_rectangle'
|
||||
echo ' */'
|
||||
echo '/*@{*/'
|
||||
gen_header "ARB_texture_rectangle"
|
||||
gen_sampler_type "2DRect" "GLSL_SAMPLER_DIM_RECT" 0 0 "GLSL_TYPE_FLOAT"
|
||||
gen_sampler_type "2DRect" "GLSL_SAMPLER_DIM_RECT" 1 0 "GLSL_TYPE_FLOAT"
|
||||
gen_footer
|
||||
echo '/*@}*/'
|
||||
|
||||
echo
|
||||
echo '/** \name Sampler types added by GL_EXT_texture_buffer_object'
|
||||
echo ' */'
|
||||
echo '/*@{*/'
|
||||
gen_header "EXT_texture_buffer_object"
|
||||
gen_sampler_type "Buffer" "GLSL_SAMPLER_DIM_BUF" 0 0 "GLSL_TYPE_FLOAT"
|
||||
gen_sampler_type "Buffer" "GLSL_SAMPLER_DIM_BUF" 0 0 "GLSL_TYPE_INT"
|
||||
gen_sampler_type "Buffer" "GLSL_SAMPLER_DIM_BUF" 0 0 "GLSL_TYPE_UINT"
|
||||
gen_footer
|
||||
echo '/*@}*/'
|
Loading…
Reference in New Issue