#include <ShTransformer.hpp>
Collaboration diagram for SH::ShTransformer:
Tuple splitting when backend canot support arbitrary | |
length tuples.
If any tuples are split, this adds entries to the splits map to map from original long tuple ShVariableNode to a vector of ShVariableNodes all <= max tuple size of the backend. All long tuples in the intermediate representation are split up into shorter tuples. | |
typedef std::vector< ShVariableNodePtr > | VarNodeVec |
typedef std::map< ShVariableNodePtr, VarNodeVec > | VarSplitMap |
void | splitTuples (int maxTuple, VarSplitMap &splits) |
struct | VariableSplitter |
struct | StatementSplitter |
Removes interval arithmetic computation | |
Converts computations on N-tuple intervals of type T into computation on regular N-tuples of type T. (Implemented in ShIntervalConverter.?pp)
splits contains a split into exactly 2 new variables for each interval variable encountered | |
typedef std::map< ShValueType, ShValueType > | ValueTypeMap |
void | convertIntervalTypes (VarSplitMap &splits) |
Input and Output variable to temp convertor | |
In most GPU shading languages/assembly, outputs cannot be used as src variable in computation and inputs cannot be used as a dest, and inout variables are not supported directly.
| |
void | convertInputOutput () |
struct | InputOutputConvertor |
Arithmetic type conversions | |
Converts ops on other basic non-float Sh types to float storage types based on the floatMapping. For each key k (a type index to convert), in floatMapping, the converter changes it to use floating point type index floatMapping[k].
(Note, the converter does not handle cases where floatMapping[j] exists, but j is also floatMapping[k]) | |
void | convertToFloat (ValueTypeMap &typeMap) |
Public Member Functions | |
ShTransformer (const ShProgramNodePtr &program) | |
bool | changed () |
Texture lookup conversion | |
Most GPUs only do indexed lookup for rectangular textures, so convert other kinds of lookup with appropriate scales. | |
void | convertTextureLookups () |
Platform-specific transformations on ShProgram objects.
These may change the variable lists (inputs, outputs, etc.) and control graph of the ShProgram, so they should be done on a copy of the ShProgram just before code generation instead of the original. (Otherwise, future algebra operations on the original may not give the expected results since the variables will no longer be the same)
Global requirements for running ShTransformer: ShContext::current()->parsing() == program
Definition at line 52 of file ShTransformer.hpp.