static void array_test(void *mem_ctx, struct gl_shader_program *prog, unsigned actual_index, const char *name, enum glsl_base_type base_type, unsigned columns, unsigned rows, unsigned array_size, unsigned excess_data_size) { const glsl_type *const element_type = glsl_type::get_instance(base_type, rows, columns); const unsigned red_zone_components = establish_uniform_storage(prog, 3, actual_index, name, element_type, array_size); /* The constant value generated may have more array elements than the * uniform that it initializes. In the real compiler and linker this can * happen when a uniform array is compacted because some of the tail * elements are not used. In this case, the type of the uniform will be * modified, but the initializer will not. */ ir_constant *val; generate_array_data(mem_ctx, base_type, columns, rows, array_size + excess_data_size, val); linker::set_uniform_initializer(mem_ctx, prog, name, element_type, val); verify_initialization(prog, actual_index); verify_data(prog->UniformStorage[actual_index].storage, array_size, val, red_zone_components); }
static void non_array_test(void *mem_ctx, struct gl_shader_program *prog, unsigned actual_index, const char *name, enum glsl_base_type base_type, unsigned columns, unsigned rows) { const glsl_type *const type = glsl_type::get_instance(base_type, rows, columns); unsigned red_zone_components = establish_uniform_storage(prog, 3, actual_index, name, type, 0); ir_constant *val; generate_data(mem_ctx, base_type, columns, rows, val); linker::set_uniform_initializer(mem_ctx, prog, name, type, val, 0xF00F); verify_data(prog->UniformStorage[actual_index].storage, 0, val, red_zone_components, 0xF00F); }