Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
RasterPipelineBuilderTest.cpp File Reference
#include "include/core/SkStream.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkStringView.h"
#include "src/core/SkRasterPipeline.h"
#include "src/sksl/codegen/SkSLRasterPipelineBuilder.h"
#include "src/sksl/tracing/SkSLDebugTracePriv.h"
#include "tests/Test.h"

Go to the source code of this file.

Functions

static sk_sp< SkDataget_program_dump (SkSL::RP::Program &program)
 
static std::string_view as_string_view (const sk_sp< SkData > &dump)
 
static void check (skiatest::Reporter *r, SkSL::RP::Program &program, std::string_view expected)
 
static SkSL::RP::SlotRange one_slot_at (SkSL::RP::Slot index)
 
static SkSL::RP::SlotRange two_slots_at (SkSL::RP::Slot index)
 
static SkSL::RP::SlotRange three_slots_at (SkSL::RP::Slot index)
 
static SkSL::RP::SlotRange four_slots_at (SkSL::RP::Slot index)
 
static SkSL::RP::SlotRange five_slots_at (SkSL::RP::Slot index)
 
static SkSL::RP::SlotRange ten_slots_at (SkSL::RP::Slot index)
 
 DEF_TEST (RasterPipelineBuilder, r)
 
 DEF_TEST (RasterPipelineBuilderPushPopMaskRegisters, r)
 
 DEF_TEST (RasterPipelineBuilderCaseOp, r)
 
 DEF_TEST (RasterPipelineBuilderPushPopSrcDst, r)
 
 DEF_TEST (RasterPipelineBuilderInvokeChild, r)
 
 DEF_TEST (RasterPipelineBuilderPushPopTempImmediates, r)
 
 DEF_TEST (RasterPipelineBuilderPushPopIndirect, r)
 
 DEF_TEST (RasterPipelineBuilderCopySlotsMasked, r)
 
 DEF_TEST (RasterPipelineBuilderCopySlotsUnmasked, r)
 
 DEF_TEST (RasterPipelineBuilderPushPopSlots, r)
 
 DEF_TEST (RasterPipelineBuilderDuplicateSelectAndSwizzleSlots, r)
 
 DEF_TEST (RasterPipelineBuilderTransposeMatrix, r)
 
 DEF_TEST (RasterPipelineBuilderDiagonalMatrix, r)
 
 DEF_TEST (RasterPipelineBuilderMatrixResize, r)
 
 DEF_TEST (RasterPipelineBuilderBranches, r)
 
 DEF_TEST (RasterPipelineBuilderBinaryFloatOps, r)
 
 DEF_TEST (RasterPipelineBuilderBinaryIntOps, r)
 
 DEF_TEST (RasterPipelineBuilderBinaryUIntOps, r)
 
 DEF_TEST (RasterPipelineBuilderUnaryOps, r)
 
 DEF_TEST (RasterPipelineBuilderUniforms, r)
 
 DEF_TEST (RasterPipelineBuilderPushZeros, r)
 
 DEF_TEST (RasterPipelineBuilderTernaryFloatOps, r)
 
 DEF_TEST (RasterPipelineBuilderAutomaticStackRewinding, r)
 
 DEF_TEST (RasterPipelineBuilderTraceOps, r)
 

Function Documentation

◆ as_string_view()

static std::string_view as_string_view ( const sk_sp< SkData > &  dump)
static

Definition at line 22 of file RasterPipelineBuilderTest.cpp.

22 {
23 return std::string_view(static_cast<const char*>(dump->data()), dump->size());
24}
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)

◆ check()

static void check ( skiatest::Reporter r,
SkSL::RP::Program program,
std::string_view  expected 
)
static

Definition at line 26 of file RasterPipelineBuilderTest.cpp.

26 {
27 // Verify that the program matches expectations.
29 REPORTER_ASSERT(r, as_string_view(dump) == expected,
30 "Output did not match expectation:\n%.*s",
31 (int)dump->size(), static_cast<const char*>(dump->data()));
32}
static std::string_view as_string_view(const sk_sp< SkData > &dump)
static sk_sp< SkData > get_program_dump(SkSL::RP::Program &program)
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286

◆ DEF_TEST() [1/24]

DEF_TEST ( RasterPipelineBuilder  ,
 
)

Definition at line 58 of file RasterPipelineBuilderTest.cpp.

58 {
59 // Create a very simple nonsense program.
61 builder.store_src_rg(two_slots_at(0));
62 builder.store_src(four_slots_at(2));
63 builder.store_dst(four_slots_at(4));
64 builder.store_device_xy01(four_slots_at(6));
65 builder.init_lane_masks();
66 builder.enableExecutionMaskWrites();
67 builder.mask_off_return_mask();
68 builder.mask_off_loop_mask();
69 builder.reenable_loop_mask(one_slot_at(4));
70 builder.disableExecutionMaskWrites();
71 builder.load_src(four_slots_at(1));
72 builder.load_dst(four_slots_at(3));
73 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/10,
74 /*numUniformSlots=*/0,
75 /*numImmutableSlots=*/0);
76 check(r, *program,
77R"(store_src_rg v0..1 = src.rg
78store_src v2..5 = src.rgba
static SkSL::RP::SlotRange one_slot_at(SkSL::RP::Slot index)
static SkSL::RP::SlotRange four_slots_at(SkSL::RP::Slot index)
static SkSL::RP::SlotRange two_slots_at(SkSL::RP::Slot index)
#define check(reporter, ref, unref, make, kill)

◆ DEF_TEST() [2/24]

DEF_TEST ( RasterPipelineBuilderAutomaticStackRewinding  ,
 
)

Definition at line 576 of file RasterPipelineBuilderTest.cpp.

◆ DEF_TEST() [3/24]

DEF_TEST ( RasterPipelineBuilderBinaryFloatOps  ,
 
)

Definition at line 428 of file RasterPipelineBuilderTest.cpp.

446 {
447#if SK_HAS_MUSTTAIL
448 // We have guaranteed tail-calling, and don't need to rewind the stack.
449 static constexpr char kExpectationWithKnownExecutionMask[] =
450R"(jump jump +9 (label 3 at #10)

◆ DEF_TEST() [4/24]

DEF_TEST ( RasterPipelineBuilderBinaryIntOps  ,
 
)

Definition at line 452 of file RasterPipelineBuilderTest.cpp.

◆ DEF_TEST() [5/24]

DEF_TEST ( RasterPipelineBuilderBinaryUIntOps  ,
 
)

Definition at line 479 of file RasterPipelineBuilderTest.cpp.

◆ DEF_TEST() [6/24]

DEF_TEST ( RasterPipelineBuilderBranches  ,
 
)

Definition at line 344 of file RasterPipelineBuilderTest.cpp.

353 {
354 // Create a very simple nonsense program.
356 builder.push_constant_f(1.0f); // push into 0
357 builder.push_duplicates(15); // duplicate into 1~15
358 builder.transpose(2, 2); // transpose a 2x2 matrix
359 builder.transpose(3, 3); // transpose a 3x3 matrix
360 builder.transpose(4, 4); // transpose a 4x4 matrix
361 builder.transpose(2, 4); // transpose a 2x4 matrix
362 builder.transpose(4, 3); // transpose a 4x3 matrix
363 builder.discard_stack(16); // balance stack
364 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/0,
365 /*numUniformSlots=*/0,
366 /*numImmutableSlots=*/0);
367 check(r, *program,
368R"(splat_4_constants $0..3 = 0x3F800000 (1.0)
369splat_4_constants $4..7 = 0x3F800000 (1.0)
370splat_4_constants $8..11 = 0x3F800000 (1.0)
371splat_4_constants $12..15 = 0x3F800000 (1.0)
372swizzle_3 $13..15 = ($13..15).yxz
373shuffle $8..15 = ($8..15)[2 5 0 3 6 1 4 7]
374shuffle $1..15 = ($1..15)[3 7 11 0 4 8 12 1 5 9 13 2 6 10 14]
375shuffle $9..15 = ($9..15)[3 0 4 1 5 2 6]
376shuffle $5..15 = ($5..15)[2 5 8 0 3 6 9 1 4 7 10]
377)");
378}
379
380DEF_TEST(RasterPipelineBuilderDiagonalMatrix, r) {
381 // Create a very simple nonsense program.
383 builder.push_constant_f(0.0f); // push into 0
384 builder.push_constant_f(1.0f); // push into 1
385 builder.diagonal_matrix(2, 2); // generate a 2x2 diagonal matrix
386 builder.discard_stack(4); // balance stack
387 builder.push_constant_f(0.0f); // push into 0
388 builder.push_constant_f(2.0f); // push into 1
389 builder.diagonal_matrix(4, 4); // generate a 4x4 diagonal matrix
390 builder.discard_stack(16); // balance stack
391 builder.push_constant_f(0.0f); // push into 0
392 builder.push_constant_f(3.0f); // push into 1
393 builder.diagonal_matrix(2, 3); // generate a 2x3 diagonal matrix
394 builder.discard_stack(6); // balance stack
395 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/0,
396 /*numUniformSlots=*/0,
397 /*numImmutableSlots=*/0);
398 check(r, *program,
399R"(copy_constant $0 = 0
400copy_constant $1 = 0x3F800000 (1.0)
401swizzle_4 $0..3 = ($0..3).yxxy
402copy_constant $0 = 0
403copy_constant $1 = 0x40000000 (2.0)
404shuffle $0..15 = ($0..15)[1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]
405copy_constant $0 = 0
406copy_constant $1 = 0x40400000 (3.0)
407shuffle $0..5 = ($0..5)[1 0 0 0 1 0]
408)");
409}
410
411DEF_TEST(RasterPipelineBuilderMatrixResize, r) {
412 // Create a very simple nonsense program.
414 builder.push_constant_f(1.0f); // synthesize a 2x2 matrix
415 builder.push_constant_f(2.0f);
416 builder.push_constant_f(3.0f);
417 builder.push_constant_f(4.0f);
418 builder.matrix_resize(2, 2, 4, 4); // resize 2x2 matrix into 4x4
419 builder.matrix_resize(4, 4, 2, 2); // resize 4x4 matrix back into 2x2
420 builder.matrix_resize(2, 2, 2, 4); // resize 2x2 matrix into 2x4
421 builder.matrix_resize(2, 4, 4, 2); // resize 2x4 matrix into 4x2
422 builder.matrix_resize(4, 2, 3, 3); // resize 4x2 matrix into 3x3
423 builder.discard_stack(9); // balance stack
424 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/0,
425 /*numUniformSlots=*/0,
426 /*numImmutableSlots=*/0);
#define DEF_TEST(name, reporter)
Definition Test.h:312

◆ DEF_TEST() [7/24]

DEF_TEST ( RasterPipelineBuilderCaseOp  ,
 
)

Definition at line 114 of file RasterPipelineBuilderTest.cpp.

◆ DEF_TEST() [8/24]

DEF_TEST ( RasterPipelineBuilderCopySlotsMasked  ,
 
)

Definition at line 217 of file RasterPipelineBuilderTest.cpp.

◆ DEF_TEST() [9/24]

DEF_TEST ( RasterPipelineBuilderCopySlotsUnmasked  ,
 
)

Definition at line 229 of file RasterPipelineBuilderTest.cpp.

230 {
231 // Create a very simple nonsense program.
233 builder.set_current_stack(1);
234 builder.push_constant_i(3);
235 builder.set_current_stack(0);
236 builder.push_slots_indirect(two_slots_at(0), /*dynamicStack=*/1, ten_slots_at(0));
237 builder.push_slots_indirect(four_slots_at(10), /*dynamicStack=*/1, ten_slots_at(10));
238 builder.push_uniform_indirect(one_slot_at(0), /*dynamicStack=*/1, five_slots_at(0));
239 builder.push_uniform_indirect(three_slots_at(5), /*dynamicStack=*/1, five_slots_at(5));
static SkSL::RP::SlotRange ten_slots_at(SkSL::RP::Slot index)
static SkSL::RP::SlotRange three_slots_at(SkSL::RP::Slot index)
static SkSL::RP::SlotRange five_slots_at(SkSL::RP::Slot index)

◆ DEF_TEST() [10/24]

DEF_TEST ( RasterPipelineBuilderDiagonalMatrix  ,
 
)

Definition at line 302 of file RasterPipelineBuilderTest.cpp.

319 {
320 // Create a very simple nonsense program.
322 builder.push_constant_f(1.0f); // push into 0

◆ DEF_TEST() [11/24]

DEF_TEST ( RasterPipelineBuilderDuplicateSelectAndSwizzleSlots  ,
 
)

Definition at line 260 of file RasterPipelineBuilderTest.cpp.

264 {
265 // Create a very simple nonsense program.
267 builder.copy_slots_masked(two_slots_at(0), two_slots_at(2));
268 builder.copy_slots_masked(four_slots_at(1), four_slots_at(5));
269 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/9,
270 /*numUniformSlots=*/0,
271 /*numImmutableSlots=*/0);
272 check(r, *program,
273R"(copy_2_slots_masked v0..1 = Mask(v2..3)
274copy_4_slots_masked v1..4 = Mask(v5..8)
275)");
276}
277
278DEF_TEST(RasterPipelineBuilderCopySlotsUnmasked, r) {
279 // Create a very simple nonsense program.
281 builder.copy_slots_unmasked(three_slots_at(0), three_slots_at(2));
282 builder.copy_slots_unmasked(five_slots_at(1), five_slots_at(5));

◆ DEF_TEST() [12/24]

DEF_TEST ( RasterPipelineBuilderInvokeChild  ,
 
)

Definition at line 150 of file RasterPipelineBuilderTest.cpp.

153 { LoopMask = true; $1 = false; }
154case_op if ($0 == 0x0000007C) { LoopMask = true; $1 = false; }
155)");
156}
157
158DEF_TEST(RasterPipelineBuilderPushPopSrcDst, r) {
159 // Create a very simple nonsense program.
160 SkSL::RP::Builder builder;
161
162 builder.push_src_rgba();
163 builder.push_dst_rgba();

◆ DEF_TEST() [13/24]

DEF_TEST ( RasterPipelineBuilderMatrixResize  ,
 
)

Definition at line 324 of file RasterPipelineBuilderTest.cpp.

330 {3, 2, 1, 0}, 4);
331 builder.swizzle_copy_stack_to_slots(four_slots_at(0), {0, 1, 3}, 3);
332 builder.swizzle(4, {3, 2, 1, 0}); // reverse the order of 0~3 (value.wzyx)
333 builder.swizzle(4, {1, 2}); // eliminate elements 0 and 3 (value.yz)
334 builder.swizzle(2, {0}); // eliminate element 1 (value.x)
335 builder.discard_stack(1); // balance stack
336 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/6,
337 /*numUniformSlots=*/0,
338 /*numImmutableSlots=*/0);
339 check(r, *program,
340R"(splat_4_constants $0..3 = 0x3F800000 (1.0)
341splat_4_constants $4..7 = 0x3F800000 (1.0)
342splat_4_constants $8..11 = 0x3F800000 (1.0)

◆ DEF_TEST() [14/24]

DEF_TEST ( RasterPipelineBuilderPushPopIndirect  ,
 
)

Definition at line 192 of file RasterPipelineBuilderTest.cpp.

200 {
201 // Create a very simple nonsense program.
203 builder.set_current_stack(1);
204 builder.push_constant_i(999); // push into 2
205 builder.set_current_stack(0);
206 builder.push_constant_f(13.5f); // push into 0
207 builder.push_clone_from_stack(one_slot_at(0), /*otherStackID=*/1, /*offsetFromStackTop=*/1);
208 // push into 1 from 2
209 builder.discard_stack(1); // discard 2
210 builder.push_constant_u(357); // push into 2
211 builder.set_current_stack(1);
212 builder.push_clone_from_stack(one_slot_at(0), /*otherStackID=*/0, /*offsetFromStackTop=*/1);
213 // push into 3 from 0
214 builder.discard_stack(2); // discard 2 and 3
215 builder.set_current_stack(0);

◆ DEF_TEST() [15/24]

DEF_TEST ( RasterPipelineBuilderPushPopMaskRegisters  ,
 
)

Definition at line 80 of file RasterPipelineBuilderTest.cpp.

90 {
91 // Create a very simple nonsense program.
93
94 REPORTER_ASSERT(r, !builder.executionMaskWritesAreEnabled());
95 builder.enableExecutionMaskWrites();
96 REPORTER_ASSERT(r, builder.executionMaskWritesAreEnabled());
97
98 builder.push_condition_mask(); // push into 0
99 builder.push_loop_mask(); // push into 1
100 builder.push_return_mask(); // push into 2
101 builder.merge_condition_mask(); // set the condition-mask to 1 & 2
102 builder.merge_inv_condition_mask(); // set the condition-mask to 1 & ~2
103 builder.pop_condition_mask(); // pop from 2
104 builder.merge_loop_mask(); // mask off the loop-mask against 1
105 builder.push_condition_mask(); // push into 2
106 builder.pop_condition_mask(); // pop from 2
107 builder.pop_loop_mask(); // pop from 1
108 builder.pop_return_mask(); // pop from 0
109 builder.push_condition_mask(); // push into 0
110 builder.pop_and_reenable_loop_mask(); // pop from 0
111

◆ DEF_TEST() [16/24]

DEF_TEST ( RasterPipelineBuilderPushPopSlots  ,
 
)

Definition at line 241 of file RasterPipelineBuilderTest.cpp.

241 {2, 1, 0},
242 /*offsetFromStackTop=*/3);
243 builder.copy_stack_to_slots_indirect(three_slots_at(4), /*dynamicStackID=*/1, ten_slots_at(0));
244 builder.pop_slots_indirect(five_slots_at(0), /*dynamicStackID=*/1, ten_slots_at(0));
245 builder.pop_slots_indirect(five_slots_at(10), /*dynamicStackID=*/1, ten_slots_at(10));
246 builder.set_current_stack(1);
247 builder.discard_stack(1);
248 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/20,
249 /*numUniformSlots=*/10,
250 /*numImmutableSlots=*/0);
251 check(r, *program,
252R"(copy_constant $10 = 0x00000003 (4.203895e-45)
253copy_from_indirect_unmasked $0..1 = Indirect(v0..1 + $10)
254copy_from_indirect_unmasked $2..5 = Indirect(v10..13 + $10)
255copy_from_indirect_uniform_unm $6 = Indirect(u0 + $10)
256copy_from_indirect_uniform_unm $7..9 = Indirect(u5..7 + $10)
257swizzle_copy_to_indirect_maske Indirect(v6..8 + $10).zyx = Mask($7..9)
258copy_to_indirect_masked Indirect(v4..6 + $10) = Mask($7..9)

◆ DEF_TEST() [17/24]

DEF_TEST ( RasterPipelineBuilderPushPopSrcDst  ,
 
)

Definition at line 131 of file RasterPipelineBuilderTest.cpp.

137 {
138 // Create a very simple nonsense program.
140
141 builder.push_constant_i(123); // push a test value
142 builder.push_constant_i(~0); // push an all-on default mask
143 builder.case_op(123); // do `case 123:`
144 builder.case_op(124); // do `case 124:`
145 builder.discard_stack(2);
146
147 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/0,
148 /*numUniformSlots=*/0,

◆ DEF_TEST() [18/24]

DEF_TEST ( RasterPipelineBuilderPushPopTempImmediates  ,
 
)

Definition at line 165 of file RasterPipelineBuilderTest.cpp.

182 {
183 // Create a very simple nonsense program.
185
186 builder.invoke_shader(1);
187 builder.invoke_color_filter(2);
188 builder.invoke_blender(3);
189
190 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/0,

◆ DEF_TEST() [19/24]

DEF_TEST ( RasterPipelineBuilderPushZeros  ,
 
)

Definition at line 542 of file RasterPipelineBuilderTest.cpp.

551 {
552 builder.disableExecutionMaskWrites();
553 }
554
555 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/3,
556 /*numUniformSlots=*/0,
557 /*numImmutableSlots=*/0);
558
559 check(r, *program, enableExecutionMaskWrites ? kExpectationWithExecutionMaskWrites

◆ DEF_TEST() [20/24]

DEF_TEST ( RasterPipelineBuilderTernaryFloatOps  ,
 
)

Definition at line 561 of file RasterPipelineBuilderTest.cpp.

564 {
566
568 builder.push_constant_f(10.0f);
569 builder.push_duplicates(30);
570 builder.binary_op(BuilderOp::add_n_floats, 1);
571 builder.binary_op(BuilderOp::sub_n_floats, 2);
572 builder.binary_op(BuilderOp::mul_n_floats, 3);
573 builder.binary_op(BuilderOp::div_n_floats, 4);
574 builder.binary_op(BuilderOp::max_n_floats, 3);

◆ DEF_TEST() [21/24]

DEF_TEST ( RasterPipelineBuilderTraceOps  ,
 
)

Definition at line 599 of file RasterPipelineBuilderTest.cpp.

606 {
608
610 builder.push_constant_i(123);
611 builder.push_duplicates(40);
612 builder.binary_op(BuilderOp::bitwise_and_n_ints, 1);
613 builder.binary_op(BuilderOp::bitwise_xor_n_ints, 2);
614 builder.binary_op(BuilderOp::bitwise_or_n_ints, 3);
615 builder.binary_op(BuilderOp::add_n_ints, 2);
616 builder.binary_op(BuilderOp::sub_n_ints, 3);
617 builder.binary_op(BuilderOp::mul_n_ints, 4);
618 builder.binary_op(BuilderOp::div_n_ints, 5);
619 builder.binary_op(BuilderOp::max_n_ints, 4);
620 builder.binary_op(BuilderOp::min_n_ints, 3);
621 builder.binary_op(BuilderOp::cmplt_n_ints, 1);
622 builder.binary_op(BuilderOp::cmple_n_ints, 2);
623 builder.binary_op(BuilderOp::cmpeq_n_ints, 3);
624 builder.binary_op(BuilderOp::cmpne_n_ints, 4);
625 builder.discard_stack(4);
626 std::unique_ptr<SkSL::RP::Program> program = builder.finish(/*numValueSlots=*/0,
627 /*numUniformSlots=*/0,
628 /*numImmutableSlots=*/0);
629 check(r, *program,
630R"(splat_4_constants $0..3 = 0x0000007B (1.723597e-43)
631splat_4_constants $4..7 = 0x0000007B (1.723597e-43)
632splat_4_constants $8..11 = 0x0000007B (1.723597e-43)
633splat_4_constants $12..15 = 0x0000007B (1.723597e-43)
634splat_4_constants $16..19 = 0x0000007B (1.723597e-43)
635splat_4_constants $20..23 = 0x0000007B (1.723597e-43)
636splat_4_constants $24..27 = 0x0000007B (1.723597e-43)
637splat_4_constants $28..31 = 0x0000007B (1.723597e-43)
638splat_4_constants $32..35 = 0x0000007B (1.723597e-43)
639splat_4_constants $36..39 = 0x0000007B (1.723597e-43)
640bitwise_and_imm_int $39 &= 0x0000007B
641bitwise_xor_2_ints $36..37 ^= $38..39
642bitwise_or_3_ints $32..34 |= $35..37
643add_2_ints $31..32 += $33..34
644sub_3_ints $27..29 -= $30..32
645mul_4_ints $22..25 *= $26..29
646div_n_ints $16..20 /= $21..25
647max_4_ints $13..16 = max($13..16, $17..20)

◆ DEF_TEST() [22/24]

DEF_TEST ( RasterPipelineBuilderTransposeMatrix  ,
 
)

Definition at line 284 of file RasterPipelineBuilderTest.cpp.

293 {
294 // Create a very simple nonsense program.
296 builder.push_slots(four_slots_at(10)); // push from 10~13 into $0~$3
297 builder.copy_stack_to_slots(one_slot_at(5), 3); // copy from $1 into 5
298 builder.pop_slots_unmasked(two_slots_at(20)); // pop from $2~$3 into 20~21 (unmasked)
299 builder.enableExecutionMaskWrites();
300 builder.copy_stack_to_slots_unmasked(one_slot_at(4), 2); // copy from $0 into 4

◆ DEF_TEST() [23/24]

DEF_TEST ( RasterPipelineBuilderUnaryOps  ,
 
)

Definition at line 498 of file RasterPipelineBuilderTest.cpp.

521 : {false, true}) {

◆ DEF_TEST() [24/24]

DEF_TEST ( RasterPipelineBuilderUniforms  ,
 
)

Definition at line 523 of file RasterPipelineBuilderTest.cpp.

529 {
530 builder.enableExecutionMaskWrites();
531 }
532
533 builder.jump(label4);
534 builder.label(label1);
535 builder.zero_slots_unmasked(one_slot_at(0));
536 builder.label(label2);
537 builder.zero_slots_unmasked(one_slot_at(1));
538 builder.branch_if_no_lanes_active(label2);
539 builder.branch_if_no_lanes_active(label3);
540 builder.branch_if_all_lanes_active(label1);

◆ five_slots_at()

static SkSL::RP::SlotRange five_slots_at ( SkSL::RP::Slot  index)
static

Definition at line 50 of file RasterPipelineBuilderTest.cpp.

◆ four_slots_at()

static SkSL::RP::SlotRange four_slots_at ( SkSL::RP::Slot  index)
static

Definition at line 46 of file RasterPipelineBuilderTest.cpp.

46 {
47 return SkSL::RP::SlotRange{index, 4};
48}

◆ get_program_dump()

static sk_sp< SkData > get_program_dump ( SkSL::RP::Program program)
static

Definition at line 16 of file RasterPipelineBuilderTest.cpp.

16 {
18 program.dump(&stream);
19 return stream.detachAsData();
20}
void dump(SkWStream *out, bool writeInstructionCount=false) const

◆ one_slot_at()

static SkSL::RP::SlotRange one_slot_at ( SkSL::RP::Slot  index)
static

Definition at line 34 of file RasterPipelineBuilderTest.cpp.

34 {
35 return SkSL::RP::SlotRange{index, 1};
36}

◆ ten_slots_at()

static SkSL::RP::SlotRange ten_slots_at ( SkSL::RP::Slot  index)
static

Definition at line 54 of file RasterPipelineBuilderTest.cpp.

54 {
55 return SkSL::RP::SlotRange{index, 10};
56}

◆ three_slots_at()

static SkSL::RP::SlotRange three_slots_at ( SkSL::RP::Slot  index)
static

Definition at line 42 of file RasterPipelineBuilderTest.cpp.

42 {
43 return SkSL::RP::SlotRange{index, 3};
44}

◆ two_slots_at()

static SkSL::RP::SlotRange two_slots_at ( SkSL::RP::Slot  index)
static

Definition at line 38 of file RasterPipelineBuilderTest.cpp.

38 {
39 return SkSL::RP::SlotRange{index, 2};
40}