[skslc] Generate .hlsl test output files
- The build now generates HLSL output when `skia_compile_sksl_tests` is enabled. - The "blend" and "shared" tests have been enabled for HLSL with the exception of 6 tests that exercise intrinsic inverse hyperbolic functions, which don't have HLSL equivalents. Bug: skia:12691, skia:12352 Change-Id: Ia970f878f75ff58e8e3d47249c2dc2f756c165b4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482778 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Auto-Submit: Arman Uguray <armansito@google.com> Commit-Queue: Arman Uguray <armansito@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
84fecee879
commit
a97a6769b5
8
BUILD.gn
8
BUILD.gn
@ -803,6 +803,12 @@ if (skia_compile_sksl_tests) {
|
||||
lang = "--metal"
|
||||
settings = "--settings"
|
||||
}
|
||||
compile_sksl("hlsl_tests") {
|
||||
sources = sksl_hlsl_tests_sources
|
||||
outExtensions = [ ".hlsl" ]
|
||||
lang = "--hlsl"
|
||||
settings = "--settings"
|
||||
}
|
||||
compile_sksl("skvm_tests") {
|
||||
sources = sksl_skvm_tests_sources
|
||||
outExtensions = [ ".skvm" ]
|
||||
@ -828,6 +834,8 @@ if (skia_compile_sksl_tests) {
|
||||
}
|
||||
group("compile_sksl_metal_tests") {
|
||||
}
|
||||
group("compile_sksl_hlsl_tests") {
|
||||
}
|
||||
group("compile_sksl_skvm_tests") {
|
||||
}
|
||||
group("compile_sksl_spirv_tests") {
|
||||
|
@ -82,6 +82,10 @@ for input, targetDir in pairwise(inputs):
|
||||
worklist.write(input + "\n")
|
||||
worklist.write(target + ".metal\n")
|
||||
worklist.write(settings + "\n\n")
|
||||
elif lang == "--hlsl":
|
||||
worklist.write(input + "\n")
|
||||
worklist.write(target + ".hlsl\n")
|
||||
worklist.write(settings + "\n\n")
|
||||
elif lang == "--spirv":
|
||||
worklist.write(input + "\n")
|
||||
worklist.write(target + ".asm" + extensionForSpirvAsm(ext) + "\n")
|
||||
@ -95,7 +99,7 @@ for input, targetDir in pairwise(inputs):
|
||||
worklist.write(target + ".stage\n")
|
||||
worklist.write(settings + "\n\n")
|
||||
else:
|
||||
sys.exit("### Expected one of: --glsl --metal --spirv --skvm --stage --dsl, got " + lang)
|
||||
sys.exit("### Expected one of: --glsl --metal --hlsl --spirv --skvm --stage --dsl, got " + lang)
|
||||
|
||||
# Compile items one at a time.
|
||||
if not batchCompile:
|
||||
|
@ -281,17 +281,22 @@ sksl_spirv_tests = [
|
||||
"/sksl/errors/UnusedInterfaceBlock.sksl",
|
||||
]
|
||||
|
||||
sksl_shared_tests = [
|
||||
"/sksl/intrinsics/AbsFloat.sksl",
|
||||
"/sksl/intrinsics/AbsInt.sksl",
|
||||
# TODO(skia:12352): HLSL doesn't support inverse hyperbolic functions as intrinsics. These tests are
|
||||
# grouped separately for HLSL tests until there is a reasonable workaround in place.
|
||||
sksl_inverse_hyperbolic_intrinsics_tests = [
|
||||
"/sksl/intrinsics/Acos.sksl",
|
||||
"/sksl/intrinsics/Acosh.sksl",
|
||||
"/sksl/intrinsics/All.sksl",
|
||||
"/sksl/intrinsics/Any.sksl",
|
||||
"/sksl/intrinsics/Asin.sksl",
|
||||
"/sksl/intrinsics/Asinh.sksl",
|
||||
"/sksl/intrinsics/Atan.sksl",
|
||||
"/sksl/intrinsics/Atanh.sksl",
|
||||
]
|
||||
|
||||
sksl_shared_tests = [
|
||||
"/sksl/intrinsics/AbsFloat.sksl",
|
||||
"/sksl/intrinsics/AbsInt.sksl",
|
||||
"/sksl/intrinsics/All.sksl",
|
||||
"/sksl/intrinsics/Any.sksl",
|
||||
"/sksl/intrinsics/BitCount.sksl",
|
||||
"/sksl/intrinsics/Ceil.sksl",
|
||||
"/sksl/intrinsics/ClampFloat.sksl",
|
||||
@ -705,7 +710,8 @@ sksl_rte_error_tests = [
|
||||
# a .glsl output file.
|
||||
sksl_glsl_tests_sources =
|
||||
sksl_error_tests + sksl_glsl_tests + sksl_inliner_tests +
|
||||
sksl_folding_tests + sksl_shared_tests
|
||||
sksl_folding_tests + sksl_shared_tests +
|
||||
sksl_inverse_hyperbolic_intrinsics_tests
|
||||
|
||||
# Tests in sksl_glsl_settings_tests_sources will be compiled twice, once with --settings and once
|
||||
# using --nosettings. In the latter mode, StandaloneSettings is appended to the output filename.
|
||||
@ -714,12 +720,18 @@ sksl_glsl_settings_tests_sources = sksl_blend_tests + sksl_settings_tests
|
||||
# Tests in sksl_metal_tests_sources will be compiled with --settings on, and are expected to
|
||||
# generate a .metal output file.
|
||||
sksl_metal_tests_sources =
|
||||
sksl_metal_tests + sksl_blend_tests + sksl_shared_tests
|
||||
sksl_metal_tests + sksl_blend_tests + sksl_shared_tests +
|
||||
sksl_inverse_hyperbolic_intrinsics_tests
|
||||
|
||||
# Tests in sksl_hlsl_tests_sources will be compiled with --settings on, and are expected to
|
||||
# generate a .hlsl output file.
|
||||
sksl_hlsl_tests_sources = sksl_blend_tests + sksl_shared_tests
|
||||
|
||||
# Tests in sksl_spirv_tests_sources will be compiled with --settings on, and are expected to
|
||||
# generate a .asm.(frag|vert|geom) output file.
|
||||
sksl_spirv_tests_sources =
|
||||
sksl_blend_tests + sksl_shared_tests + sksl_spirv_tests
|
||||
sksl_blend_tests + sksl_shared_tests +
|
||||
sksl_inverse_hyperbolic_intrinsics_tests + sksl_spirv_tests
|
||||
|
||||
## Tests in sksl_skvm_tests_sources will be compiled with --settings on, and are expected to
|
||||
## generate a .skvm output file.
|
||||
|
26
tests/sksl/blend/BlendClear.hlsl
Normal file
26
tests/sksl/blend/BlendClear.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = 0.0f.xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
70
tests/sksl/blend/BlendColor.hlsl
Normal file
70
tests/sksl/blend/BlendColor.hlsl
Normal file
@ -0,0 +1,70 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_src : packoffset(c0);
|
||||
float4 _11_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float3 _blend_set_color_luminance_h3h3hh3(float3 _18, float _19, float3 _20)
|
||||
{
|
||||
float lum = dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _20);
|
||||
float3 result = (lum - dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _18)).xxx + _18;
|
||||
float minComp = min(min(result.x, result.y), result.z);
|
||||
float maxComp = max(max(result.x, result.y), result.z);
|
||||
bool _64 = false;
|
||||
if (minComp < 0.0f)
|
||||
{
|
||||
_64 = lum != minComp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_64 = false;
|
||||
}
|
||||
if (_64)
|
||||
{
|
||||
result = lum.xxx + ((result - lum.xxx) * (lum / (lum - minComp)));
|
||||
}
|
||||
bool _88 = false;
|
||||
if (maxComp > _19)
|
||||
{
|
||||
_88 = maxComp != lum;
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = false;
|
||||
}
|
||||
if (_88)
|
||||
{
|
||||
return lum.xxx + (((result - lum.xxx) * (_19 - lum)) * (1.0f / (maxComp - lum)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float _RESERVED_IDENTIFIER_FIXUP_0_alpha = _11_dst.w * _11_src.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_1_sda = _11_src.xyz * _11_dst.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_2_dsa = _11_dst.xyz * _11_src.w;
|
||||
float3 _142 = _RESERVED_IDENTIFIER_FIXUP_1_sda;
|
||||
float _144 = _RESERVED_IDENTIFIER_FIXUP_0_alpha;
|
||||
float3 _146 = _RESERVED_IDENTIFIER_FIXUP_2_dsa;
|
||||
sk_FragColor = float4((((_blend_set_color_luminance_h3h3hh3(_142, _144, _146) + _11_dst.xyz) - _RESERVED_IDENTIFIER_FIXUP_2_dsa) + _11_src.xyz) - _RESERVED_IDENTIFIER_FIXUP_1_sda, (_11_src.w + _11_dst.w) - _RESERVED_IDENTIFIER_FIXUP_0_alpha);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
52
tests/sksl/blend/BlendColorBurn.hlsl
Normal file
52
tests/sksl/blend/BlendColorBurn.hlsl
Normal file
@ -0,0 +1,52 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_src : packoffset(c0);
|
||||
float4 _11_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float _color_burn_component_hh2h2(float2 _17, float2 _18)
|
||||
{
|
||||
if (_18.y == _18.x)
|
||||
{
|
||||
return ((_17.y * _18.y) + (_17.x * (1.0f - _18.y))) + (_18.x * (1.0f - _17.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_17.x == 0.0f)
|
||||
{
|
||||
return _18.x * (1.0f - _17.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
float delta = max(0.0f, _18.y - (((_18.y - _18.x) * _17.y) / _17.x));
|
||||
return ((delta * _17.y) + (_17.x * (1.0f - _18.y))) + (_18.x * (1.0f - _17.y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _105 = _11_src.xw;
|
||||
float2 _110 = _11_dst.xw;
|
||||
float2 _115 = _11_src.yw;
|
||||
float2 _119 = _11_dst.yw;
|
||||
float2 _124 = _11_src.zw;
|
||||
float2 _128 = _11_dst.zw;
|
||||
sk_FragColor = float4(_color_burn_component_hh2h2(_105, _110), _color_burn_component_hh2h2(_115, _119), _color_burn_component_hh2h2(_124, _128), _11_src.w + ((1.0f - _11_src.w) * _11_dst.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
53
tests/sksl/blend/BlendColorDodge.hlsl
Normal file
53
tests/sksl/blend/BlendColorDodge.hlsl
Normal file
@ -0,0 +1,53 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_src : packoffset(c0);
|
||||
float4 _11_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float _color_dodge_component_hh2h2(float2 _17, float2 _18)
|
||||
{
|
||||
if (_18.x == 0.0f)
|
||||
{
|
||||
return _17.x * (1.0f - _18.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
float delta = _17.y - _17.x;
|
||||
if (delta == 0.0f)
|
||||
{
|
||||
return ((_17.y * _18.y) + (_17.x * (1.0f - _18.y))) + (_18.x * (1.0f - _17.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = min(_18.y, (_18.x * _17.y) / delta);
|
||||
return ((delta * _17.y) + (_17.x * (1.0f - _18.y))) + (_18.x * (1.0f - _17.y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _102 = _11_src.xw;
|
||||
float2 _107 = _11_dst.xw;
|
||||
float2 _112 = _11_src.yw;
|
||||
float2 _116 = _11_dst.yw;
|
||||
float2 _121 = _11_src.zw;
|
||||
float2 _125 = _11_dst.zw;
|
||||
sk_FragColor = float4(_color_dodge_component_hh2h2(_102, _107), _color_dodge_component_hh2h2(_112, _116), _color_dodge_component_hh2h2(_121, _125), _11_src.w + ((1.0f - _11_src.w) * _11_dst.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
29
tests/sksl/blend/BlendDarken.hlsl
Normal file
29
tests/sksl/blend/BlendDarken.hlsl
Normal file
@ -0,0 +1,29 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_0_result = _10_src + (_10_dst * (1.0f - _10_src.w));
|
||||
float3 _33 = min(_RESERVED_IDENTIFIER_FIXUP_0_result.xyz, (_10_src.xyz * (1.0f - _10_dst.w)) + _10_dst.xyz);
|
||||
_RESERVED_IDENTIFIER_FIXUP_0_result = float4(_33.x, _33.y, _33.z, _RESERVED_IDENTIFIER_FIXUP_0_result.w);
|
||||
sk_FragColor = _RESERVED_IDENTIFIER_FIXUP_0_result;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendDifference.hlsl
Normal file
26
tests/sksl/blend/BlendDifference.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = float4((_10_src.xyz + _10_dst.xyz) - (min(_10_src.xyz * _10_dst.w, _10_dst.xyz * _10_src.w) * 2.0f), _10_src.w + ((1.0f - _10_src.w) * _10_dst.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendDst.hlsl
Normal file
26
tests/sksl/blend/BlendDst.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_dst;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendDstAtop.hlsl
Normal file
26
tests/sksl/blend/BlendDstAtop.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = (_10_src * _10_dst.w) + (_10_dst * (1.0f - _10_src.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendDstIn.hlsl
Normal file
26
tests/sksl/blend/BlendDstIn.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_dst * _10_src.w;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendDstOut.hlsl
Normal file
26
tests/sksl/blend/BlendDstOut.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_dst * (1.0f - _10_src.w);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendDstOver.hlsl
Normal file
26
tests/sksl/blend/BlendDstOver.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = (_10_src * (1.0f - _10_dst.w)) + _10_dst;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendExclusion.hlsl
Normal file
26
tests/sksl/blend/BlendExclusion.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = float4((_10_dst.xyz + _10_src.xyz) - ((_10_dst.xyz * 2.0f) * _10_src.xyz), _10_src.w + ((1.0f - _10_src.w) * _10_dst.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
49
tests/sksl/blend/BlendHardLight.hlsl
Normal file
49
tests/sksl/blend/BlendHardLight.hlsl
Normal file
@ -0,0 +1,49 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_src : packoffset(c0);
|
||||
float4 _11_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float _blend_overlay_component_hh2h2(float2 _17, float2 _18)
|
||||
{
|
||||
float _27 = 0.0f;
|
||||
if ((2.0f * _18.x) <= _18.y)
|
||||
{
|
||||
_27 = (2.0f * _17.x) * _18.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_27 = (_17.y * _18.y) - ((2.0f * (_18.y - _18.x)) * (_17.y - _17.x));
|
||||
}
|
||||
return _27;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _68 = _11_dst.xw;
|
||||
float2 _73 = _11_src.xw;
|
||||
float2 _78 = _11_dst.yw;
|
||||
float2 _82 = _11_src.yw;
|
||||
float2 _87 = _11_dst.zw;
|
||||
float2 _91 = _11_src.zw;
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_0_result = float4(_blend_overlay_component_hh2h2(_68, _73), _blend_overlay_component_hh2h2(_78, _82), _blend_overlay_component_hh2h2(_87, _91), _11_dst.w + ((1.0f - _11_dst.w) * _11_src.w));
|
||||
float3 _127 = _RESERVED_IDENTIFIER_FIXUP_0_result.xyz + ((_11_src.xyz * (1.0f - _11_dst.w)) + (_11_dst.xyz * (1.0f - _11_src.w)));
|
||||
_RESERVED_IDENTIFIER_FIXUP_0_result = float4(_127.x, _127.y, _127.z, _RESERVED_IDENTIFIER_FIXUP_0_result.w);
|
||||
sk_FragColor = _RESERVED_IDENTIFIER_FIXUP_0_result;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
137
tests/sksl/blend/BlendHue.hlsl
Normal file
137
tests/sksl/blend/BlendHue.hlsl
Normal file
@ -0,0 +1,137 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _13_src : packoffset(c0);
|
||||
float4 _13_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float3 _blend_set_color_saturation_helper_h3h3h(float3 _113, float _114)
|
||||
{
|
||||
if (_113.x < _113.z)
|
||||
{
|
||||
return float3(0.0f, (_114 * (_113.y - _113.x)) / (_113.z - _113.x), _114);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0f.xxx;
|
||||
}
|
||||
}
|
||||
|
||||
float3 _blend_set_color_saturation_h3h3h3(float3 _141, float3 _142)
|
||||
{
|
||||
float sat = max(max(_142.x, _142.y), _142.z) - min(min(_142.x, _142.y), _142.z);
|
||||
if (_141.x <= _141.y)
|
||||
{
|
||||
if (_141.y <= _141.z)
|
||||
{
|
||||
float3 _179 = _141;
|
||||
float _181 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_179, _181);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_141.x <= _141.z)
|
||||
{
|
||||
float3 _193 = _141.xzy;
|
||||
float _195 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_193, _195).xzy;
|
||||
}
|
||||
else
|
||||
{
|
||||
float3 _200 = _141.zxy;
|
||||
float _202 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_200, _202).yzx;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_141.x <= _141.z)
|
||||
{
|
||||
float3 _215 = _141.yxz;
|
||||
float _217 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_215, _217).yxz;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_141.y <= _141.z)
|
||||
{
|
||||
float3 _230 = _141.yzx;
|
||||
float _232 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_230, _232).zxy;
|
||||
}
|
||||
else
|
||||
{
|
||||
float3 _237 = _141.zyx;
|
||||
float _239 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_237, _239).zyx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float3 _blend_set_color_luminance_h3h3hh3(float3 _20, float _21, float3 _22)
|
||||
{
|
||||
float lum = dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _22);
|
||||
float3 result = (lum - dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _20)).xxx + _20;
|
||||
float minComp = min(min(result.x, result.y), result.z);
|
||||
float maxComp = max(max(result.x, result.y), result.z);
|
||||
bool _66 = false;
|
||||
if (minComp < 0.0f)
|
||||
{
|
||||
_66 = lum != minComp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_66 = false;
|
||||
}
|
||||
if (_66)
|
||||
{
|
||||
result = lum.xxx + ((result - lum.xxx) * (lum / (lum - minComp)));
|
||||
}
|
||||
bool _90 = false;
|
||||
if (maxComp > _21)
|
||||
{
|
||||
_90 = maxComp != lum;
|
||||
}
|
||||
else
|
||||
{
|
||||
_90 = false;
|
||||
}
|
||||
if (_90)
|
||||
{
|
||||
return lum.xxx + (((result - lum.xxx) * (_21 - lum)) * (1.0f / (maxComp - lum)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float _RESERVED_IDENTIFIER_FIXUP_0_alpha = _13_dst.w * _13_src.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_1_sda = _13_src.xyz * _13_dst.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_2_dsa = _13_dst.xyz * _13_src.w;
|
||||
float3 _274 = _RESERVED_IDENTIFIER_FIXUP_1_sda;
|
||||
float3 _276 = _RESERVED_IDENTIFIER_FIXUP_2_dsa;
|
||||
float3 _278 = _blend_set_color_saturation_h3h3h3(_274, _276);
|
||||
float _280 = _RESERVED_IDENTIFIER_FIXUP_0_alpha;
|
||||
float3 _282 = _RESERVED_IDENTIFIER_FIXUP_2_dsa;
|
||||
sk_FragColor = float4((((_blend_set_color_luminance_h3h3hh3(_278, _280, _282) + _13_dst.xyz) - _RESERVED_IDENTIFIER_FIXUP_2_dsa) + _13_src.xyz) - _RESERVED_IDENTIFIER_FIXUP_1_sda, (_13_src.w + _13_dst.w) - _RESERVED_IDENTIFIER_FIXUP_0_alpha);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
29
tests/sksl/blend/BlendLighten.hlsl
Normal file
29
tests/sksl/blend/BlendLighten.hlsl
Normal file
@ -0,0 +1,29 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_0_result = _10_src + (_10_dst * (1.0f - _10_src.w));
|
||||
float3 _33 = max(_RESERVED_IDENTIFIER_FIXUP_0_result.xyz, (_10_src.xyz * (1.0f - _10_dst.w)) + _10_dst.xyz);
|
||||
_RESERVED_IDENTIFIER_FIXUP_0_result = float4(_33.x, _33.y, _33.z, _RESERVED_IDENTIFIER_FIXUP_0_result.w);
|
||||
sk_FragColor = _RESERVED_IDENTIFIER_FIXUP_0_result;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
70
tests/sksl/blend/BlendLuminosity.hlsl
Normal file
70
tests/sksl/blend/BlendLuminosity.hlsl
Normal file
@ -0,0 +1,70 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_src : packoffset(c0);
|
||||
float4 _11_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float3 _blend_set_color_luminance_h3h3hh3(float3 _18, float _19, float3 _20)
|
||||
{
|
||||
float lum = dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _20);
|
||||
float3 result = (lum - dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _18)).xxx + _18;
|
||||
float minComp = min(min(result.x, result.y), result.z);
|
||||
float maxComp = max(max(result.x, result.y), result.z);
|
||||
bool _64 = false;
|
||||
if (minComp < 0.0f)
|
||||
{
|
||||
_64 = lum != minComp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_64 = false;
|
||||
}
|
||||
if (_64)
|
||||
{
|
||||
result = lum.xxx + ((result - lum.xxx) * (lum / (lum - minComp)));
|
||||
}
|
||||
bool _88 = false;
|
||||
if (maxComp > _19)
|
||||
{
|
||||
_88 = maxComp != lum;
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = false;
|
||||
}
|
||||
if (_88)
|
||||
{
|
||||
return lum.xxx + (((result - lum.xxx) * (_19 - lum)) * (1.0f / (maxComp - lum)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float _RESERVED_IDENTIFIER_FIXUP_0_alpha = _11_dst.w * _11_src.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_1_sda = _11_src.xyz * _11_dst.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_2_dsa = _11_dst.xyz * _11_src.w;
|
||||
float3 _142 = _RESERVED_IDENTIFIER_FIXUP_2_dsa;
|
||||
float _144 = _RESERVED_IDENTIFIER_FIXUP_0_alpha;
|
||||
float3 _146 = _RESERVED_IDENTIFIER_FIXUP_1_sda;
|
||||
sk_FragColor = float4((((_blend_set_color_luminance_h3h3hh3(_142, _144, _146) + _11_dst.xyz) - _RESERVED_IDENTIFIER_FIXUP_2_dsa) + _11_src.xyz) - _RESERVED_IDENTIFIER_FIXUP_1_sda, (_11_src.w + _11_dst.w) - _RESERVED_IDENTIFIER_FIXUP_0_alpha);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendModulate.hlsl
Normal file
26
tests/sksl/blend/BlendModulate.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_src * _10_dst;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendMultiply.hlsl
Normal file
26
tests/sksl/blend/BlendMultiply.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = float4(((_10_dst.xyz * (1.0f - _10_src.w)) + (_10_src.xyz * (1.0f - _10_dst.w))) + (_10_src.xyz * _10_dst.xyz), _10_src.w + ((1.0f - _10_src.w) * _10_dst.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
49
tests/sksl/blend/BlendOverlay.hlsl
Normal file
49
tests/sksl/blend/BlendOverlay.hlsl
Normal file
@ -0,0 +1,49 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_src : packoffset(c0);
|
||||
float4 _11_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float _blend_overlay_component_hh2h2(float2 _17, float2 _18)
|
||||
{
|
||||
float _27 = 0.0f;
|
||||
if ((2.0f * _18.x) <= _18.y)
|
||||
{
|
||||
_27 = (2.0f * _17.x) * _18.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_27 = (_17.y * _18.y) - ((2.0f * (_18.y - _18.x)) * (_17.y - _17.x));
|
||||
}
|
||||
return _27;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _68 = _11_src.xw;
|
||||
float2 _73 = _11_dst.xw;
|
||||
float2 _78 = _11_src.yw;
|
||||
float2 _82 = _11_dst.yw;
|
||||
float2 _87 = _11_src.zw;
|
||||
float2 _91 = _11_dst.zw;
|
||||
float4 _RESERVED_IDENTIFIER_FIXUP_0_result = float4(_blend_overlay_component_hh2h2(_68, _73), _blend_overlay_component_hh2h2(_78, _82), _blend_overlay_component_hh2h2(_87, _91), _11_src.w + ((1.0f - _11_src.w) * _11_dst.w));
|
||||
float3 _127 = _RESERVED_IDENTIFIER_FIXUP_0_result.xyz + ((_11_dst.xyz * (1.0f - _11_src.w)) + (_11_src.xyz * (1.0f - _11_dst.w)));
|
||||
_RESERVED_IDENTIFIER_FIXUP_0_result = float4(_127.x, _127.y, _127.z, _RESERVED_IDENTIFIER_FIXUP_0_result.w);
|
||||
sk_FragColor = _RESERVED_IDENTIFIER_FIXUP_0_result;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendPlus.hlsl
Normal file
26
tests/sksl/blend/BlendPlus.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = min(_10_src + _10_dst, 1.0f.xxxx);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
137
tests/sksl/blend/BlendSaturation.hlsl
Normal file
137
tests/sksl/blend/BlendSaturation.hlsl
Normal file
@ -0,0 +1,137 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _13_src : packoffset(c0);
|
||||
float4 _13_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float3 _blend_set_color_saturation_helper_h3h3h(float3 _113, float _114)
|
||||
{
|
||||
if (_113.x < _113.z)
|
||||
{
|
||||
return float3(0.0f, (_114 * (_113.y - _113.x)) / (_113.z - _113.x), _114);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0f.xxx;
|
||||
}
|
||||
}
|
||||
|
||||
float3 _blend_set_color_saturation_h3h3h3(float3 _141, float3 _142)
|
||||
{
|
||||
float sat = max(max(_142.x, _142.y), _142.z) - min(min(_142.x, _142.y), _142.z);
|
||||
if (_141.x <= _141.y)
|
||||
{
|
||||
if (_141.y <= _141.z)
|
||||
{
|
||||
float3 _179 = _141;
|
||||
float _181 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_179, _181);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_141.x <= _141.z)
|
||||
{
|
||||
float3 _193 = _141.xzy;
|
||||
float _195 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_193, _195).xzy;
|
||||
}
|
||||
else
|
||||
{
|
||||
float3 _200 = _141.zxy;
|
||||
float _202 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_200, _202).yzx;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_141.x <= _141.z)
|
||||
{
|
||||
float3 _215 = _141.yxz;
|
||||
float _217 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_215, _217).yxz;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_141.y <= _141.z)
|
||||
{
|
||||
float3 _230 = _141.yzx;
|
||||
float _232 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_230, _232).zxy;
|
||||
}
|
||||
else
|
||||
{
|
||||
float3 _237 = _141.zyx;
|
||||
float _239 = sat;
|
||||
return _blend_set_color_saturation_helper_h3h3h(_237, _239).zyx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float3 _blend_set_color_luminance_h3h3hh3(float3 _20, float _21, float3 _22)
|
||||
{
|
||||
float lum = dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _22);
|
||||
float3 result = (lum - dot(float3(0.300000011920928955078125f, 0.589999973773956298828125f, 0.10999999940395355224609375f), _20)).xxx + _20;
|
||||
float minComp = min(min(result.x, result.y), result.z);
|
||||
float maxComp = max(max(result.x, result.y), result.z);
|
||||
bool _66 = false;
|
||||
if (minComp < 0.0f)
|
||||
{
|
||||
_66 = lum != minComp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_66 = false;
|
||||
}
|
||||
if (_66)
|
||||
{
|
||||
result = lum.xxx + ((result - lum.xxx) * (lum / (lum - minComp)));
|
||||
}
|
||||
bool _90 = false;
|
||||
if (maxComp > _21)
|
||||
{
|
||||
_90 = maxComp != lum;
|
||||
}
|
||||
else
|
||||
{
|
||||
_90 = false;
|
||||
}
|
||||
if (_90)
|
||||
{
|
||||
return lum.xxx + (((result - lum.xxx) * (_21 - lum)) * (1.0f / (maxComp - lum)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float _RESERVED_IDENTIFIER_FIXUP_0_alpha = _13_dst.w * _13_src.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_1_sda = _13_src.xyz * _13_dst.w;
|
||||
float3 _RESERVED_IDENTIFIER_FIXUP_2_dsa = _13_dst.xyz * _13_src.w;
|
||||
float3 _274 = _RESERVED_IDENTIFIER_FIXUP_2_dsa;
|
||||
float3 _276 = _RESERVED_IDENTIFIER_FIXUP_1_sda;
|
||||
float3 _278 = _blend_set_color_saturation_h3h3h3(_274, _276);
|
||||
float _280 = _RESERVED_IDENTIFIER_FIXUP_0_alpha;
|
||||
float3 _282 = _RESERVED_IDENTIFIER_FIXUP_2_dsa;
|
||||
sk_FragColor = float4((((_blend_set_color_luminance_h3h3hh3(_278, _280, _282) + _13_dst.xyz) - _RESERVED_IDENTIFIER_FIXUP_2_dsa) + _13_src.xyz) - _RESERVED_IDENTIFIER_FIXUP_1_sda, (_13_src.w + _13_dst.w) - _RESERVED_IDENTIFIER_FIXUP_0_alpha);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendScreen.hlsl
Normal file
26
tests/sksl/blend/BlendScreen.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_src + ((1.0f.xxxx - _10_src) * _10_dst);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
64
tests/sksl/blend/BlendSoftLight.hlsl
Normal file
64
tests/sksl/blend/BlendSoftLight.hlsl
Normal file
@ -0,0 +1,64 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_src : packoffset(c0);
|
||||
float4 _11_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float _soft_light_component_hh2h2(float2 _17, float2 _18)
|
||||
{
|
||||
if ((2.0f * _17.x) <= _17.y)
|
||||
{
|
||||
return ((((_18.x * _18.x) * (_17.y - (2.0f * _17.x))) / _18.y) + ((1.0f - _18.y) * _17.x)) + (_18.x * (((-_17.y) + (2.0f * _17.x)) + 1.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((4.0f * _18.x) <= _18.y)
|
||||
{
|
||||
float DSqd = _18.x * _18.x;
|
||||
float DCub = DSqd * _18.x;
|
||||
float DaSqd = _18.y * _18.y;
|
||||
float DaCub = DaSqd * _18.y;
|
||||
return ((((DaSqd * (_17.x - (_18.x * (((3.0f * _17.y) - (6.0f * _17.x)) - 1.0f)))) + (((12.0f * _18.y) * DSqd) * (_17.y - (2.0f * _17.x)))) - ((16.0f * DCub) * (_17.y - (2.0f * _17.x)))) - (DaCub * _17.x)) / DaSqd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (((_18.x * ((_17.y - (2.0f * _17.x)) + 1.0f)) + _17.x) - (sqrt(_18.y * _18.x) * (_17.y - (2.0f * _17.x)))) - (_18.y * _17.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float4 _192 = 0.0f.xxxx;
|
||||
if (_11_dst.w == 0.0f)
|
||||
{
|
||||
_192 = _11_src;
|
||||
}
|
||||
else
|
||||
{
|
||||
float2 _203 = _11_src.xw;
|
||||
float2 _207 = _11_dst.xw;
|
||||
float2 _212 = _11_src.yw;
|
||||
float2 _216 = _11_dst.yw;
|
||||
float2 _221 = _11_src.zw;
|
||||
float2 _225 = _11_dst.zw;
|
||||
_192 = float4(_soft_light_component_hh2h2(_203, _207), _soft_light_component_hh2h2(_212, _216), _soft_light_component_hh2h2(_221, _225), _11_src.w + ((1.0f - _11_src.w) * _11_dst.w));
|
||||
}
|
||||
sk_FragColor = _192;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendSrc.hlsl
Normal file
26
tests/sksl/blend/BlendSrc.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_src;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendSrcAtop.hlsl
Normal file
26
tests/sksl/blend/BlendSrcAtop.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = (_10_src * _10_dst.w) + (_10_dst * (1.0f - _10_src.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendSrcIn.hlsl
Normal file
26
tests/sksl/blend/BlendSrcIn.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_src * _10_dst.w;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendSrcOut.hlsl
Normal file
26
tests/sksl/blend/BlendSrcOut.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_src * (1.0f - _10_dst.w);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendSrcOver.hlsl
Normal file
26
tests/sksl/blend/BlendSrcOver.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = _10_src + (_10_dst * (1.0f - _10_src.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
26
tests/sksl/blend/BlendXor.hlsl
Normal file
26
tests/sksl/blend/BlendXor.hlsl
Normal file
@ -0,0 +1,26 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_src : packoffset(c0);
|
||||
float4 _10_dst : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor = (_10_src * (1.0f - _10_dst.w)) + (_10_dst * (1.0f - _10_src.w));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/AbsFloat.hlsl
Normal file
109
tests/sksl/intrinsics/AbsFloat.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(1.25f, 0.0f, 0.75f, 2.25f);
|
||||
bool _54 = false;
|
||||
if (abs(_10_testInputs.x) == expected.x)
|
||||
{
|
||||
float2 _45 = abs(_10_testInputs.xy);
|
||||
_54 = all(bool2(_45.x == expected.xy.x, _45.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_54 = false;
|
||||
}
|
||||
bool _67 = false;
|
||||
if (_54)
|
||||
{
|
||||
float3 _57 = abs(_10_testInputs.xyz);
|
||||
_67 = all(bool3(_57.x == expected.xyz.x, _57.y == expected.xyz.y, _57.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_67 = false;
|
||||
}
|
||||
bool _77 = false;
|
||||
if (_67)
|
||||
{
|
||||
float4 _70 = abs(_10_testInputs);
|
||||
_77 = all(bool4(_70.x == expected.x, _70.y == expected.y, _70.z == expected.z, _70.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_77 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_77)
|
||||
{
|
||||
_83 = 1.25f == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _91 = false;
|
||||
if (_83)
|
||||
{
|
||||
_91 = all(bool2(float2(1.25f, 0.0f).x == expected.xy.x, float2(1.25f, 0.0f).y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
bool _99 = false;
|
||||
if (_91)
|
||||
{
|
||||
_99 = all(bool3(float3(1.25f, 0.0f, 0.75f).x == expected.xyz.x, float3(1.25f, 0.0f, 0.75f).y == expected.xyz.y, float3(1.25f, 0.0f, 0.75f).z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_99 = false;
|
||||
}
|
||||
bool _105 = false;
|
||||
if (_99)
|
||||
{
|
||||
_105 = all(bool4(float4(1.25f, 0.0f, 0.75f, 2.25f).x == expected.x, float4(1.25f, 0.0f, 0.75f, 2.25f).y == expected.y, float4(1.25f, 0.0f, 0.75f, 2.25f).z == expected.z, float4(1.25f, 0.0f, 0.75f, 2.25f).w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_105 = false;
|
||||
}
|
||||
float4 _106 = 0.0f.xxxx;
|
||||
if (_105)
|
||||
{
|
||||
_106 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_106 = _10_colorRed;
|
||||
}
|
||||
return _106;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/AbsInt.hlsl
Normal file
109
tests/sksl/intrinsics/AbsInt.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
int4 expected = int4(1, 0, 0, 2);
|
||||
bool _61 = false;
|
||||
if (abs(int(_10_testInputs.x)) == expected.x)
|
||||
{
|
||||
int2 _46 = abs(int2(int(_10_testInputs.xy.x), int(_10_testInputs.xy.y)));
|
||||
_61 = all(bool2(_46.x == expected.xy.x, _46.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_61 = false;
|
||||
}
|
||||
bool _82 = false;
|
||||
if (_61)
|
||||
{
|
||||
int3 _64 = abs(int3(int(_10_testInputs.xyz.x), int(_10_testInputs.xyz.y), int(_10_testInputs.xyz.z)));
|
||||
_82 = all(bool3(_64.x == expected.xyz.x, _64.y == expected.xyz.y, _64.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_82 = false;
|
||||
}
|
||||
bool _101 = false;
|
||||
if (_82)
|
||||
{
|
||||
int4 _85 = abs(int4(int(_10_testInputs.x), int(_10_testInputs.y), int(_10_testInputs.z), int(_10_testInputs.w)));
|
||||
_101 = all(bool4(_85.x == expected.x, _85.y == expected.y, _85.z == expected.z, _85.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_101 = false;
|
||||
}
|
||||
bool _107 = false;
|
||||
if (_101)
|
||||
{
|
||||
_107 = 1 == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_107 = false;
|
||||
}
|
||||
bool _115 = false;
|
||||
if (_107)
|
||||
{
|
||||
_115 = all(bool2(int2(1, 0).x == expected.xy.x, int2(1, 0).y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_115 = false;
|
||||
}
|
||||
bool _123 = false;
|
||||
if (_115)
|
||||
{
|
||||
_123 = all(bool3(int3(1, 0, 0).x == expected.xyz.x, int3(1, 0, 0).y == expected.xyz.y, int3(1, 0, 0).z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_123 = false;
|
||||
}
|
||||
bool _129 = false;
|
||||
if (_123)
|
||||
{
|
||||
_129 = all(bool4(int4(1, 0, 0, 2).x == expected.x, int4(1, 0, 0, 2).y == expected.y, int4(1, 0, 0, 2).z == expected.z, int4(1, 0, 0, 2).w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_129 = false;
|
||||
}
|
||||
float4 _130 = 0.0f.xxxx;
|
||||
if (_129)
|
||||
{
|
||||
_130 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_130 = _10_colorRed;
|
||||
}
|
||||
return _130;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
90
tests/sksl/intrinsics/All.hlsl
Normal file
90
tests/sksl/intrinsics/All.hlsl
Normal file
@ -0,0 +1,90 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputH4 : packoffset(c0);
|
||||
float4 _10_expectedH4 : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool4 inputVal = bool4(_10_inputH4.x != 0.0f, _10_inputH4.y != 0.0f, _10_inputH4.z != 0.0f, _10_inputH4.w != 0.0f);
|
||||
bool4 expected = bool4(_10_expectedH4.x != 0.0f, _10_expectedH4.y != 0.0f, _10_expectedH4.z != 0.0f, _10_expectedH4.w != 0.0f);
|
||||
bool _73 = false;
|
||||
if (all(inputVal.xy) == expected.x)
|
||||
{
|
||||
_73 = all(inputVal.xyz) == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = false;
|
||||
}
|
||||
bool _81 = false;
|
||||
if (_73)
|
||||
{
|
||||
_81 = all(inputVal) == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_81 = false;
|
||||
}
|
||||
bool _86 = false;
|
||||
if (_81)
|
||||
{
|
||||
_86 = expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_86 = false;
|
||||
}
|
||||
bool _92 = false;
|
||||
if (_86)
|
||||
{
|
||||
_92 = false == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_92 = false;
|
||||
}
|
||||
bool _98 = false;
|
||||
if (_92)
|
||||
{
|
||||
_98 = false == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_98 = false;
|
||||
}
|
||||
float4 _99 = 0.0f.xxxx;
|
||||
if (_98)
|
||||
{
|
||||
_99 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_99 = _10_colorRed;
|
||||
}
|
||||
return _99;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
90
tests/sksl/intrinsics/Any.hlsl
Normal file
90
tests/sksl/intrinsics/Any.hlsl
Normal file
@ -0,0 +1,90 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputH4 : packoffset(c0);
|
||||
float4 _10_expectedH4 : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool4 inputVal = bool4(_10_inputH4.x != 0.0f, _10_inputH4.y != 0.0f, _10_inputH4.z != 0.0f, _10_inputH4.w != 0.0f);
|
||||
bool4 expected = bool4(_10_expectedH4.x != 0.0f, _10_expectedH4.y != 0.0f, _10_expectedH4.z != 0.0f, _10_expectedH4.w != 0.0f);
|
||||
bool _73 = false;
|
||||
if (any(inputVal.xy) == expected.x)
|
||||
{
|
||||
_73 = any(inputVal.xyz) == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = false;
|
||||
}
|
||||
bool _81 = false;
|
||||
if (_73)
|
||||
{
|
||||
_81 = any(inputVal) == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_81 = false;
|
||||
}
|
||||
bool _87 = false;
|
||||
if (_81)
|
||||
{
|
||||
_87 = false == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_87 = false;
|
||||
}
|
||||
bool _92 = false;
|
||||
if (_87)
|
||||
{
|
||||
_92 = expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_92 = false;
|
||||
}
|
||||
bool _97 = false;
|
||||
if (_92)
|
||||
{
|
||||
_97 = expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_97 = false;
|
||||
}
|
||||
float4 _98 = 0.0f.xxxx;
|
||||
if (_97)
|
||||
{
|
||||
_98 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_98 = _10_colorRed;
|
||||
}
|
||||
return _98;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
27
tests/sksl/intrinsics/BitCount.hlsl
Normal file
27
tests/sksl/intrinsics/BitCount.hlsl
Normal file
@ -0,0 +1,27 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
int _10_a : packoffset(c0);
|
||||
uint _10_b : packoffset(c0.y);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = float(countbits(_10_a));
|
||||
sk_FragColor.y = float(int(countbits(_10_b)));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Ceil.hlsl
Normal file
109
tests/sksl/intrinsics/Ceil.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(-1.0f, 0.0f, 1.0f, 3.0f);
|
||||
bool _54 = false;
|
||||
if (ceil(_10_testInputs.x) == expected.x)
|
||||
{
|
||||
float2 _45 = ceil(_10_testInputs.xy);
|
||||
_54 = all(bool2(_45.x == expected.xy.x, _45.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_54 = false;
|
||||
}
|
||||
bool _67 = false;
|
||||
if (_54)
|
||||
{
|
||||
float3 _57 = ceil(_10_testInputs.xyz);
|
||||
_67 = all(bool3(_57.x == expected.xyz.x, _57.y == expected.xyz.y, _57.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_67 = false;
|
||||
}
|
||||
bool _77 = false;
|
||||
if (_67)
|
||||
{
|
||||
float4 _70 = ceil(_10_testInputs);
|
||||
_77 = all(bool4(_70.x == expected.x, _70.y == expected.y, _70.z == expected.z, _70.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_77 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_77)
|
||||
{
|
||||
_83 = (-1.0f) == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _91 = false;
|
||||
if (_83)
|
||||
{
|
||||
_91 = all(bool2(float2(-1.0f, 0.0f).x == expected.xy.x, float2(-1.0f, 0.0f).y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
bool _99 = false;
|
||||
if (_91)
|
||||
{
|
||||
_99 = all(bool3(float3(-1.0f, 0.0f, 1.0f).x == expected.xyz.x, float3(-1.0f, 0.0f, 1.0f).y == expected.xyz.y, float3(-1.0f, 0.0f, 1.0f).z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_99 = false;
|
||||
}
|
||||
bool _105 = false;
|
||||
if (_99)
|
||||
{
|
||||
_105 = all(bool4(float4(-1.0f, 0.0f, 1.0f, 3.0f).x == expected.x, float4(-1.0f, 0.0f, 1.0f, 3.0f).y == expected.y, float4(-1.0f, 0.0f, 1.0f, 3.0f).z == expected.z, float4(-1.0f, 0.0f, 1.0f, 3.0f).w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_105 = false;
|
||||
}
|
||||
float4 _106 = 0.0f.xxxx;
|
||||
if (_105)
|
||||
{
|
||||
_106 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_106 = _10_colorRed;
|
||||
}
|
||||
return _106;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
187
tests/sksl/intrinsics/ClampFloat.hlsl
Normal file
187
tests/sksl/intrinsics/ClampFloat.hlsl
Normal file
@ -0,0 +1,187 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedA = float4(-1.0f, 0.0f, 0.75f, 1.0f);
|
||||
float4 clampLow = float4(-1.0f, -2.0f, -2.0f, 1.0f);
|
||||
float4 expectedB = float4(-1.0f, 0.0f, 0.5f, 2.25f);
|
||||
float4 clampHigh = float4(1.0f, 2.0f, 0.5f, 3.0f);
|
||||
bool _67 = false;
|
||||
if (clamp(_10_testInputs.x, -1.0f, 1.0f) == expectedA.x)
|
||||
{
|
||||
float2 _56 = clamp(_10_testInputs.xy, (-1.0f).xx, 1.0f.xx);
|
||||
_67 = all(bool2(_56.x == expectedA.xy.x, _56.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_67 = false;
|
||||
}
|
||||
bool _82 = false;
|
||||
if (_67)
|
||||
{
|
||||
float3 _70 = clamp(_10_testInputs.xyz, (-1.0f).xxx, 1.0f.xxx);
|
||||
_82 = all(bool3(_70.x == expectedA.xyz.x, _70.y == expectedA.xyz.y, _70.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_82 = false;
|
||||
}
|
||||
bool _94 = false;
|
||||
if (_82)
|
||||
{
|
||||
float4 _85 = clamp(_10_testInputs, (-1.0f).xxxx, 1.0f.xxxx);
|
||||
_94 = all(bool4(_85.x == expectedA.x, _85.y == expectedA.y, _85.z == expectedA.z, _85.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_94 = false;
|
||||
}
|
||||
bool _100 = false;
|
||||
if (_94)
|
||||
{
|
||||
_100 = (-1.0f) == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = false;
|
||||
}
|
||||
bool _108 = false;
|
||||
if (_100)
|
||||
{
|
||||
_108 = all(bool2(float2(-1.0f, 0.0f).x == expectedA.xy.x, float2(-1.0f, 0.0f).y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
bool _116 = false;
|
||||
if (_108)
|
||||
{
|
||||
_116 = all(bool3(float3(-1.0f, 0.0f, 0.75f).x == expectedA.xyz.x, float3(-1.0f, 0.0f, 0.75f).y == expectedA.xyz.y, float3(-1.0f, 0.0f, 0.75f).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_116 = false;
|
||||
}
|
||||
bool _122 = false;
|
||||
if (_116)
|
||||
{
|
||||
_122 = all(bool4(float4(-1.0f, 0.0f, 0.75f, 1.0f).x == expectedA.x, float4(-1.0f, 0.0f, 0.75f, 1.0f).y == expectedA.y, float4(-1.0f, 0.0f, 0.75f, 1.0f).z == expectedA.z, float4(-1.0f, 0.0f, 0.75f, 1.0f).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_122 = false;
|
||||
}
|
||||
bool _132 = false;
|
||||
if (_122)
|
||||
{
|
||||
_132 = clamp(_10_testInputs.x, -1.0f, 1.0f) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_132 = false;
|
||||
}
|
||||
bool _145 = false;
|
||||
if (_132)
|
||||
{
|
||||
float2 _135 = clamp(_10_testInputs.xy, float2(-1.0f, -2.0f), float2(1.0f, 2.0f));
|
||||
_145 = all(bool2(_135.x == expectedB.xy.x, _135.y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_145 = false;
|
||||
}
|
||||
bool _158 = false;
|
||||
if (_145)
|
||||
{
|
||||
float3 _148 = clamp(_10_testInputs.xyz, float3(-1.0f, -2.0f, -2.0f), float3(1.0f, 2.0f, 0.5f));
|
||||
_158 = all(bool3(_148.x == expectedB.xyz.x, _148.y == expectedB.xyz.y, _148.z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_158 = false;
|
||||
}
|
||||
bool _169 = false;
|
||||
if (_158)
|
||||
{
|
||||
float4 _161 = clamp(_10_testInputs, clampLow, clampHigh);
|
||||
_169 = all(bool4(_161.x == expectedB.x, _161.y == expectedB.y, _161.z == expectedB.z, _161.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_169 = false;
|
||||
}
|
||||
bool _175 = false;
|
||||
if (_169)
|
||||
{
|
||||
_175 = (-1.0f) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_175 = false;
|
||||
}
|
||||
bool _182 = false;
|
||||
if (_175)
|
||||
{
|
||||
_182 = all(bool2(float2(-1.0f, 0.0f).x == expectedB.xy.x, float2(-1.0f, 0.0f).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_182 = false;
|
||||
}
|
||||
bool _190 = false;
|
||||
if (_182)
|
||||
{
|
||||
_190 = all(bool3(float3(-1.0f, 0.0f, 0.5f).x == expectedB.xyz.x, float3(-1.0f, 0.0f, 0.5f).y == expectedB.xyz.y, float3(-1.0f, 0.0f, 0.5f).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_190 = false;
|
||||
}
|
||||
bool _196 = false;
|
||||
if (_190)
|
||||
{
|
||||
_196 = all(bool4(float4(-1.0f, 0.0f, 0.5f, 2.25f).x == expectedB.x, float4(-1.0f, 0.0f, 0.5f, 2.25f).y == expectedB.y, float4(-1.0f, 0.0f, 0.5f, 2.25f).z == expectedB.z, float4(-1.0f, 0.0f, 0.5f, 2.25f).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_196 = false;
|
||||
}
|
||||
float4 _197 = 0.0f.xxxx;
|
||||
if (_196)
|
||||
{
|
||||
_197 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_197 = _10_colorRed;
|
||||
}
|
||||
return _197;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
189
tests/sksl/intrinsics/ClampInt.hlsl
Normal file
189
tests/sksl/intrinsics/ClampInt.hlsl
Normal file
@ -0,0 +1,189 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 _35 = _10_testInputs * 100.0f;
|
||||
int4 intValues = int4(int(_35.x), int(_35.y), int(_35.z), int(_35.w));
|
||||
int4 expectedA = int4(-100, 0, 75, 100);
|
||||
int4 clampLow = int4(-100, -200, -200, 100);
|
||||
int4 expectedB = int4(-100, 0, 50, 225);
|
||||
int4 clampHigh = int4(100, 200, 50, 300);
|
||||
bool _81 = false;
|
||||
if (clamp(intValues.x, -100, 100) == expectedA.x)
|
||||
{
|
||||
int2 _70 = clamp(intValues.xy, int2(-100, -100), int2(100, 100));
|
||||
_81 = all(bool2(_70.x == expectedA.xy.x, _70.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_81 = false;
|
||||
}
|
||||
bool _95 = false;
|
||||
if (_81)
|
||||
{
|
||||
int3 _84 = clamp(intValues.xyz, int3(-100, -100, -100), int3(100, 100, 100));
|
||||
_95 = all(bool3(_84.x == expectedA.xyz.x, _84.y == expectedA.xyz.y, _84.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_95 = false;
|
||||
}
|
||||
bool _106 = false;
|
||||
if (_95)
|
||||
{
|
||||
int4 _98 = clamp(intValues, int4(-100, -100, -100, -100), int4(100, 100, 100, 100));
|
||||
_106 = all(bool4(_98.x == expectedA.x, _98.y == expectedA.y, _98.z == expectedA.z, _98.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_106 = false;
|
||||
}
|
||||
bool _112 = false;
|
||||
if (_106)
|
||||
{
|
||||
_112 = (-100) == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_112 = false;
|
||||
}
|
||||
bool _120 = false;
|
||||
if (_112)
|
||||
{
|
||||
_120 = all(bool2(int2(-100, 0).x == expectedA.xy.x, int2(-100, 0).y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_120 = false;
|
||||
}
|
||||
bool _128 = false;
|
||||
if (_120)
|
||||
{
|
||||
_128 = all(bool3(int3(-100, 0, 75).x == expectedA.xyz.x, int3(-100, 0, 75).y == expectedA.xyz.y, int3(-100, 0, 75).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_128 = false;
|
||||
}
|
||||
bool _134 = false;
|
||||
if (_128)
|
||||
{
|
||||
_134 = all(bool4(int4(-100, 0, 75, 100).x == expectedA.x, int4(-100, 0, 75, 100).y == expectedA.y, int4(-100, 0, 75, 100).z == expectedA.z, int4(-100, 0, 75, 100).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_134 = false;
|
||||
}
|
||||
bool _143 = false;
|
||||
if (_134)
|
||||
{
|
||||
_143 = clamp(intValues.x, -100, 100) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_143 = false;
|
||||
}
|
||||
bool _155 = false;
|
||||
if (_143)
|
||||
{
|
||||
int2 _146 = clamp(intValues.xy, int2(-100, -200), int2(100, 200));
|
||||
_155 = all(bool2(_146.x == expectedB.xy.x, _146.y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_155 = false;
|
||||
}
|
||||
bool _167 = false;
|
||||
if (_155)
|
||||
{
|
||||
int3 _158 = clamp(intValues.xyz, int3(-100, -200, -200), int3(100, 200, 50));
|
||||
_167 = all(bool3(_158.x == expectedB.xyz.x, _158.y == expectedB.xyz.y, _158.z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_167 = false;
|
||||
}
|
||||
bool _177 = false;
|
||||
if (_167)
|
||||
{
|
||||
int4 _170 = clamp(intValues, clampLow, clampHigh);
|
||||
_177 = all(bool4(_170.x == expectedB.x, _170.y == expectedB.y, _170.z == expectedB.z, _170.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_177 = false;
|
||||
}
|
||||
bool _183 = false;
|
||||
if (_177)
|
||||
{
|
||||
_183 = (-100) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_183 = false;
|
||||
}
|
||||
bool _190 = false;
|
||||
if (_183)
|
||||
{
|
||||
_190 = all(bool2(int2(-100, 0).x == expectedB.xy.x, int2(-100, 0).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_190 = false;
|
||||
}
|
||||
bool _198 = false;
|
||||
if (_190)
|
||||
{
|
||||
_198 = all(bool3(int3(-100, 0, 50).x == expectedB.xyz.x, int3(-100, 0, 50).y == expectedB.xyz.y, int3(-100, 0, 50).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_198 = false;
|
||||
}
|
||||
bool _204 = false;
|
||||
if (_198)
|
||||
{
|
||||
_204 = all(bool4(int4(-100, 0, 50, 225).x == expectedB.x, int4(-100, 0, 50, 225).y == expectedB.y, int4(-100, 0, 50, 225).z == expectedB.z, int4(-100, 0, 50, 225).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_204 = false;
|
||||
}
|
||||
float4 _205 = 0.0f.xxxx;
|
||||
if (_204)
|
||||
{
|
||||
_205 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_205 = _10_colorRed;
|
||||
}
|
||||
return _205;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
189
tests/sksl/intrinsics/ClampUInt.hlsl
Normal file
189
tests/sksl/intrinsics/ClampUInt.hlsl
Normal file
@ -0,0 +1,189 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 _39 = (_10_testInputs * 100.0f) + 200.0f.xxxx;
|
||||
uint4 uintValues = uint4(uint(_39.x), uint(_39.y), uint(_39.z), uint(_39.w));
|
||||
uint4 expectedA = uint4(100u, 200u, 275u, 300u);
|
||||
uint4 clampLow = uint4(100u, 0u, 0u, 300u);
|
||||
uint4 expectedB = uint4(100u, 200u, 250u, 425u);
|
||||
uint4 clampHigh = uint4(300u, 400u, 250u, 500u);
|
||||
bool _86 = false;
|
||||
if (clamp(uintValues.x, 100u, 300u) == expectedA.x)
|
||||
{
|
||||
uint2 _75 = clamp(uintValues.xy, uint2(100u, 100u), uint2(300u, 300u));
|
||||
_86 = all(bool2(_75.x == expectedA.xy.x, _75.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_86 = false;
|
||||
}
|
||||
bool _100 = false;
|
||||
if (_86)
|
||||
{
|
||||
uint3 _89 = clamp(uintValues.xyz, uint3(100u, 100u, 100u), uint3(300u, 300u, 300u));
|
||||
_100 = all(bool3(_89.x == expectedA.xyz.x, _89.y == expectedA.xyz.y, _89.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = false;
|
||||
}
|
||||
bool _111 = false;
|
||||
if (_100)
|
||||
{
|
||||
uint4 _103 = clamp(uintValues, uint4(100u, 100u, 100u, 100u), uint4(300u, 300u, 300u, 300u));
|
||||
_111 = all(bool4(_103.x == expectedA.x, _103.y == expectedA.y, _103.z == expectedA.z, _103.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_111 = false;
|
||||
}
|
||||
bool _117 = false;
|
||||
if (_111)
|
||||
{
|
||||
_117 = 100u == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_117 = false;
|
||||
}
|
||||
bool _125 = false;
|
||||
if (_117)
|
||||
{
|
||||
_125 = all(bool2(uint2(100u, 200u).x == expectedA.xy.x, uint2(100u, 200u).y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_125 = false;
|
||||
}
|
||||
bool _133 = false;
|
||||
if (_125)
|
||||
{
|
||||
_133 = all(bool3(uint3(100u, 200u, 275u).x == expectedA.xyz.x, uint3(100u, 200u, 275u).y == expectedA.xyz.y, uint3(100u, 200u, 275u).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_133 = false;
|
||||
}
|
||||
bool _139 = false;
|
||||
if (_133)
|
||||
{
|
||||
_139 = all(bool4(uint4(100u, 200u, 275u, 300u).x == expectedA.x, uint4(100u, 200u, 275u, 300u).y == expectedA.y, uint4(100u, 200u, 275u, 300u).z == expectedA.z, uint4(100u, 200u, 275u, 300u).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_139 = false;
|
||||
}
|
||||
bool _148 = false;
|
||||
if (_139)
|
||||
{
|
||||
_148 = clamp(uintValues.x, 100u, 300u) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_148 = false;
|
||||
}
|
||||
bool _160 = false;
|
||||
if (_148)
|
||||
{
|
||||
uint2 _151 = clamp(uintValues.xy, uint2(100u, 0u), uint2(300u, 400u));
|
||||
_160 = all(bool2(_151.x == expectedB.xy.x, _151.y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_160 = false;
|
||||
}
|
||||
bool _172 = false;
|
||||
if (_160)
|
||||
{
|
||||
uint3 _163 = clamp(uintValues.xyz, uint3(100u, 0u, 0u), uint3(300u, 400u, 250u));
|
||||
_172 = all(bool3(_163.x == expectedB.xyz.x, _163.y == expectedB.xyz.y, _163.z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_172 = false;
|
||||
}
|
||||
bool _182 = false;
|
||||
if (_172)
|
||||
{
|
||||
uint4 _175 = clamp(uintValues, clampLow, clampHigh);
|
||||
_182 = all(bool4(_175.x == expectedB.x, _175.y == expectedB.y, _175.z == expectedB.z, _175.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_182 = false;
|
||||
}
|
||||
bool _188 = false;
|
||||
if (_182)
|
||||
{
|
||||
_188 = 100u == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_188 = false;
|
||||
}
|
||||
bool _195 = false;
|
||||
if (_188)
|
||||
{
|
||||
_195 = all(bool2(uint2(100u, 200u).x == expectedB.xy.x, uint2(100u, 200u).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_195 = false;
|
||||
}
|
||||
bool _203 = false;
|
||||
if (_195)
|
||||
{
|
||||
_203 = all(bool3(uint3(100u, 200u, 250u).x == expectedB.xyz.x, uint3(100u, 200u, 250u).y == expectedB.xyz.y, uint3(100u, 200u, 250u).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_203 = false;
|
||||
}
|
||||
bool _209 = false;
|
||||
if (_203)
|
||||
{
|
||||
_209 = all(bool4(uint4(100u, 200u, 250u, 425u).x == expectedB.x, uint4(100u, 200u, 250u, 425u).y == expectedB.y, uint4(100u, 200u, 250u, 425u).z == expectedB.z, uint4(100u, 200u, 250u, 425u).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_209 = false;
|
||||
}
|
||||
float4 _210 = 0.0f.xxxx;
|
||||
if (_209)
|
||||
{
|
||||
_210 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_210 = _10_colorRed;
|
||||
}
|
||||
return _210;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Cos.hlsl
Normal file
109
tests/sksl/intrinsics/Cos.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (cos(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = cos(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = cos(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = cos(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_76)
|
||||
{
|
||||
_84 = 1.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _93 = false;
|
||||
if (_84)
|
||||
{
|
||||
_93 = all(bool2(1.0f.xx.x == _10_expected.xy.x, 1.0f.xx.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_93 = false;
|
||||
}
|
||||
bool _102 = false;
|
||||
if (_93)
|
||||
{
|
||||
_102 = all(bool3(1.0f.xxx.x == _10_expected.xyz.x, 1.0f.xxx.y == _10_expected.xyz.y, 1.0f.xxx.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_102 = false;
|
||||
}
|
||||
bool _110 = false;
|
||||
if (_102)
|
||||
{
|
||||
_110 = all(bool4(1.0f.xxxx.x == _10_expected.x, 1.0f.xxxx.y == _10_expected.y, 1.0f.xxxx.z == _10_expected.z, 1.0f.xxxx.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = false;
|
||||
}
|
||||
float4 _111 = 0.0f.xxxx;
|
||||
if (_110)
|
||||
{
|
||||
_111 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_111 = _10_colorRed;
|
||||
}
|
||||
return _111;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Cosh.hlsl
Normal file
109
tests/sksl/intrinsics/Cosh.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (cosh(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = cosh(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = cosh(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = cosh(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_76)
|
||||
{
|
||||
_84 = 1.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _93 = false;
|
||||
if (_84)
|
||||
{
|
||||
_93 = all(bool2(1.0f.xx.x == _10_expected.xy.x, 1.0f.xx.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_93 = false;
|
||||
}
|
||||
bool _102 = false;
|
||||
if (_93)
|
||||
{
|
||||
_102 = all(bool3(1.0f.xxx.x == _10_expected.xyz.x, 1.0f.xxx.y == _10_expected.xyz.y, 1.0f.xxx.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_102 = false;
|
||||
}
|
||||
bool _110 = false;
|
||||
if (_102)
|
||||
{
|
||||
_110 = all(bool4(1.0f.xxxx.x == _10_expected.x, 1.0f.xxxx.y == _10_expected.y, 1.0f.xxxx.z == _10_expected.z, 1.0f.xxxx.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = false;
|
||||
}
|
||||
float4 _111 = 0.0f.xxxx;
|
||||
if (_110)
|
||||
{
|
||||
_111 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_111 = _10_colorRed;
|
||||
}
|
||||
return _111;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
32
tests/sksl/intrinsics/Cross.hlsl
Normal file
32
tests/sksl/intrinsics/Cross.hlsl
Normal file
@ -0,0 +1,32 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float2 _10_ah : packoffset(c0);
|
||||
float2 _10_bh : packoffset(c0.z);
|
||||
float2 _10_af : packoffset(c1);
|
||||
float2 _10_bf : packoffset(c1.z);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = (_10_ah.x * _10_bh.y) - (_10_ah.y * _10_bh.x);
|
||||
sk_FragColor.y = (_10_af.x * _10_bf.y) - (_10_af.y * _10_bf.x);
|
||||
sk_FragColor.z = 12.0f;
|
||||
sk_FragColor = float4(float3(-8.0f, -8.0f, 12.0f).x, float3(-8.0f, -8.0f, 12.0f).y, float3(-8.0f, -8.0f, 12.0f).z, sk_FragColor.w);
|
||||
sk_FragColor = float4(sk_FragColor.x, float3(9.0f, -18.0f, -9.0f).x, float3(9.0f, -18.0f, -9.0f).y, float3(9.0f, -18.0f, -9.0f).z);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
43
tests/sksl/intrinsics/CrossNoInline.hlsl
Normal file
43
tests/sksl/intrinsics/CrossNoInline.hlsl
Normal file
@ -0,0 +1,43 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float2 _12_ah : packoffset(c0);
|
||||
float2 _12_bh : packoffset(c0.z);
|
||||
float2 _12_af : packoffset(c1);
|
||||
float2 _12_bf : packoffset(c1.z);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float cross_hh2h2(float2 _18, float2 _19)
|
||||
{
|
||||
return (_18.x * _19.y) - (_18.y * _19.x);
|
||||
}
|
||||
|
||||
float cross_ff2f2(float2 _32, float2 _33)
|
||||
{
|
||||
return (_32.x * _33.y) - (_32.y * _33.x);
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _54 = _12_ah;
|
||||
float2 _58 = _12_bh;
|
||||
sk_FragColor.x = cross_hh2h2(_54, _58);
|
||||
float2 _65 = _12_af;
|
||||
float2 _69 = _12_bf;
|
||||
sk_FragColor.y = cross_ff2f2(_65, _69);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
103
tests/sksl/intrinsics/DFdx.hlsl
Normal file
103
tests/sksl/intrinsics/DFdx.hlsl
Normal file
@ -0,0 +1,103 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = 0.0f.xxxx;
|
||||
bool _51 = false;
|
||||
if (ddx(_10_testInputs.x) == expected.x)
|
||||
{
|
||||
float2 _42 = ddx(_10_testInputs.xy);
|
||||
_51 = all(bool2(_42.x == expected.xy.x, _42.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _64 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = ddx(_10_testInputs.xyz);
|
||||
_64 = all(bool3(_54.x == expected.xyz.x, _54.y == expected.xyz.y, _54.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_64 = false;
|
||||
}
|
||||
bool _74 = false;
|
||||
if (_64)
|
||||
{
|
||||
float4 _67 = ddx(_10_testInputs);
|
||||
_74 = all(bool4(_67.x == expected.x, _67.y == expected.y, _67.z == expected.z, _67.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_74 = false;
|
||||
}
|
||||
bool _85 = false;
|
||||
if (_74)
|
||||
{
|
||||
float2 _77 = sign(ddx(_24.xx));
|
||||
_85 = all(bool2(_77.x == 1.0f.xx.x, _77.y == 1.0f.xx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_85 = false;
|
||||
}
|
||||
bool _94 = false;
|
||||
if (_85)
|
||||
{
|
||||
float2 _88 = sign(ddx(_24.yy));
|
||||
_94 = all(bool2(_88.x == 0.0f.xx.x, _88.y == 0.0f.xx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_94 = false;
|
||||
}
|
||||
bool _103 = false;
|
||||
if (_94)
|
||||
{
|
||||
float2 _97 = sign(ddx(_24));
|
||||
_103 = all(bool2(_97.x == float2(1.0f, 0.0f).x, _97.y == float2(1.0f, 0.0f).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_103 = false;
|
||||
}
|
||||
float4 _104 = 0.0f.xxxx;
|
||||
if (_103)
|
||||
{
|
||||
_104 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_104 = _10_colorRed;
|
||||
}
|
||||
return _104;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
104
tests/sksl/intrinsics/DFdy.hlsl
Normal file
104
tests/sksl/intrinsics/DFdy.hlsl
Normal file
@ -0,0 +1,104 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _11_testInputs : packoffset(c0);
|
||||
float4 _11_colorGreen : packoffset(c1);
|
||||
float4 _11_colorRed : packoffset(c2);
|
||||
float2 _11_u_skRTFlip : packoffset(c1024);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _25)
|
||||
{
|
||||
float4 expected = 0.0f.xxxx;
|
||||
bool _63 = false;
|
||||
if ((ddy(_11_testInputs.x) * _11_u_skRTFlip.y) == expected.x)
|
||||
{
|
||||
float2 _57 = ddy(_11_testInputs.xy) * _11_u_skRTFlip.y.xx;
|
||||
_63 = all(bool2(_57.x == expected.xy.x, _57.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_63 = false;
|
||||
}
|
||||
bool _81 = false;
|
||||
if (_63)
|
||||
{
|
||||
float3 _75 = ddy(_11_testInputs.xyz) * _11_u_skRTFlip.y.xxx;
|
||||
_81 = all(bool3(_75.x == expected.xyz.x, _75.y == expected.xyz.y, _75.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_81 = false;
|
||||
}
|
||||
bool _96 = false;
|
||||
if (_81)
|
||||
{
|
||||
float4 _91 = ddy(_11_testInputs) * _11_u_skRTFlip.y.xxxx;
|
||||
_96 = all(bool4(_91.x == expected.x, _91.y == expected.y, _91.z == expected.z, _91.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_96 = false;
|
||||
}
|
||||
bool _110 = false;
|
||||
if (_96)
|
||||
{
|
||||
float2 _99 = sign(ddy(_25.xx) * _11_u_skRTFlip.y.xx);
|
||||
_110 = all(bool2(_99.x == 0.0f.xx.x, _99.y == 0.0f.xx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = false;
|
||||
}
|
||||
bool _126 = false;
|
||||
if (_110)
|
||||
{
|
||||
float2 _113 = sign(ddy(_25.yy) * _11_u_skRTFlip.y.xx);
|
||||
_126 = all(bool2(_113.x == 1.0f.xx.x, _113.y == 1.0f.xx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_126 = false;
|
||||
}
|
||||
bool _140 = false;
|
||||
if (_126)
|
||||
{
|
||||
float2 _129 = sign(ddy(_25) * _11_u_skRTFlip.y.xx);
|
||||
_140 = all(bool2(_129.x == float2(0.0f, 1.0f).x, _129.y == float2(0.0f, 1.0f).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_140 = false;
|
||||
}
|
||||
float4 _141 = 0.0f.xxxx;
|
||||
if (_140)
|
||||
{
|
||||
_141 = _11_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_141 = _11_colorRed;
|
||||
}
|
||||
return _141;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _21 = 0.0f.xx;
|
||||
sk_FragColor = main(_21);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Degrees.hlsl
Normal file
109
tests/sksl/intrinsics/Degrees.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (degrees(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = degrees(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = degrees(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = degrees(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_76)
|
||||
{
|
||||
_84 = 90.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _94 = false;
|
||||
if (_84)
|
||||
{
|
||||
_94 = all(bool2(float2(90.0f, 180.0f).x == _10_expected.xy.x, float2(90.0f, 180.0f).y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_94 = false;
|
||||
}
|
||||
bool _104 = false;
|
||||
if (_94)
|
||||
{
|
||||
_104 = all(bool3(float3(90.0f, 180.0f, 270.0f).x == _10_expected.xyz.x, float3(90.0f, 180.0f, 270.0f).y == _10_expected.xyz.y, float3(90.0f, 180.0f, 270.0f).z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_104 = false;
|
||||
}
|
||||
bool _113 = false;
|
||||
if (_104)
|
||||
{
|
||||
_113 = all(bool4(float4(90.0f, 180.0f, 270.0f, 360.0f).x == _10_expected.x, float4(90.0f, 180.0f, 270.0f, 360.0f).y == _10_expected.y, float4(90.0f, 180.0f, 270.0f, 360.0f).z == _10_expected.z, float4(90.0f, 180.0f, 270.0f, 360.0f).w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_113 = false;
|
||||
}
|
||||
float4 _114 = 0.0f.xxxx;
|
||||
if (_113)
|
||||
{
|
||||
_114 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_114 = _10_colorRed;
|
||||
}
|
||||
return _114;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
42
tests/sksl/intrinsics/Determinant.hlsl
Normal file
42
tests/sksl/intrinsics/Determinant.hlsl
Normal file
@ -0,0 +1,42 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
row_major float2x2 _10_testMatrix2x2 : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _25)
|
||||
{
|
||||
float4 _35 = 0.0f.xxxx;
|
||||
if (determinant(_10_testMatrix2x2) == (-2.0f))
|
||||
{
|
||||
_35 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_35 = _10_colorRed;
|
||||
}
|
||||
return _35;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _21 = 0.0f.xx;
|
||||
sk_FragColor = main(_21);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
107
tests/sksl/intrinsics/Distance.hlsl
Normal file
107
tests/sksl/intrinsics/Distance.hlsl
Normal file
@ -0,0 +1,107 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_pos1 : packoffset(c0);
|
||||
float4 _10_pos2 : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(3.0f, 3.0f, 5.0f, 13.0f);
|
||||
bool _59 = false;
|
||||
if (distance(_10_pos1.x, _10_pos2.x) == expected.x)
|
||||
{
|
||||
_59 = distance(_10_pos1.xy, _10_pos2.xy) == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_59 = false;
|
||||
}
|
||||
bool _73 = false;
|
||||
if (_59)
|
||||
{
|
||||
_73 = distance(_10_pos1.xyz, _10_pos2.xyz) == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_73)
|
||||
{
|
||||
_84 = distance(_10_pos1, _10_pos2) == expected.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _90 = false;
|
||||
if (_84)
|
||||
{
|
||||
_90 = 3.0f == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_90 = false;
|
||||
}
|
||||
bool _96 = false;
|
||||
if (_90)
|
||||
{
|
||||
_96 = 3.0f == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_96 = false;
|
||||
}
|
||||
bool _102 = false;
|
||||
if (_96)
|
||||
{
|
||||
_102 = 5.0f == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_102 = false;
|
||||
}
|
||||
bool _108 = false;
|
||||
if (_102)
|
||||
{
|
||||
_108 = 13.0f == expected.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
float4 _109 = 0.0f.xxxx;
|
||||
if (_108)
|
||||
{
|
||||
_109 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = _10_colorRed;
|
||||
}
|
||||
return _109;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
107
tests/sksl/intrinsics/Dot.hlsl
Normal file
107
tests/sksl/intrinsics/Dot.hlsl
Normal file
@ -0,0 +1,107 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputA : packoffset(c0);
|
||||
float4 _10_inputB : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(5.0f, 17.0f, 38.0f, 70.0f);
|
||||
bool _60 = false;
|
||||
if ((_10_inputA.x * _10_inputB.x) == expected.x)
|
||||
{
|
||||
_60 = dot(_10_inputA.xy, _10_inputB.xy) == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_60 = false;
|
||||
}
|
||||
bool _74 = false;
|
||||
if (_60)
|
||||
{
|
||||
_74 = dot(_10_inputA.xyz, _10_inputB.xyz) == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_74 = false;
|
||||
}
|
||||
bool _85 = false;
|
||||
if (_74)
|
||||
{
|
||||
_85 = dot(_10_inputA, _10_inputB) == expected.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
_85 = false;
|
||||
}
|
||||
bool _91 = false;
|
||||
if (_85)
|
||||
{
|
||||
_91 = 5.0f == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
bool _97 = false;
|
||||
if (_91)
|
||||
{
|
||||
_97 = 17.0f == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_97 = false;
|
||||
}
|
||||
bool _103 = false;
|
||||
if (_97)
|
||||
{
|
||||
_103 = 38.0f == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_103 = false;
|
||||
}
|
||||
bool _109 = false;
|
||||
if (_103)
|
||||
{
|
||||
_109 = 70.0f == expected.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = false;
|
||||
}
|
||||
float4 _110 = 0.0f.xxxx;
|
||||
if (_109)
|
||||
{
|
||||
_110 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = _10_colorRed;
|
||||
}
|
||||
return _110;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
54
tests/sksl/intrinsics/Equal.hlsl
Normal file
54
tests/sksl/intrinsics/Equal.hlsl
Normal file
@ -0,0 +1,54 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_a : packoffset(c0);
|
||||
float4 _10_b : packoffset(c1);
|
||||
uint2 _10_c : packoffset(c2);
|
||||
uint2 _10_d : packoffset(c2.z);
|
||||
int3 _10_e : packoffset(c3);
|
||||
int3 _10_f : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool4 expectTTFF = bool4(true, true, false, false);
|
||||
bool4 expectFFTT = bool4(false, false, true, true);
|
||||
bool4 expectTTTT = bool4(true, true, true, true);
|
||||
sk_FragColor.x = float(int(bool4(_10_a.x == _10_b.x, _10_a.y == _10_b.y, _10_a.z == _10_b.z, _10_a.w == _10_b.w).x));
|
||||
sk_FragColor.y = float(int(bool2(_10_c.x == _10_d.x, _10_c.y == _10_d.y).y));
|
||||
sk_FragColor.z = float(int(bool3(_10_e.x == _10_f.x, _10_e.y == _10_f.y, _10_e.z == _10_f.z).z));
|
||||
bool _75 = false;
|
||||
if (any(expectTTFF))
|
||||
{
|
||||
_75 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_75 = any(expectFFTT);
|
||||
}
|
||||
bool _80 = false;
|
||||
if (_75)
|
||||
{
|
||||
_80 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_80 = any(expectTTTT);
|
||||
}
|
||||
sk_FragColor.w = float(int(_80));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Exp.hlsl
Normal file
109
tests/sksl/intrinsics/Exp.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (exp(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = exp(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = exp(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = exp(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_76)
|
||||
{
|
||||
_84 = 1.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _93 = false;
|
||||
if (_84)
|
||||
{
|
||||
_93 = all(bool2(1.0f.xx.x == _10_expected.xy.x, 1.0f.xx.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_93 = false;
|
||||
}
|
||||
bool _102 = false;
|
||||
if (_93)
|
||||
{
|
||||
_102 = all(bool3(1.0f.xxx.x == _10_expected.xyz.x, 1.0f.xxx.y == _10_expected.xyz.y, 1.0f.xxx.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_102 = false;
|
||||
}
|
||||
bool _110 = false;
|
||||
if (_102)
|
||||
{
|
||||
_110 = all(bool4(1.0f.xxxx.x == _10_expected.x, 1.0f.xxxx.y == _10_expected.y, 1.0f.xxxx.z == _10_expected.z, 1.0f.xxxx.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = false;
|
||||
}
|
||||
float4 _111 = 0.0f.xxxx;
|
||||
if (_110)
|
||||
{
|
||||
_111 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_111 = _10_colorRed;
|
||||
}
|
||||
return _111;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Exp2.hlsl
Normal file
109
tests/sksl/intrinsics/Exp2.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (exp2(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = exp2(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = exp2(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = exp2(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_76)
|
||||
{
|
||||
_84 = 1.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _94 = false;
|
||||
if (_84)
|
||||
{
|
||||
_94 = all(bool2(float2(1.0f, 2.0f).x == _10_expected.xy.x, float2(1.0f, 2.0f).y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_94 = false;
|
||||
}
|
||||
bool _104 = false;
|
||||
if (_94)
|
||||
{
|
||||
_104 = all(bool3(float3(1.0f, 2.0f, 4.0f).x == _10_expected.xyz.x, float3(1.0f, 2.0f, 4.0f).y == _10_expected.xyz.y, float3(1.0f, 2.0f, 4.0f).z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_104 = false;
|
||||
}
|
||||
bool _113 = false;
|
||||
if (_104)
|
||||
{
|
||||
_113 = all(bool4(float4(1.0f, 2.0f, 4.0f, 8.0f).x == _10_expected.x, float4(1.0f, 2.0f, 4.0f, 8.0f).y == _10_expected.y, float4(1.0f, 2.0f, 4.0f, 8.0f).z == _10_expected.z, float4(1.0f, 2.0f, 4.0f, 8.0f).w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_113 = false;
|
||||
}
|
||||
float4 _114 = 0.0f.xxxx;
|
||||
if (_113)
|
||||
{
|
||||
_114 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_114 = _10_colorRed;
|
||||
}
|
||||
return _114;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
117
tests/sksl/intrinsics/FaceForward.hlsl
Normal file
117
tests/sksl/intrinsics/FaceForward.hlsl
Normal file
@ -0,0 +1,117 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_N : packoffset(c0);
|
||||
float4 _10_I : packoffset(c1);
|
||||
float4 _10_NRef : packoffset(c2);
|
||||
float4 _10_colorGreen : packoffset(c3);
|
||||
float4 _10_colorRed : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float spvFaceForward(float n, float i, float nref)
|
||||
{
|
||||
return i * nref < 0.0 ? n : -n;
|
||||
}
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedPos = float4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
float4 expectedNeg = float4(-1.0f, -2.0f, -3.0f, -4.0f);
|
||||
bool _75 = false;
|
||||
if (spvFaceForward(_10_N.x, _10_I.x, _10_NRef.x) == expectedNeg.x)
|
||||
{
|
||||
float2 _60 = faceforward(_10_N.xy, _10_I.xy, _10_NRef.xy);
|
||||
_75 = all(bool2(_60.x == expectedNeg.xy.x, _60.y == expectedNeg.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_75 = false;
|
||||
}
|
||||
bool _94 = false;
|
||||
if (_75)
|
||||
{
|
||||
float3 _78 = faceforward(_10_N.xyz, _10_I.xyz, _10_NRef.xyz);
|
||||
_94 = all(bool3(_78.x == expectedPos.xyz.x, _78.y == expectedPos.xyz.y, _78.z == expectedPos.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_94 = false;
|
||||
}
|
||||
bool _108 = false;
|
||||
if (_94)
|
||||
{
|
||||
float4 _97 = faceforward(_10_N, _10_I, _10_NRef);
|
||||
_108 = all(bool4(_97.x == expectedPos.x, _97.y == expectedPos.y, _97.z == expectedPos.z, _97.w == expectedPos.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
bool _114 = false;
|
||||
if (_108)
|
||||
{
|
||||
_114 = (-1.0f) == expectedNeg.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_114 = false;
|
||||
}
|
||||
bool _122 = false;
|
||||
if (_114)
|
||||
{
|
||||
_122 = all(bool2(float2(-1.0f, -2.0f).x == expectedNeg.xy.x, float2(-1.0f, -2.0f).y == expectedNeg.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_122 = false;
|
||||
}
|
||||
bool _130 = false;
|
||||
if (_122)
|
||||
{
|
||||
_130 = all(bool3(float3(1.0f, 2.0f, 3.0f).x == expectedPos.xyz.x, float3(1.0f, 2.0f, 3.0f).y == expectedPos.xyz.y, float3(1.0f, 2.0f, 3.0f).z == expectedPos.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_130 = false;
|
||||
}
|
||||
bool _136 = false;
|
||||
if (_130)
|
||||
{
|
||||
_136 = all(bool4(float4(1.0f, 2.0f, 3.0f, 4.0f).x == expectedPos.x, float4(1.0f, 2.0f, 3.0f, 4.0f).y == expectedPos.y, float4(1.0f, 2.0f, 3.0f, 4.0f).z == expectedPos.z, float4(1.0f, 2.0f, 3.0f, 4.0f).w == expectedPos.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_136 = false;
|
||||
}
|
||||
float4 _137 = 0.0f.xxxx;
|
||||
if (_136)
|
||||
{
|
||||
_137 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_137 = _10_colorRed;
|
||||
}
|
||||
return _137;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
27
tests/sksl/intrinsics/FindLSB.hlsl
Normal file
27
tests/sksl/intrinsics/FindLSB.hlsl
Normal file
@ -0,0 +1,27 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
int _10_a : packoffset(c0);
|
||||
uint _10_b : packoffset(c0.y);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = float(firstbitlow(_10_a));
|
||||
sk_FragColor.y = float(int(firstbitlow(_10_b)));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
27
tests/sksl/intrinsics/FindMSB.hlsl
Normal file
27
tests/sksl/intrinsics/FindMSB.hlsl
Normal file
@ -0,0 +1,27 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
int _10_a : packoffset(c0);
|
||||
uint _10_b : packoffset(c0.y);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = float(firstbithigh(_10_a));
|
||||
sk_FragColor.y = float(int(firstbithigh(_10_b)));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
75
tests/sksl/intrinsics/FloatBitsToInt.hlsl
Normal file
75
tests/sksl/intrinsics/FloatBitsToInt.hlsl
Normal file
@ -0,0 +1,75 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float _10_testInput : packoffset(c0);
|
||||
row_major float2x2 _10_testMatrix2x2 : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c3);
|
||||
float4 _10_colorRed : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _25)
|
||||
{
|
||||
float4 inputVal = float4(_10_testMatrix2x2[0].x, _10_testMatrix2x2[0].y, _10_testMatrix2x2[1].x, _10_testMatrix2x2[1].y) * float4(1.0f, 1.0f, -1.0f, -1.0f);
|
||||
int4 expectedB = int4(1065353216, 1073741824, -1069547520, -1065353216);
|
||||
bool _66 = false;
|
||||
if (asint(inputVal.x) == 1065353216)
|
||||
{
|
||||
int2 _58 = asint(inputVal.xy);
|
||||
_66 = all(bool2(_58.x == int2(1065353216, 1073741824).x, _58.y == int2(1065353216, 1073741824).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_66 = false;
|
||||
}
|
||||
bool _78 = false;
|
||||
if (_66)
|
||||
{
|
||||
int3 _69 = asint(inputVal.xyz);
|
||||
_78 = all(bool3(_69.x == int3(1065353216, 1073741824, -1069547520).x, _69.y == int3(1065353216, 1073741824, -1069547520).y, _69.z == int3(1065353216, 1073741824, -1069547520).z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_78 = false;
|
||||
}
|
||||
bool _87 = false;
|
||||
if (_78)
|
||||
{
|
||||
int4 _81 = asint(inputVal);
|
||||
_87 = all(bool4(_81.x == expectedB.x, _81.y == expectedB.y, _81.z == expectedB.z, _81.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_87 = false;
|
||||
}
|
||||
float4 _88 = 0.0f.xxxx;
|
||||
if (_87)
|
||||
{
|
||||
_88 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = _10_colorRed;
|
||||
}
|
||||
return _88;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _21 = 0.0f.xx;
|
||||
sk_FragColor = main(_21);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
75
tests/sksl/intrinsics/FloatBitsToUint.hlsl
Normal file
75
tests/sksl/intrinsics/FloatBitsToUint.hlsl
Normal file
@ -0,0 +1,75 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float _10_testInput : packoffset(c0);
|
||||
row_major float2x2 _10_testMatrix2x2 : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c3);
|
||||
float4 _10_colorRed : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _25)
|
||||
{
|
||||
float4 inputVal = float4(_10_testMatrix2x2[0].x, _10_testMatrix2x2[0].y, _10_testMatrix2x2[1].x, _10_testMatrix2x2[1].y) * float4(1.0f, 1.0f, -1.0f, -1.0f);
|
||||
uint4 expectedB = uint4(1065353216u, 1073741824u, 3225419776u, 3229614080u);
|
||||
bool _67 = false;
|
||||
if (asuint(inputVal.x) == 1065353216u)
|
||||
{
|
||||
uint2 _59 = asuint(inputVal.xy);
|
||||
_67 = all(bool2(_59.x == uint2(1065353216u, 1073741824u).x, _59.y == uint2(1065353216u, 1073741824u).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_67 = false;
|
||||
}
|
||||
bool _79 = false;
|
||||
if (_67)
|
||||
{
|
||||
uint3 _70 = asuint(inputVal.xyz);
|
||||
_79 = all(bool3(_70.x == uint3(1065353216u, 1073741824u, 3225419776u).x, _70.y == uint3(1065353216u, 1073741824u, 3225419776u).y, _70.z == uint3(1065353216u, 1073741824u, 3225419776u).z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_79 = false;
|
||||
}
|
||||
bool _88 = false;
|
||||
if (_79)
|
||||
{
|
||||
uint4 _82 = asuint(inputVal);
|
||||
_88 = all(bool4(_82.x == expectedB.x, _82.y == expectedB.y, _82.z == expectedB.z, _82.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = false;
|
||||
}
|
||||
float4 _89 = 0.0f.xxxx;
|
||||
if (_88)
|
||||
{
|
||||
_89 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_89 = _10_colorRed;
|
||||
}
|
||||
return _89;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _21 = 0.0f.xx;
|
||||
sk_FragColor = main(_21);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Floor.hlsl
Normal file
109
tests/sksl/intrinsics/Floor.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(-2.0f, 0.0f, 0.0f, 2.0f);
|
||||
bool _53 = false;
|
||||
if (floor(_10_testInputs.x) == expected.x)
|
||||
{
|
||||
float2 _44 = floor(_10_testInputs.xy);
|
||||
_53 = all(bool2(_44.x == expected.xy.x, _44.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_53 = false;
|
||||
}
|
||||
bool _66 = false;
|
||||
if (_53)
|
||||
{
|
||||
float3 _56 = floor(_10_testInputs.xyz);
|
||||
_66 = all(bool3(_56.x == expected.xyz.x, _56.y == expected.xyz.y, _56.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_66 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_66)
|
||||
{
|
||||
float4 _69 = floor(_10_testInputs);
|
||||
_76 = all(bool4(_69.x == expected.x, _69.y == expected.y, _69.z == expected.z, _69.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _82 = false;
|
||||
if (_76)
|
||||
{
|
||||
_82 = (-2.0f) == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_82 = false;
|
||||
}
|
||||
bool _90 = false;
|
||||
if (_82)
|
||||
{
|
||||
_90 = all(bool2(float2(-2.0f, 0.0f).x == expected.xy.x, float2(-2.0f, 0.0f).y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_90 = false;
|
||||
}
|
||||
bool _98 = false;
|
||||
if (_90)
|
||||
{
|
||||
_98 = all(bool3(float3(-2.0f, 0.0f, 0.0f).x == expected.xyz.x, float3(-2.0f, 0.0f, 0.0f).y == expected.xyz.y, float3(-2.0f, 0.0f, 0.0f).z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_98 = false;
|
||||
}
|
||||
bool _104 = false;
|
||||
if (_98)
|
||||
{
|
||||
_104 = all(bool4(float4(-2.0f, 0.0f, 0.0f, 2.0f).x == expected.x, float4(-2.0f, 0.0f, 0.0f, 2.0f).y == expected.y, float4(-2.0f, 0.0f, 0.0f, 2.0f).z == expected.z, float4(-2.0f, 0.0f, 0.0f, 2.0f).w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_104 = false;
|
||||
}
|
||||
float4 _105 = 0.0f.xxxx;
|
||||
if (_104)
|
||||
{
|
||||
_105 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_105 = _10_colorRed;
|
||||
}
|
||||
return _105;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
27
tests/sksl/intrinsics/Fma.hlsl
Normal file
27
tests/sksl/intrinsics/Fma.hlsl
Normal file
@ -0,0 +1,27 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float _10_a : packoffset(c0);
|
||||
float _10_b : packoffset(c0.y);
|
||||
float _10_c : packoffset(c0.z);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = mad(_10_a, _10_b, _10_c);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Fract.hlsl
Normal file
109
tests/sksl/intrinsics/Fract.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (frac(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = frac(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = frac(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = frac(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_76)
|
||||
{
|
||||
_83 = 0.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _93 = false;
|
||||
if (_83)
|
||||
{
|
||||
_93 = all(bool2(float2(0.0f, 0.25f).x == _10_expected.xy.x, float2(0.0f, 0.25f).y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_93 = false;
|
||||
}
|
||||
bool _103 = false;
|
||||
if (_93)
|
||||
{
|
||||
_103 = all(bool3(float3(0.0f, 0.25f, 0.5f).x == _10_expected.xyz.x, float3(0.0f, 0.25f, 0.5f).y == _10_expected.xyz.y, float3(0.0f, 0.25f, 0.5f).z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_103 = false;
|
||||
}
|
||||
bool _112 = false;
|
||||
if (_103)
|
||||
{
|
||||
_112 = all(bool4(float4(0.0f, 0.25f, 0.5f, 0.75f).x == _10_expected.x, float4(0.0f, 0.25f, 0.5f, 0.75f).y == _10_expected.y, float4(0.0f, 0.25f, 0.5f, 0.75f).z == _10_expected.z, float4(0.0f, 0.25f, 0.5f, 0.75f).w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_112 = false;
|
||||
}
|
||||
float4 _113 = 0.0f.xxxx;
|
||||
if (_112)
|
||||
{
|
||||
_113 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_113 = _10_colorRed;
|
||||
}
|
||||
return _113;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
99
tests/sksl/intrinsics/Frexp.hlsl
Normal file
99
tests/sksl/intrinsics/Frexp.hlsl
Normal file
@ -0,0 +1,99 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 value = _10_colorGreen.yyyy * 6.0f;
|
||||
int4 _exp = int4(0, 0, 0, 0);
|
||||
int _48 = 0;
|
||||
float _43 = frexp(value.x, _48);
|
||||
_exp.x = _48;
|
||||
float4 result = 0.0f.xxxx;
|
||||
result.x = _43;
|
||||
bool _63 = false;
|
||||
if (result.x == 0.75f)
|
||||
{
|
||||
_63 = _exp.x == 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
_63 = false;
|
||||
}
|
||||
bool4 ok = bool4(false, false, false, false);
|
||||
ok.x = _63;
|
||||
int2 _69 = int2(0, 0);
|
||||
float2 _66 = frexp(value.xy, _69);
|
||||
_exp = int4(_69.x, _69.y, _exp.z, _exp.w);
|
||||
result = float4(_66.x, _66.y, result.z, result.w);
|
||||
bool _85 = false;
|
||||
if (result.y == 0.75f)
|
||||
{
|
||||
_85 = _exp.y == 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
_85 = false;
|
||||
}
|
||||
ok.y = _85;
|
||||
int3 _92 = int3(0, 0, 0);
|
||||
float3 _88 = frexp(value.xyz, _92);
|
||||
_exp = int4(_92.x, _92.y, _92.z, _exp.w);
|
||||
result = float4(_88.x, _88.y, _88.z, result.w);
|
||||
bool _108 = false;
|
||||
if (result.z == 0.75f)
|
||||
{
|
||||
_108 = _exp.z == 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
ok.z = _108;
|
||||
float4 _111 = frexp(value, _exp);
|
||||
result = _111;
|
||||
bool _121 = false;
|
||||
if (result.w == 0.75f)
|
||||
{
|
||||
_121 = _exp.w == 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
_121 = false;
|
||||
}
|
||||
ok.w = _121;
|
||||
float4 _125 = 0.0f.xxxx;
|
||||
if (all(ok))
|
||||
{
|
||||
_125 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_125 = _10_colorRed;
|
||||
}
|
||||
return _125;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
123
tests/sksl/intrinsics/Fwidth.hlsl
Normal file
123
tests/sksl/intrinsics/Fwidth.hlsl
Normal file
@ -0,0 +1,123 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = 0.0f.xxxx;
|
||||
bool _51 = false;
|
||||
if (ddx(_10_testInputs.x) == expected.x)
|
||||
{
|
||||
float2 _42 = ddx(_10_testInputs.xy);
|
||||
_51 = all(bool2(_42.x == expected.xy.x, _42.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _64 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = ddx(_10_testInputs.xyz);
|
||||
_64 = all(bool3(_54.x == expected.xyz.x, _54.y == expected.xyz.y, _54.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_64 = false;
|
||||
}
|
||||
bool _74 = false;
|
||||
if (_64)
|
||||
{
|
||||
float4 _67 = ddx(_10_testInputs);
|
||||
_74 = all(bool4(_67.x == expected.x, _67.y == expected.y, _67.z == expected.z, _67.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_74 = false;
|
||||
}
|
||||
bool _85 = false;
|
||||
if (_74)
|
||||
{
|
||||
float2 _77 = sign(fwidth(_24.xx));
|
||||
_85 = all(bool2(_77.x == 1.0f.xx.x, _77.y == 1.0f.xx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_85 = false;
|
||||
}
|
||||
bool _96 = false;
|
||||
if (_85)
|
||||
{
|
||||
float2 _88 = sign(fwidth(float2(_24.x, 1.0f)));
|
||||
_96 = all(bool2(_88.x == float2(1.0f, 0.0f).x, _88.y == float2(1.0f, 0.0f).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_96 = false;
|
||||
}
|
||||
bool _105 = false;
|
||||
if (_96)
|
||||
{
|
||||
float2 _99 = sign(fwidth(_24.yy));
|
||||
_105 = all(bool2(_99.x == 1.0f.xx.x, _99.y == 1.0f.xx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_105 = false;
|
||||
}
|
||||
bool _116 = false;
|
||||
if (_105)
|
||||
{
|
||||
float2 _108 = sign(fwidth(float2(0.0f, _24.y)));
|
||||
_116 = all(bool2(_108.x == float2(0.0f, 1.0f).x, _108.y == float2(0.0f, 1.0f).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_116 = false;
|
||||
}
|
||||
bool _124 = false;
|
||||
if (_116)
|
||||
{
|
||||
float2 _119 = sign(fwidth(_24));
|
||||
_124 = all(bool2(_119.x == 1.0f.xx.x, _119.y == 1.0f.xx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_124 = false;
|
||||
}
|
||||
float4 _125 = 0.0f.xxxx;
|
||||
if (_124)
|
||||
{
|
||||
_125 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_125 = _10_colorRed;
|
||||
}
|
||||
return _125;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
44
tests/sksl/intrinsics/GreaterThan.hlsl
Normal file
44
tests/sksl/intrinsics/GreaterThan.hlsl
Normal file
@ -0,0 +1,44 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_a : packoffset(c0);
|
||||
float4 _10_b : packoffset(c1);
|
||||
uint2 _10_c : packoffset(c2);
|
||||
uint2 _10_d : packoffset(c2.z);
|
||||
int3 _10_e : packoffset(c3);
|
||||
int3 _10_f : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool4 expectFFTT = bool4(false, false, true, true);
|
||||
bool4 expectTTFF = bool4(true, true, false, false);
|
||||
sk_FragColor.x = float(int(bool4(_10_a.x > _10_b.x, _10_a.y > _10_b.y, _10_a.z > _10_b.z, _10_a.w > _10_b.w).x));
|
||||
sk_FragColor.y = float(int(bool2(_10_c.x > _10_d.x, _10_c.y > _10_d.y).y));
|
||||
sk_FragColor.z = float(int(bool3(_10_e.x > _10_f.x, _10_e.y > _10_f.y, _10_e.z > _10_f.z).z));
|
||||
bool _73 = false;
|
||||
if (any(expectTTFF))
|
||||
{
|
||||
_73 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = any(expectFFTT);
|
||||
}
|
||||
sk_FragColor.w = float(int(_73));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
44
tests/sksl/intrinsics/GreaterThanEqual.hlsl
Normal file
44
tests/sksl/intrinsics/GreaterThanEqual.hlsl
Normal file
@ -0,0 +1,44 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_a : packoffset(c0);
|
||||
float4 _10_b : packoffset(c1);
|
||||
uint2 _10_c : packoffset(c2);
|
||||
uint2 _10_d : packoffset(c2.z);
|
||||
int3 _10_e : packoffset(c3);
|
||||
int3 _10_f : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool4 expectFFTT = bool4(false, false, true, true);
|
||||
bool4 expectTTFF = bool4(true, true, false, false);
|
||||
sk_FragColor.x = float(int(bool4(_10_a.x >= _10_b.x, _10_a.y >= _10_b.y, _10_a.z >= _10_b.z, _10_a.w >= _10_b.w).x));
|
||||
sk_FragColor.y = float(int(bool2(_10_c.x >= _10_d.x, _10_c.y >= _10_d.y).y));
|
||||
sk_FragColor.z = float(int(bool3(_10_e.x >= _10_f.x, _10_e.y >= _10_f.y, _10_e.z >= _10_f.z).z));
|
||||
bool _73 = false;
|
||||
if (any(expectTTFF))
|
||||
{
|
||||
_73 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = any(expectFFTT);
|
||||
}
|
||||
sk_FragColor.w = float(int(_73));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
75
tests/sksl/intrinsics/IntBitsToFloat.hlsl
Normal file
75
tests/sksl/intrinsics/IntBitsToFloat.hlsl
Normal file
@ -0,0 +1,75 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float _10_testInput : packoffset(c0);
|
||||
row_major float2x2 _10_testMatrix2x2 : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c3);
|
||||
float4 _10_colorRed : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _25)
|
||||
{
|
||||
float4 inputVal = float4(_10_testMatrix2x2[0].x, _10_testMatrix2x2[0].y, _10_testMatrix2x2[1].x, _10_testMatrix2x2[1].y) * float4(1.0f, 1.0f, -1.0f, -1.0f);
|
||||
int4 expectedB = int4(1065353216, 1073741824, -1069547520, -1065353216);
|
||||
bool _69 = false;
|
||||
if (inputVal.x == asfloat(expectedB.x))
|
||||
{
|
||||
float2 _62 = asfloat(expectedB.xy);
|
||||
_69 = all(bool2(inputVal.xy.x == _62.x, inputVal.xy.y == _62.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_69 = false;
|
||||
}
|
||||
bool _82 = false;
|
||||
if (_69)
|
||||
{
|
||||
float3 _75 = asfloat(expectedB.xyz);
|
||||
_82 = all(bool3(inputVal.xyz.x == _75.x, inputVal.xyz.y == _75.y, inputVal.xyz.z == _75.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_82 = false;
|
||||
}
|
||||
bool _91 = false;
|
||||
if (_82)
|
||||
{
|
||||
float4 _86 = asfloat(expectedB);
|
||||
_91 = all(bool4(inputVal.x == _86.x, inputVal.y == _86.y, inputVal.z == _86.z, inputVal.w == _86.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
float4 _92 = 0.0f.xxxx;
|
||||
if (_91)
|
||||
{
|
||||
_92 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_92 = _10_colorRed;
|
||||
}
|
||||
return _92;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _21 = 0.0f.xx;
|
||||
sk_FragColor = main(_21);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
120
tests/sksl/intrinsics/Inverse.hlsl
Normal file
120
tests/sksl/intrinsics/Inverse.hlsl
Normal file
@ -0,0 +1,120 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
// Returns the determinant of a 2x2 matrix.
|
||||
float spvDet2x2(float a1, float a2, float b1, float b2)
|
||||
{
|
||||
return a1 * b2 - b1 * a2;
|
||||
}
|
||||
|
||||
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
|
||||
// adjoint and dividing by the determinant. The contents of the matrix are changed.
|
||||
float3x3 spvInverse(float3x3 m)
|
||||
{
|
||||
float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)
|
||||
|
||||
// Create the transpose of the cofactors, as the classical adjoint of the matrix.
|
||||
adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]);
|
||||
adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]);
|
||||
adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]);
|
||||
|
||||
adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]);
|
||||
adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]);
|
||||
adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]);
|
||||
|
||||
adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]);
|
||||
adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]);
|
||||
adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]);
|
||||
|
||||
// Calculate the determinant as a combination of the cofactors of the first row.
|
||||
float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]);
|
||||
|
||||
// Divide the classical adjoint matrix by the determinant.
|
||||
// If determinant is zero, matrix is not invertable, so leave it unchanged.
|
||||
return (det != 0.0f) ? (adj * (1.0f / det)) : m;
|
||||
}
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float2x2 inv2x2 = float2x2(float2(-2.0f, 1.0f), float2(1.5f, -0.5f));
|
||||
float3x3 inv3x3 = float3x3(float3(-24.0f, 18.0f, 5.0f), float3(20.0f, -15.0f, -4.0f), float3(-5.0f, 4.0f, 1.0f));
|
||||
float4x4 inv4x4 = float4x4(float4(-2.0f, -0.5f, 1.0f, 0.5f), float4(1.0f, 0.5f, 0.0f, -0.5f), float4(-8.0f, -1.0f, 2.0f, 2.0f), float4(3.0f, 0.5f, -1.0f, -0.5f));
|
||||
float2x2 _68 = float2x2(float2(-2.0f, 1.0f), float2(1.5f, -0.5f));
|
||||
float2 _71 = _68[0];
|
||||
float2 _75 = _68[1];
|
||||
bool _102 = false;
|
||||
if (all(bool2(_71.x == inv2x2[0].x, _71.y == inv2x2[0].y)) && all(bool2(_75.x == inv2x2[1].x, _75.y == inv2x2[1].y)))
|
||||
{
|
||||
float3x3 _85 = float3x3(float3(-24.0f, 18.0f, 5.0f), float3(20.0f, -15.0f, -4.0f), float3(-5.0f, 4.0f, 1.0f));
|
||||
float3 _88 = _85[0];
|
||||
float3 _92 = _85[1];
|
||||
float3 _97 = _85[2];
|
||||
_102 = (all(bool3(_88.x == inv3x3[0].x, _88.y == inv3x3[0].y, _88.z == inv3x3[0].z)) && all(bool3(_92.x == inv3x3[1].x, _92.y == inv3x3[1].y, _92.z == inv3x3[1].z))) && all(bool3(_97.x == inv3x3[2].x, _97.y == inv3x3[2].y, _97.z == inv3x3[2].z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_102 = false;
|
||||
}
|
||||
bool _131 = false;
|
||||
if (_102)
|
||||
{
|
||||
float4x4 _109 = float4x4(float4(-2.0f, -0.5f, 1.0f, 0.5f), float4(1.0f, 0.5f, 0.0f, -0.5f), float4(-8.0f, -1.0f, 2.0f, 2.0f), float4(3.0f, 0.5f, -1.0f, -0.5f));
|
||||
float4 _112 = _109[0];
|
||||
float4 _116 = _109[1];
|
||||
float4 _121 = _109[2];
|
||||
float4 _126 = _109[3];
|
||||
_131 = ((all(bool4(_112.x == inv4x4[0].x, _112.y == inv4x4[0].y, _112.z == inv4x4[0].z, _112.w == inv4x4[0].w)) && all(bool4(_116.x == inv4x4[1].x, _116.y == inv4x4[1].y, _116.z == inv4x4[1].z, _116.w == inv4x4[1].w))) && all(bool4(_121.x == inv4x4[2].x, _121.y == inv4x4[2].y, _121.z == inv4x4[2].z, _121.w == inv4x4[2].w))) && all(bool4(_126.x == inv4x4[3].x, _126.y == inv4x4[3].y, _126.z == inv4x4[3].z, _126.w == inv4x4[3].w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_131 = false;
|
||||
}
|
||||
bool _158 = false;
|
||||
if (_131)
|
||||
{
|
||||
float3x3 _134 = spvInverse(float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)));
|
||||
float3 _144 = _134[0];
|
||||
float3 _148 = _134[1];
|
||||
float3 _153 = _134[2];
|
||||
_158 = (any(bool3(_144.x != inv3x3[0].x, _144.y != inv3x3[0].y, _144.z != inv3x3[0].z)) || any(bool3(_148.x != inv3x3[1].x, _148.y != inv3x3[1].y, _148.z != inv3x3[1].z))) || any(bool3(_153.x != inv3x3[2].x, _153.y != inv3x3[2].y, _153.z != inv3x3[2].z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_158 = false;
|
||||
}
|
||||
float4 _159 = 0.0f.xxxx;
|
||||
if (_158)
|
||||
{
|
||||
_159 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_159 = _10_colorRed;
|
||||
}
|
||||
return _159;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
149
tests/sksl/intrinsics/Inversesqrt.hlsl
Normal file
149
tests/sksl/intrinsics/Inversesqrt.hlsl
Normal file
@ -0,0 +1,149 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 negativeVal = float4(-1.0f, -4.0f, -16.0f, -64.0f);
|
||||
bool _58 = false;
|
||||
if (rsqrt(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _48 = rsqrt(_10_inputVal.xy);
|
||||
_58 = all(bool2(_48.x == _10_expected.xy.x, _48.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_58 = false;
|
||||
}
|
||||
bool _72 = false;
|
||||
if (_58)
|
||||
{
|
||||
float3 _61 = rsqrt(_10_inputVal.xyz);
|
||||
_72 = all(bool3(_61.x == _10_expected.xyz.x, _61.y == _10_expected.xyz.y, _61.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_72 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_72)
|
||||
{
|
||||
float4 _75 = rsqrt(_10_inputVal);
|
||||
_83 = all(bool4(_75.x == _10_expected.x, _75.y == _10_expected.y, _75.z == _10_expected.z, _75.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _91 = false;
|
||||
if (_83)
|
||||
{
|
||||
_91 = 1.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
bool _101 = false;
|
||||
if (_91)
|
||||
{
|
||||
_101 = all(bool2(float2(1.0f, 0.5f).x == _10_expected.xy.x, float2(1.0f, 0.5f).y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_101 = false;
|
||||
}
|
||||
bool _111 = false;
|
||||
if (_101)
|
||||
{
|
||||
_111 = all(bool3(float3(1.0f, 0.5f, 0.25f).x == _10_expected.xyz.x, float3(1.0f, 0.5f, 0.25f).y == _10_expected.xyz.y, float3(1.0f, 0.5f, 0.25f).z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_111 = false;
|
||||
}
|
||||
bool _120 = false;
|
||||
if (_111)
|
||||
{
|
||||
_120 = all(bool4(float4(1.0f, 0.5f, 0.25f, 0.125f).x == _10_expected.x, float4(1.0f, 0.5f, 0.25f, 0.125f).y == _10_expected.y, float4(1.0f, 0.5f, 0.25f, 0.125f).z == _10_expected.z, float4(1.0f, 0.5f, 0.25f, 0.125f).w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_120 = false;
|
||||
}
|
||||
bool _128 = false;
|
||||
if (_120)
|
||||
{
|
||||
_128 = rsqrt(-1.0f) == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_128 = false;
|
||||
}
|
||||
bool _138 = false;
|
||||
if (_128)
|
||||
{
|
||||
float2 _131 = rsqrt(float2(-1.0f, -4.0f));
|
||||
_138 = all(bool2(_131.x == _10_expected.xy.x, _131.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_138 = false;
|
||||
}
|
||||
bool _148 = false;
|
||||
if (_138)
|
||||
{
|
||||
float3 _141 = rsqrt(float3(-1.0f, -4.0f, -16.0f));
|
||||
_148 = all(bool3(_141.x == _10_expected.xyz.x, _141.y == _10_expected.xyz.y, _141.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_148 = false;
|
||||
}
|
||||
bool _157 = false;
|
||||
if (_148)
|
||||
{
|
||||
float4 _151 = rsqrt(negativeVal);
|
||||
_157 = all(bool4(_151.x == _10_expected.x, _151.y == _10_expected.y, _151.z == _10_expected.z, _151.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_157 = false;
|
||||
}
|
||||
float4 _158 = 0.0f.xxxx;
|
||||
if (_157)
|
||||
{
|
||||
_158 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_158 = _10_colorRed;
|
||||
}
|
||||
return _158;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
107
tests/sksl/intrinsics/IsInf.hlsl
Normal file
107
tests/sksl/intrinsics/IsInf.hlsl
Normal file
@ -0,0 +1,107 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
row_major float2x2 _10_testMatrix2x2 : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _25)
|
||||
{
|
||||
float4 infiniteValue = float4(_10_testMatrix2x2[0].x, _10_testMatrix2x2[0].y, _10_testMatrix2x2[1].x, _10_testMatrix2x2[1].y) * (1.0f / _10_colorGreen.x);
|
||||
float4 finiteValue = float4(_10_testMatrix2x2[0].x, _10_testMatrix2x2[0].y, _10_testMatrix2x2[1].x, _10_testMatrix2x2[1].y) * (1.0f / _10_colorGreen.y);
|
||||
bool _71 = false;
|
||||
if (isinf(infiniteValue.x))
|
||||
{
|
||||
_71 = all(isinf(infiniteValue.xy));
|
||||
}
|
||||
else
|
||||
{
|
||||
_71 = false;
|
||||
}
|
||||
bool _80 = false;
|
||||
if (_71)
|
||||
{
|
||||
_80 = all(isinf(infiniteValue.xyz));
|
||||
}
|
||||
else
|
||||
{
|
||||
_80 = false;
|
||||
}
|
||||
bool _87 = false;
|
||||
if (_80)
|
||||
{
|
||||
_87 = all(isinf(infiniteValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_87 = false;
|
||||
}
|
||||
bool _94 = false;
|
||||
if (_87)
|
||||
{
|
||||
_94 = !isinf(finiteValue.x);
|
||||
}
|
||||
else
|
||||
{
|
||||
_94 = false;
|
||||
}
|
||||
bool _102 = false;
|
||||
if (_94)
|
||||
{
|
||||
_102 = !any(isinf(finiteValue.xy));
|
||||
}
|
||||
else
|
||||
{
|
||||
_102 = false;
|
||||
}
|
||||
bool _110 = false;
|
||||
if (_102)
|
||||
{
|
||||
_110 = !any(isinf(finiteValue.xyz));
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = false;
|
||||
}
|
||||
bool _117 = false;
|
||||
if (_110)
|
||||
{
|
||||
_117 = !any(isinf(finiteValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_117 = false;
|
||||
}
|
||||
float4 _118 = 0.0f.xxxx;
|
||||
if (_117)
|
||||
{
|
||||
_118 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_118 = _10_colorRed;
|
||||
}
|
||||
return _118;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _21 = 0.0f.xx;
|
||||
sk_FragColor = main(_21);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
107
tests/sksl/intrinsics/IsNan.hlsl
Normal file
107
tests/sksl/intrinsics/IsNan.hlsl
Normal file
@ -0,0 +1,107 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 valueIsNaN = 0.0f.xxxx / _10_testInputs.yyyy;
|
||||
float4 valueIsNumber = 1.0f.xxxx / _10_testInputs;
|
||||
bool _53 = false;
|
||||
if (isnan(valueIsNaN.x))
|
||||
{
|
||||
_53 = all(isnan(valueIsNaN.xy));
|
||||
}
|
||||
else
|
||||
{
|
||||
_53 = false;
|
||||
}
|
||||
bool _62 = false;
|
||||
if (_53)
|
||||
{
|
||||
_62 = all(isnan(valueIsNaN.xyz));
|
||||
}
|
||||
else
|
||||
{
|
||||
_62 = false;
|
||||
}
|
||||
bool _69 = false;
|
||||
if (_62)
|
||||
{
|
||||
_69 = all(isnan(valueIsNaN));
|
||||
}
|
||||
else
|
||||
{
|
||||
_69 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_69)
|
||||
{
|
||||
_76 = !isnan(valueIsNumber.x);
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_76)
|
||||
{
|
||||
_84 = !any(isnan(valueIsNumber.xy));
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _92 = false;
|
||||
if (_84)
|
||||
{
|
||||
_92 = !any(isnan(valueIsNumber.xyz));
|
||||
}
|
||||
else
|
||||
{
|
||||
_92 = false;
|
||||
}
|
||||
bool _99 = false;
|
||||
if (_92)
|
||||
{
|
||||
_99 = !any(isnan(valueIsNumber));
|
||||
}
|
||||
else
|
||||
{
|
||||
_99 = false;
|
||||
}
|
||||
float4 _100 = 0.0f.xxxx;
|
||||
if (_99)
|
||||
{
|
||||
_100 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = _10_colorRed;
|
||||
}
|
||||
return _100;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
27
tests/sksl/intrinsics/Ldexp.hlsl
Normal file
27
tests/sksl/intrinsics/Ldexp.hlsl
Normal file
@ -0,0 +1,27 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float _13_a : packoffset(c0);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
static int b = 0;
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = ldexp(_13_a, b);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
106
tests/sksl/intrinsics/Length.hlsl
Normal file
106
tests/sksl/intrinsics/Length.hlsl
Normal file
@ -0,0 +1,106 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(3.0f, 3.0f, 5.0f, 13.0f);
|
||||
bool _52 = false;
|
||||
if (length(_10_inputVal.x) == expected.x)
|
||||
{
|
||||
_52 = length(_10_inputVal.xy) == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_52 = false;
|
||||
}
|
||||
bool _63 = false;
|
||||
if (_52)
|
||||
{
|
||||
_63 = length(_10_inputVal.xyz) == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_63 = false;
|
||||
}
|
||||
bool _72 = false;
|
||||
if (_63)
|
||||
{
|
||||
_72 = length(_10_inputVal) == expected.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
_72 = false;
|
||||
}
|
||||
bool _78 = false;
|
||||
if (_72)
|
||||
{
|
||||
_78 = 3.0f == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_78 = false;
|
||||
}
|
||||
bool _84 = false;
|
||||
if (_78)
|
||||
{
|
||||
_84 = 3.0f == expected.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
_84 = false;
|
||||
}
|
||||
bool _90 = false;
|
||||
if (_84)
|
||||
{
|
||||
_90 = 5.0f == expected.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
_90 = false;
|
||||
}
|
||||
bool _96 = false;
|
||||
if (_90)
|
||||
{
|
||||
_96 = 13.0f == expected.w;
|
||||
}
|
||||
else
|
||||
{
|
||||
_96 = false;
|
||||
}
|
||||
float4 _97 = 0.0f.xxxx;
|
||||
if (_96)
|
||||
{
|
||||
_97 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_97 = _10_colorRed;
|
||||
}
|
||||
return _97;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
44
tests/sksl/intrinsics/LessThan.hlsl
Normal file
44
tests/sksl/intrinsics/LessThan.hlsl
Normal file
@ -0,0 +1,44 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_a : packoffset(c0);
|
||||
float4 _10_b : packoffset(c1);
|
||||
uint2 _10_c : packoffset(c2);
|
||||
uint2 _10_d : packoffset(c2.z);
|
||||
int3 _10_e : packoffset(c3);
|
||||
int3 _10_f : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool4 expectTTFF = bool4(true, true, false, false);
|
||||
bool4 expectFFTT = bool4(false, false, true, true);
|
||||
sk_FragColor.x = float(int(bool4(_10_a.x < _10_b.x, _10_a.y < _10_b.y, _10_a.z < _10_b.z, _10_a.w < _10_b.w).x));
|
||||
sk_FragColor.y = float(int(bool2(_10_c.x < _10_d.x, _10_c.y < _10_d.y).y));
|
||||
sk_FragColor.z = float(int(bool3(_10_e.x < _10_f.x, _10_e.y < _10_f.y, _10_e.z < _10_f.z).z));
|
||||
bool _73 = false;
|
||||
if (any(expectTTFF))
|
||||
{
|
||||
_73 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = any(expectFFTT);
|
||||
}
|
||||
sk_FragColor.w = float(int(_73));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
44
tests/sksl/intrinsics/LessThanEqual.hlsl
Normal file
44
tests/sksl/intrinsics/LessThanEqual.hlsl
Normal file
@ -0,0 +1,44 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_a : packoffset(c0);
|
||||
float4 _10_b : packoffset(c1);
|
||||
uint2 _10_c : packoffset(c2);
|
||||
uint2 _10_d : packoffset(c2.z);
|
||||
int3 _10_e : packoffset(c3);
|
||||
int3 _10_f : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool4 expectTTFF = bool4(true, true, false, false);
|
||||
bool4 expectFFTT = bool4(false, false, true, true);
|
||||
sk_FragColor.x = float(int(bool4(_10_a.x <= _10_b.x, _10_a.y <= _10_b.y, _10_a.z <= _10_b.z, _10_a.w <= _10_b.w).x));
|
||||
sk_FragColor.y = float(int(bool2(_10_c.x <= _10_d.x, _10_c.y <= _10_d.y).y));
|
||||
sk_FragColor.z = float(int(bool3(_10_e.x <= _10_f.x, _10_e.y <= _10_f.y, _10_e.z <= _10_f.z).z));
|
||||
bool _73 = false;
|
||||
if (any(expectTTFF))
|
||||
{
|
||||
_73 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = any(expectFFTT);
|
||||
}
|
||||
sk_FragColor.w = float(int(_73));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Log.hlsl
Normal file
109
tests/sksl/intrinsics/Log.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (log(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = log(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = log(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = log(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_76)
|
||||
{
|
||||
_83 = 0.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _91 = false;
|
||||
if (_83)
|
||||
{
|
||||
_91 = all(bool2(0.0f.xx.x == _10_expected.xy.x, 0.0f.xx.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
bool _100 = false;
|
||||
if (_91)
|
||||
{
|
||||
_100 = all(bool3(0.0f.xxx.x == _10_expected.xyz.x, 0.0f.xxx.y == _10_expected.xyz.y, 0.0f.xxx.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = false;
|
||||
}
|
||||
bool _108 = false;
|
||||
if (_100)
|
||||
{
|
||||
_108 = all(bool4(0.0f.xxxx.x == _10_expected.x, 0.0f.xxxx.y == _10_expected.y, 0.0f.xxxx.z == _10_expected.z, 0.0f.xxxx.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
float4 _109 = 0.0f.xxxx;
|
||||
if (_108)
|
||||
{
|
||||
_109 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = _10_colorRed;
|
||||
}
|
||||
return _109;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Log2.hlsl
Normal file
109
tests/sksl/intrinsics/Log2.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (log2(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = log2(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = log2(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = log2(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_76)
|
||||
{
|
||||
_83 = 0.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _93 = false;
|
||||
if (_83)
|
||||
{
|
||||
_93 = all(bool2(float2(0.0f, 1.0f).x == _10_expected.xy.x, float2(0.0f, 1.0f).y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_93 = false;
|
||||
}
|
||||
bool _103 = false;
|
||||
if (_93)
|
||||
{
|
||||
_103 = all(bool3(float3(0.0f, 1.0f, 2.0f).x == _10_expected.xyz.x, float3(0.0f, 1.0f, 2.0f).y == _10_expected.xyz.y, float3(0.0f, 1.0f, 2.0f).z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_103 = false;
|
||||
}
|
||||
bool _112 = false;
|
||||
if (_103)
|
||||
{
|
||||
_112 = all(bool4(float4(0.0f, 1.0f, 2.0f, 3.0f).x == _10_expected.x, float4(0.0f, 1.0f, 2.0f, 3.0f).y == _10_expected.y, float4(0.0f, 1.0f, 2.0f, 3.0f).z == _10_expected.z, float4(0.0f, 1.0f, 2.0f, 3.0f).w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_112 = false;
|
||||
}
|
||||
float4 _113 = 0.0f.xxxx;
|
||||
if (_112)
|
||||
{
|
||||
_113 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_113 = _10_colorRed;
|
||||
}
|
||||
return _113;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
76
tests/sksl/intrinsics/MatrixCompMultES2.hlsl
Normal file
76
tests/sksl/intrinsics/MatrixCompMultES2.hlsl
Normal file
@ -0,0 +1,76 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
row_major float2x2 _10_testMatrix2x2 : packoffset(c2);
|
||||
row_major float3x3 _10_testMatrix3x3 : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _27)
|
||||
{
|
||||
float2x2 h22 = float2x2(float2(0.0f, 5.0f), float2(10.0f, 15.0f));
|
||||
float2x2 _45 = float2x2(float2(1.0f, 0.0f), float2(0.0f, 1.0f));
|
||||
float2x2 f22 = float2x2(_10_testMatrix2x2[0] * _45[0], _10_testMatrix2x2[1] * _45[1]);
|
||||
float3x3 _66 = float3x3(2.0f.xxx, 2.0f.xxx, 2.0f.xxx);
|
||||
float3x3 h33 = float3x3(_10_testMatrix3x3[0] * _66[0], _10_testMatrix3x3[1] * _66[1], _10_testMatrix3x3[2] * _66[2]);
|
||||
float2x2 _81 = float2x2(float2(0.0f, 5.0f), float2(10.0f, 15.0f));
|
||||
float2 _84 = _81[0];
|
||||
float2 _88 = _81[1];
|
||||
bool _108 = false;
|
||||
if (all(bool2(h22[0].x == _84.x, h22[0].y == _84.y)) && all(bool2(h22[1].x == _88.x, h22[1].y == _88.y)))
|
||||
{
|
||||
float2x2 _98 = float2x2(float2(1.0f, 0.0f), float2(0.0f, 4.0f));
|
||||
float2 _100 = _98[0];
|
||||
float2 _104 = _98[1];
|
||||
_108 = all(bool2(f22[0].x == _100.x, f22[0].y == _100.y)) && all(bool2(f22[1].x == _104.x, f22[1].y == _104.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
bool _137 = false;
|
||||
if (_108)
|
||||
{
|
||||
float3x3 _121 = float3x3(float3(2.0f, 4.0f, 6.0f), float3(8.0f, 10.0f, 12.0f), float3(14.0f, 16.0f, 18.0f));
|
||||
float3 _124 = _121[0];
|
||||
float3 _128 = _121[1];
|
||||
float3 _133 = _121[2];
|
||||
_137 = (all(bool3(h33[0].x == _124.x, h33[0].y == _124.y, h33[0].z == _124.z)) && all(bool3(h33[1].x == _128.x, h33[1].y == _128.y, h33[1].z == _128.z))) && all(bool3(h33[2].x == _133.x, h33[2].y == _133.y, h33[2].z == _133.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_137 = false;
|
||||
}
|
||||
float4 _138 = 0.0f.xxxx;
|
||||
if (_137)
|
||||
{
|
||||
_138 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_138 = _10_colorRed;
|
||||
}
|
||||
return _138;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _23 = 0.0f.xx;
|
||||
sk_FragColor = main(_23);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
79
tests/sksl/intrinsics/MatrixCompMultES3.hlsl
Normal file
79
tests/sksl/intrinsics/MatrixCompMultES3.hlsl
Normal file
@ -0,0 +1,79 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float2x4 _33 = float2x4(9.0f.xxxx, 9.0f.xxxx);
|
||||
float2x4 _42 = float2x4(_10_colorRed, _10_colorGreen);
|
||||
float2x4 h24 = float2x4(_33[0] * _42[0], _33[1] * _42[1]);
|
||||
float4x2 _66 = float4x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f), float2(5.0f, 6.0f), float2(7.0f, 8.0f));
|
||||
float4x2 _83 = float4x2(float2(_10_colorRed.xy), float2(_10_colorRed.zw), float2(_10_colorGreen.xy), float2(_10_colorGreen.zw));
|
||||
float4x2 h42 = float4x2(_66[0] * _83[0], _66[1] * _83[1], _66[2] * _83[2], _66[3] * _83[3]);
|
||||
float4x3 f43 = float4x3(float3(12.0f, 22.0f, 30.0f), float3(36.0f, 40.0f, 42.0f), float3(42.0f, 40.0f, 36.0f), float3(30.0f, 22.0f, 12.0f));
|
||||
float2x4 _116 = float2x4(float4(9.0f, 0.0f, 0.0f, 9.0f), float4(0.0f, 9.0f, 0.0f, 9.0f));
|
||||
float4 _119 = _116[0];
|
||||
float4 _123 = _116[1];
|
||||
bool _155 = false;
|
||||
if (all(bool4(h24[0].x == _119.x, h24[0].y == _119.y, h24[0].z == _119.z, h24[0].w == _119.w)) && all(bool4(h24[1].x == _123.x, h24[1].y == _123.y, h24[1].z == _123.z, h24[1].w == _123.w)))
|
||||
{
|
||||
float4x2 _134 = float4x2(float2(1.0f, 0.0f), float2(0.0f, 4.0f), float2(0.0f, 6.0f), float2(0.0f, 8.0f));
|
||||
float2 _137 = _134[0];
|
||||
float2 _141 = _134[1];
|
||||
float2 _146 = _134[2];
|
||||
float2 _151 = _134[3];
|
||||
_155 = ((all(bool2(h42[0].x == _137.x, h42[0].y == _137.y)) && all(bool2(h42[1].x == _141.x, h42[1].y == _141.y))) && all(bool2(h42[2].x == _146.x, h42[2].y == _146.y))) && all(bool2(h42[3].x == _151.x, h42[3].y == _151.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_155 = false;
|
||||
}
|
||||
bool _184 = false;
|
||||
if (_155)
|
||||
{
|
||||
float4x3 _163 = float4x3(float3(12.0f, 22.0f, 30.0f), float3(36.0f, 40.0f, 42.0f), float3(42.0f, 40.0f, 36.0f), float3(30.0f, 22.0f, 12.0f));
|
||||
float3 _166 = _163[0];
|
||||
float3 _170 = _163[1];
|
||||
float3 _175 = _163[2];
|
||||
float3 _180 = _163[3];
|
||||
_184 = ((all(bool3(f43[0].x == _166.x, f43[0].y == _166.y, f43[0].z == _166.z)) && all(bool3(f43[1].x == _170.x, f43[1].y == _170.y, f43[1].z == _170.z))) && all(bool3(f43[2].x == _175.x, f43[2].y == _175.y, f43[2].z == _175.z))) && all(bool3(f43[3].x == _180.x, f43[3].y == _180.y, f43[3].z == _180.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_184 = false;
|
||||
}
|
||||
float4 _185 = 0.0f.xxxx;
|
||||
if (_184)
|
||||
{
|
||||
_185 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_185 = _10_colorRed;
|
||||
}
|
||||
return _185;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
185
tests/sksl/intrinsics/MaxFloat.hlsl
Normal file
185
tests/sksl/intrinsics/MaxFloat.hlsl
Normal file
@ -0,0 +1,185 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedA = float4(0.5f, 0.5f, 0.75f, 2.25f);
|
||||
float4 expectedB = float4(0.0f, 1.0f, 0.75f, 2.25f);
|
||||
bool _58 = false;
|
||||
if (max(_10_testInputs.x, 0.5f) == expectedA.x)
|
||||
{
|
||||
float2 _48 = max(_10_testInputs.xy, 0.5f.xx);
|
||||
_58 = all(bool2(_48.x == expectedA.xy.x, _48.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_58 = false;
|
||||
}
|
||||
bool _72 = false;
|
||||
if (_58)
|
||||
{
|
||||
float3 _61 = max(_10_testInputs.xyz, 0.5f.xxx);
|
||||
_72 = all(bool3(_61.x == expectedA.xyz.x, _61.y == expectedA.xyz.y, _61.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_72 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_72)
|
||||
{
|
||||
float4 _75 = max(_10_testInputs, 0.5f.xxxx);
|
||||
_83 = all(bool4(_75.x == expectedA.x, _75.y == expectedA.y, _75.z == expectedA.z, _75.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _89 = false;
|
||||
if (_83)
|
||||
{
|
||||
_89 = 0.5f == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_89 = false;
|
||||
}
|
||||
bool _97 = false;
|
||||
if (_89)
|
||||
{
|
||||
_97 = all(bool2(0.5f.xx.x == expectedA.xy.x, 0.5f.xx.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_97 = false;
|
||||
}
|
||||
bool _105 = false;
|
||||
if (_97)
|
||||
{
|
||||
_105 = all(bool3(float3(0.5f, 0.5f, 0.75f).x == expectedA.xyz.x, float3(0.5f, 0.5f, 0.75f).y == expectedA.xyz.y, float3(0.5f, 0.5f, 0.75f).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_105 = false;
|
||||
}
|
||||
bool _111 = false;
|
||||
if (_105)
|
||||
{
|
||||
_111 = all(bool4(float4(0.5f, 0.5f, 0.75f, 2.25f).x == expectedA.x, float4(0.5f, 0.5f, 0.75f, 2.25f).y == expectedA.y, float4(0.5f, 0.5f, 0.75f, 2.25f).z == expectedA.z, float4(0.5f, 0.5f, 0.75f, 2.25f).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_111 = false;
|
||||
}
|
||||
bool _125 = false;
|
||||
if (_111)
|
||||
{
|
||||
_125 = max(_10_testInputs.x, _10_colorGreen.x) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_125 = false;
|
||||
}
|
||||
bool _139 = false;
|
||||
if (_125)
|
||||
{
|
||||
float2 _128 = max(_10_testInputs.xy, _10_colorGreen.xy);
|
||||
_139 = all(bool2(_128.x == expectedB.xy.x, _128.y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_139 = false;
|
||||
}
|
||||
bool _153 = false;
|
||||
if (_139)
|
||||
{
|
||||
float3 _142 = max(_10_testInputs.xyz, _10_colorGreen.xyz);
|
||||
_153 = all(bool3(_142.x == expectedB.xyz.x, _142.y == expectedB.xyz.y, _142.z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_153 = false;
|
||||
}
|
||||
bool _164 = false;
|
||||
if (_153)
|
||||
{
|
||||
float4 _156 = max(_10_testInputs, _10_colorGreen);
|
||||
_164 = all(bool4(_156.x == expectedB.x, _156.y == expectedB.y, _156.z == expectedB.z, _156.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_164 = false;
|
||||
}
|
||||
bool _170 = false;
|
||||
if (_164)
|
||||
{
|
||||
_170 = 0.0f == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_170 = false;
|
||||
}
|
||||
bool _178 = false;
|
||||
if (_170)
|
||||
{
|
||||
_178 = all(bool2(float2(0.0f, 1.0f).x == expectedB.xy.x, float2(0.0f, 1.0f).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_178 = false;
|
||||
}
|
||||
bool _186 = false;
|
||||
if (_178)
|
||||
{
|
||||
_186 = all(bool3(float3(0.0f, 1.0f, 0.75f).x == expectedB.xyz.x, float3(0.0f, 1.0f, 0.75f).y == expectedB.xyz.y, float3(0.0f, 1.0f, 0.75f).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_186 = false;
|
||||
}
|
||||
bool _192 = false;
|
||||
if (_186)
|
||||
{
|
||||
_192 = all(bool4(float4(0.0f, 1.0f, 0.75f, 2.25f).x == expectedB.x, float4(0.0f, 1.0f, 0.75f, 2.25f).y == expectedB.y, float4(0.0f, 1.0f, 0.75f, 2.25f).z == expectedB.z, float4(0.0f, 1.0f, 0.75f, 2.25f).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_192 = false;
|
||||
}
|
||||
float4 _193 = 0.0f.xxxx;
|
||||
if (_192)
|
||||
{
|
||||
_193 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_193 = _10_colorRed;
|
||||
}
|
||||
return _193;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
189
tests/sksl/intrinsics/MaxInt.hlsl
Normal file
189
tests/sksl/intrinsics/MaxInt.hlsl
Normal file
@ -0,0 +1,189 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 _35 = _10_testInputs * 100.0f;
|
||||
int4 intValues = int4(int(_35.x), int(_35.y), int(_35.z), int(_35.w));
|
||||
float4 _49 = _10_colorGreen * 100.0f;
|
||||
int4 intGreen = int4(int(_49.x), int(_49.y), int(_49.z), int(_49.w));
|
||||
int4 expectedA = int4(50, 50, 75, 225);
|
||||
int4 expectedB = int4(0, 100, 75, 225);
|
||||
bool _86 = false;
|
||||
if (max(intValues.x, 50) == expectedA.x)
|
||||
{
|
||||
int2 _76 = max(intValues.xy, int2(50, 50));
|
||||
_86 = all(bool2(_76.x == expectedA.xy.x, _76.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_86 = false;
|
||||
}
|
||||
bool _99 = false;
|
||||
if (_86)
|
||||
{
|
||||
int3 _89 = max(intValues.xyz, int3(50, 50, 50));
|
||||
_99 = all(bool3(_89.x == expectedA.xyz.x, _89.y == expectedA.xyz.y, _89.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_99 = false;
|
||||
}
|
||||
bool _109 = false;
|
||||
if (_99)
|
||||
{
|
||||
int4 _102 = max(intValues, int4(50, 50, 50, 50));
|
||||
_109 = all(bool4(_102.x == expectedA.x, _102.y == expectedA.y, _102.z == expectedA.z, _102.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = false;
|
||||
}
|
||||
bool _115 = false;
|
||||
if (_109)
|
||||
{
|
||||
_115 = 50 == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_115 = false;
|
||||
}
|
||||
bool _123 = false;
|
||||
if (_115)
|
||||
{
|
||||
_123 = all(bool2(int2(50, 50).x == expectedA.xy.x, int2(50, 50).y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_123 = false;
|
||||
}
|
||||
bool _131 = false;
|
||||
if (_123)
|
||||
{
|
||||
_131 = all(bool3(int3(50, 50, 75).x == expectedA.xyz.x, int3(50, 50, 75).y == expectedA.xyz.y, int3(50, 50, 75).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_131 = false;
|
||||
}
|
||||
bool _137 = false;
|
||||
if (_131)
|
||||
{
|
||||
_137 = all(bool4(int4(50, 50, 75, 225).x == expectedA.x, int4(50, 50, 75, 225).y == expectedA.y, int4(50, 50, 75, 225).z == expectedA.z, int4(50, 50, 75, 225).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_137 = false;
|
||||
}
|
||||
bool _148 = false;
|
||||
if (_137)
|
||||
{
|
||||
_148 = max(intValues.x, intGreen.x) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_148 = false;
|
||||
}
|
||||
bool _160 = false;
|
||||
if (_148)
|
||||
{
|
||||
int2 _151 = max(intValues.xy, intGreen.xy);
|
||||
_160 = all(bool2(_151.x == expectedB.xy.x, _151.y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_160 = false;
|
||||
}
|
||||
bool _172 = false;
|
||||
if (_160)
|
||||
{
|
||||
int3 _163 = max(intValues.xyz, intGreen.xyz);
|
||||
_172 = all(bool3(_163.x == expectedB.xyz.x, _163.y == expectedB.xyz.y, _163.z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_172 = false;
|
||||
}
|
||||
bool _181 = false;
|
||||
if (_172)
|
||||
{
|
||||
int4 _175 = max(intValues, intGreen);
|
||||
_181 = all(bool4(_175.x == expectedB.x, _175.y == expectedB.y, _175.z == expectedB.z, _175.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_181 = false;
|
||||
}
|
||||
bool _187 = false;
|
||||
if (_181)
|
||||
{
|
||||
_187 = 0 == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_187 = false;
|
||||
}
|
||||
bool _195 = false;
|
||||
if (_187)
|
||||
{
|
||||
_195 = all(bool2(int2(0, 100).x == expectedB.xy.x, int2(0, 100).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_195 = false;
|
||||
}
|
||||
bool _203 = false;
|
||||
if (_195)
|
||||
{
|
||||
_203 = all(bool3(int3(0, 100, 75).x == expectedB.xyz.x, int3(0, 100, 75).y == expectedB.xyz.y, int3(0, 100, 75).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_203 = false;
|
||||
}
|
||||
bool _209 = false;
|
||||
if (_203)
|
||||
{
|
||||
_209 = all(bool4(int4(0, 100, 75, 225).x == expectedB.x, int4(0, 100, 75, 225).y == expectedB.y, int4(0, 100, 75, 225).z == expectedB.z, int4(0, 100, 75, 225).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_209 = false;
|
||||
}
|
||||
float4 _210 = 0.0f.xxxx;
|
||||
if (_209)
|
||||
{
|
||||
_210 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_210 = _10_colorRed;
|
||||
}
|
||||
return _210;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
185
tests/sksl/intrinsics/MinFloat.hlsl
Normal file
185
tests/sksl/intrinsics/MinFloat.hlsl
Normal file
@ -0,0 +1,185 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedA = float4(-1.25f, 0.0f, 0.5f, 0.5f);
|
||||
float4 expectedB = float4(-1.25f, 0.0f, 0.0f, 1.0f);
|
||||
bool _57 = false;
|
||||
if (min(_10_testInputs.x, 0.5f) == expectedA.x)
|
||||
{
|
||||
float2 _47 = min(_10_testInputs.xy, 0.5f.xx);
|
||||
_57 = all(bool2(_47.x == expectedA.xy.x, _47.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_57 = false;
|
||||
}
|
||||
bool _71 = false;
|
||||
if (_57)
|
||||
{
|
||||
float3 _60 = min(_10_testInputs.xyz, 0.5f.xxx);
|
||||
_71 = all(bool3(_60.x == expectedA.xyz.x, _60.y == expectedA.xyz.y, _60.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_71 = false;
|
||||
}
|
||||
bool _82 = false;
|
||||
if (_71)
|
||||
{
|
||||
float4 _74 = min(_10_testInputs, 0.5f.xxxx);
|
||||
_82 = all(bool4(_74.x == expectedA.x, _74.y == expectedA.y, _74.z == expectedA.z, _74.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_82 = false;
|
||||
}
|
||||
bool _88 = false;
|
||||
if (_82)
|
||||
{
|
||||
_88 = (-1.25f) == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = false;
|
||||
}
|
||||
bool _96 = false;
|
||||
if (_88)
|
||||
{
|
||||
_96 = all(bool2(float2(-1.25f, 0.0f).x == expectedA.xy.x, float2(-1.25f, 0.0f).y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_96 = false;
|
||||
}
|
||||
bool _104 = false;
|
||||
if (_96)
|
||||
{
|
||||
_104 = all(bool3(float3(-1.25f, 0.0f, 0.5f).x == expectedA.xyz.x, float3(-1.25f, 0.0f, 0.5f).y == expectedA.xyz.y, float3(-1.25f, 0.0f, 0.5f).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_104 = false;
|
||||
}
|
||||
bool _110 = false;
|
||||
if (_104)
|
||||
{
|
||||
_110 = all(bool4(float4(-1.25f, 0.0f, 0.5f, 0.5f).x == expectedA.x, float4(-1.25f, 0.0f, 0.5f, 0.5f).y == expectedA.y, float4(-1.25f, 0.0f, 0.5f, 0.5f).z == expectedA.z, float4(-1.25f, 0.0f, 0.5f, 0.5f).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = false;
|
||||
}
|
||||
bool _124 = false;
|
||||
if (_110)
|
||||
{
|
||||
_124 = min(_10_testInputs.x, _10_colorGreen.x) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_124 = false;
|
||||
}
|
||||
bool _138 = false;
|
||||
if (_124)
|
||||
{
|
||||
float2 _127 = min(_10_testInputs.xy, _10_colorGreen.xy);
|
||||
_138 = all(bool2(_127.x == expectedB.xy.x, _127.y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_138 = false;
|
||||
}
|
||||
bool _152 = false;
|
||||
if (_138)
|
||||
{
|
||||
float3 _141 = min(_10_testInputs.xyz, _10_colorGreen.xyz);
|
||||
_152 = all(bool3(_141.x == expectedB.xyz.x, _141.y == expectedB.xyz.y, _141.z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_152 = false;
|
||||
}
|
||||
bool _163 = false;
|
||||
if (_152)
|
||||
{
|
||||
float4 _155 = min(_10_testInputs, _10_colorGreen);
|
||||
_163 = all(bool4(_155.x == expectedB.x, _155.y == expectedB.y, _155.z == expectedB.z, _155.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_163 = false;
|
||||
}
|
||||
bool _169 = false;
|
||||
if (_163)
|
||||
{
|
||||
_169 = (-1.25f) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_169 = false;
|
||||
}
|
||||
bool _176 = false;
|
||||
if (_169)
|
||||
{
|
||||
_176 = all(bool2(float2(-1.25f, 0.0f).x == expectedB.xy.x, float2(-1.25f, 0.0f).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_176 = false;
|
||||
}
|
||||
bool _184 = false;
|
||||
if (_176)
|
||||
{
|
||||
_184 = all(bool3(float3(-1.25f, 0.0f, 0.0f).x == expectedB.xyz.x, float3(-1.25f, 0.0f, 0.0f).y == expectedB.xyz.y, float3(-1.25f, 0.0f, 0.0f).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_184 = false;
|
||||
}
|
||||
bool _190 = false;
|
||||
if (_184)
|
||||
{
|
||||
_190 = all(bool4(float4(-1.25f, 0.0f, 0.0f, 1.0f).x == expectedB.x, float4(-1.25f, 0.0f, 0.0f, 1.0f).y == expectedB.y, float4(-1.25f, 0.0f, 0.0f, 1.0f).z == expectedB.z, float4(-1.25f, 0.0f, 0.0f, 1.0f).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_190 = false;
|
||||
}
|
||||
float4 _191 = 0.0f.xxxx;
|
||||
if (_190)
|
||||
{
|
||||
_191 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_191 = _10_colorRed;
|
||||
}
|
||||
return _191;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
189
tests/sksl/intrinsics/MinInt.hlsl
Normal file
189
tests/sksl/intrinsics/MinInt.hlsl
Normal file
@ -0,0 +1,189 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 _35 = _10_testInputs * 100.0f;
|
||||
int4 intValues = int4(int(_35.x), int(_35.y), int(_35.z), int(_35.w));
|
||||
float4 _49 = _10_colorGreen * 100.0f;
|
||||
int4 intGreen = int4(int(_49.x), int(_49.y), int(_49.z), int(_49.w));
|
||||
int4 expectedA = int4(-125, 0, 50, 50);
|
||||
int4 expectedB = int4(-125, 0, 0, 100);
|
||||
bool _85 = false;
|
||||
if (min(intValues.x, 50) == expectedA.x)
|
||||
{
|
||||
int2 _75 = min(intValues.xy, int2(50, 50));
|
||||
_85 = all(bool2(_75.x == expectedA.xy.x, _75.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_85 = false;
|
||||
}
|
||||
bool _98 = false;
|
||||
if (_85)
|
||||
{
|
||||
int3 _88 = min(intValues.xyz, int3(50, 50, 50));
|
||||
_98 = all(bool3(_88.x == expectedA.xyz.x, _88.y == expectedA.xyz.y, _88.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_98 = false;
|
||||
}
|
||||
bool _108 = false;
|
||||
if (_98)
|
||||
{
|
||||
int4 _101 = min(intValues, int4(50, 50, 50, 50));
|
||||
_108 = all(bool4(_101.x == expectedA.x, _101.y == expectedA.y, _101.z == expectedA.z, _101.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
bool _114 = false;
|
||||
if (_108)
|
||||
{
|
||||
_114 = (-125) == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_114 = false;
|
||||
}
|
||||
bool _122 = false;
|
||||
if (_114)
|
||||
{
|
||||
_122 = all(bool2(int2(-125, 0).x == expectedA.xy.x, int2(-125, 0).y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_122 = false;
|
||||
}
|
||||
bool _130 = false;
|
||||
if (_122)
|
||||
{
|
||||
_130 = all(bool3(int3(-125, 0, 50).x == expectedA.xyz.x, int3(-125, 0, 50).y == expectedA.xyz.y, int3(-125, 0, 50).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_130 = false;
|
||||
}
|
||||
bool _136 = false;
|
||||
if (_130)
|
||||
{
|
||||
_136 = all(bool4(int4(-125, 0, 50, 50).x == expectedA.x, int4(-125, 0, 50, 50).y == expectedA.y, int4(-125, 0, 50, 50).z == expectedA.z, int4(-125, 0, 50, 50).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_136 = false;
|
||||
}
|
||||
bool _147 = false;
|
||||
if (_136)
|
||||
{
|
||||
_147 = min(intValues.x, intGreen.x) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_147 = false;
|
||||
}
|
||||
bool _159 = false;
|
||||
if (_147)
|
||||
{
|
||||
int2 _150 = min(intValues.xy, intGreen.xy);
|
||||
_159 = all(bool2(_150.x == expectedB.xy.x, _150.y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_159 = false;
|
||||
}
|
||||
bool _171 = false;
|
||||
if (_159)
|
||||
{
|
||||
int3 _162 = min(intValues.xyz, intGreen.xyz);
|
||||
_171 = all(bool3(_162.x == expectedB.xyz.x, _162.y == expectedB.xyz.y, _162.z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_171 = false;
|
||||
}
|
||||
bool _180 = false;
|
||||
if (_171)
|
||||
{
|
||||
int4 _174 = min(intValues, intGreen);
|
||||
_180 = all(bool4(_174.x == expectedB.x, _174.y == expectedB.y, _174.z == expectedB.z, _174.w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_180 = false;
|
||||
}
|
||||
bool _186 = false;
|
||||
if (_180)
|
||||
{
|
||||
_186 = (-125) == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_186 = false;
|
||||
}
|
||||
bool _193 = false;
|
||||
if (_186)
|
||||
{
|
||||
_193 = all(bool2(int2(-125, 0).x == expectedB.xy.x, int2(-125, 0).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_193 = false;
|
||||
}
|
||||
bool _201 = false;
|
||||
if (_193)
|
||||
{
|
||||
_201 = all(bool3(int3(-125, 0, 0).x == expectedB.xyz.x, int3(-125, 0, 0).y == expectedB.xyz.y, int3(-125, 0, 0).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_201 = false;
|
||||
}
|
||||
bool _207 = false;
|
||||
if (_201)
|
||||
{
|
||||
_207 = all(bool4(int4(-125, 0, 0, 100).x == expectedB.x, int4(-125, 0, 0, 100).y == expectedB.y, int4(-125, 0, 0, 100).z == expectedB.z, int4(-125, 0, 0, 100).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_207 = false;
|
||||
}
|
||||
float4 _208 = 0.0f.xxxx;
|
||||
if (_207)
|
||||
{
|
||||
_208 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_208 = _10_colorRed;
|
||||
}
|
||||
return _208;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
339
tests/sksl/intrinsics/MixBool.hlsl
Normal file
339
tests/sksl/intrinsics/MixBool.hlsl
Normal file
@ -0,0 +1,339 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
float4 _10_colorBlack : packoffset(c2);
|
||||
float4 _10_colorWhite : packoffset(c3);
|
||||
float4 _10_testInputs : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 _35 = _10_colorGreen * 100.0f;
|
||||
int4 intGreen = int4(int(_35.x), int(_35.y), int(_35.z), int(_35.w));
|
||||
float4 _49 = _10_colorRed * 100.0f;
|
||||
int4 intRed = int4(int(_49.x), int(_49.y), int(_49.z), int(_49.w));
|
||||
bool _90 = false;
|
||||
if ((false ? intRed.x : intGreen.x) == intGreen.x)
|
||||
{
|
||||
int2 _74 = int2(bool2(false, false).x ? intRed.xy.x : intGreen.xy.x, bool2(false, false).y ? intRed.xy.y : intGreen.xy.y);
|
||||
_90 = all(bool2(_74.x == intGreen.xy.x, _74.y == intGreen.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_90 = false;
|
||||
}
|
||||
bool _109 = false;
|
||||
if (_90)
|
||||
{
|
||||
int3 _93 = int3(bool3(false, false, false).x ? intRed.xyz.x : intGreen.xyz.x, bool3(false, false, false).y ? intRed.xyz.y : intGreen.xyz.y, bool3(false, false, false).z ? intRed.xyz.z : intGreen.xyz.z);
|
||||
_109 = all(bool3(_93.x == intGreen.xyz.x, _93.y == intGreen.xyz.y, _93.z == intGreen.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = false;
|
||||
}
|
||||
bool _122 = false;
|
||||
if (_109)
|
||||
{
|
||||
int4 _112 = int4(bool4(false, false, false, false).x ? intRed.x : intGreen.x, bool4(false, false, false, false).y ? intRed.y : intGreen.y, bool4(false, false, false, false).z ? intRed.z : intGreen.z, bool4(false, false, false, false).w ? intRed.w : intGreen.w);
|
||||
_122 = all(bool4(_112.x == intGreen.x, _112.y == intGreen.y, _112.z == intGreen.z, _112.w == intGreen.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_122 = false;
|
||||
}
|
||||
bool _138 = false;
|
||||
if (_122)
|
||||
{
|
||||
_138 = (true ? intRed.x : intGreen.x) == intRed.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_138 = false;
|
||||
}
|
||||
bool _155 = false;
|
||||
if (_138)
|
||||
{
|
||||
int2 _141 = int2(bool2(true, true).x ? intRed.xy.x : intGreen.xy.x, bool2(true, true).y ? intRed.xy.y : intGreen.xy.y);
|
||||
_155 = all(bool2(_141.x == intRed.xy.x, _141.y == intRed.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_155 = false;
|
||||
}
|
||||
bool _172 = false;
|
||||
if (_155)
|
||||
{
|
||||
int3 _158 = int3(bool3(true, true, true).x ? intRed.xyz.x : intGreen.xyz.x, bool3(true, true, true).y ? intRed.xyz.y : intGreen.xyz.y, bool3(true, true, true).z ? intRed.xyz.z : intGreen.xyz.z);
|
||||
_172 = all(bool3(_158.x == intRed.xyz.x, _158.y == intRed.xyz.y, _158.z == intRed.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_172 = false;
|
||||
}
|
||||
bool _184 = false;
|
||||
if (_172)
|
||||
{
|
||||
int4 _175 = int4(bool4(true, true, true, true).x ? intRed.x : intGreen.x, bool4(true, true, true, true).y ? intRed.y : intGreen.y, bool4(true, true, true, true).z ? intRed.z : intGreen.z, bool4(true, true, true, true).w ? intRed.w : intGreen.w);
|
||||
_184 = all(bool4(_175.x == intRed.x, _175.y == intRed.y, _175.z == intRed.z, _175.w == intRed.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_184 = false;
|
||||
}
|
||||
bool _190 = false;
|
||||
if (_184)
|
||||
{
|
||||
_190 = 0 == intGreen.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_190 = false;
|
||||
}
|
||||
bool _199 = false;
|
||||
if (_190)
|
||||
{
|
||||
_199 = all(bool2(int2(0, 100).x == intGreen.xy.x, int2(0, 100).y == intGreen.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_199 = false;
|
||||
}
|
||||
bool _207 = false;
|
||||
if (_199)
|
||||
{
|
||||
_207 = all(bool3(int3(0, 100, 0).x == intGreen.xyz.x, int3(0, 100, 0).y == intGreen.xyz.y, int3(0, 100, 0).z == intGreen.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_207 = false;
|
||||
}
|
||||
bool _214 = false;
|
||||
if (_207)
|
||||
{
|
||||
_214 = all(bool4(int4(0, 100, 0, 100).x == intGreen.x, int4(0, 100, 0, 100).y == intGreen.y, int4(0, 100, 0, 100).z == intGreen.z, int4(0, 100, 0, 100).w == intGreen.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_214 = false;
|
||||
}
|
||||
bool _220 = false;
|
||||
if (_214)
|
||||
{
|
||||
_220 = 100 == intRed.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_220 = false;
|
||||
}
|
||||
bool _228 = false;
|
||||
if (_220)
|
||||
{
|
||||
_228 = all(bool2(int2(100, 0).x == intRed.xy.x, int2(100, 0).y == intRed.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_228 = false;
|
||||
}
|
||||
bool _236 = false;
|
||||
if (_228)
|
||||
{
|
||||
_236 = all(bool3(int3(100, 0, 0).x == intRed.xyz.x, int3(100, 0, 0).y == intRed.xyz.y, int3(100, 0, 0).z == intRed.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_236 = false;
|
||||
}
|
||||
bool _243 = false;
|
||||
if (_236)
|
||||
{
|
||||
_243 = all(bool4(int4(100, 0, 0, 100).x == intRed.x, int4(100, 0, 0, 100).y == intRed.y, int4(100, 0, 0, 100).z == intRed.z, int4(100, 0, 0, 100).w == intRed.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_243 = false;
|
||||
}
|
||||
bool _263 = false;
|
||||
if (_243)
|
||||
{
|
||||
_263 = (false ? _10_colorRed.x : _10_colorGreen.x) == _10_colorGreen.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_263 = false;
|
||||
}
|
||||
bool _284 = false;
|
||||
if (_263)
|
||||
{
|
||||
float2 _266 = float2(bool2(false, false).x ? _10_colorRed.xy.x : _10_colorGreen.xy.x, bool2(false, false).y ? _10_colorRed.xy.y : _10_colorGreen.xy.y);
|
||||
_284 = all(bool2(_266.x == _10_colorGreen.xy.x, _266.y == _10_colorGreen.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_284 = false;
|
||||
}
|
||||
bool _306 = false;
|
||||
if (_284)
|
||||
{
|
||||
float3 _287 = float3(bool3(false, false, false).x ? _10_colorRed.xyz.x : _10_colorGreen.xyz.x, bool3(false, false, false).y ? _10_colorRed.xyz.y : _10_colorGreen.xyz.y, bool3(false, false, false).z ? _10_colorRed.xyz.z : _10_colorGreen.xyz.z);
|
||||
_306 = all(bool3(_287.x == _10_colorGreen.xyz.x, _287.y == _10_colorGreen.xyz.y, _287.z == _10_colorGreen.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_306 = false;
|
||||
}
|
||||
bool _322 = false;
|
||||
if (_306)
|
||||
{
|
||||
float4 _309 = float4(bool4(false, false, false, false).x ? _10_colorRed.x : _10_colorGreen.x, bool4(false, false, false, false).y ? _10_colorRed.y : _10_colorGreen.y, bool4(false, false, false, false).z ? _10_colorRed.z : _10_colorGreen.z, bool4(false, false, false, false).w ? _10_colorRed.w : _10_colorGreen.w);
|
||||
_322 = all(bool4(_309.x == _10_colorGreen.x, _309.y == _10_colorGreen.y, _309.z == _10_colorGreen.z, _309.w == _10_colorGreen.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_322 = false;
|
||||
}
|
||||
bool _342 = false;
|
||||
if (_322)
|
||||
{
|
||||
_342 = (true ? _10_colorRed.x : _10_colorGreen.x) == _10_colorRed.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_342 = false;
|
||||
}
|
||||
bool _363 = false;
|
||||
if (_342)
|
||||
{
|
||||
float2 _345 = float2(bool2(true, true).x ? _10_colorRed.xy.x : _10_colorGreen.xy.x, bool2(true, true).y ? _10_colorRed.xy.y : _10_colorGreen.xy.y);
|
||||
_363 = all(bool2(_345.x == _10_colorRed.xy.x, _345.y == _10_colorRed.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_363 = false;
|
||||
}
|
||||
bool _384 = false;
|
||||
if (_363)
|
||||
{
|
||||
float3 _366 = float3(bool3(true, true, true).x ? _10_colorRed.xyz.x : _10_colorGreen.xyz.x, bool3(true, true, true).y ? _10_colorRed.xyz.y : _10_colorGreen.xyz.y, bool3(true, true, true).z ? _10_colorRed.xyz.z : _10_colorGreen.xyz.z);
|
||||
_384 = all(bool3(_366.x == _10_colorRed.xyz.x, _366.y == _10_colorRed.xyz.y, _366.z == _10_colorRed.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_384 = false;
|
||||
}
|
||||
bool _400 = false;
|
||||
if (_384)
|
||||
{
|
||||
float4 _387 = float4(bool4(true, true, true, true).x ? _10_colorRed.x : _10_colorGreen.x, bool4(true, true, true, true).y ? _10_colorRed.y : _10_colorGreen.y, bool4(true, true, true, true).z ? _10_colorRed.z : _10_colorGreen.z, bool4(true, true, true, true).w ? _10_colorRed.w : _10_colorGreen.w);
|
||||
_400 = all(bool4(_387.x == _10_colorRed.x, _387.y == _10_colorRed.y, _387.z == _10_colorRed.z, _387.w == _10_colorRed.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_400 = false;
|
||||
}
|
||||
bool _407 = false;
|
||||
if (_400)
|
||||
{
|
||||
_407 = 0.0f == _10_colorGreen.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_407 = false;
|
||||
}
|
||||
bool _417 = false;
|
||||
if (_407)
|
||||
{
|
||||
_417 = all(bool2(float2(0.0f, 1.0f).x == _10_colorGreen.xy.x, float2(0.0f, 1.0f).y == _10_colorGreen.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_417 = false;
|
||||
}
|
||||
bool _426 = false;
|
||||
if (_417)
|
||||
{
|
||||
_426 = all(bool3(float3(0.0f, 1.0f, 0.0f).x == _10_colorGreen.xyz.x, float3(0.0f, 1.0f, 0.0f).y == _10_colorGreen.xyz.y, float3(0.0f, 1.0f, 0.0f).z == _10_colorGreen.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_426 = false;
|
||||
}
|
||||
bool _434 = false;
|
||||
if (_426)
|
||||
{
|
||||
_434 = all(bool4(float4(0.0f, 1.0f, 0.0f, 1.0f).x == _10_colorGreen.x, float4(0.0f, 1.0f, 0.0f, 1.0f).y == _10_colorGreen.y, float4(0.0f, 1.0f, 0.0f, 1.0f).z == _10_colorGreen.z, float4(0.0f, 1.0f, 0.0f, 1.0f).w == _10_colorGreen.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_434 = false;
|
||||
}
|
||||
bool _441 = false;
|
||||
if (_434)
|
||||
{
|
||||
_441 = 1.0f == _10_colorRed.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_441 = false;
|
||||
}
|
||||
bool _450 = false;
|
||||
if (_441)
|
||||
{
|
||||
_450 = all(bool2(float2(1.0f, 0.0f).x == _10_colorRed.xy.x, float2(1.0f, 0.0f).y == _10_colorRed.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_450 = false;
|
||||
}
|
||||
bool _459 = false;
|
||||
if (_450)
|
||||
{
|
||||
_459 = all(bool3(float3(1.0f, 0.0f, 0.0f).x == _10_colorRed.xyz.x, float3(1.0f, 0.0f, 0.0f).y == _10_colorRed.xyz.y, float3(1.0f, 0.0f, 0.0f).z == _10_colorRed.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_459 = false;
|
||||
}
|
||||
bool _467 = false;
|
||||
if (_459)
|
||||
{
|
||||
_467 = all(bool4(float4(1.0f, 0.0f, 0.0f, 1.0f).x == _10_colorRed.x, float4(1.0f, 0.0f, 0.0f, 1.0f).y == _10_colorRed.y, float4(1.0f, 0.0f, 0.0f, 1.0f).z == _10_colorRed.z, float4(1.0f, 0.0f, 0.0f, 1.0f).w == _10_colorRed.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_467 = false;
|
||||
}
|
||||
float4 _468 = 0.0f.xxxx;
|
||||
if (_467)
|
||||
{
|
||||
_468 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_468 = _10_colorRed;
|
||||
}
|
||||
return _468;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
227
tests/sksl/intrinsics/MixFloat.hlsl
Normal file
227
tests/sksl/intrinsics/MixFloat.hlsl
Normal file
@ -0,0 +1,227 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
float4 _10_colorBlack : packoffset(c2);
|
||||
float4 _10_colorWhite : packoffset(c3);
|
||||
float4 _10_testInputs : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedBW = float4(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
float4 expectedWT = float4(1.0f, 0.5f, 1.0f, 2.25f);
|
||||
float4 _35 = lerp(_10_colorGreen, _10_colorRed, 0.0f.xxxx);
|
||||
bool _62 = false;
|
||||
if (all(bool4(_35.x == float4(0.0f, 1.0f, 0.0f, 1.0f).x, _35.y == float4(0.0f, 1.0f, 0.0f, 1.0f).y, _35.z == float4(0.0f, 1.0f, 0.0f, 1.0f).z, _35.w == float4(0.0f, 1.0f, 0.0f, 1.0f).w)))
|
||||
{
|
||||
float4 _51 = lerp(_10_colorGreen, _10_colorRed, 0.25f.xxxx);
|
||||
_62 = all(bool4(_51.x == float4(0.25f, 0.75f, 0.0f, 1.0f).x, _51.y == float4(0.25f, 0.75f, 0.0f, 1.0f).y, _51.z == float4(0.25f, 0.75f, 0.0f, 1.0f).z, _51.w == float4(0.25f, 0.75f, 0.0f, 1.0f).w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_62 = false;
|
||||
}
|
||||
bool _74 = false;
|
||||
if (_62)
|
||||
{
|
||||
float4 _65 = lerp(_10_colorGreen, _10_colorRed, 0.75f.xxxx);
|
||||
_74 = all(bool4(_65.x == float4(0.75f, 0.25f, 0.0f, 1.0f).x, _65.y == float4(0.75f, 0.25f, 0.0f, 1.0f).y, _65.z == float4(0.75f, 0.25f, 0.0f, 1.0f).z, _65.w == float4(0.75f, 0.25f, 0.0f, 1.0f).w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_74 = false;
|
||||
}
|
||||
bool _86 = false;
|
||||
if (_74)
|
||||
{
|
||||
float4 _77 = lerp(_10_colorGreen, _10_colorRed, 1.0f.xxxx);
|
||||
_86 = all(bool4(_77.x == float4(1.0f, 0.0f, 0.0f, 1.0f).x, _77.y == float4(1.0f, 0.0f, 0.0f, 1.0f).y, _77.z == float4(1.0f, 0.0f, 0.0f, 1.0f).z, _77.w == float4(1.0f, 0.0f, 0.0f, 1.0f).w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_86 = false;
|
||||
}
|
||||
bool _101 = false;
|
||||
if (_86)
|
||||
{
|
||||
_101 = lerp(_10_colorBlack.x, _10_colorWhite.x, 0.5f) == expectedBW.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_101 = false;
|
||||
}
|
||||
bool _117 = false;
|
||||
if (_101)
|
||||
{
|
||||
float2 _104 = lerp(_10_colorBlack.xy, _10_colorWhite.xy, 0.5f.xx);
|
||||
_117 = all(bool2(_104.x == expectedBW.xy.x, _104.y == expectedBW.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_117 = false;
|
||||
}
|
||||
bool _134 = false;
|
||||
if (_117)
|
||||
{
|
||||
float3 _120 = lerp(_10_colorBlack.xyz, _10_colorWhite.xyz, 0.5f.xxx);
|
||||
_134 = all(bool3(_120.x == expectedBW.xyz.x, _120.y == expectedBW.xyz.y, _120.z == expectedBW.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_134 = false;
|
||||
}
|
||||
bool _146 = false;
|
||||
if (_134)
|
||||
{
|
||||
float4 _137 = lerp(_10_colorBlack, _10_colorWhite, 0.5f.xxxx);
|
||||
_146 = all(bool4(_137.x == expectedBW.x, _137.y == expectedBW.y, _137.z == expectedBW.z, _137.w == expectedBW.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_146 = false;
|
||||
}
|
||||
bool _152 = false;
|
||||
if (_146)
|
||||
{
|
||||
_152 = 0.5f == expectedBW.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_152 = false;
|
||||
}
|
||||
bool _160 = false;
|
||||
if (_152)
|
||||
{
|
||||
_160 = all(bool2(0.5f.xx.x == expectedBW.xy.x, 0.5f.xx.y == expectedBW.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_160 = false;
|
||||
}
|
||||
bool _168 = false;
|
||||
if (_160)
|
||||
{
|
||||
_168 = all(bool3(0.5f.xxx.x == expectedBW.xyz.x, 0.5f.xxx.y == expectedBW.xyz.y, 0.5f.xxx.z == expectedBW.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_168 = false;
|
||||
}
|
||||
bool _174 = false;
|
||||
if (_168)
|
||||
{
|
||||
_174 = all(bool4(float4(0.5f, 0.5f, 0.5f, 1.0f).x == expectedBW.x, float4(0.5f, 0.5f, 0.5f, 1.0f).y == expectedBW.y, float4(0.5f, 0.5f, 0.5f, 1.0f).z == expectedBW.z, float4(0.5f, 0.5f, 0.5f, 1.0f).w == expectedBW.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_174 = false;
|
||||
}
|
||||
bool _188 = false;
|
||||
if (_174)
|
||||
{
|
||||
_188 = lerp(_10_colorWhite.x, _10_testInputs.x, 0.0f) == expectedWT.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_188 = false;
|
||||
}
|
||||
bool _203 = false;
|
||||
if (_188)
|
||||
{
|
||||
float2 _191 = lerp(_10_colorWhite.xy, _10_testInputs.xy, float2(0.0f, 0.5f));
|
||||
_203 = all(bool2(_191.x == expectedWT.xy.x, _191.y == expectedWT.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_203 = false;
|
||||
}
|
||||
bool _218 = false;
|
||||
if (_203)
|
||||
{
|
||||
float3 _206 = lerp(_10_colorWhite.xyz, _10_testInputs.xyz, float3(0.0f, 0.5f, 0.0f));
|
||||
_218 = all(bool3(_206.x == expectedWT.xyz.x, _206.y == expectedWT.xyz.y, _206.z == expectedWT.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_218 = false;
|
||||
}
|
||||
bool _230 = false;
|
||||
if (_218)
|
||||
{
|
||||
float4 _221 = lerp(_10_colorWhite, _10_testInputs, float4(0.0f, 0.5f, 0.0f, 1.0f));
|
||||
_230 = all(bool4(_221.x == expectedWT.x, _221.y == expectedWT.y, _221.z == expectedWT.z, _221.w == expectedWT.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_230 = false;
|
||||
}
|
||||
bool _236 = false;
|
||||
if (_230)
|
||||
{
|
||||
_236 = 1.0f == expectedWT.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_236 = false;
|
||||
}
|
||||
bool _244 = false;
|
||||
if (_236)
|
||||
{
|
||||
_244 = all(bool2(float2(1.0f, 0.5f).x == expectedWT.xy.x, float2(1.0f, 0.5f).y == expectedWT.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_244 = false;
|
||||
}
|
||||
bool _252 = false;
|
||||
if (_244)
|
||||
{
|
||||
_252 = all(bool3(float3(1.0f, 0.5f, 1.0f).x == expectedWT.xyz.x, float3(1.0f, 0.5f, 1.0f).y == expectedWT.xyz.y, float3(1.0f, 0.5f, 1.0f).z == expectedWT.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_252 = false;
|
||||
}
|
||||
bool _258 = false;
|
||||
if (_252)
|
||||
{
|
||||
_258 = all(bool4(float4(1.0f, 0.5f, 1.0f, 2.25f).x == expectedWT.x, float4(1.0f, 0.5f, 1.0f, 2.25f).y == expectedWT.y, float4(1.0f, 0.5f, 1.0f, 2.25f).z == expectedWT.z, float4(1.0f, 0.5f, 1.0f, 2.25f).w == expectedWT.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_258 = false;
|
||||
}
|
||||
float4 _259 = 0.0f.xxxx;
|
||||
if (_258)
|
||||
{
|
||||
_259 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_259 = _10_colorRed;
|
||||
}
|
||||
return _259;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
206
tests/sksl/intrinsics/Mod.hlsl
Normal file
206
tests/sksl/intrinsics/Mod.hlsl
Normal file
@ -0,0 +1,206 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
float4 _10_colorWhite : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float mod(float x, float y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float2 mod(float2 x, float2 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float3 mod(float3 x, float3 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float4 mod(float4 x, float4 y)
|
||||
{
|
||||
return x - y * floor(x / y);
|
||||
}
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedA = float4(0.75f, 0.0f, 0.75f, 0.25f);
|
||||
float4 expectedB = float4(0.25f, 0.0f, 0.75f, 1.0f);
|
||||
bool _57 = false;
|
||||
if (mod(_10_testInputs.x, 1.0f) == expectedA.x)
|
||||
{
|
||||
float2 _47 = mod(_10_testInputs.xy, 1.0f.xx);
|
||||
_57 = all(bool2(_47.x == expectedA.xy.x, _47.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_57 = false;
|
||||
}
|
||||
bool _71 = false;
|
||||
if (_57)
|
||||
{
|
||||
float3 _60 = mod(_10_testInputs.xyz, 1.0f.xxx);
|
||||
_71 = all(bool3(_60.x == expectedA.xyz.x, _60.y == expectedA.xyz.y, _60.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_71 = false;
|
||||
}
|
||||
bool _82 = false;
|
||||
if (_71)
|
||||
{
|
||||
float4 _74 = mod(_10_testInputs, 1.0f.xxxx);
|
||||
_82 = all(bool4(_74.x == expectedA.x, _74.y == expectedA.y, _74.z == expectedA.z, _74.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_82 = false;
|
||||
}
|
||||
bool _88 = false;
|
||||
if (_82)
|
||||
{
|
||||
_88 = 0.75f == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = false;
|
||||
}
|
||||
bool _96 = false;
|
||||
if (_88)
|
||||
{
|
||||
_96 = all(bool2(float2(0.75f, 0.0f).x == expectedA.xy.x, float2(0.75f, 0.0f).y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_96 = false;
|
||||
}
|
||||
bool _104 = false;
|
||||
if (_96)
|
||||
{
|
||||
_104 = all(bool3(float3(0.75f, 0.0f, 0.75f).x == expectedA.xyz.x, float3(0.75f, 0.0f, 0.75f).y == expectedA.xyz.y, float3(0.75f, 0.0f, 0.75f).z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_104 = false;
|
||||
}
|
||||
bool _110 = false;
|
||||
if (_104)
|
||||
{
|
||||
_110 = all(bool4(float4(0.75f, 0.0f, 0.75f, 0.25f).x == expectedA.x, float4(0.75f, 0.0f, 0.75f, 0.25f).y == expectedA.y, float4(0.75f, 0.0f, 0.75f, 0.25f).z == expectedA.z, float4(0.75f, 0.0f, 0.75f, 0.25f).w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = false;
|
||||
}
|
||||
bool _124 = false;
|
||||
if (_110)
|
||||
{
|
||||
_124 = mod(_10_testInputs.x, _10_colorWhite.x) == expectedA.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_124 = false;
|
||||
}
|
||||
bool _138 = false;
|
||||
if (_124)
|
||||
{
|
||||
float2 _127 = mod(_10_testInputs.xy, _10_colorWhite.xy);
|
||||
_138 = all(bool2(_127.x == expectedA.xy.x, _127.y == expectedA.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_138 = false;
|
||||
}
|
||||
bool _152 = false;
|
||||
if (_138)
|
||||
{
|
||||
float3 _141 = mod(_10_testInputs.xyz, _10_colorWhite.xyz);
|
||||
_152 = all(bool3(_141.x == expectedA.xyz.x, _141.y == expectedA.xyz.y, _141.z == expectedA.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_152 = false;
|
||||
}
|
||||
bool _163 = false;
|
||||
if (_152)
|
||||
{
|
||||
float4 _155 = mod(_10_testInputs, _10_colorWhite);
|
||||
_163 = all(bool4(_155.x == expectedA.x, _155.y == expectedA.y, _155.z == expectedA.z, _155.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_163 = false;
|
||||
}
|
||||
bool _169 = false;
|
||||
if (_163)
|
||||
{
|
||||
_169 = 0.25f == expectedB.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_169 = false;
|
||||
}
|
||||
bool _177 = false;
|
||||
if (_169)
|
||||
{
|
||||
_177 = all(bool2(float2(0.25f, 0.0f).x == expectedB.xy.x, float2(0.25f, 0.0f).y == expectedB.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_177 = false;
|
||||
}
|
||||
bool _185 = false;
|
||||
if (_177)
|
||||
{
|
||||
_185 = all(bool3(float3(0.25f, 0.0f, 0.75f).x == expectedB.xyz.x, float3(0.25f, 0.0f, 0.75f).y == expectedB.xyz.y, float3(0.25f, 0.0f, 0.75f).z == expectedB.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_185 = false;
|
||||
}
|
||||
bool _191 = false;
|
||||
if (_185)
|
||||
{
|
||||
_191 = all(bool4(float4(0.25f, 0.0f, 0.75f, 1.0f).x == expectedB.x, float4(0.25f, 0.0f, 0.75f, 1.0f).y == expectedB.y, float4(0.25f, 0.0f, 0.75f, 1.0f).z == expectedB.z, float4(0.25f, 0.0f, 0.75f, 1.0f).w == expectedB.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_191 = false;
|
||||
}
|
||||
float4 _192 = 0.0f.xxxx;
|
||||
if (_191)
|
||||
{
|
||||
_192 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_192 = _10_colorRed;
|
||||
}
|
||||
return _192;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
101
tests/sksl/intrinsics/Modf.hlsl
Normal file
101
tests/sksl/intrinsics/Modf.hlsl
Normal file
@ -0,0 +1,101 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 value = float4(2.5f, -2.5f, 8.0f, -0.125f);
|
||||
float4 expectedWhole = float4(2.0f, -2.0f, 8.0f, 0.0f);
|
||||
float4 expectedFraction = float4(0.5f, -0.5f, 0.0f, -0.125f);
|
||||
bool4 ok = bool4(false, false, false, false);
|
||||
float4 whole = 0.0f.xxxx;
|
||||
float _55 = 0.0f;
|
||||
float _48 = modf(value.x, _55);
|
||||
whole.x = _55;
|
||||
float4 fraction = 0.0f.xxxx;
|
||||
fraction.x = _48;
|
||||
bool _66 = false;
|
||||
if (whole.x == 2.0f)
|
||||
{
|
||||
_66 = fraction.x == 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_66 = false;
|
||||
}
|
||||
ok.x = _66;
|
||||
float2 _72 = 0.0f.xx;
|
||||
float2 _69 = modf(value.xy, _72);
|
||||
whole = float4(_72.x, _72.y, whole.z, whole.w);
|
||||
fraction = float4(_69.x, _69.y, fraction.z, fraction.w);
|
||||
bool _91 = false;
|
||||
if (all(bool2(whole.xy.x == float2(2.0f, -2.0f).x, whole.xy.y == float2(2.0f, -2.0f).y)))
|
||||
{
|
||||
_91 = all(bool2(fraction.xy.x == float2(0.5f, -0.5f).x, fraction.xy.y == float2(0.5f, -0.5f).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
ok.y = _91;
|
||||
float3 _98 = 0.0f.xxx;
|
||||
float3 _94 = modf(value.xyz, _98);
|
||||
whole = float4(_98.x, _98.y, _98.z, whole.w);
|
||||
fraction = float4(_94.x, _94.y, _94.z, fraction.w);
|
||||
bool _118 = false;
|
||||
if (all(bool3(whole.xyz.x == float3(2.0f, -2.0f, 8.0f).x, whole.xyz.y == float3(2.0f, -2.0f, 8.0f).y, whole.xyz.z == float3(2.0f, -2.0f, 8.0f).z)))
|
||||
{
|
||||
_118 = all(bool3(fraction.xyz.x == float3(0.5f, -0.5f, 0.0f).x, fraction.xyz.y == float3(0.5f, -0.5f, 0.0f).y, fraction.xyz.z == float3(0.5f, -0.5f, 0.0f).z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_118 = false;
|
||||
}
|
||||
ok.z = _118;
|
||||
float4 _121 = modf(value, whole);
|
||||
fraction = _121;
|
||||
bool _133 = false;
|
||||
if (all(bool4(whole.x == expectedWhole.x, whole.y == expectedWhole.y, whole.z == expectedWhole.z, whole.w == expectedWhole.w)))
|
||||
{
|
||||
_133 = all(bool4(fraction.x == expectedFraction.x, fraction.y == expectedFraction.y, fraction.z == expectedFraction.z, fraction.w == expectedFraction.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_133 = false;
|
||||
}
|
||||
ok.w = _133;
|
||||
float4 _138 = 0.0f.xxxx;
|
||||
if (all(ok))
|
||||
{
|
||||
_138 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_138 = _10_colorRed;
|
||||
}
|
||||
return _138;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Normalize.hlsl
Normal file
109
tests/sksl/intrinsics/Normalize.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedVec = float4(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
bool _52 = false;
|
||||
if (sign(_10_inputVal.x) == expectedVec.x)
|
||||
{
|
||||
float2 _43 = normalize(_10_inputVal.xy);
|
||||
_52 = all(bool2(_43.x == expectedVec.xy.x, _43.y == expectedVec.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_52 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_52)
|
||||
{
|
||||
float3 _55 = normalize(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_55.x == expectedVec.xyz.x, _55.y == expectedVec.xyz.y, _55.z == expectedVec.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _75 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = normalize(_10_inputVal);
|
||||
_75 = all(bool4(_68.x == expectedVec.x, _68.y == expectedVec.y, _68.z == expectedVec.z, _68.w == expectedVec.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_75 = false;
|
||||
}
|
||||
bool _81 = false;
|
||||
if (_75)
|
||||
{
|
||||
_81 = 1.0f == expectedVec.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_81 = false;
|
||||
}
|
||||
bool _89 = false;
|
||||
if (_81)
|
||||
{
|
||||
_89 = all(bool2(float2(0.0f, 1.0f).x == expectedVec.yx.x, float2(0.0f, 1.0f).y == expectedVec.yx.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_89 = false;
|
||||
}
|
||||
bool _97 = false;
|
||||
if (_89)
|
||||
{
|
||||
_97 = all(bool3(float3(0.0f, 1.0f, 0.0f).x == expectedVec.zxy.x, float3(0.0f, 1.0f, 0.0f).y == expectedVec.zxy.y, float3(0.0f, 1.0f, 0.0f).z == expectedVec.zxy.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_97 = false;
|
||||
}
|
||||
bool _103 = false;
|
||||
if (_97)
|
||||
{
|
||||
_103 = all(bool4(float4(1.0f, 0.0f, 0.0f, 0.0f).x == expectedVec.x, float4(1.0f, 0.0f, 0.0f, 0.0f).y == expectedVec.y, float4(1.0f, 0.0f, 0.0f, 0.0f).z == expectedVec.z, float4(1.0f, 0.0f, 0.0f, 0.0f).w == expectedVec.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_103 = false;
|
||||
}
|
||||
float4 _104 = 0.0f.xxxx;
|
||||
if (_103)
|
||||
{
|
||||
_104 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_104 = _10_colorRed;
|
||||
}
|
||||
return _104;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
93
tests/sksl/intrinsics/Not.hlsl
Normal file
93
tests/sksl/intrinsics/Not.hlsl
Normal file
@ -0,0 +1,93 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputH4 : packoffset(c0);
|
||||
float4 _10_expectedH4 : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool4 inputVal = bool4(_10_inputH4.x != 0.0f, _10_inputH4.y != 0.0f, _10_inputH4.z != 0.0f, _10_inputH4.w != 0.0f);
|
||||
bool4 expected = bool4(_10_expectedH4.x != 0.0f, _10_expectedH4.y != 0.0f, _10_expectedH4.z != 0.0f, _10_expectedH4.w != 0.0f);
|
||||
bool2 _57 = bool2(!inputVal.xy.x, !inputVal.xy.y);
|
||||
bool _75 = false;
|
||||
if (all(bool2(_57.x == expected.xy.x, _57.y == expected.xy.y)))
|
||||
{
|
||||
bool3 _67 = bool3(!inputVal.xyz.x, !inputVal.xyz.y, !inputVal.xyz.z);
|
||||
_75 = all(bool3(_67.x == expected.xyz.x, _67.y == expected.xyz.y, _67.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_75 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_75)
|
||||
{
|
||||
bool4 _78 = bool4(!inputVal.x, !inputVal.y, !inputVal.z, !inputVal.w);
|
||||
_83 = all(bool4(_78.x == expected.x, _78.y == expected.y, _78.z == expected.z, _78.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _92 = false;
|
||||
if (_83)
|
||||
{
|
||||
_92 = all(bool2(bool2(false, true).x == expected.xy.x, bool2(false, true).y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_92 = false;
|
||||
}
|
||||
bool _100 = false;
|
||||
if (_92)
|
||||
{
|
||||
_100 = all(bool3(bool3(false, true, false).x == expected.xyz.x, bool3(false, true, false).y == expected.xyz.y, bool3(false, true, false).z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = false;
|
||||
}
|
||||
bool _107 = false;
|
||||
if (_100)
|
||||
{
|
||||
_107 = all(bool4(bool4(false, true, false, true).x == expected.x, bool4(false, true, false, true).y == expected.y, bool4(false, true, false, true).z == expected.z, bool4(false, true, false, true).w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_107 = false;
|
||||
}
|
||||
float4 _108 = 0.0f.xxxx;
|
||||
if (_107)
|
||||
{
|
||||
_108 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = _10_colorRed;
|
||||
}
|
||||
return _108;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
44
tests/sksl/intrinsics/NotEqual.hlsl
Normal file
44
tests/sksl/intrinsics/NotEqual.hlsl
Normal file
@ -0,0 +1,44 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_a : packoffset(c0);
|
||||
float4 _10_b : packoffset(c1);
|
||||
uint2 _10_c : packoffset(c2);
|
||||
uint2 _10_d : packoffset(c2.z);
|
||||
int3 _10_e : packoffset(c3);
|
||||
int3 _10_f : packoffset(c4);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
bool4 expectFFTT = bool4(false, false, true, true);
|
||||
bool4 expectTTFF = bool4(true, true, false, false);
|
||||
sk_FragColor.x = float(int(bool4(_10_a.x != _10_b.x, _10_a.y != _10_b.y, _10_a.z != _10_b.z, _10_a.w != _10_b.w).x));
|
||||
sk_FragColor.y = float(int(bool2(_10_c.x != _10_d.x, _10_c.y != _10_d.y).y));
|
||||
sk_FragColor.z = float(int(bool3(_10_e.x != _10_f.x, _10_e.y != _10_f.y, _10_e.z != _10_f.z).z));
|
||||
bool _73 = false;
|
||||
if (any(expectTTFF))
|
||||
{
|
||||
_73 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = any(expectFFTT);
|
||||
}
|
||||
sk_FragColor.w = float(int(_73));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
138
tests/sksl/intrinsics/OuterProduct.hlsl
Normal file
138
tests/sksl/intrinsics/OuterProduct.hlsl
Normal file
@ -0,0 +1,138 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
row_major float2x2 _10_testMatrix2x2 : packoffset(c2);
|
||||
row_major float3x3 _10_testMatrix3x3 : packoffset(c4);
|
||||
float4 _10_testInputs : packoffset(c7);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _27)
|
||||
{
|
||||
float2 c12 = float2(1.0f, 2.0f);
|
||||
float2x2 _34 = float2x2(_10_testMatrix2x2[0] * _10_testMatrix2x2[1].x, _10_testMatrix2x2[0] * _10_testMatrix2x2[1].y);
|
||||
float2x2 _53 = float2x2(float2(3.0f, 6.0f), float2(4.0f, 8.0f));
|
||||
float2 _55 = _34[0];
|
||||
float2 _56 = _53[0];
|
||||
float2 _59 = _34[1];
|
||||
float2 _60 = _53[1];
|
||||
bool _100 = false;
|
||||
if (all(bool2(_55.x == _56.x, _55.y == _56.y)) && all(bool2(_59.x == _60.x, _59.y == _60.y)))
|
||||
{
|
||||
float3x3 _66 = float3x3(_10_testMatrix3x3[0] * _10_testMatrix3x3[1].x, _10_testMatrix3x3[0] * _10_testMatrix3x3[1].y, _10_testMatrix3x3[0] * _10_testMatrix3x3[1].z);
|
||||
float3x3 _84 = float3x3(float3(4.0f, 8.0f, 12.0f), float3(5.0f, 10.0f, 15.0f), float3(6.0f, 12.0f, 18.0f));
|
||||
float3 _86 = _66[0];
|
||||
float3 _87 = _84[0];
|
||||
float3 _90 = _66[1];
|
||||
float3 _91 = _84[1];
|
||||
float3 _95 = _66[2];
|
||||
float3 _96 = _84[2];
|
||||
_100 = (all(bool3(_86.x == _87.x, _86.y == _87.y, _86.z == _87.z)) && all(bool3(_90.x == _91.x, _90.y == _91.y, _90.z == _91.z))) && all(bool3(_95.x == _96.x, _95.y == _96.y, _95.z == _96.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = false;
|
||||
}
|
||||
bool _129 = false;
|
||||
if (_100)
|
||||
{
|
||||
float3x2 _103 = float3x2(_10_testMatrix2x2[0] * _10_testMatrix3x3[1].x, _10_testMatrix2x2[0] * _10_testMatrix3x3[1].y, _10_testMatrix2x2[0] * _10_testMatrix3x3[1].z);
|
||||
float3x2 _114 = float3x2(float2(4.0f, 8.0f), float2(5.0f, 10.0f), float2(6.0f, 12.0f));
|
||||
float2 _115 = _103[0];
|
||||
float2 _116 = _114[0];
|
||||
float2 _119 = _103[1];
|
||||
float2 _120 = _114[1];
|
||||
float2 _124 = _103[2];
|
||||
float2 _125 = _114[2];
|
||||
_129 = (all(bool2(_115.x == _116.x, _115.y == _116.y)) && all(bool2(_119.x == _120.x, _119.y == _120.y))) && all(bool2(_124.x == _125.x, _124.y == _125.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_129 = false;
|
||||
}
|
||||
bool _170 = false;
|
||||
if (_129)
|
||||
{
|
||||
float4x4 _132 = float4x4(_10_testInputs * float4(1.0f, 0.0f, 0.0f, 2.0f).x, _10_testInputs * float4(1.0f, 0.0f, 0.0f, 2.0f).y, _10_testInputs * float4(1.0f, 0.0f, 0.0f, 2.0f).z, _10_testInputs * float4(1.0f, 0.0f, 0.0f, 2.0f).w);
|
||||
float4x4 _149 = float4x4(float4(-1.25f, 0.0f, 0.75f, 2.25f), 0.0f.xxxx, 0.0f.xxxx, float4(-2.5f, 0.0f, 1.5f, 4.5f));
|
||||
float4 _151 = _132[0];
|
||||
float4 _152 = _149[0];
|
||||
float4 _155 = _132[1];
|
||||
float4 _156 = _149[1];
|
||||
float4 _160 = _132[2];
|
||||
float4 _161 = _149[2];
|
||||
float4 _165 = _132[3];
|
||||
float4 _166 = _149[3];
|
||||
_170 = ((all(bool4(_151.x == _152.x, _151.y == _152.y, _151.z == _152.z, _151.w == _152.w)) && all(bool4(_155.x == _156.x, _155.y == _156.y, _155.z == _156.z, _155.w == _156.w))) && all(bool4(_160.x == _161.x, _160.y == _161.y, _160.z == _161.z, _160.w == _161.w))) && all(bool4(_165.x == _166.x, _165.y == _166.y, _165.z == _166.z, _165.w == _166.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_170 = false;
|
||||
}
|
||||
bool _190 = false;
|
||||
if (_170)
|
||||
{
|
||||
float2x4 _173 = float2x4(_10_testInputs * c12.x, _10_testInputs * c12.y);
|
||||
float2x4 _180 = float2x4(float4(-1.25f, 0.0f, 0.75f, 2.25f), float4(-2.5f, 0.0f, 1.5f, 4.5f));
|
||||
float4 _181 = _173[0];
|
||||
float4 _182 = _180[0];
|
||||
float4 _185 = _173[1];
|
||||
float4 _186 = _180[1];
|
||||
_190 = all(bool4(_181.x == _182.x, _181.y == _182.y, _181.z == _182.z, _181.w == _182.w)) && all(bool4(_185.x == _186.x, _185.y == _186.y, _185.z == _186.z, _185.w == _186.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_190 = false;
|
||||
}
|
||||
bool _222 = false;
|
||||
if (_190)
|
||||
{
|
||||
float4x2 _193 = float4x2(c12 * _10_testInputs.x, c12 * _10_testInputs.y, c12 * _10_testInputs.z, c12 * _10_testInputs.w);
|
||||
float4x2 _202 = float4x2(float2(-1.25f, -2.5f), 0.0f.xx, float2(0.75f, 1.5f), float2(2.25f, 4.5f));
|
||||
float2 _203 = _193[0];
|
||||
float2 _204 = _202[0];
|
||||
float2 _207 = _193[1];
|
||||
float2 _208 = _202[1];
|
||||
float2 _212 = _193[2];
|
||||
float2 _213 = _202[2];
|
||||
float2 _217 = _193[3];
|
||||
float2 _218 = _202[3];
|
||||
_222 = ((all(bool2(_203.x == _204.x, _203.y == _204.y)) && all(bool2(_207.x == _208.x, _207.y == _208.y))) && all(bool2(_212.x == _213.x, _212.y == _213.y))) && all(bool2(_217.x == _218.x, _217.y == _218.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_222 = false;
|
||||
}
|
||||
float4 _223 = 0.0f.xxxx;
|
||||
if (_222)
|
||||
{
|
||||
_223 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_223 = _10_colorRed;
|
||||
}
|
||||
return _223;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _23 = 0.0f.xx;
|
||||
sk_FragColor = main(_23);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
91
tests/sksl/intrinsics/Pack.hlsl
Normal file
91
tests/sksl/intrinsics/Pack.hlsl
Normal file
@ -0,0 +1,91 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float2 _10_a : packoffset(c0);
|
||||
float4 _10_b : packoffset(c1);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
uint spvPackHalf2x16(float2 value)
|
||||
{
|
||||
uint2 Packed = f32tof16(value);
|
||||
return Packed.x | (Packed.y << 16);
|
||||
}
|
||||
|
||||
float2 spvUnpackHalf2x16(uint value)
|
||||
{
|
||||
return f16tof32(uint2(value & 0xffff, value >> 16));
|
||||
}
|
||||
|
||||
uint spvPackUnorm4x8(float4 value)
|
||||
{
|
||||
uint4 Packed = uint4(round(saturate(value) * 255.0));
|
||||
return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24);
|
||||
}
|
||||
|
||||
float4 spvUnpackUnorm4x8(uint value)
|
||||
{
|
||||
uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24);
|
||||
return float4(Packed) / 255.0;
|
||||
}
|
||||
|
||||
uint spvPackSnorm4x8(float4 value)
|
||||
{
|
||||
int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff;
|
||||
return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24));
|
||||
}
|
||||
|
||||
float4 spvUnpackSnorm4x8(uint value)
|
||||
{
|
||||
int SignedValue = int(value);
|
||||
int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24;
|
||||
return clamp(float4(Packed) / 127.0, -1.0, 1.0);
|
||||
}
|
||||
|
||||
uint spvPackUnorm2x16(float2 value)
|
||||
{
|
||||
uint2 Packed = uint2(round(saturate(value) * 65535.0));
|
||||
return Packed.x | (Packed.y << 16);
|
||||
}
|
||||
|
||||
float2 spvUnpackUnorm2x16(uint value)
|
||||
{
|
||||
uint2 Packed = uint2(value & 0xffff, value >> 16);
|
||||
return float2(Packed) / 65535.0;
|
||||
}
|
||||
|
||||
uint spvPackSnorm2x16(float2 value)
|
||||
{
|
||||
int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff;
|
||||
return uint(Packed.x | (Packed.y << 16));
|
||||
}
|
||||
|
||||
float2 spvUnpackSnorm2x16(uint value)
|
||||
{
|
||||
int SignedValue = int(value);
|
||||
int2 Packed = int2(SignedValue << 16, SignedValue) >> 16;
|
||||
return clamp(float2(Packed) / 32767.0, -1.0, 1.0);
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = float(spvPackHalf2x16(_10_a));
|
||||
sk_FragColor.x = float(spvPackUnorm2x16(_10_a));
|
||||
sk_FragColor.x = float(spvPackSnorm2x16(_10_a));
|
||||
sk_FragColor.x = float(spvPackUnorm4x8(_10_b));
|
||||
sk_FragColor.x = float(spvPackSnorm4x8(_10_b));
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
68
tests/sksl/intrinsics/PackUnorm2x16.hlsl
Normal file
68
tests/sksl/intrinsics/PackUnorm2x16.hlsl
Normal file
@ -0,0 +1,68 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_colorGreen : packoffset(c0);
|
||||
float4 _10_colorRed : packoffset(c1);
|
||||
float4 _10_testInputs : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
uint spvPackUnorm2x16(float2 value)
|
||||
{
|
||||
uint2 Packed = uint2(round(saturate(value) * 65535.0));
|
||||
return Packed.x | (Packed.y << 16);
|
||||
}
|
||||
|
||||
float2 spvUnpackUnorm2x16(uint value)
|
||||
{
|
||||
uint2 Packed = uint2(value & 0xffff, value >> 16);
|
||||
return float2(Packed) / 65535.0;
|
||||
}
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
uint xy = spvPackUnorm2x16(_10_testInputs.xy);
|
||||
uint zw = spvPackUnorm2x16(_10_testInputs.zw);
|
||||
float2 tolerance = 0.015625f.xx;
|
||||
float2 _47 = abs(spvUnpackUnorm2x16(xy));
|
||||
bool _64 = false;
|
||||
if (all(bool2(_47.x < tolerance.x, _47.y < tolerance.y)))
|
||||
{
|
||||
float2 _56 = abs(spvUnpackUnorm2x16(zw) - float2(0.75f, 1.0f));
|
||||
_64 = all(bool2(_56.x < tolerance.x, _56.y < tolerance.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_64 = false;
|
||||
}
|
||||
float4 _65 = 0.0f.xxxx;
|
||||
if (_64)
|
||||
{
|
||||
_65 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = _10_colorRed;
|
||||
}
|
||||
return _65;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
110
tests/sksl/intrinsics/Pow.hlsl
Normal file
110
tests/sksl/intrinsics/Pow.hlsl
Normal file
@ -0,0 +1,110 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(-1.5625f, 0.0f, 0.75f, 3.375f);
|
||||
float4 exponents = float4(2.0f, 3.0f, 1.0f, 1.5f);
|
||||
bool _61 = false;
|
||||
if (pow(_10_testInputs.x, 2.0f) == expected.x)
|
||||
{
|
||||
float2 _51 = pow(_10_testInputs.xy, float2(2.0f, 3.0f));
|
||||
_61 = all(bool2(_51.x == expected.xy.x, _51.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_61 = false;
|
||||
}
|
||||
bool _75 = false;
|
||||
if (_61)
|
||||
{
|
||||
float3 _64 = pow(_10_testInputs.xyz, float3(2.0f, 3.0f, 1.0f));
|
||||
_75 = all(bool3(_64.x == expected.xyz.x, _64.y == expected.xyz.y, _64.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_75 = false;
|
||||
}
|
||||
bool _86 = false;
|
||||
if (_75)
|
||||
{
|
||||
float4 _78 = pow(_10_testInputs, exponents);
|
||||
_86 = all(bool4(_78.x == expected.x, _78.y == expected.y, _78.z == expected.z, _78.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_86 = false;
|
||||
}
|
||||
bool _93 = false;
|
||||
if (_86)
|
||||
{
|
||||
_93 = 1.5625f == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_93 = false;
|
||||
}
|
||||
bool _101 = false;
|
||||
if (_93)
|
||||
{
|
||||
_101 = all(bool2(float2(1.5625f, 0.0f).x == expected.xy.x, float2(1.5625f, 0.0f).y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_101 = false;
|
||||
}
|
||||
bool _109 = false;
|
||||
if (_101)
|
||||
{
|
||||
_109 = all(bool3(float3(1.5625f, 0.0f, 0.75f).x == expected.xyz.x, float3(1.5625f, 0.0f, 0.75f).y == expected.xyz.y, float3(1.5625f, 0.0f, 0.75f).z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = false;
|
||||
}
|
||||
bool _116 = false;
|
||||
if (_109)
|
||||
{
|
||||
_116 = all(bool4(float4(1.5625f, 0.0f, 0.75f, 3.375f).x == expected.x, float4(1.5625f, 0.0f, 0.75f, 3.375f).y == expected.y, float4(1.5625f, 0.0f, 0.75f, 3.375f).z == expected.z, float4(1.5625f, 0.0f, 0.75f, 3.375f).w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_116 = false;
|
||||
}
|
||||
float4 _117 = 0.0f.xxxx;
|
||||
if (_116)
|
||||
{
|
||||
_117 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_117 = _10_colorRed;
|
||||
}
|
||||
return _117;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Radians.hlsl
Normal file
109
tests/sksl/intrinsics/Radians.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_inputVal : packoffset(c0);
|
||||
float4 _10_expected : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
bool _51 = false;
|
||||
if (radians(_10_inputVal.x) == _10_expected.x)
|
||||
{
|
||||
float2 _41 = radians(_10_inputVal.xy);
|
||||
_51 = all(bool2(_41.x == _10_expected.xy.x, _41.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _65 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = radians(_10_inputVal.xyz);
|
||||
_65 = all(bool3(_54.x == _10_expected.xyz.x, _54.y == _10_expected.xyz.y, _54.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_65 = false;
|
||||
}
|
||||
bool _76 = false;
|
||||
if (_65)
|
||||
{
|
||||
float4 _68 = radians(_10_inputVal);
|
||||
_76 = all(bool4(_68.x == _10_expected.x, _68.y == _10_expected.y, _68.z == _10_expected.z, _68.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_76 = false;
|
||||
}
|
||||
bool _83 = false;
|
||||
if (_76)
|
||||
{
|
||||
_83 = 0.0f == _10_expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_83 = false;
|
||||
}
|
||||
bool _91 = false;
|
||||
if (_83)
|
||||
{
|
||||
_91 = all(bool2(0.0f.xx.x == _10_expected.xy.x, 0.0f.xx.y == _10_expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_91 = false;
|
||||
}
|
||||
bool _100 = false;
|
||||
if (_91)
|
||||
{
|
||||
_100 = all(bool3(0.0f.xxx.x == _10_expected.xyz.x, 0.0f.xxx.y == _10_expected.xyz.y, 0.0f.xxx.z == _10_expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = false;
|
||||
}
|
||||
bool _108 = false;
|
||||
if (_100)
|
||||
{
|
||||
_108 = all(bool4(0.0f.xxxx.x == _10_expected.x, 0.0f.xxxx.y == _10_expected.y, 0.0f.xxxx.z == _10_expected.z, 0.0f.xxxx.w == _10_expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_108 = false;
|
||||
}
|
||||
float4 _109 = 0.0f.xxxx;
|
||||
if (_108)
|
||||
{
|
||||
_109 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = _10_colorRed;
|
||||
}
|
||||
return _109;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
118
tests/sksl/intrinsics/Reflect.hlsl
Normal file
118
tests/sksl/intrinsics/Reflect.hlsl
Normal file
@ -0,0 +1,118 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_I : packoffset(c0);
|
||||
float4 _10_N : packoffset(c1);
|
||||
float4 _10_colorGreen : packoffset(c2);
|
||||
float4 _10_colorRed : packoffset(c3);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float spvReflect(float i, float n)
|
||||
{
|
||||
return i - 2.0 * dot(n, i) * n;
|
||||
}
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float expectedX = -49.0f;
|
||||
float2 expectedXY = float2(-169.0f, 202.0f);
|
||||
float3 expectedXYZ = float3(-379.0f, 454.0f, -529.0f);
|
||||
float4 expectedXYZW = float4(-699.0f, 838.0f, -977.0f, 1116.0f);
|
||||
bool _74 = false;
|
||||
if (spvReflect(_10_I.x, _10_N.x) == expectedX)
|
||||
{
|
||||
float2 _63 = reflect(_10_I.xy, _10_N.xy);
|
||||
_74 = all(bool2(_63.x == expectedXY.x, _63.y == expectedXY.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_74 = false;
|
||||
}
|
||||
bool _88 = false;
|
||||
if (_74)
|
||||
{
|
||||
float3 _77 = reflect(_10_I.xyz, _10_N.xyz);
|
||||
_88 = all(bool3(_77.x == expectedXYZ.x, _77.y == expectedXYZ.y, _77.z == expectedXYZ.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = false;
|
||||
}
|
||||
bool _100 = false;
|
||||
if (_88)
|
||||
{
|
||||
float4 _91 = reflect(_10_I, _10_N);
|
||||
_100 = all(bool4(_91.x == expectedXYZW.x, _91.y == expectedXYZW.y, _91.z == expectedXYZW.z, _91.w == expectedXYZW.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_100 = false;
|
||||
}
|
||||
bool _105 = false;
|
||||
if (_100)
|
||||
{
|
||||
_105 = (-49.0f) == expectedX;
|
||||
}
|
||||
else
|
||||
{
|
||||
_105 = false;
|
||||
}
|
||||
bool _111 = false;
|
||||
if (_105)
|
||||
{
|
||||
_111 = all(bool2(float2(-169.0f, 202.0f).x == expectedXY.x, float2(-169.0f, 202.0f).y == expectedXY.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_111 = false;
|
||||
}
|
||||
bool _117 = false;
|
||||
if (_111)
|
||||
{
|
||||
_117 = all(bool3(float3(-379.0f, 454.0f, -529.0f).x == expectedXYZ.x, float3(-379.0f, 454.0f, -529.0f).y == expectedXYZ.y, float3(-379.0f, 454.0f, -529.0f).z == expectedXYZ.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_117 = false;
|
||||
}
|
||||
bool _123 = false;
|
||||
if (_117)
|
||||
{
|
||||
_123 = all(bool4(float4(-699.0f, 838.0f, -977.0f, 1116.0f).x == expectedXYZW.x, float4(-699.0f, 838.0f, -977.0f, 1116.0f).y == expectedXYZW.y, float4(-699.0f, 838.0f, -977.0f, 1116.0f).z == expectedXYZW.z, float4(-699.0f, 838.0f, -977.0f, 1116.0f).w == expectedXYZW.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_123 = false;
|
||||
}
|
||||
float4 _124 = 0.0f.xxxx;
|
||||
if (_123)
|
||||
{
|
||||
_124 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_124 = _10_colorRed;
|
||||
}
|
||||
return _124;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
48
tests/sksl/intrinsics/Refract.hlsl
Normal file
48
tests/sksl/intrinsics/Refract.hlsl
Normal file
@ -0,0 +1,48 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float _10_a : packoffset(c0);
|
||||
float _10_b : packoffset(c0.y);
|
||||
float _10_c : packoffset(c0.z);
|
||||
float4 _10_d : packoffset(c1);
|
||||
float4 _10_e : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float spvRefract(float i, float n, float eta)
|
||||
{
|
||||
float NoI = n * i;
|
||||
float NoI2 = NoI * NoI;
|
||||
float k = 1.0 - eta * eta * (1.0 - NoI2);
|
||||
if (k < 0.0)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return eta * i - (eta * NoI + sqrt(k)) * n;
|
||||
}
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
sk_FragColor.x = spvRefract(_10_a, _10_b, _10_c);
|
||||
sk_FragColor = refract(_10_d, _10_e, _10_c);
|
||||
sk_FragColor = float4(float2(0.5f, -0.866025388240814208984375f).x, float2(0.5f, -0.866025388240814208984375f).y, sk_FragColor.z, sk_FragColor.w);
|
||||
sk_FragColor = float4(float3(0.5f, 0.0f, -0.866025388240814208984375f).x, float3(0.5f, 0.0f, -0.866025388240814208984375f).y, float3(0.5f, 0.0f, -0.866025388240814208984375f).z, sk_FragColor.w);
|
||||
sk_FragColor = float4(0.5f, 0.0f, 0.0f, -0.866025388240814208984375f);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
73
tests/sksl/intrinsics/Round.hlsl
Normal file
73
tests/sksl/intrinsics/Round.hlsl
Normal file
@ -0,0 +1,73 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedA = float4(-1.0f, 0.0f, 1.0f, 2.0f);
|
||||
bool _51 = false;
|
||||
if (round(_10_testInputs.x) == (-1.0f))
|
||||
{
|
||||
float2 _43 = round(_10_testInputs.xy);
|
||||
_51 = all(bool2(_43.x == float2(-1.0f, 0.0f).x, _43.y == float2(-1.0f, 0.0f).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _63 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = round(_10_testInputs.xyz);
|
||||
_63 = all(bool3(_54.x == float3(-1.0f, 0.0f, 1.0f).x, _54.y == float3(-1.0f, 0.0f, 1.0f).y, _54.z == float3(-1.0f, 0.0f, 1.0f).z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_63 = false;
|
||||
}
|
||||
bool _73 = false;
|
||||
if (_63)
|
||||
{
|
||||
float4 _66 = round(_10_testInputs);
|
||||
_73 = all(bool4(_66.x == expectedA.x, _66.y == expectedA.y, _66.z == expectedA.z, _66.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = false;
|
||||
}
|
||||
float4 _74 = 0.0f.xxxx;
|
||||
if (_73)
|
||||
{
|
||||
_74 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_74 = _10_colorRed;
|
||||
}
|
||||
return _74;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
73
tests/sksl/intrinsics/RoundEven.hlsl
Normal file
73
tests/sksl/intrinsics/RoundEven.hlsl
Normal file
@ -0,0 +1,73 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expectedA = float4(-1.0f, 0.0f, 1.0f, 2.0f);
|
||||
bool _51 = false;
|
||||
if (round(_10_testInputs.x) == (-1.0f))
|
||||
{
|
||||
float2 _43 = round(_10_testInputs.xy);
|
||||
_51 = all(bool2(_43.x == float2(-1.0f, 0.0f).x, _43.y == float2(-1.0f, 0.0f).y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_51 = false;
|
||||
}
|
||||
bool _63 = false;
|
||||
if (_51)
|
||||
{
|
||||
float3 _54 = round(_10_testInputs.xyz);
|
||||
_63 = all(bool3(_54.x == float3(-1.0f, 0.0f, 1.0f).x, _54.y == float3(-1.0f, 0.0f, 1.0f).y, _54.z == float3(-1.0f, 0.0f, 1.0f).z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_63 = false;
|
||||
}
|
||||
bool _73 = false;
|
||||
if (_63)
|
||||
{
|
||||
float4 _66 = round(_10_testInputs);
|
||||
_73 = all(bool4(_66.x == expectedA.x, _66.y == expectedA.y, _66.z == expectedA.z, _66.w == expectedA.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_73 = false;
|
||||
}
|
||||
float4 _74 = 0.0f.xxxx;
|
||||
if (_73)
|
||||
{
|
||||
_74 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_74 = _10_colorRed;
|
||||
}
|
||||
return _74;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
109
tests/sksl/intrinsics/Saturate.hlsl
Normal file
109
tests/sksl/intrinsics/Saturate.hlsl
Normal file
@ -0,0 +1,109 @@
|
||||
cbuffer _UniformBuffer : register(b0, space0)
|
||||
{
|
||||
float4 _10_testInputs : packoffset(c0);
|
||||
float4 _10_colorGreen : packoffset(c1);
|
||||
float4 _10_colorRed : packoffset(c2);
|
||||
};
|
||||
|
||||
|
||||
static float4 sk_FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 sk_FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main(float2 _24)
|
||||
{
|
||||
float4 expected = float4(0.0f, 0.0f, 0.75f, 1.0f);
|
||||
bool _55 = false;
|
||||
if (clamp(_10_testInputs.x, 0.0f, 1.0f) == expected.x)
|
||||
{
|
||||
float2 _44 = clamp(_10_testInputs.xy, 0.0f.xx, 1.0f.xx);
|
||||
_55 = all(bool2(_44.x == expected.xy.x, _44.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_55 = false;
|
||||
}
|
||||
bool _70 = false;
|
||||
if (_55)
|
||||
{
|
||||
float3 _58 = clamp(_10_testInputs.xyz, 0.0f.xxx, 1.0f.xxx);
|
||||
_70 = all(bool3(_58.x == expected.xyz.x, _58.y == expected.xyz.y, _58.z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_70 = false;
|
||||
}
|
||||
bool _82 = false;
|
||||
if (_70)
|
||||
{
|
||||
float4 _73 = clamp(_10_testInputs, 0.0f.xxxx, 1.0f.xxxx);
|
||||
_82 = all(bool4(_73.x == expected.x, _73.y == expected.y, _73.z == expected.z, _73.w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_82 = false;
|
||||
}
|
||||
bool _88 = false;
|
||||
if (_82)
|
||||
{
|
||||
_88 = 0.0f == expected.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
_88 = false;
|
||||
}
|
||||
bool _95 = false;
|
||||
if (_88)
|
||||
{
|
||||
_95 = all(bool2(0.0f.xx.x == expected.xy.x, 0.0f.xx.y == expected.xy.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
_95 = false;
|
||||
}
|
||||
bool _103 = false;
|
||||
if (_95)
|
||||
{
|
||||
_103 = all(bool3(float3(0.0f, 0.0f, 0.75f).x == expected.xyz.x, float3(0.0f, 0.0f, 0.75f).y == expected.xyz.y, float3(0.0f, 0.0f, 0.75f).z == expected.xyz.z));
|
||||
}
|
||||
else
|
||||
{
|
||||
_103 = false;
|
||||
}
|
||||
bool _109 = false;
|
||||
if (_103)
|
||||
{
|
||||
_109 = all(bool4(float4(0.0f, 0.0f, 0.75f, 1.0f).x == expected.x, float4(0.0f, 0.0f, 0.75f, 1.0f).y == expected.y, float4(0.0f, 0.0f, 0.75f, 1.0f).z == expected.z, float4(0.0f, 0.0f, 0.75f, 1.0f).w == expected.w));
|
||||
}
|
||||
else
|
||||
{
|
||||
_109 = false;
|
||||
}
|
||||
float4 _110 = 0.0f.xxxx;
|
||||
if (_109)
|
||||
{
|
||||
_110 = _10_colorGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
_110 = _10_colorRed;
|
||||
}
|
||||
return _110;
|
||||
}
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float2 _20 = 0.0f.xx;
|
||||
sk_FragColor = main(_20);
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.sk_FragColor = sk_FragColor;
|
||||
return stage_output;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user