compiler/types: Flip wrapping of convenience accessors for vector types
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25470>
This commit is contained in:
@@ -543,8 +543,8 @@ glsl_cmat_use_to_string(enum glsl_cmat_use use)
|
||||
}
|
||||
};
|
||||
|
||||
const struct glsl_type *
|
||||
glsl_type::vec(unsigned components, const struct glsl_type *const ts[])
|
||||
static const struct glsl_type *
|
||||
vec(unsigned components, const struct glsl_type *const ts[])
|
||||
{
|
||||
unsigned n = components;
|
||||
|
||||
@@ -554,22 +554,25 @@ glsl_type::vec(unsigned components, const struct glsl_type *const ts[])
|
||||
n = 7;
|
||||
|
||||
if (n == 0 || n > 7)
|
||||
return error_type;
|
||||
return &glsl_type_builtin_error;
|
||||
|
||||
return ts[n - 1];
|
||||
}
|
||||
|
||||
#define VECN(components, sname, vname) \
|
||||
const struct glsl_type * \
|
||||
glsl_type:: vname (unsigned components) \
|
||||
extern "C" const struct glsl_type * \
|
||||
glsl_ ## vname ## _type (unsigned components) \
|
||||
{ \
|
||||
static const struct glsl_type *const ts[] = { \
|
||||
sname ## _type, vname ## 2_type, \
|
||||
vname ## 3_type, vname ## 4_type, \
|
||||
vname ## 5_type, \
|
||||
vname ## 8_type, vname ## 16_type, \
|
||||
&glsl_type_builtin_ ## sname, \
|
||||
&glsl_type_builtin_ ## vname ## 2, \
|
||||
&glsl_type_builtin_ ## vname ## 3, \
|
||||
&glsl_type_builtin_ ## vname ## 4, \
|
||||
&glsl_type_builtin_ ## vname ## 5, \
|
||||
&glsl_type_builtin_ ## vname ## 8, \
|
||||
&glsl_type_builtin_ ## vname ## 16, \
|
||||
}; \
|
||||
return glsl_type::vec(components, ts); \
|
||||
return vec(components, ts); \
|
||||
}
|
||||
|
||||
VECN(components, float, vec)
|
||||
|
@@ -391,7 +391,6 @@ struct glsl_type {
|
||||
* Convenience accessors for vector types (shorter than get_instance()).
|
||||
* @{
|
||||
*/
|
||||
static const glsl_type *vec(unsigned components, const glsl_type *const ts[]);
|
||||
static const glsl_type *vec(unsigned components);
|
||||
static const glsl_type *f16vec(unsigned components);
|
||||
static const glsl_type *dvec(unsigned components);
|
||||
@@ -1342,7 +1341,17 @@ const struct glsl_type *glsl_intN_t_type(unsigned bit_size);
|
||||
const struct glsl_type *glsl_uintN_t_type(unsigned bit_size);
|
||||
|
||||
const struct glsl_type *glsl_vec_type(unsigned components);
|
||||
const struct glsl_type *glsl_f16vec_type(unsigned components);
|
||||
const struct glsl_type *glsl_dvec_type(unsigned components);
|
||||
const struct glsl_type *glsl_ivec_type(unsigned components);
|
||||
const struct glsl_type *glsl_uvec_type(unsigned components);
|
||||
const struct glsl_type *glsl_bvec_type(unsigned components);
|
||||
const struct glsl_type *glsl_i64vec_type(unsigned components);
|
||||
const struct glsl_type *glsl_u64vec_type(unsigned components);
|
||||
const struct glsl_type *glsl_i16vec_type(unsigned components);
|
||||
const struct glsl_type *glsl_u16vec_type(unsigned components);
|
||||
const struct glsl_type *glsl_i8vec_type(unsigned components);
|
||||
const struct glsl_type *glsl_u8vec_type(unsigned components);
|
||||
|
||||
const struct glsl_type *glsl_sampler_type(enum glsl_sampler_dim dim,
|
||||
bool shadow,
|
||||
|
@@ -50,6 +50,19 @@ glsl_type::count_attribute_slots(bool is_gl_vertex_input) const
|
||||
return count_vec4_slots(is_gl_vertex_input, true);
|
||||
}
|
||||
|
||||
inline const glsl_type *glsl_type::vec(unsigned components) { return glsl_vec_type(components); }
|
||||
inline const glsl_type *glsl_type::f16vec(unsigned components) { return glsl_f16vec_type(components); }
|
||||
inline const glsl_type *glsl_type::dvec(unsigned components) { return glsl_dvec_type(components); }
|
||||
inline const glsl_type *glsl_type::ivec(unsigned components) { return glsl_ivec_type(components); }
|
||||
inline const glsl_type *glsl_type::uvec(unsigned components) { return glsl_uvec_type(components); }
|
||||
inline const glsl_type *glsl_type::bvec(unsigned components) { return glsl_bvec_type(components); }
|
||||
inline const glsl_type *glsl_type::i64vec(unsigned components) { return glsl_i64vec_type(components); }
|
||||
inline const glsl_type *glsl_type::u64vec(unsigned components) { return glsl_u64vec_type(components); }
|
||||
inline const glsl_type *glsl_type::i16vec(unsigned components) { return glsl_i16vec_type(components); }
|
||||
inline const glsl_type *glsl_type::u16vec(unsigned components) { return glsl_u16vec_type(components); }
|
||||
inline const glsl_type *glsl_type::i8vec(unsigned components) { return glsl_i8vec_type(components); }
|
||||
inline const glsl_type *glsl_type::u8vec(unsigned components) { return glsl_u8vec_type(components); }
|
||||
|
||||
inline bool
|
||||
glsl_type::is_integer_16() const
|
||||
{
|
||||
|
@@ -307,18 +307,6 @@ glsl_floatN_t_type(unsigned bit_size)
|
||||
}
|
||||
}
|
||||
|
||||
const struct glsl_type *
|
||||
glsl_vec_type(unsigned n)
|
||||
{
|
||||
return glsl_type::vec(n);
|
||||
}
|
||||
|
||||
const struct glsl_type *
|
||||
glsl_dvec_type(unsigned n)
|
||||
{
|
||||
return glsl_type::dvec(n);
|
||||
}
|
||||
|
||||
const struct glsl_type *
|
||||
glsl_vec4_type(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user