Add more dm tests for the comma operator.
Change-Id: I37a95fd95c23a91c3510f922bab0569093e612a5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364604 Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
58a7d8520b
commit
5a956ce54b
@ -301,6 +301,7 @@ sksl_shared_tests = [
|
||||
"/sksl/shared/Caps.sksl",
|
||||
"/sksl/shared/CastsRoundTowardZero.sksl",
|
||||
"/sksl/shared/Clockwise.sksl",
|
||||
"/sksl/shared/CommaMixedTypes.sksl",
|
||||
"/sksl/shared/CommaSideEffects.sksl",
|
||||
"/sksl/shared/ComplexDelete.sksl",
|
||||
"/sksl/shared/ConstArray.sksl",
|
||||
@ -341,7 +342,6 @@ sksl_shared_tests = [
|
||||
"/sksl/shared/InterfaceBlockNamedArray.sksl",
|
||||
"/sksl/shared/MatricesFloat.sksl",
|
||||
"/sksl/shared/MatricesHalf.sksl",
|
||||
"/sksl/shared/MixedTypeCommaOperator.sksl",
|
||||
"/sksl/shared/MultipleAssignments.sksl",
|
||||
"/sksl/shared/NegatedVectorLiteral.sksl",
|
||||
"/sksl/shared/NoFragCoordsPos.vert",
|
||||
|
10
resources/sksl/shared/CommaMixedTypes.sksl
Normal file
10
resources/sksl/shared/CommaMixedTypes.sksl
Normal file
@ -0,0 +1,10 @@
|
||||
uniform half4 colorGreen;
|
||||
|
||||
half4 main() {
|
||||
half4 result;
|
||||
result.x = (sqrt(1), colorGreen.x);
|
||||
result.y = (float2(2), colorGreen.y);
|
||||
result.z = (half3(3), colorGreen.z);
|
||||
result.w = (float2x2(4), colorGreen.w);
|
||||
return result;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
void main() {
|
||||
sk_FragColor.x = (float(true), 1);
|
||||
sk_FragColor.y = (float2(1), 1);
|
||||
sk_FragColor.z = (half3(1), 1);
|
||||
sk_FragColor.w = (float2x2(1), 1);
|
||||
}
|
@ -115,6 +115,7 @@ SKSL_TEST(SkSLIntrinsicMinFloat, "intrinsics/MinFloat.sksl")
|
||||
SKSL_TEST(SkSLIntrinsicMixFloat, "intrinsics/MixFloat.sksl")
|
||||
SKSL_TEST(SkSLIntrinsicSignFloat, "intrinsics/SignFloat.sksl")
|
||||
|
||||
SKSL_TEST(SkSLCommaMixedTypes, "shared/CommaMixedTypes.sksl")
|
||||
SKSL_TEST(SkSLCommaSideEffects, "shared/CommaSideEffects.sksl")
|
||||
SKSL_TEST(SkSLConstantIf, "shared/ConstantIf.sksl")
|
||||
SKSL_TEST(SkSLConstVariableComparison, "shared/ConstVariableComparison.sksl")
|
||||
|
94
tests/sksl/shared/CommaMixedTypes.asm.frag
Normal file
94
tests/sksl/shared/CommaMixedTypes.asm.frag
Normal file
@ -0,0 +1,94 @@
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %_entrypoint "_entrypoint" %sk_FragColor %sk_Clockwise
|
||||
OpExecutionMode %_entrypoint OriginUpperLeft
|
||||
OpName %sk_FragColor "sk_FragColor"
|
||||
OpName %sk_Clockwise "sk_Clockwise"
|
||||
OpName %_UniformBuffer "_UniformBuffer"
|
||||
OpMemberName %_UniformBuffer 0 "colorGreen"
|
||||
OpName %_entrypoint "_entrypoint"
|
||||
OpName %main "main"
|
||||
OpName %result "result"
|
||||
OpDecorate %sk_FragColor RelaxedPrecision
|
||||
OpDecorate %sk_FragColor Location 0
|
||||
OpDecorate %sk_FragColor Index 0
|
||||
OpDecorate %sk_Clockwise RelaxedPrecision
|
||||
OpDecorate %sk_Clockwise BuiltIn FrontFacing
|
||||
OpMemberDecorate %_UniformBuffer 0 Offset 0
|
||||
OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
|
||||
OpDecorate %_UniformBuffer Block
|
||||
OpDecorate %10 Binding 0
|
||||
OpDecorate %10 DescriptorSet 0
|
||||
OpDecorate %28 RelaxedPrecision
|
||||
OpDecorate %36 RelaxedPrecision
|
||||
OpDecorate %44 RelaxedPrecision
|
||||
OpDecorate %55 RelaxedPrecision
|
||||
OpDecorate %59 RelaxedPrecision
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Input_bool = OpTypePointer Input %bool
|
||||
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
|
||||
%_UniformBuffer = OpTypeStruct %v4float
|
||||
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
|
||||
%10 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%18 = OpTypeFunction %v4float
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%float_2 = OpConstant %float 2
|
||||
%34 = OpConstantComposite %v2float %float_2 %float_2
|
||||
%int_1 = OpConstant %int 1
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_3 = OpConstant %float 3
|
||||
%42 = OpConstantComposite %v3float %float_3 %float_3 %float_3
|
||||
%int_2 = OpConstant %int 2
|
||||
%float_4 = OpConstant %float 4
|
||||
%float_0 = OpConstant %float 0
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%_entrypoint = OpFunction %void None %15
|
||||
%16 = OpLabel
|
||||
%17 = OpFunctionCall %v4float %main
|
||||
OpStore %sk_FragColor %17
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %v4float None %18
|
||||
%19 = OpLabel
|
||||
%result = OpVariable %_ptr_Function_v4float Function
|
||||
%22 = OpExtInst %float %1 Sqrt %float_1
|
||||
%24 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
|
||||
%28 = OpLoad %v4float %24
|
||||
%29 = OpCompositeExtract %float %28 0
|
||||
%30 = OpAccessChain %_ptr_Function_float %result %int_0
|
||||
OpStore %30 %29
|
||||
%35 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
|
||||
%36 = OpLoad %v4float %35
|
||||
%37 = OpCompositeExtract %float %36 1
|
||||
%38 = OpAccessChain %_ptr_Function_float %result %int_1
|
||||
OpStore %38 %37
|
||||
%43 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
|
||||
%44 = OpLoad %v4float %43
|
||||
%45 = OpCompositeExtract %float %44 2
|
||||
%46 = OpAccessChain %_ptr_Function_float %result %int_2
|
||||
OpStore %46 %45
|
||||
%51 = OpCompositeConstruct %v2float %float_4 %float_0
|
||||
%52 = OpCompositeConstruct %v2float %float_0 %float_4
|
||||
%49 = OpCompositeConstruct %mat2v2float %51 %52
|
||||
%54 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
|
||||
%55 = OpLoad %v4float %54
|
||||
%56 = OpCompositeExtract %float %55 3
|
||||
%57 = OpAccessChain %_ptr_Function_float %result %int_3
|
||||
OpStore %57 %56
|
||||
%59 = OpLoad %v4float %result
|
||||
OpReturnValue %59
|
||||
OpFunctionEnd
|
11
tests/sksl/shared/CommaMixedTypes.glsl
Normal file
11
tests/sksl/shared/CommaMixedTypes.glsl
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
out vec4 sk_FragColor;
|
||||
uniform vec4 colorGreen;
|
||||
vec4 main() {
|
||||
vec4 result;
|
||||
result.x = (sqrt(1.0) , colorGreen.x);
|
||||
result.y = (vec2(2.0) , colorGreen.y);
|
||||
result.z = (vec3(3.0) , colorGreen.z);
|
||||
result.w = (mat2(4.0) , colorGreen.w);
|
||||
return result;
|
||||
}
|
23
tests/sksl/shared/CommaMixedTypes.metal
Normal file
23
tests/sksl/shared/CommaMixedTypes.metal
Normal file
@ -0,0 +1,23 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
using namespace metal;
|
||||
struct Uniforms {
|
||||
float4 colorGreen;
|
||||
};
|
||||
struct Inputs {
|
||||
};
|
||||
struct Outputs {
|
||||
float4 sk_FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Outputs _out;
|
||||
(void)_out;
|
||||
float4 result;
|
||||
result.x = (sqrt(1.0) , _uniforms.colorGreen.x);
|
||||
result.y = (float2(2.0) , _uniforms.colorGreen.y);
|
||||
result.z = (float3(3.0) , _uniforms.colorGreen.z);
|
||||
result.w = (float2x2(4.0) , _uniforms.colorGreen.w);
|
||||
_out.sk_FragColor = result;
|
||||
return _out;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %sk_FragColor %sk_Clockwise
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %sk_FragColor "sk_FragColor"
|
||||
OpName %sk_Clockwise "sk_Clockwise"
|
||||
OpName %main "main"
|
||||
OpDecorate %sk_FragColor RelaxedPrecision
|
||||
OpDecorate %sk_FragColor Location 0
|
||||
OpDecorate %sk_FragColor Index 0
|
||||
OpDecorate %sk_Clockwise RelaxedPrecision
|
||||
OpDecorate %sk_Clockwise BuiltIn FrontFacing
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Input_bool = OpTypePointer Input %bool
|
||||
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
|
||||
%void = OpTypeVoid
|
||||
%11 = OpTypeFunction %void
|
||||
%float_1 = OpConstant %float 1
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%int_0 = OpConstant %int 0
|
||||
%v2float = OpTypeVector %float 2
|
||||
%21 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%v3float = OpTypeVector %float 3
|
||||
%25 = OpConstantComposite %v3float %float_1 %float_1 %float_1
|
||||
%int_2 = OpConstant %int 2
|
||||
%float_0 = OpConstant %float 0
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%main = OpFunction %void None %11
|
||||
%12 = OpLabel
|
||||
%16 = OpConvertSToF %float %int_1
|
||||
%17 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_0
|
||||
OpStore %17 %16
|
||||
%22 = OpConvertSToF %float %int_1
|
||||
%23 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_1
|
||||
OpStore %23 %22
|
||||
%26 = OpConvertSToF %float %int_1
|
||||
%27 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_2
|
||||
OpStore %27 %26
|
||||
%31 = OpCompositeConstruct %v2float %float_1 %float_0
|
||||
%32 = OpCompositeConstruct %v2float %float_0 %float_1
|
||||
%29 = OpCompositeConstruct %mat2v2float %31 %32
|
||||
%34 = OpConvertSToF %float %int_1
|
||||
%35 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_3
|
||||
OpStore %35 %34
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,8 +0,0 @@
|
||||
|
||||
out vec4 sk_FragColor;
|
||||
void main() {
|
||||
sk_FragColor.x = float((1.0 , 1));
|
||||
sk_FragColor.y = float((vec2(1.0) , 1));
|
||||
sk_FragColor.z = float((vec3(1.0) , 1));
|
||||
sk_FragColor.w = float((mat2(1.0) , 1));
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
using namespace metal;
|
||||
struct Inputs {
|
||||
};
|
||||
struct Outputs {
|
||||
float4 sk_FragColor [[color(0)]];
|
||||
};
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Outputs _out;
|
||||
(void)_out;
|
||||
_out.sk_FragColor.x = float((1.0 , 1));
|
||||
_out.sk_FragColor.y = float((float2(1.0) , 1));
|
||||
_out.sk_FragColor.z = float((float3(1.0) , 1));
|
||||
_out.sk_FragColor.w = float((float2x2(1.0) , 1));
|
||||
return _out;
|
||||
}
|
Loading…
Reference in New Issue
Block a user