Commit graph

36 commits

Author SHA1 Message Date
Ian Romanick
57bb893a46 glsl_type: Add method to get number of slots used by a type 2010-06-23 10:56:04 -07:00
Ian Romanick
eeedd355cf Add glsl_types::field_index to get the location of a record field 2010-06-11 13:51:42 -07:00
Ian Romanick
93073551f9 Add glsl_type::is_record query 2010-06-11 13:51:42 -07:00
Kenneth Graunke
56d3f6ad78 Set the type of ir_texture properly; infer it from the sampler type. 2010-06-09 11:14:57 -07:00
Ian Romanick
82baaf4283 glsl_type::generate_constructor_prototype now generates the function too
Also, change the name of the method to generate_constructor.
2010-04-28 18:22:54 -07:00
Ian Romanick
8f755dcb67 Add glsl_type::field_type
Query the type of a structure field
2010-04-28 18:22:54 -07:00
Ian Romanick
230ade93a6 Make private glsl_type singletons public 2010-04-26 14:59:16 -07:00
Eric Anholt
ec9e73870c Put static pointers to vec[234]_types along with the static float_type.
Otherwise you have to type a lot of get_instance.
2010-04-23 16:12:44 -07:00
Ian Romanick
00e517616b Add glsl_type::element_type and glsl_type::array_size queries
The former gets the type of elements in an array, and the later gets
the declared size, if any, of the array.
2010-04-01 17:17:34 -07:00
Ian Romanick
4ef183e51d Add glsl_type::generate_constructor_prototype
Generates a symbol table entry and the IR approximation of a prototype for a
type's constructor.  Currently only arrays are supported.
2010-03-31 16:30:56 -07:00
Ian Romanick
299ed08a68 Fix big dumbness in glsl_type::get_array_instance
hash_table_insert needs to keep the key so that it compare keys on a
following hash_table_find call.  Since key was allocated on the stack,
it disappeared out from under the hash table.
2010-03-31 16:13:38 -07:00
Ian Romanick
0bf3810165 glsl_type array constructor generate a real name for the type 2010-03-31 14:37:42 -07:00
Ian Romanick
548a1b5ab7 Implement array type handling
Since all glsl_type objects are flyweights, support is added to track all
known array types.  This accounts for most of the changes.
2010-03-30 16:58:19 -07:00
Ian Romanick
70348543ac Add glsl_type::is_array and glsl_type::is_float queries 2010-03-29 16:17:15 -07:00
Ian Romanick
738c183cc9 Slightly change the representation of numeric types
For numeric types, vector_elements and matrix_columns must be at least
1.  Previously matrix_columns was 0 for vectors, and both were 0 for
scalars.  This change simplifies things in some places.
2010-03-26 14:43:16 -07:00
Ian Romanick
d811d47609 Add glsl_type::components to query total number of components in a type 2010-03-26 14:43:11 -07:00
Ian Romanick
cef3baecf6 Replace remaining use of is_error_type with glsl_type::is_error 2010-03-26 14:41:32 -07:00
Ian Romanick
a6d653dcbb Replace remaining uses of is_numeric_base_type with glsl_type::is_numeric 2010-03-26 14:40:37 -07:00
Ian Romanick
40176e249f Replace is_integer_base_type macro with glsl_type::is_integer method 2010-03-26 14:38:37 -07:00
Ian Romanick
0471e8b089 Make glsl_*_type glsl_type class static data 2010-03-26 14:33:41 -07:00
Ian Romanick
720c88eab9 Add functions to generate constructors for built-in types.
Currently only vector and matrix types are supported.  Structure types will be
added later.
2010-03-25 16:58:45 -07:00
Ian Romanick
1b4f04124a Fix matrix dimensioning
Newb GL mistake: matrices in GL are column-major.  This means that
vector_elements is the number of rows.  Making these changes causes
matrix-08.glsl to pass.
2010-03-25 13:19:13 -07:00
Ian Romanick
252127c379 Add queries to get the glsl_type of a row or column of a matrix 2010-03-25 11:42:45 -07:00
Ian Romanick
532edd9bc4 Remove unused _mesa_glsl_get_vector_type
This function has been completely replaced by glsl_type::get_instance.
2010-03-24 17:47:20 -07:00
Ian Romanick
3209c4e369 Add glsl_type::get_instance method
Gets the singleton corresponding to a particular scalar, vector, or
matrix type.
2010-03-24 17:11:30 -07:00
Ian Romanick
9ff8f3777e Add class-private handles to matrix types in glsl_type 2010-03-24 17:05:09 -07:00
Ian Romanick
bb7e00a1cd Add glsl_type::get_base_type query
Retreives the glsl_type that corresponds to the base type of a numeric scalar /
vector / matrix type.  So vec4 returns float, etc.
2010-03-23 17:31:39 -07:00
Ian Romanick
7aeb6abda7 Add glsl_type::is_numeric and glsl_type::is_boolean queries 2010-03-23 17:31:03 -07:00
Ian Romanick
cb7d066967 Add query to determine whether a type is a sampler 2010-03-23 15:03:46 -07:00
Ian Romanick
8400bc4d35 Add is_error and is_void type queries 2010-03-23 12:28:28 -07:00
Ian Romanick
986b8f7982 Tell emacs that C++ .h files are C++ 2010-03-10 13:58:12 -08:00
Ian Romanick
fce1150156 Convert is_glsl_type_matrix to glsl_type::is_matrix 2010-03-09 15:58:52 -08:00
Ian Romanick
a2dd22fb19 Convert is_glsl_type_vector to glsl_type::is_vector 2010-03-09 15:55:16 -08:00
Ian Romanick
cb36f8aaee Convert is_glsl_type_scalar to glsl_type::is_scalar 2010-03-09 15:51:22 -08:00
Ian Romanick
eccf0bf5f2 Make glsl_type a class
Among other benefits, this cleans up a the hackery invovled in
initializing the union field in builtin_types.h.
2010-03-09 15:49:31 -08:00
Ian Romanick
a87ac255cf Initial commit. lol 2010-02-22 13:19:34 -08:00