1655 {
1656#if defined(SKSL_STANDALONE)
1657 return false;
1658#else
1659
1661 SlotData slotData = this->allocateSlotData(alloc);
1662 this->makeStages(&stages, alloc, uniforms, slotData);
1663
1664
1665
1672
1673 auto resetBasePointer = [&]() {
1674
1675
1676 pipeline->
append(SkRasterPipelineOp::set_base_pointer, slotData.values.data());
1677 };
1678
1679 resetBasePointer();
1680
1681 for (
const Stage& stage : stages) {
1682 switch (stage.op) {
1685 break;
1686
1687 case ProgramOp::invoke_shader:
1688 if (!callbacks || !callbacks->appendShader(sk_bit_cast<intptr_t>(stage.ctx))) {
1689 return false;
1690 }
1691 resetBasePointer();
1692 break;
1693
1694 case ProgramOp::invoke_color_filter:
1695 if (!callbacks || !callbacks->appendColorFilter(sk_bit_cast<intptr_t>(stage.ctx))) {
1696 return false;
1697 }
1698 resetBasePointer();
1699 break;
1700
1701 case ProgramOp::invoke_blender:
1702 if (!callbacks || !callbacks->appendBlender(sk_bit_cast<intptr_t>(stage.ctx))) {
1703 return false;
1704 }
1705 resetBasePointer();
1706 break;
1707
1708 case ProgramOp::invoke_to_linear_srgb:
1709 if (!callbacks) {
1710 return false;
1711 }
1712 callbacks->toLinearSrgb(stage.ctx);
1713
1714
1715 break;
1716
1717 case ProgramOp::invoke_from_linear_srgb:
1718 if (!callbacks) {
1719 return false;
1720 }
1721 callbacks->fromLinearSrgb(stage.ctx);
1722
1723
1724 break;
1725
1726 case ProgramOp::label: {
1727
1728 int labelID = sk_bit_cast<intptr_t>(stage.ctx);
1729 SkASSERT(labelID >= 0 && labelID < fNumLabels);
1731 break;
1732 }
1733 case ProgramOp::jump:
1734 case ProgramOp::branch_if_all_lanes_active:
1735 case ProgramOp::branch_if_any_lanes_active:
1736 case ProgramOp::branch_if_no_lanes_active:
1737 case ProgramOp::branch_if_no_active_lanes_eq: {
1738
1740 int labelID = branchCtx->
offset;
1741 SkASSERT(labelID >= 0 && labelID < fNumLabels);
1742
1743
1744
1746
1750 [[fallthrough]];
1751 }
1752 default:
1753
1756 break;
1757 }
1758 }
1759
1760
1761
1763 for (
int index = 0; index < branchContexts.
size(); ++index) {
1764 int branchFromIdx = branchContexts[index]->offset;
1765 int branchToIdx = labelOffsets[branchGoesToLabel[index]];
1766 branchContexts[index]->offset = branchToIdx - branchFromIdx;
1767 }
1768
1769 return true;
1770#endif
1771}
static constexpr int kNumRasterPipelineHighpOps
void append(SkRasterPipelineOp, void *=nullptr)
void reserve_exact(int n)
static void ABI stack_rewind(Params *params, SkRasterPipelineStage *program, F r, F g, F b, F a)