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

Public Member Functions

 VariableLValue (const Variable *v)
 
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 *gen, SlotRange fixedOffset, AutoStack *dynamicOffset, SkSpan< const int8_t > swizzle) 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 779 of file SkSLRasterPipelineCodeGenerator.cpp.

Constructor & Destructor Documentation

◆ VariableLValue()

SkSL::RP::VariableLValue::VariableLValue ( const Variable v)
inlineexplicit

Definition at line 781 of file SkSLRasterPipelineCodeGenerator.cpp.

781: fVariable(v) {}

Member Function Documentation

◆ dynamicSlotRange()

AutoStack * SkSL::RP::VariableLValue::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 792 of file SkSLRasterPipelineCodeGenerator.cpp.

792 {
793 return nullptr;
794 }

◆ fixedSlotRange()

SlotRange SkSL::RP::VariableLValue::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 787 of file SkSLRasterPipelineCodeGenerator.cpp.

787 {
788 return Generator::IsUniform(*fVariable) ? gen->getUniformSlots(*fVariable)
789 : gen->getVariableSlots(*fVariable);
790 }
static bool IsUniform(const Variable &var)
Definition: gen.py:1

◆ isWritable()

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

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

Implements SkSL::RP::LValue.

Definition at line 783 of file SkSLRasterPipelineCodeGenerator.cpp.

783 {
784 return !Generator::IsUniform(*fVariable);
785 }

◆ push()

bool SkSL::RP::VariableLValue::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 796 of file SkSLRasterPipelineCodeGenerator.cpp.

799 {
800 if (Generator::IsUniform(*fVariable)) {
801 if (dynamicOffset) {
802 gen->builder()->push_uniform_indirect(fixedOffset, dynamicOffset->stackID(),
803 this->fixedSlotRange(gen));
804 } else {
805 gen->builder()->push_uniform(fixedOffset);
806 }
807 } else {
808 if (dynamicOffset) {
809 gen->builder()->push_slots_indirect(fixedOffset, dynamicOffset->stackID(),
810 this->fixedSlotRange(gen));
811 } else {
812 gen->builder()->push_slots(fixedOffset);
813 }
814 }
815 if (!swizzle.empty()) {
816 gen->builder()->swizzle(fixedOffset.count, swizzle);
817 }
818 return true;
819 }
virtual SkSpan< const int8_t > swizzle()

◆ store()

bool SkSL::RP::VariableLValue::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 821 of file SkSLRasterPipelineCodeGenerator.cpp.

824 {
825 SkASSERT(!Generator::IsUniform(*fVariable));
826
827 if (swizzle.empty()) {
828 if (dynamicOffset) {
829 gen->builder()->copy_stack_to_slots_indirect(fixedOffset, dynamicOffset->stackID(),
830 this->fixedSlotRange(gen));
831 } else {
832 gen->builder()->copy_stack_to_slots(fixedOffset);
833 }
834 } else {
835 if (dynamicOffset) {
836 gen->builder()->swizzle_copy_stack_to_slots_indirect(fixedOffset,
837 dynamicOffset->stackID(),
838 this->fixedSlotRange(gen),
839 swizzle,
840 swizzle.size());
841 } else {
842 gen->builder()->swizzle_copy_stack_to_slots(fixedOffset, swizzle, swizzle.size());
843 }
844 }
845 if (gen->shouldWriteTraceOps()) {
846 if (dynamicOffset) {
847 gen->builder()->trace_var_indirect(gen->traceMaskStackID(),
848 fixedOffset,
849 dynamicOffset->stackID(),
850 this->fixedSlotRange(gen));
851 } else {
852 gen->builder()->trace_var(gen->traceMaskStackID(), fixedOffset);
853 }
854 }
855 return true;
856 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

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