Enable proper testing of const arrays.
This test was generating invalid code in Metal (http://review.skia.org/408356), but we didn't catch it because the code wasn't actually being run. Change-Id: I649034593a566f9e835b1cf7b0702c64952d31ef Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408641 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
6831635373
commit
82491c5d65
@ -1,5 +1,5 @@
|
||||
const half test[4] = half[4](1, 2, 3, 4);
|
||||
const half test[4] = half[4](0, 1, 0, 1);
|
||||
|
||||
void main() {
|
||||
sk_FragColor = half4(test[0], test[1], test[2], test[3]);
|
||||
half4 main(float2 xy) {
|
||||
return half4(test[0], test[1], test[2], test[3]);
|
||||
}
|
||||
|
@ -222,6 +222,7 @@ SKSL_TEST(SkSLCommaMixedTypes, "shared/CommaMixedTypes.sksl")
|
||||
// The CPU test confirms that we can get it right, even if not all drivers do.
|
||||
SKSL_TEST_CPU(SkSLCommaSideEffects, "shared/CommaSideEffects.sksl")
|
||||
SKSL_TEST(SkSLConstantIf, "shared/ConstantIf.sksl")
|
||||
SKSL_TEST_ES3(SkSLConstArray, "shared/ConstArray.sksl")
|
||||
SKSL_TEST(SkSLConstVariableComparison, "shared/ConstVariableComparison.sksl")
|
||||
SKSL_TEST(SkSLDeadIfStatement, "shared/DeadIfStatement.sksl")
|
||||
SKSL_TEST(SkSLDeadStripFunctions, "shared/DeadStripFunctions.sksl")
|
||||
|
@ -1,11 +1,12 @@
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %sk_FragColor %sk_Clockwise
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpEntryPoint Fragment %_entrypoint_v "_entrypoint" %sk_FragColor %sk_Clockwise
|
||||
OpExecutionMode %_entrypoint_v OriginUpperLeft
|
||||
OpName %sk_FragColor "sk_FragColor"
|
||||
OpName %sk_Clockwise "sk_Clockwise"
|
||||
OpName %test "test"
|
||||
OpName %_entrypoint_v "_entrypoint_v"
|
||||
OpName %main "main"
|
||||
OpDecorate %sk_FragColor RelaxedPrecision
|
||||
OpDecorate %sk_FragColor Location 0
|
||||
@ -13,12 +14,12 @@ OpDecorate %sk_FragColor Index 0
|
||||
OpDecorate %sk_Clockwise BuiltIn FrontFacing
|
||||
OpDecorate %test RelaxedPrecision
|
||||
OpDecorate %_arr_float_int_4 ArrayStride 16
|
||||
OpDecorate %19 RelaxedPrecision
|
||||
OpDecorate %26 RelaxedPrecision
|
||||
OpDecorate %29 RelaxedPrecision
|
||||
OpDecorate %32 RelaxedPrecision
|
||||
OpDecorate %35 RelaxedPrecision
|
||||
OpDecorate %17 RelaxedPrecision
|
||||
OpDecorate %33 RelaxedPrecision
|
||||
OpDecorate %36 RelaxedPrecision
|
||||
OpDecorate %39 RelaxedPrecision
|
||||
OpDecorate %42 RelaxedPrecision
|
||||
OpDecorate %43 RelaxedPrecision
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
@ -31,30 +32,40 @@ OpDecorate %36 RelaxedPrecision
|
||||
%_arr_float_int_4 = OpTypeArray %float %int_4
|
||||
%_ptr_Private__arr_float_int_4 = OpTypePointer Private %_arr_float_int_4
|
||||
%test = OpVariable %_ptr_Private__arr_float_int_4 Private
|
||||
%float_0 = OpConstant %float 0
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_2 = OpConstant %float 2
|
||||
%float_3 = OpConstant %float 3
|
||||
%float_4 = OpConstant %float 4
|
||||
%void = OpTypeVoid
|
||||
%21 = OpTypeFunction %void
|
||||
%20 = OpTypeFunction %void
|
||||
%v2float = OpTypeVector %float 2
|
||||
%23 = OpConstantComposite %v2float %float_0 %float_0
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%27 = OpTypeFunction %v4float %_ptr_Function_v2float
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%main = OpFunction %void None %21
|
||||
%22 = OpLabel
|
||||
%19 = OpCompositeConstruct %_arr_float_int_4 %float_1 %float_2 %float_3 %float_4
|
||||
OpStore %test %19
|
||||
%24 = OpAccessChain %_ptr_Private_float %test %int_0
|
||||
%26 = OpLoad %float %24
|
||||
%28 = OpAccessChain %_ptr_Private_float %test %int_1
|
||||
%29 = OpLoad %float %28
|
||||
%31 = OpAccessChain %_ptr_Private_float %test %int_2
|
||||
%32 = OpLoad %float %31
|
||||
%34 = OpAccessChain %_ptr_Private_float %test %int_3
|
||||
%35 = OpLoad %float %34
|
||||
%36 = OpCompositeConstruct %v4float %26 %29 %32 %35
|
||||
OpStore %sk_FragColor %36
|
||||
%_entrypoint_v = OpFunction %void None %20
|
||||
%21 = OpLabel
|
||||
%24 = OpVariable %_ptr_Function_v2float Function
|
||||
OpStore %24 %23
|
||||
%26 = OpFunctionCall %v4float %main %24
|
||||
OpStore %sk_FragColor %26
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %v4float None %27
|
||||
%28 = OpFunctionParameter %_ptr_Function_v2float
|
||||
%29 = OpLabel
|
||||
%17 = OpCompositeConstruct %_arr_float_int_4 %float_0 %float_1 %float_0 %float_1
|
||||
OpStore %test %17
|
||||
%31 = OpAccessChain %_ptr_Private_float %test %int_0
|
||||
%33 = OpLoad %float %31
|
||||
%35 = OpAccessChain %_ptr_Private_float %test %int_1
|
||||
%36 = OpLoad %float %35
|
||||
%38 = OpAccessChain %_ptr_Private_float %test %int_2
|
||||
%39 = OpLoad %float %38
|
||||
%41 = OpAccessChain %_ptr_Private_float %test %int_3
|
||||
%42 = OpLoad %float %41
|
||||
%43 = OpCompositeConstruct %v4float %33 %36 %39 %42
|
||||
OpReturnValue %43
|
||||
OpFunctionEnd
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
out vec4 sk_FragColor;
|
||||
const float test[4] = float[4](1.0, 2.0, 3.0, 4.0);
|
||||
void main() {
|
||||
sk_FragColor = vec4(test[0], test[1], test[2], test[3]);
|
||||
const float test[4] = float[4](0.0, 1.0, 0.0, 1.0);
|
||||
vec4 main() {
|
||||
return vec4(test[0], test[1], test[2], test[3]);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ struct Globals {
|
||||
const array<float, 4> test;
|
||||
};
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Globals _globals{array<float, 4>{1.0, 2.0, 3.0, 4.0}};
|
||||
Globals _globals{array<float, 4>{0.0, 1.0, 0.0, 1.0}};
|
||||
(void)_globals;
|
||||
Outputs _out;
|
||||
(void)_out;
|
||||
|
Loading…
Reference in New Issue
Block a user