glsl: add arithmetic builtin functions for EXT_gpu_shader4
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
7004114102
commit
8dbe23c8c6
|
@ -280,6 +280,18 @@ shader_packing_or_es3_or_gpu_shader5(const _mesa_glsl_parse_state *state)
|
||||||
state->is_version(400, 300);
|
state->is_version(400, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
gpu_shader4(const _mesa_glsl_parse_state *state)
|
||||||
|
{
|
||||||
|
return state->EXT_gpu_shader4_enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
v130_or_gpu_shader4(const _mesa_glsl_parse_state *state)
|
||||||
|
{
|
||||||
|
return state->is_version(130, 300) || state->EXT_gpu_shader4_enable;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
gpu_shader5(const _mesa_glsl_parse_state *state)
|
gpu_shader5(const _mesa_glsl_parse_state *state)
|
||||||
{
|
{
|
||||||
|
@ -874,6 +886,7 @@ private:
|
||||||
BA1(abs)
|
BA1(abs)
|
||||||
BA1(sign)
|
BA1(sign)
|
||||||
BA1(floor)
|
BA1(floor)
|
||||||
|
BA1(truncate)
|
||||||
BA1(trunc)
|
BA1(trunc)
|
||||||
BA1(round)
|
BA1(round)
|
||||||
BA1(roundEven)
|
BA1(roundEven)
|
||||||
|
@ -1488,9 +1501,9 @@ builtin_builder::create_builtins()
|
||||||
_##NAME(always_available, glsl_type::ivec3_type), \
|
_##NAME(always_available, glsl_type::ivec3_type), \
|
||||||
_##NAME(always_available, glsl_type::ivec4_type), \
|
_##NAME(always_available, glsl_type::ivec4_type), \
|
||||||
\
|
\
|
||||||
_##NAME(v130, glsl_type::uvec2_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type), \
|
||||||
_##NAME(v130, glsl_type::uvec3_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type), \
|
||||||
_##NAME(v130, glsl_type::uvec4_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type), \
|
||||||
_##NAME(fp64, glsl_type::dvec2_type), \
|
_##NAME(fp64, glsl_type::dvec2_type), \
|
||||||
_##NAME(fp64, glsl_type::dvec3_type), \
|
_##NAME(fp64, glsl_type::dvec3_type), \
|
||||||
_##NAME(fp64, glsl_type::dvec4_type), \
|
_##NAME(fp64, glsl_type::dvec4_type), \
|
||||||
|
@ -1527,9 +1540,9 @@ builtin_builder::create_builtins()
|
||||||
_##NAME(always_available, glsl_type::ivec3_type), \
|
_##NAME(always_available, glsl_type::ivec3_type), \
|
||||||
_##NAME(always_available, glsl_type::ivec4_type), \
|
_##NAME(always_available, glsl_type::ivec4_type), \
|
||||||
\
|
\
|
||||||
_##NAME(v130, glsl_type::uvec2_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type), \
|
||||||
_##NAME(v130, glsl_type::uvec3_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type), \
|
||||||
_##NAME(v130, glsl_type::uvec4_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type), \
|
||||||
\
|
\
|
||||||
_##NAME(always_available, glsl_type::bvec2_type), \
|
_##NAME(always_available, glsl_type::bvec2_type), \
|
||||||
_##NAME(always_available, glsl_type::bvec3_type), \
|
_##NAME(always_available, glsl_type::bvec3_type), \
|
||||||
|
@ -1568,14 +1581,14 @@ builtin_builder::create_builtins()
|
||||||
_##NAME(always_available, glsl_type::ivec3_type, glsl_type::ivec3_type), \
|
_##NAME(always_available, glsl_type::ivec3_type, glsl_type::ivec3_type), \
|
||||||
_##NAME(always_available, glsl_type::ivec4_type, glsl_type::ivec4_type), \
|
_##NAME(always_available, glsl_type::ivec4_type, glsl_type::ivec4_type), \
|
||||||
\
|
\
|
||||||
_##NAME(v130, glsl_type::uint_type, glsl_type::uint_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uint_type, glsl_type::uint_type), \
|
||||||
_##NAME(v130, glsl_type::uvec2_type, glsl_type::uint_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type, glsl_type::uint_type), \
|
||||||
_##NAME(v130, glsl_type::uvec3_type, glsl_type::uint_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type, glsl_type::uint_type), \
|
||||||
_##NAME(v130, glsl_type::uvec4_type, glsl_type::uint_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type, glsl_type::uint_type), \
|
||||||
\
|
\
|
||||||
_##NAME(v130, glsl_type::uvec2_type, glsl_type::uvec2_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec2_type, glsl_type::uvec2_type), \
|
||||||
_##NAME(v130, glsl_type::uvec3_type, glsl_type::uvec3_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec3_type, glsl_type::uvec3_type), \
|
||||||
_##NAME(v130, glsl_type::uvec4_type, glsl_type::uvec4_type), \
|
_##NAME(v130_or_gpu_shader4, glsl_type::uvec4_type, glsl_type::uvec4_type), \
|
||||||
\
|
\
|
||||||
_##NAME(fp64, glsl_type::double_type, glsl_type::double_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::dvec2_type, glsl_type::double_type), \
|
||||||
|
@ -1642,6 +1655,14 @@ builtin_builder::create_builtins()
|
||||||
FD(ceil)
|
FD(ceil)
|
||||||
FD(fract)
|
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",
|
add_function("mod",
|
||||||
_mod(always_available, glsl_type::float_type, glsl_type::float_type),
|
_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::vec2_type, glsl_type::float_type),
|
||||||
|
@ -4203,6 +4224,7 @@ UNOPA(inversesqrt, ir_unop_rsq)
|
||||||
UNOPA(abs, ir_unop_abs)
|
UNOPA(abs, ir_unop_abs)
|
||||||
UNOPA(sign, ir_unop_sign)
|
UNOPA(sign, ir_unop_sign)
|
||||||
UNOPA(floor, ir_unop_floor)
|
UNOPA(floor, ir_unop_floor)
|
||||||
|
UNOPA(truncate, ir_unop_trunc)
|
||||||
UNOPA(trunc, ir_unop_trunc)
|
UNOPA(trunc, ir_unop_trunc)
|
||||||
UNOPA(round, ir_unop_round_even)
|
UNOPA(round, ir_unop_round_even)
|
||||||
UNOPA(roundEven, ir_unop_round_even)
|
UNOPA(roundEven, ir_unop_round_even)
|
||||||
|
|
Loading…
Reference in New Issue