#include <GrFragmentProcessor.h>
|
| ProgramImpl ()=default |
|
virtual | ~ProgramImpl ()=default |
|
virtual void | emitCode (EmitArgs &)=0 |
|
void | setData (const GrGLSLProgramDataManager &pdman, const GrFragmentProcessor &processor) |
|
int | numChildProcessors () const |
|
ProgramImpl * | childProcessor (int index) const |
|
void | setFunctionName (SkString name) |
|
const char * | functionName () const |
|
SkString | invokeChild (int childIndex, EmitArgs &parentArgs, std::string_view skslCoords={}) |
|
SkString | invokeChildWithMatrix (int childIndex, EmitArgs &parentArgs) |
|
SkString | invokeChild (int childIndex, const char *inputColor, EmitArgs &parentArgs, std::string_view skslCoords={}) |
|
SkString | invokeChildWithMatrix (int childIndex, const char *inputColor, EmitArgs &parentArgs) |
|
SkString | invokeChild (int childIndex, const char *inputColor, const char *destColor, EmitArgs &parentArgs, std::string_view skslCoords={}) |
|
SkString | invokeChildWithMatrix (int childIndex, const char *inputColor, const char *destColor, EmitArgs &parentArgs) |
|
Definition at line 472 of file GrFragmentProcessor.h.
◆ SamplerHandle
◆ UniformHandle
◆ ProgramImpl()
GrFragmentProcessor::ProgramImpl::ProgramImpl |
( |
| ) |
|
|
default |
◆ ~ProgramImpl()
virtual GrFragmentProcessor::ProgramImpl::~ProgramImpl |
( |
| ) |
|
|
virtualdefault |
◆ childProcessor()
ProgramImpl * GrFragmentProcessor::ProgramImpl::childProcessor |
( |
int |
index | ) |
const |
|
inline |
◆ emitCode()
virtual void GrFragmentProcessor::ProgramImpl::emitCode |
( |
EmitArgs & |
| ) |
|
|
pure virtual |
◆ functionName()
const char * GrFragmentProcessor::ProgramImpl::functionName |
( |
| ) |
const |
|
inline |
◆ invokeChild() [1/3]
SkString ProgramImpl::invokeChild |
( |
int |
childIndex, |
|
|
const char * |
inputColor, |
|
|
const char * |
destColor, |
|
|
EmitArgs & |
parentArgs, |
|
|
std::string_view |
skslCoords = {} |
|
) |
| |
Invokes a child proc in its own scope. Pass in the parent's EmitArgs and invokeChild will automatically extract the coords and samplers of that child and pass them on to the child's emitCode(). Also, any uniforms or functions emitted by the child will have their names mangled to prevent redefinitions. The returned string contains the output color (as a call to the child's helper function). It is legal to pass nullptr as inputColor, since all fragment processors are required to work without an input color.
When skslCoords is empty, the child is invoked at the sample coordinates from parentArgs. When skslCoords is not empty, is must be an SkSL expression that evaluates to a float2. That expression is passed to the child's processor function as the "_coords" argument.
Definition at line 856 of file GrFragmentProcessor.cpp.
860 {
862
863 if (!inputColor) {
864 inputColor =
args.fInputColor;
865 }
866
868 if (!childProc) {
869
871 }
872
874 inputColor);
875
877 if (!destColor) {
878 destColor =
args.fFp.isBlendFunction() ?
args.fDestColor :
"half4(1)";
879 }
880 invocation.appendf(", %s", destColor);
881 }
882
883
884
886
887 if (
args.fFragBuilder->getProgramBuilder()->fragmentProcessorHasCoordsParam(childProc)) {
889
890 if (!skslCoords.empty()) {
891 invocation.appendf(", %.*s", (int)skslCoords.size(), skslCoords.data());
892 } else {
893 invocation.appendf(
", %s",
args.fSampleCoord);
894 }
895 }
896
897 invocation.append(")");
898 return invocation;
899}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
const char * functionName() const
ProgramImpl * childProcessor(int index) const
bool isBlendFunction() const
const SkSL::SampleUsage & sampleUsage() const
bool isUniformMatrix() const
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
◆ invokeChild() [2/3]
SkString GrFragmentProcessor::ProgramImpl::invokeChild |
( |
int |
childIndex, |
|
|
const char * |
inputColor, |
|
|
EmitArgs & |
parentArgs, |
|
|
std::string_view |
skslCoords = {} |
|
) |
| |
|
inline |
Definition at line 564 of file GrFragmentProcessor.h.
567 {}) {
569 inputColor,
570 nullptr,
571 parentArgs,
572 skslCoords);
573 }
SkString invokeChild(int childIndex, EmitArgs &parentArgs, std::string_view skslCoords={})
◆ invokeChild() [3/3]
SkString GrFragmentProcessor::ProgramImpl::invokeChild |
( |
int |
childIndex, |
|
|
EmitArgs & |
parentArgs, |
|
|
std::string_view |
skslCoords = {} |
|
) |
| |
|
inline |
Definition at line 546 of file GrFragmentProcessor.h.
548 {}) {
550 nullptr,
551 nullptr,
552 parentArgs,
553 skslCoords);
554 }
◆ invokeChildWithMatrix() [1/3]
SkString ProgramImpl::invokeChildWithMatrix |
( |
int |
childIndex, |
|
|
const char * |
inputColor, |
|
|
const char * |
destColor, |
|
|
EmitArgs & |
parentArgs |
|
) |
| |
As invokeChild, but transforms the coordinates according to the matrix expression attached to the child's SampleUsage object. This is only valid if the child is sampled with a const-uniform matrix.
Definition at line 901 of file GrFragmentProcessor.cpp.
904 {
906
907 if (!inputColor) {
908 inputColor =
args.fInputColor;
909 }
910
912 if (!childProc) {
913
915 }
916
918
919
924
926 inputColor);
927
929 if (!destColor) {
930 destColor =
args.fFp.isBlendFunction() ?
args.fDestColor :
"half4(1)";
931 }
932 invocation.appendf(", %s", destColor);
933 }
934
935
936
937
938
939
940
941
942
943 if (
args.fFragBuilder->getProgramBuilder()->fragmentProcessorHasCoordsParam(childProc)) {
944
945
947 invocation.appendf(
", proj((%s) * %s.xy1)", matrixName.c_str(),
args.fSampleCoord);
948 }
else if (
args.fShaderCaps->fNonsquareMatrixSupport) {
949 invocation.appendf(
", float3x2(%s) * %s.xy1", matrixName.c_str(),
args.fSampleCoord);
950 } else {
951 invocation.appendf(
", ((%s) * %s.xy1).xy", matrixName.c_str(),
args.fSampleCoord);
952 }
953 }
954
955 invocation.append(")");
956 return invocation;
957}
const SkString & getName() const
static const char * MatrixUniformName()
bool hasPerspective() const
◆ invokeChildWithMatrix() [2/3]
SkString GrFragmentProcessor::ProgramImpl::invokeChildWithMatrix |
( |
int |
childIndex, |
|
|
const char * |
inputColor, |
|
|
EmitArgs & |
parentArgs |
|
) |
| |
|
inline |
Definition at line 575 of file GrFragmentProcessor.h.
577 {
579 inputColor,
580 nullptr,
581 parentArgs);
582 }
SkString invokeChildWithMatrix(int childIndex, EmitArgs &parentArgs)
◆ invokeChildWithMatrix() [3/3]
SkString GrFragmentProcessor::ProgramImpl::invokeChildWithMatrix |
( |
int |
childIndex, |
|
|
EmitArgs & |
parentArgs |
|
) |
| |
|
inline |
◆ numChildProcessors()
int GrFragmentProcessor::ProgramImpl::numChildProcessors |
( |
| ) |
const |
|
inline |
◆ onSetData()
◆ setData()
Definition at line 851 of file GrFragmentProcessor.cpp.
852 {
854}
virtual void onSetData(const GrGLSLProgramDataManager &, const GrFragmentProcessor &)
◆ setFunctionName()
void GrFragmentProcessor::ProgramImpl::setFunctionName |
( |
SkString |
name | ) |
|
|
inline |
◆ GrFragmentProcessor
The documentation for this class was generated from the following files: