glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, const char *name) : base_type(GLSL_TYPE_STRUCT), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_ms(false), sampler_buffer(false), outputstream_type(GLSL_OUTPUTSTREAM_NONE), sample_count(1), inner_type(0), vector_elements(0), matrix_columns(0), HlslName(nullptr), length(num_fields), patch_length(0) { unsigned int i; init_ralloc_type_ctx(); this->name = ralloc_strdup(this->mem_ctx, name); this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; this->fields.structure[i].name = ralloc_strdup(this->mem_ctx, fields[i].name); this->fields.structure[i].semantic = ralloc_strdup(this->mem_ctx, fields[i].semantic); this->fields.structure[i].centroid = fields[i].centroid; this->fields.structure[i].interpolation = fields[i].interpolation; this->fields.structure[i].geometryinput = fields[i].geometryinput; this->fields.structure[i].patchconstant = fields[i].patchconstant; } }
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, const char *name) : gl_type(0), base_type(GLSL_TYPE_STRUCT), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), interface_packing(0), vector_elements(0), matrix_columns(0), length(num_fields) { unsigned int i; init_ralloc_type_ctx(); assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; this->fields.structure[i].name = ralloc_strdup(this->fields.structure, fields[i].name); this->fields.structure[i].precision = fields[i].precision; this->fields.structure[i].location = fields[i].location; this->fields.structure[i].interpolation = fields[i].interpolation; this->fields.structure[i].centroid = fields[i].centroid; this->fields.structure[i].sample = fields[i].sample; this->fields.structure[i].matrix_layout = fields[i].matrix_layout; } }
glsl_type::glsl_type(enum glsl_outputstream_type output_stream_type, const struct glsl_type* type, const char *name) : base_type(GLSL_TYPE_OUTPUTSTREAM), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_ms(false), sampler_buffer(false), outputstream_type(output_stream_type), sample_count(1), inner_type(type), vector_elements(0), matrix_columns(0), HlslName(nullptr), length(0), patch_length(0) { init_ralloc_type_ctx(); this->name = ralloc_strdup(this->mem_ctx, name); memset(&fields, 0, sizeof(fields)); }
glsl_type::glsl_type(GLenum gl_type, enum glsl_sampler_dim dim, bool shadow, bool array, unsigned type, const char *name) : gl_type(gl_type), base_type(GLSL_TYPE_SAMPLER), sampler_dimensionality(dim), sampler_shadow(shadow), sampler_array(array), sampler_type(type), vector_elements(0), matrix_columns(0), length(0) { init_ralloc_type_ctx(); this->name = ralloc_strdup(this->mem_ctx, name); memset(& fields, 0, sizeof(fields)); }
glsl_type::glsl_type( enum glsl_sampler_dim dim, bool shadow, bool array, bool multisample, int samples, bool is_sampler_buffer, const struct glsl_type* type, const char *name, const char* InHlslName) : base_type(GLSL_TYPE_SAMPLER), sampler_dimensionality(dim), sampler_shadow(shadow), sampler_array(array), sampler_ms(multisample), sampler_buffer(is_sampler_buffer), outputstream_type(GLSL_OUTPUTSTREAM_NONE), sample_count(samples), inner_type(type), vector_elements(0), matrix_columns(0), length(0), patch_length(0) { init_ralloc_type_ctx(); this->name = ralloc_strdup(this->mem_ctx, name); this->HlslName = ralloc_strdup(this->mem_ctx, InHlslName); memset(&fields, 0, sizeof(fields)); }
glsl_type::glsl_type(glsl_base_type base_type, unsigned vector_elements, unsigned matrix_columns, const char *name, const char* InHlslName) : base_type(base_type), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_ms(false), sampler_buffer(false), outputstream_type(GLSL_OUTPUTSTREAM_NONE), sample_count(1), inner_type(0), vector_elements(vector_elements), matrix_columns(matrix_columns), length(0), patch_length(0) { init_ralloc_type_ctx(); this->name = ralloc_strdup(BaseTypesContext, name); this->HlslName = ralloc_strdup(BaseTypesContext, InHlslName); /* Neither dimension is zero or both dimensions are zero. */ check((vector_elements == 0) == (matrix_columns == 0)); memset(&fields, 0, sizeof(fields)); }
glsl_type::glsl_type(GLenum gl_type, glsl_base_type base_type, unsigned vector_elements, unsigned matrix_columns, const char *name) : gl_type(gl_type), base_type(base_type), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), vector_elements(vector_elements), matrix_columns(matrix_columns), length(0) { init_ralloc_type_ctx(); this->name = ralloc_strdup(this->mem_ctx, name); /* Neither dimension is zero or both dimensions are zero. */ assert((vector_elements == 0) == (matrix_columns == 0)); memset(& fields, 0, sizeof(fields)); }
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, const char *name) : base_type(GLSL_TYPE_STRUCT), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), vector_elements(0), matrix_columns(0), length(num_fields) { unsigned int i; init_ralloc_type_ctx(); this->name = ralloc_strdup(this->mem_ctx, name); this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; this->fields.structure[i].name = ralloc_strdup(this->fields.structure, fields[i].name); } }
glsl_type::glsl_type(GLenum gl_type, glsl_base_type base_type, enum glsl_sampler_dim dim, bool shadow, bool array, unsigned type, const char *name) : gl_type(gl_type), base_type(base_type), sampler_dimensionality(dim), sampler_shadow(shadow), sampler_array(array), sampler_type(type), interface_packing(0), length(0) { init_ralloc_type_ctx(); assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); memset(& fields, 0, sizeof(fields)); if (base_type == GLSL_TYPE_SAMPLER) { /* Samplers take no storage whatsoever. */ matrix_columns = vector_elements = 0; } else { matrix_columns = vector_elements = 1; } }
glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, enum glsl_interface_packing packing, const char *name) : gl_type(0), base_type(GLSL_TYPE_INTERFACE), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), interface_packing((unsigned) packing), vector_elements(0), matrix_columns(0), length(num_fields) { unsigned int i; init_ralloc_type_ctx(); assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; this->fields.structure[i].name = ralloc_strdup(this->fields.structure, fields[i].name); this->fields.structure[i].row_major = fields[i].row_major; } }