Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integer signature to floor and ceil #1362

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
<implementation name="IM_floor_vector2_genglsl" nodedef="ND_floor_vector2" target="genglsl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_vector3_genglsl" nodedef="ND_floor_vector3" target="genglsl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_vector4_genglsl" nodedef="ND_floor_vector4" target="genglsl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_integer_genglsl" nodedef="ND_floor_integer" target="genglsl" sourcecode="int(floor({{in}}))" />

<!-- <ceil> -->
<implementation name="IM_ceil_float_genglsl" nodedef="ND_ceil_float" target="genglsl" sourcecode="ceil({{in}})" />
Expand All @@ -318,6 +319,7 @@
<implementation name="IM_ceil_vector2_genglsl" nodedef="ND_ceil_vector2" target="genglsl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_vector3_genglsl" nodedef="ND_ceil_vector3" target="genglsl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_vector4_genglsl" nodedef="ND_ceil_vector4" target="genglsl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_integer_genglsl" nodedef="ND_ceil_integer" target="genglsl" sourcecode="int(ceil({{in}}))" />

<!-- <power> -->
<implementation name="IM_power_float_genglsl" nodedef="ND_power_float" target="genglsl" sourcecode="pow({{in1}}, {{in2}})" />
Expand Down
2 changes: 2 additions & 0 deletions libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
<implementation name="IM_floor_vector2_genmdl" nodedef="ND_floor_vector2" sourcecode="math::floor({{in}})" target="genmdl" />
<implementation name="IM_floor_vector3_genmdl" nodedef="ND_floor_vector3" sourcecode="math::floor({{in}})" target="genmdl" />
<implementation name="IM_floor_vector4_genmdl" nodedef="ND_floor_vector4" sourcecode="math::floor({{in}})" target="genmdl" />
<implementation name="IM_floor_integer_genmdl" nodedef="ND_floor_integer" sourcecode="int(math::floor({{in}}))" target="genmdl" />

<!-- <ceil> -->
<implementation name="IM_ceil_float_genmdl" nodedef="ND_ceil_float" sourcecode="math::ceil({{in}})" target="genmdl" />
Expand All @@ -321,6 +322,7 @@
<implementation name="IM_ceil_vector2_genmdl" nodedef="ND_ceil_vector2" sourcecode="math::ceil({{in}})" target="genmdl" />
<implementation name="IM_ceil_vector3_genmdl" nodedef="ND_ceil_vector3" sourcecode="math::ceil({{in}})" target="genmdl" />
<implementation name="IM_ceil_vector4_genmdl" nodedef="ND_ceil_vector4" sourcecode="math::ceil({{in}})" target="genmdl" />
<implementation name="IM_ceil_integer_genmdl" nodedef="ND_ceil_integer" sourcecode="int(math::ceil({{in}}))" target="genmdl" />

<!-- <power> -->
<implementation name="IM_power_float_genmdl" nodedef="ND_power_float" sourcecode="math::pow({{in1}}, {{in2}})" target="genmdl" />
Expand Down
2 changes: 2 additions & 0 deletions libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
<implementation name="IM_floor_vector2_genmsl" nodedef="ND_floor_vector2" target="genmsl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_vector3_genmsl" nodedef="ND_floor_vector3" target="genmsl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_vector4_genmsl" nodedef="ND_floor_vector4" target="genmsl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_integer_genmsl" nodedef="ND_floor_integer" target="genmsl" sourcecode="int(floor({{in}}))" />

<!-- <ceil> -->
<implementation name="IM_ceil_float_genmsl" nodedef="ND_ceil_float" target="genmsl" sourcecode="ceil({{in}})" />
Expand All @@ -319,6 +320,7 @@
<implementation name="IM_ceil_vector2_genmsl" nodedef="ND_ceil_vector2" target="genmsl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_vector3_genmsl" nodedef="ND_ceil_vector3" target="genmsl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_vector4_genmsl" nodedef="ND_ceil_vector4" target="genmsl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_integer_genmsl" nodedef="ND_ceil_integer" target="genmsl" sourcecode="int(ceil({{in}}))" />

<!-- <power> -->
<implementation name="IM_power_float_genmsl" nodedef="ND_power_float" target="genmsl" sourcecode="pow({{in1}}, {{in2}})" />
Expand Down
2 changes: 2 additions & 0 deletions libraries/stdlib/genosl/stdlib_genosl_impl.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
<implementation name="IM_floor_vector2_genosl" nodedef="ND_floor_vector2" target="genosl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_vector3_genosl" nodedef="ND_floor_vector3" target="genosl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_vector4_genosl" nodedef="ND_floor_vector4" target="genosl" sourcecode="floor({{in}})" />
<implementation name="IM_floor_integer_genosl" nodedef="ND_floor_integer" target="genosl" sourcecode="int(floor({{in}}))" />

<!-- <ceil> -->
<implementation name="IM_ceil_float_genosl" nodedef="ND_ceil_float" target="genosl" sourcecode="ceil({{in}})" />
Expand All @@ -321,6 +322,7 @@
<implementation name="IM_ceil_vector2_genosl" nodedef="ND_ceil_vector2" target="genosl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_vector3_genosl" nodedef="ND_ceil_vector3" target="genosl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_vector4_genosl" nodedef="ND_ceil_vector4" target="genosl" sourcecode="ceil({{in}})" />
<implementation name="IM_ceil_integer_genosl" nodedef="ND_ceil_integer" target="genosl" sourcecode="int(ceil({{in}}))" />

<!-- <power> -->
<implementation name="IM_power_float_genosl" nodedef="ND_power_float" target="genosl" sourcecode="pow({{in1}}, {{in2}})" />
Expand Down
8 changes: 8 additions & 0 deletions libraries/stdlib/stdlib_defs.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,10 @@
<input name="in" type="vector4" value="0.0, 0.0, 0.0, 0.0" />
<output name="out" type="vector4" defaultinput="in" />
</nodedef>
<nodedef name="ND_floor_integer" node="floor" nodegroup="math">
<input name="in" type="float" value="0.0" />
<output name="out" type="integer" defaultinput="in" />
</nodedef>

<!--
Node: <ceil>
Expand Down Expand Up @@ -1728,6 +1732,10 @@
<input name="in" type="vector4" value="0.0, 0.0, 0.0, 0.0" />
<output name="out" type="vector4" defaultinput="in" />
</nodedef>
<nodedef name="ND_ceil_integer" node="ceil" nodegroup="math">
<input name="in" type="float" value="0.0" />
<output name="out" type="integer" defaultinput="in" />
</nodedef>

<!--
Node: <power>
Expand Down
118 changes: 68 additions & 50 deletions resources/Materials/TestSuite/stdlib/math/math.mtlx
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,77 @@
</constant>
<output name="out" type="vector4" nodename="sqrt1" />
</nodegraph>
<nodegraph name="ceil_float_nodegraph">
<ceil name="ceil1" type="float">
<nodegraph name="floor_float_nodegraph">
<floor name="floor1" type="float">
<input name="in" type="float" nodename="constant1" />
</ceil>
</floor>
<constant name="constant1" type="float">
<input name="value" type="float" value="0.5000" />
</constant>
<output name="out" type="float" nodename="ceil1" />
<output name="out" type="float" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_float_nodegraph">
<floor name="floor1" type="float">
<nodegraph name="floor_vector2_nodegraph">
<floor name="floor1" type="vector2">
<input name="in" type="vector2" nodename="constant1" />
</floor>
<constant name="constant1" type="vector2">
<input name="value" type="vector2" value="0.5000, 1.5000" />
</constant>
<output name="out" type="vector2" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_vector3_nodegraph">
<floor name="floor1" type="vector3">
<input name="in" type="vector3" nodename="constant1" />
</floor>
<constant name="constant1" type="vector3">
<input name="value" type="vector3" value="0.5000, 1.5000, 0.0" />
</constant>
<output name="out" type="vector3" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_vector4_nodegraph">
<floor name="floor1" type="vector4">
<input name="in" type="vector4" nodename="constant1" />
</floor>
<constant name="constant1" type="vector4">
<input name="value" type="vector4" value="0.5000, 1.5000, 0.0, 1.0" />
</constant>
<output name="out" type="vector4" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_color3_nodegraph">
<constant name="constant1" type="color3">
<input name="value" type="color3" value="0.5000, 1.5000, 0.0" />
</constant>
<floor name="floor1" type="color3">
<input name="in" type="color3" nodename="constant1" />
</floor>
<output name="out" type="color3" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_color4_nodegraph">
<constant name="constant1" type="color4">
<input name="value" type="color4" value="0.5000, 1.5000, 0.0, 1.0" />
</constant>
<floor name="floor1" type="color4">
<input name="in" type="color4" nodename="constant1" />
</floor>
<output name="out" type="color4" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_integer_nodegraph">
<floor name="floor1" type="integer">
<input name="in" type="float" nodename="constant1" />
</floor>
<constant name="constant1" type="float">
<input name="value" type="float" value="0.5000" />
</constant>
<output name="out" type="float" nodename="floor1" />
<output name="out" type="integer" nodename="floor1" />
</nodegraph>
<nodegraph name="ceil_float_nodegraph">
<ceil name="ceil1" type="float">
<input name="in" type="float" nodename="constant1" />
</ceil>
<constant name="constant1" type="float">
<input name="value" type="float" value="0.5000" />
</constant>
<output name="out" type="float" nodename="ceil1" />
</nodegraph>
<nodegraph name="ceil_vector2_nodegraph">
<ceil name="ceil1" type="vector2">
Expand Down Expand Up @@ -171,50 +225,14 @@
</ceil>
<output name="out" type="color4" nodename="ceil1" />
</nodegraph>
<nodegraph name="floor_vector2_nodegraph">
<floor name="floor1" type="vector2">
<input name="in" type="vector2" nodename="constant1" />
</floor>
<constant name="constant1" type="vector2">
<input name="value" type="vector2" value="0.5000, 1.5000" />
</constant>
<output name="out" type="vector2" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_vector3_nodegraph">
<floor name="floor1" type="vector3">
<input name="in" type="vector3" nodename="constant1" />
</floor>
<constant name="constant1" type="vector3">
<input name="value" type="vector3" value="0.5000, 1.5000, 0.0" />
</constant>
<output name="out" type="vector3" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_vector4_nodegraph">
<floor name="floor1" type="vector4">
<input name="in" type="vector4" nodename="constant1" />
</floor>
<constant name="constant1" type="vector4">
<input name="value" type="vector4" value="0.5000, 1.5000, 0.0, 1.0" />
</constant>
<output name="out" type="vector4" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_color3_nodegraph">
<constant name="constant1" type="color3">
<input name="value" type="color3" value="0.5000, 1.5000, 0.0" />
</constant>
<floor name="floor1" type="color3">
<input name="in" type="color3" nodename="constant1" />
</floor>
<output name="out" type="color3" nodename="floor1" />
</nodegraph>
<nodegraph name="floor_color4_nodegraph">
<constant name="constant1" type="color4">
<input name="value" type="color4" value="0.5000, 1.5000, 0.0, 1.0" />
<nodegraph name="ceil_integer_nodegraph">
<ceil name="ceil1" type="integer">
<input name="in" type="float" nodename="constant1" />
</ceil>
<constant name="constant1" type="float">
<input name="value" type="float" value="0.5000" />
</constant>
<floor name="floor1" type="color4">
<input name="in" type="color4" nodename="constant1" />
</floor>
<output name="out" type="color4" nodename="floor1" />
<output name="out" type="integer" nodename="ceil1" />
</nodegraph>
<nodegraph name="sign_float">
<constant name="constant1" type="float">
Expand Down