Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkSL::RP::ScratchLValue Class Referencefinal
Inheritance diagram for SkSL::RP::ScratchLValue:
SkSL::RP::LValue

Public Member Functions

 ScratchLValue (const Expression &e)
 
 ~ScratchLValue () override
 
bool isWritable () const override
 
SlotRange fixedSlotRange (Generator *gen) override
 
AutoStackdynamicSlotRange () override
 
bool push (Generator *gen, SlotRange fixedOffset, AutoStack *dynamicOffset, SkSpan< const int8_t > swizzle) override
 
bool store (Generator *, SlotRange, AutoStack *, SkSpan< const int8_t >) override
 
- Public Member Functions inherited from SkSL::RP::LValue
virtual ~LValue ()=default
 
virtual bool isWritable () const =0
 
virtual SlotRange fixedSlotRange (Generator *gen)=0
 
virtual AutoStackdynamicSlotRange ()=0
 
virtual SkSpan< const int8_t > swizzle ()
 
virtual bool push (Generator *gen, SlotRange fixedOffset, AutoStack *dynamicOffset, SkSpan< const int8_t > swizzle)=0
 
virtual bool store (Generator *gen, SlotRange fixedOffset, AutoStack *dynamicOffset, SkSpan< const int8_t > swizzle)=0
 

Additional Inherited Members

- Public Attributes inherited from SkSL::RP::LValue
std::unique_ptr< ExpressionfScratchExpression
 

Detailed Description

Definition at line 714 of file SkSLRasterPipelineCodeGenerator.cpp.

Constructor & Destructor Documentation

◆ ScratchLValue()

SkSL::RP::ScratchLValue::ScratchLValue ( const Expression e)
inlineexplicit

Definition at line 716 of file SkSLRasterPipelineCodeGenerator.cpp.

717 : fExpression(&e)
718 , fNumSlots(e.type().slotCount()) {}

◆ ~ScratchLValue()

SkSL::RP::ScratchLValue::~ScratchLValue ( )
inlineoverride

Definition at line 720 of file SkSLRasterPipelineCodeGenerator.cpp.

720 {
721 if (fGenerator && fDedicatedStack.has_value()) {
722 // Jettison the scratch expression.
723 fDedicatedStack->enter();
724 fGenerator->discardExpression(fNumSlots);
725 fDedicatedStack->exit();
726 }
727 }

Member Function Documentation

◆ dynamicSlotRange()

AutoStack * SkSL::RP::ScratchLValue::dynamicSlotRange ( )
inlineoverridevirtual

Returns a stack which holds a single integer, representing the dynamic offset of the lvalue. This value does not incorporate the fixed offset. If null is returned, the lvalue doesn't have a dynamic offset. evaluateDynamicIndices must be called before this is used.

Implements SkSL::RP::LValue.

Definition at line 737 of file SkSLRasterPipelineCodeGenerator.cpp.

737 {
738 return nullptr;
739 }

◆ fixedSlotRange()

SlotRange SkSL::RP::ScratchLValue::fixedSlotRange ( Generator gen)
inlineoverridevirtual

Returns the fixed slot range of the lvalue, after it is winnowed down to the selected field/index. The range is calculated assuming every dynamic index will evaluate to zero.

Implements SkSL::RP::LValue.

Definition at line 733 of file SkSLRasterPipelineCodeGenerator.cpp.

733 {
734 return SlotRange{0, fNumSlots};
735 }

◆ isWritable()

bool SkSL::RP::ScratchLValue::isWritable ( ) const
inlineoverridevirtual

Returns true if this lvalue is actually writable–temporaries and uniforms are not.

Implements SkSL::RP::LValue.

Definition at line 729 of file SkSLRasterPipelineCodeGenerator.cpp.

729 {
730 return false;
731 }

◆ push()

bool SkSL::RP::ScratchLValue::push ( Generator gen,
SlotRange  fixedOffset,
AutoStack dynamicOffset,
SkSpan< const int8_t >  swizzle 
)
inlineoverridevirtual

Pushes values directly onto the stack.

Implements SkSL::RP::LValue.

Definition at line 741 of file SkSLRasterPipelineCodeGenerator.cpp.

744 {
745 if (!fDedicatedStack.has_value()) {
746 // Push the scratch expression onto a dedicated stack.
747 fGenerator = gen;
748 fDedicatedStack.emplace(fGenerator);
749 fDedicatedStack->enter();
750 if (!fGenerator->pushExpression(*fExpression)) {
751 return unsupported();
752 }
753 fDedicatedStack->exit();
754 }
755
756 if (dynamicOffset) {
757 fDedicatedStack->pushCloneIndirect(fixedOffset, dynamicOffset->stackID(), fNumSlots);
758 } else {
759 fDedicatedStack->pushClone(fixedOffset, fNumSlots);
760 }
761 if (!swizzle.empty()) {
762 gen->builder()->swizzle(fixedOffset.count, swizzle);
763 }
764 return true;
765 }
bool pushExpression(const Expression &e, bool usesResult=true)
virtual SkSpan< const int8_t > swizzle()
def gen()
Definition: dom.py:77
Definition: gen.py:1

◆ store()

bool SkSL::RP::ScratchLValue::store ( Generator gen,
SlotRange  fixedOffset,
AutoStack dynamicOffset,
SkSpan< const int8_t >  swizzle 
)
inlineoverridevirtual

Stores topmost values from the stack directly into the lvalue.

Implements SkSL::RP::LValue.

Definition at line 767 of file SkSLRasterPipelineCodeGenerator.cpp.

767 {
768 SkDEBUGFAIL("scratch lvalues cannot be stored into");
769 return unsupported();
770 }
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118

The documentation for this class was generated from the following file: