|
| 1 | +[vertex shader spirv] |
| 2 | + OpCapability Shader |
| 3 | + %1 = OpExtInstImport "GLSL.std.450" |
| 4 | + OpMemoryModel Logical GLSL450 |
| 5 | + OpEntryPoint Vertex %main "main" %_ %pos %norm_coord |
| 6 | + OpSource GLSL 430 |
| 7 | + OpName %main "main" |
| 8 | + OpName %gl_PerVertex "gl_PerVertex" |
| 9 | + OpMemberName %gl_PerVertex 0 "gl_Position" |
| 10 | + OpName %_ "" |
| 11 | + OpName %pos "pos" |
| 12 | + OpName %norm_coord "norm_coord" |
| 13 | + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position |
| 14 | + OpDecorate %gl_PerVertex Block |
| 15 | + OpDecorate %pos Location 0 |
| 16 | + OpDecorate %norm_coord Location 0 |
| 17 | + %void = OpTypeVoid |
| 18 | + %3 = OpTypeFunction %void |
| 19 | + %float = OpTypeFloat 32 |
| 20 | + %v4float = OpTypeVector %float 4 |
| 21 | + %uint = OpTypeInt 32 0 |
| 22 | + %uint_1 = OpConstant %uint 1 |
| 23 | +%_arr_float_uint_1 = OpTypeArray %float %uint_1 |
| 24 | +%gl_PerVertex = OpTypeStruct %v4float |
| 25 | +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex |
| 26 | + %_ = OpVariable %_ptr_Output_gl_PerVertex Output |
| 27 | + %int = OpTypeInt 32 1 |
| 28 | + %int_0 = OpConstant %int 0 |
| 29 | +%_ptr_Input_v4float = OpTypePointer Input %v4float |
| 30 | + %pos = OpVariable %_ptr_Input_v4float Input |
| 31 | +%_ptr_Output_v4float = OpTypePointer Output %v4float |
| 32 | + %norm_coord = OpVariable %_ptr_Output_v4float Output |
| 33 | + %main = OpFunction %void None %3 |
| 34 | + %5 = OpLabel |
| 35 | + %18 = OpLoad %v4float %pos |
| 36 | + %20 = OpAccessChain %_ptr_Output_v4float %_ %int_0 |
| 37 | + OpStore %20 %18 |
| 38 | + OpStore %norm_coord %18 |
| 39 | + OpReturn |
| 40 | + OpFunctionEnd |
| 41 | + |
| 42 | +[fragment shader spirv] |
| 43 | + OpCapability Shader |
| 44 | + %1 = OpExtInstImport "GLSL.std.450" |
| 45 | + OpMemoryModel Logical GLSL450 |
| 46 | + OpEntryPoint Fragment %main "main" %color %norm_coord |
| 47 | + OpExecutionMode %main OriginUpperLeft |
| 48 | + OpSource GLSL 430 |
| 49 | + OpName %main "main" |
| 50 | + OpName %color "color" |
| 51 | + OpName %norm_coord "norm_coord" |
| 52 | + OpDecorate %color Location 0 |
| 53 | + OpDecorate %norm_coord Location 0 |
| 54 | + %void = OpTypeVoid |
| 55 | + %3 = OpTypeFunction %void |
| 56 | + %float = OpTypeFloat 32 |
| 57 | + %v4float = OpTypeVector %float 4 |
| 58 | +%_ptr_Output_v4float = OpTypePointer Output %v4float |
| 59 | + %color = OpVariable %_ptr_Output_v4float Output |
| 60 | + %v2float = OpTypeVector %float 2 |
| 61 | + %float_1 = OpConstant %float 1 |
| 62 | + %12 = OpConstantComposite %v2float %float_1 %float_1 |
| 63 | + %bool = OpTypeBool |
| 64 | +%_ptr_Input_v4float = OpTypePointer Input %v4float |
| 65 | + %norm_coord = OpVariable %_ptr_Input_v4float Input |
| 66 | + %uint = OpTypeInt 32 0 |
| 67 | + %uint_0 = OpConstant %uint 0 |
| 68 | +%_ptr_Input_float = OpTypePointer Input %float |
| 69 | + %float_0_1 = OpConstant %float 0.1 |
| 70 | + %uint_1 = OpConstant %uint 1 |
| 71 | + %float_0 = OpConstant %float 0 |
| 72 | + %38 = OpConstantComposite %v2float %float_0 %float_0 |
| 73 | + %main = OpFunction %void None %3 |
| 74 | + %5 = OpLabel |
| 75 | + %13 = OpLoad %v4float %color |
| 76 | + %14 = OpVectorShuffle %v4float %13 %12 4 1 2 5 |
| 77 | + OpStore %color %14 |
| 78 | + %21 = OpAccessChain %_ptr_Input_float %norm_coord %uint_0 |
| 79 | + %22 = OpLoad %float %21 |
| 80 | + %23 = OpExtInst %float %1 FAbs %22 |
| 81 | + %25 = OpFOrdLessThan %bool %23 %float_0_1 |
| 82 | + %26 = OpLogicalNot %bool %25 |
| 83 | + OpSelectionMerge %28 None |
| 84 | + OpBranchConditional %26 %27 %28 |
| 85 | + %27 = OpLabel |
| 86 | + %30 = OpAccessChain %_ptr_Input_float %norm_coord %uint_1 |
| 87 | + %31 = OpLoad %float %30 |
| 88 | + %32 = OpExtInst %float %1 FAbs %31 |
| 89 | + %33 = OpFOrdLessThan %bool %32 %float_0_1 |
| 90 | + OpBranch %28 |
| 91 | + %28 = OpLabel |
| 92 | + %34 = OpPhi %bool %25 %5 %33 %27 |
| 93 | + OpSelectionMerge %36 None |
| 94 | + OpBranchConditional %34 %35 %41 |
| 95 | + %35 = OpLabel |
| 96 | + %39 = OpLoad %v4float %color |
| 97 | + %40 = OpVectorShuffle %v4float %39 %38 0 4 5 3 |
| 98 | + OpStore %color %40 |
| 99 | + OpBranch %36 |
| 100 | + %41 = OpLabel |
| 101 | + %42 = OpLoad %v4float %color |
| 102 | + %43 = OpVectorShuffle %v4float %42 %12 0 4 5 3 |
| 103 | + OpStore %color %43 |
| 104 | + OpBranch %36 |
| 105 | + %36 = OpLabel |
| 106 | + OpReturn |
| 107 | + OpFunctionEnd |
| 108 | + |
| 109 | +[test] |
| 110 | +draw rect -1 -1 2 2 |
| 111 | + |
| 112 | +probe rect rgba (0, 0, 11, 11) (1, 1, 1, 1) |
| 113 | +probe rect rgba (138, 0, 112, 11) (1, 1, 1, 1) |
| 114 | +probe rect rgba (0, 138, 11, 112) (1, 1, 1, 1) |
| 115 | +probe rect rgba (138, 138, 112, 112) (1, 1, 1, 1) |
| 116 | +probe rect rgba (114, 0, 23, 250) (1, 0, 0, 1) |
| 117 | +probe rect rgba (0, 114, 250, 23) (1, 0, 0, 1) |
0 commit comments