On 08/07/2018 10:42 PM, Marek Olšák wrote: > From: Marek Olšák <marek.ol...@amd.com> > > --- > src/compiler/glsl/builtin_functions.cpp | 48 ++++++++++++++++++------- > 1 file changed, 35 insertions(+), 13 deletions(-) > > diff --git a/src/compiler/glsl/builtin_functions.cpp > b/src/compiler/glsl/builtin_functions.cpp > index 7119903795f..1370245ff91 100644 > --- a/src/compiler/glsl/builtin_functions.cpp > +++ b/src/compiler/glsl/builtin_functions.cpp > @@ -264,20 +264,32 @@ shader_packing_or_es3(const _mesa_glsl_parse_state > *state) > } > > static bool > shader_packing_or_es3_or_gpu_shader5(const _mesa_glsl_parse_state *state) > { > return state->ARB_shading_language_packing_enable || > state->ARB_gpu_shader5_enable || > state->is_version(400, 300); > } > > +static bool > +gpu_shader4(const _mesa_glsl_parse_state *state) > +{ > + return state->EXT_gpu_shader4_enable; > +} > + > +static bool > +v130_gpu_shader4(const _mesa_glsl_parse_state *state)
The other things like this use "or" in the name. Maybe v130_or_gpu_shader4? With that changed, this patch is Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> > +{ > + return state->is_version(130, 300) || state->EXT_gpu_shader4_enable; > +} > + > static bool > gpu_shader5(const _mesa_glsl_parse_state *state) > { > return state->is_version(400, 0) || state->ARB_gpu_shader5_enable; > } > > static bool > gpu_shader5_es(const _mesa_glsl_parse_state *state) > { > return state->is_version(400, 320) || > @@ -786,20 +798,21 @@ private: > B1(pow) > B1(exp) > B1(log) > B1(exp2) > B1(log2) > BA1(sqrt) > BA1(inversesqrt) > BA1(abs) > BA1(sign) > BA1(floor) > + BA1(truncate) > BA1(trunc) > BA1(round) > BA1(roundEven) > BA1(ceil) > BA1(fract) > BA2(mod) > BA1(modf) > BA2(min) > BA2(max) > BA2(clamp) > @@ -1384,23 +1397,23 @@ builtin_builder::create_builtins() > #define FIUD_VEC(NAME) \ > add_function(#NAME, \ > _##NAME(always_available, glsl_type::vec2_type), \ > _##NAME(always_available, glsl_type::vec3_type), \ > _##NAME(always_available, glsl_type::vec4_type), \ > \ > _##NAME(always_available, glsl_type::ivec2_type), \ > _##NAME(always_available, glsl_type::ivec3_type), \ > _##NAME(always_available, glsl_type::ivec4_type), \ > \ > - _##NAME(v130, glsl_type::uvec2_type), \ > - _##NAME(v130, glsl_type::uvec3_type), \ > - _##NAME(v130, glsl_type::uvec4_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec2_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec3_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec4_type), \ > _##NAME(fp64, glsl_type::dvec2_type), \ > _##NAME(fp64, glsl_type::dvec3_type), \ > _##NAME(fp64, glsl_type::dvec4_type), \ > _##NAME(int64, glsl_type::int64_t_type), \ > _##NAME(int64, glsl_type::i64vec2_type), \ > _##NAME(int64, glsl_type::i64vec3_type), \ > _##NAME(int64, glsl_type::i64vec4_type), \ > _##NAME(int64, glsl_type::uint64_t_type), \ > _##NAME(int64, glsl_type::u64vec2_type), \ > _##NAME(int64, glsl_type::u64vec3_type), \ > @@ -1423,23 +1436,23 @@ builtin_builder::create_builtins() > #define FIUBD_VEC(NAME) \ > add_function(#NAME, \ > _##NAME(always_available, glsl_type::vec2_type), \ > _##NAME(always_available, glsl_type::vec3_type), \ > _##NAME(always_available, glsl_type::vec4_type), \ > \ > _##NAME(always_available, glsl_type::ivec2_type), \ > _##NAME(always_available, glsl_type::ivec3_type), \ > _##NAME(always_available, glsl_type::ivec4_type), \ > \ > - _##NAME(v130, glsl_type::uvec2_type), \ > - _##NAME(v130, glsl_type::uvec3_type), \ > - _##NAME(v130, glsl_type::uvec4_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec2_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec3_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec4_type), \ > \ > _##NAME(always_available, glsl_type::bvec2_type), \ > _##NAME(always_available, glsl_type::bvec3_type), \ > _##NAME(always_available, glsl_type::bvec4_type), \ > \ > _##NAME(fp64, glsl_type::dvec2_type), \ > _##NAME(fp64, glsl_type::dvec3_type), \ > _##NAME(fp64, glsl_type::dvec4_type), \ > _##NAME(int64, glsl_type::int64_t_type), \ > _##NAME(int64, glsl_type::i64vec2_type), \ > @@ -1464,28 +1477,28 @@ builtin_builder::create_builtins() > > \ > _##NAME(always_available, glsl_type::int_type, > glsl_type::int_type), \ > _##NAME(always_available, glsl_type::ivec2_type, > glsl_type::int_type), \ > _##NAME(always_available, glsl_type::ivec3_type, > glsl_type::int_type), \ > _##NAME(always_available, glsl_type::ivec4_type, > glsl_type::int_type), \ > > \ > _##NAME(always_available, glsl_type::ivec2_type, > glsl_type::ivec2_type), \ > _##NAME(always_available, glsl_type::ivec3_type, > glsl_type::ivec3_type), \ > _##NAME(always_available, glsl_type::ivec4_type, > glsl_type::ivec4_type), \ > > \ > - _##NAME(v130, glsl_type::uint_type, glsl_type::uint_type), > \ > - _##NAME(v130, glsl_type::uvec2_type, glsl_type::uint_type), > \ > - _##NAME(v130, glsl_type::uvec3_type, glsl_type::uint_type), > \ > - _##NAME(v130, glsl_type::uvec4_type, glsl_type::uint_type), > \ > + _##NAME(v130_gpu_shader4, glsl_type::uint_type, > glsl_type::uint_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec2_type, > glsl_type::uint_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec3_type, > glsl_type::uint_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec4_type, > glsl_type::uint_type), \ > > \ > - _##NAME(v130, glsl_type::uvec2_type, glsl_type::uvec2_type), > \ > - _##NAME(v130, glsl_type::uvec3_type, glsl_type::uvec3_type), > \ > - _##NAME(v130, glsl_type::uvec4_type, glsl_type::uvec4_type), > \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec2_type, > glsl_type::uvec2_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec3_type, > glsl_type::uvec3_type), \ > + _##NAME(v130_gpu_shader4, glsl_type::uvec4_type, > glsl_type::uvec4_type), \ > > \ > _##NAME(fp64, glsl_type::double_type, > glsl_type::double_type), \ > _##NAME(fp64, glsl_type::dvec2_type, > glsl_type::double_type), \ > _##NAME(fp64, glsl_type::dvec3_type, > glsl_type::double_type), \ > _##NAME(fp64, glsl_type::dvec4_type, > glsl_type::double_type), \ > _##NAME(fp64, glsl_type::dvec2_type, glsl_type::dvec2_type), > \ > _##NAME(fp64, glsl_type::dvec3_type, glsl_type::dvec3_type), > \ > _##NAME(fp64, glsl_type::dvec4_type, glsl_type::dvec4_type), > \ > \ > _##NAME(int64, glsl_type::int64_t_type, > glsl_type::int64_t_type), \ > @@ -1538,20 +1551,28 @@ builtin_builder::create_builtins() > FD(inversesqrt) > FI64(abs) > FI64(sign) > FD(floor) > FD(trunc) > FD(round) > FD(roundEven) > FD(ceil) > FD(fract) > > + add_function("truncate", > + _truncate(gpu_shader4, glsl_type::float_type), > + _truncate(gpu_shader4, glsl_type::vec2_type), > + _truncate(gpu_shader4, glsl_type::vec3_type), > + _truncate(gpu_shader4, glsl_type::vec4_type), > + NULL); > + > + > add_function("mod", > _mod(always_available, glsl_type::float_type, > glsl_type::float_type), > _mod(always_available, glsl_type::vec2_type, > glsl_type::float_type), > _mod(always_available, glsl_type::vec3_type, > glsl_type::float_type), > _mod(always_available, glsl_type::vec4_type, > glsl_type::float_type), > > _mod(always_available, glsl_type::vec2_type, > glsl_type::vec2_type), > _mod(always_available, glsl_type::vec3_type, > glsl_type::vec3_type), > _mod(always_available, glsl_type::vec4_type, > glsl_type::vec4_type), > > @@ -4066,20 +4087,21 @@ UNOP(log, ir_unop_log, always_available) > UNOP(exp2, ir_unop_exp2, always_available) > UNOP(log2, ir_unop_log2, always_available) > UNOPA(sqrt, ir_unop_sqrt) > UNOPA(inversesqrt, ir_unop_rsq) > > /** @} */ > > UNOPA(abs, ir_unop_abs) > UNOPA(sign, ir_unop_sign) > UNOPA(floor, ir_unop_floor) > +UNOPA(truncate, ir_unop_trunc) > UNOPA(trunc, ir_unop_trunc) > UNOPA(round, ir_unop_round_even) > UNOPA(roundEven, ir_unop_round_even) > UNOPA(ceil, ir_unop_ceil) > UNOPA(fract, ir_unop_fract) > > ir_function_signature * > builtin_builder::_mod(builtin_available_predicate avail, > const glsl_type *x_type, const glsl_type *y_type) > { > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev