}
-glsl_type::glsl_type(const glsl_type *array, unsigned length) :
+glsl_type::glsl_type(void *ctx, const glsl_type *array, unsigned length) :
base_type(GLSL_TYPE_ARRAY),
sampler_dimensionality(0), sampler_shadow(0), sampler_array(0),
sampler_type(0),
* NUL.
*/
const unsigned name_length = strlen(array->name) + 10 + 3;
- char *const n = (char *) malloc(name_length);
+ char *const n = (char *) talloc_size(ctx, name_length);
if (length == 0)
snprintf(n, name_length, "%s[]", array->name);
const glsl_type *
-glsl_type::get_array_instance(const glsl_type *base, unsigned array_size)
+glsl_type::get_array_instance(void *ctx, const glsl_type *base,
+ unsigned array_size)
{
- const glsl_type key(base, array_size);
+ const glsl_type key(ctx, base, array_size);
if (array_types == NULL) {
array_types = hash_table_ctor(64, array_key_hash, array_key_compare);
const glsl_type *t = (glsl_type *) hash_table_find(array_types, & key);
if (t == NULL) {
- t = new glsl_type(base, array_size);
+ t = new glsl_type(ctx, base, array_size);
hash_table_insert(array_types, (void *) t, t);
}
* FINISHME: for now.
*/
const glsl_type *const mat4_array_type =
- glsl_type::get_array_instance(glsl_type::mat4_type, 4);
+ glsl_type::get_array_instance(symtab, glsl_type::mat4_type, 4);
add_variable("gl_TextureMatrix", ir_var_uniform, -1, mat4_array_type,
instructions, symtab);
* FINISHME: at least 8, so hard-code 8 for now.
*/
const glsl_type *const light_source_array_type =
- glsl_type::get_array_instance(symtab->get_type("gl_LightSourceParameters"), 8);
+ glsl_type::get_array_instance(symtab,
+ symtab->get_type("gl_LightSourceParameters"), 8);
add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type,
instructions, symtab);
* FINISHME: for now.
*/
const glsl_type *const vec4_array_type =
- glsl_type::get_array_instance(glsl_type::vec4_type, 4);
+ glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 4);
add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type,
instructions, symtab);
generate_130_vs_variables(exec_list *instructions,
glsl_symbol_table *symtab)
{
+ void *ctx = symtab;
generate_120_vs_variables(instructions, symtab);
for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) {
* FINISHME: the value of GL_MAX_CLIP_DISTANCES.
*/
const glsl_type *const clip_distance_array_type =
- glsl_type::get_array_instance(glsl_type::float_type, 8);
+ glsl_type::get_array_instance(ctx, glsl_type::float_type, 8);
/* FINISHME: gl_ClipDistance needs a real location assigned. */
add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type,
* FINISHME: for now.
*/
const glsl_type *const vec4_array_type =
- glsl_type::get_array_instance(glsl_type::vec4_type, 4);
+ glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 4);
add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type,
instructions, symtab);
* FINISHME: at least 1, so hard-code 1 for now.
*/
const glsl_type *const vec4_array_type =
- glsl_type::get_array_instance(glsl_type::vec4_type, 1);
+ glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 1);
ir_variable *const fd =
add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0,
generate_130_fs_variables(exec_list *instructions,
glsl_symbol_table *symtab)
{
+ void *ctx = symtab;
generate_120_fs_variables(instructions, symtab);
/* FINISHME: The size of this array is implementation dependent based on
* FINISHME: the value of GL_MAX_CLIP_DISTANCES.
*/
const glsl_type *const clip_distance_array_type =
- glsl_type::get_array_instance(glsl_type::float_type, 8);
+ glsl_type::get_array_instance(ctx, glsl_type::float_type, 8);
/* FINISHME: gl_ClipDistance needs a real location assigned. */
add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type,