diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-11-07 14:36:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-07 14:36:42 +0300 |
commit | f1d4aff85ef9a1edfa595ef800f8c5a69e5a362b (patch) | |
tree | 4470dd4cb9f82b1dc6edfcb7b47db4515eeb8f0c /reference | |
parent | 2c53d306643033f312291e2623f0acf939a61458 (diff) | |
parent | 4561ecddbd8c0569506d968a28acd611cb0d45c8 (diff) |
Merge pull request #1805 from KhronosGroup/fix-1776
Handle Modf/Frexp in more cases.
Diffstat (limited to 'reference')
6 files changed, 142 insertions, 0 deletions
diff --git a/reference/opt/shaders-msl/frag/modf-access-tracking-function.frag b/reference/opt/shaders-msl/frag/modf-access-tracking-function.frag new file mode 100644 index 00000000..612dd4e9 --- /dev/null +++ b/reference/opt/shaders-msl/frag/modf-access-tracking-function.frag @@ -0,0 +1,24 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct main0_out +{ + float4 vo0 [[color(0)]]; + float4 vo1 [[color(1)]]; +}; + +struct main0_in +{ + float4 v [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _25 = modf(in.v, out.vo1); + out.vo0 = _25; + return out; +} + diff --git a/reference/opt/shaders/frag/modf-pointer-function-analysis.frag b/reference/opt/shaders/frag/modf-pointer-function-analysis.frag new file mode 100644 index 00000000..07160bbd --- /dev/null +++ b/reference/opt/shaders/frag/modf-pointer-function-analysis.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec4 vo0; +layout(location = 1) out vec4 vo1; + +void main() +{ + vec4 param; + vec4 _59 = modf(v, param); + vo0 = _59; + vo1 = param; + vec4 param_1 = param; + float _65 = modf(v.x, param_1.x); + vo0.x += _65; + vo1.x += param_1.x; +} + diff --git a/reference/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag b/reference/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag new file mode 100644 index 00000000..5ba57b3f --- /dev/null +++ b/reference/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag @@ -0,0 +1,17 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct main0_out +{ + float4 _GLF_color [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float4 _13 = modf(float4(1.0, 0.0, 0.0, 1.0), out._GLF_color); + return out; +} + diff --git a/reference/shaders-msl/frag/modf-access-tracking-function.frag b/reference/shaders-msl/frag/modf-access-tracking-function.frag new file mode 100644 index 00000000..934561e8 --- /dev/null +++ b/reference/shaders-msl/frag/modf-access-tracking-function.frag @@ -0,0 +1,33 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +struct main0_out +{ + float4 vo0 [[color(0)]]; + float4 vo1 [[color(1)]]; +}; + +struct main0_in +{ + float4 v [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 modf_inner(thread float4& v, thread float4& vo1) +{ + float4 _16 = modf(v, vo1); + return _16; +} + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _20 = modf_inner(in.v, out.vo1); + out.vo0 = _20; + return out; +} + diff --git a/reference/shaders-no-opt/frag/modf-non-function-purity-analysis.frag b/reference/shaders-no-opt/frag/modf-non-function-purity-analysis.frag new file mode 100644 index 00000000..3a4e0866 --- /dev/null +++ b/reference/shaders-no-opt/frag/modf-non-function-purity-analysis.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 1) out vec4 vo1; +layout(location = 0) out vec4 vo0; + +vec4 modf_inner() +{ + vec4 _16 = modf(v, vo1); + return _16; +} + +void main() +{ + vec4 _20 = modf_inner(); + vo0 = _20; +} + diff --git a/reference/shaders/frag/modf-pointer-function-analysis.frag b/reference/shaders/frag/modf-pointer-function-analysis.frag new file mode 100644 index 00000000..2ca0050b --- /dev/null +++ b/reference/shaders/frag/modf-pointer-function-analysis.frag @@ -0,0 +1,32 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec4 vo0; +layout(location = 1) out vec4 vo1; + +vec4 modf_inner(out vec4 tmp) +{ + vec4 _20 = modf(v, tmp); + return _20; +} + +float modf_inner_partial(inout vec4 tmp) +{ + float _30 = modf(v.x, tmp.x); + return _30; +} + +void main() +{ + vec4 param; + vec4 _37 = modf_inner(param); + vec4 tmp = param; + vo0 = _37; + vo1 = tmp; + vec4 param_1 = tmp; + float _43 = modf_inner_partial(param_1); + tmp = param_1; + vo0.x += _43; + vo1.x += tmp.x; +} + |