Add GrShaderFlags enum
Replaces GrGLSLUniformHandler::ShaderVisibility with GrShaderFlags. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1684063006 Review URL: https://codereview.chromium.org/1684063006
This commit is contained in:
parent
ddb64c81fb
commit
5e58ceea85
@ -736,14 +736,14 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
|
||||
|
||||
fBaseFrequencyUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"baseFrequency");
|
||||
const char* baseFrequencyUni = uniformHandler->getUniformCStr(fBaseFrequencyUni);
|
||||
|
||||
const char* stitchDataUni = nullptr;
|
||||
if (pne.stitchTiles()) {
|
||||
fStitchDataUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fStitchDataUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"stitchData");
|
||||
stitchDataUni = uniformHandler->getUniformCStr(fStitchDataUni);
|
||||
@ -1139,17 +1139,17 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
|
||||
|
||||
fBaseFrequencyUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"baseFrequency");
|
||||
const char* baseFrequencyUni = uniformHandler->getUniformCStr(fBaseFrequencyUni);
|
||||
|
||||
fOctavesUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fOctavesUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"octaves");
|
||||
const char* octavesUni = uniformHandler->getUniformCStr(fOctavesUni);
|
||||
|
||||
fZUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fZUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"z");
|
||||
const char* zUni = uniformHandler->getUniformCStr(fZUni);
|
||||
|
@ -44,6 +44,14 @@ enum GrShaderType {
|
||||
};
|
||||
static const int kGrShaderTypeCount = kLastkFragment_GrShaderType + 1;
|
||||
|
||||
enum GrShaderFlags {
|
||||
kNone_GrShaderFlags = 0,
|
||||
kVertex_GrShaderFlag = 1 << kVertex_GrShaderType,
|
||||
kGeometry_GrShaderFlag = 1 << kGeometry_GrShaderType,
|
||||
kFragment_GrShaderFlag = 1 << kFragment_GrShaderType
|
||||
};
|
||||
GR_MAKE_BITFIELD_OPS(GrShaderFlags);
|
||||
|
||||
/**
|
||||
* Precisions of shader language variables. Not all shading languages support precisions or actually
|
||||
* vary the internal precision based on the qualifiers. These currently only apply to float types (
|
||||
|
@ -257,10 +257,10 @@ public:
|
||||
|
||||
void emitCode(EmitArgs& args) override {
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fMatrixHandle = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fMatrixHandle = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kMat44f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ColorMatrix");
|
||||
fVectorHandle = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fVectorHandle = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ColorMatrixVector");
|
||||
|
||||
|
@ -185,22 +185,22 @@ public:
|
||||
|
||||
// add uniforms
|
||||
const char* lightDirUniName = nullptr;
|
||||
fLightDirUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fLightDirUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"LightDir", &lightDirUniName);
|
||||
|
||||
const char* lightColorUniName = nullptr;
|
||||
fLightColorUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fLightColorUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"LightColor", &lightColorUniName);
|
||||
|
||||
const char* ambientColorUniName = nullptr;
|
||||
fAmbientColorUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fAmbientColorUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"AmbientColor", &ambientColorUniName);
|
||||
|
||||
const char* xformUniName = nullptr;
|
||||
fXformUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fXformUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Xform", &xformUniName);
|
||||
|
||||
|
@ -40,7 +40,7 @@ void GrGLCircleBlurFragmentProcessor::emitCode(EmitArgs& args) {
|
||||
// x,y - the center of the circle
|
||||
// z - the distance at which the intensity starts falling off (e.g., the start of the table)
|
||||
// w - the inverse of the profile texture size
|
||||
fDataUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fDataUniform = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"data",
|
||||
|
@ -157,10 +157,10 @@ private:
|
||||
|
||||
void GrGLAlphaThresholdEffect::emitCode(EmitArgs& args) {
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fInnerThresholdVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fInnerThresholdVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"inner_threshold");
|
||||
fOuterThresholdVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fOuterThresholdVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"outer_threshold");
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
SkString dstColor("dstColor");
|
||||
this->emitChild(0, nullptr, &dstColor, args);
|
||||
|
||||
fKUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fKUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"k");
|
||||
const char* kUni = args.fUniformHandler->getUniformCStr(fKUni);
|
||||
@ -213,7 +213,7 @@ private:
|
||||
const char* outColor,
|
||||
const char* outColorSecondary,
|
||||
const GrXferProcessor& proc) override {
|
||||
fKUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fKUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"k");
|
||||
const char* kUni = uniformHandler->getUniformCStr(fKUni);
|
||||
|
@ -277,7 +277,7 @@ public:
|
||||
this->emitChild(0, nullptr, &dstColor, args);
|
||||
|
||||
fColorAndTolUni = args.fUniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"colorAndTol");
|
||||
const char* kColorAndTolUni = args.fUniformHandler->getUniformCStr(fColorAndTolUni);
|
||||
@ -413,7 +413,7 @@ private:
|
||||
const GrXferProcessor& proc) override {
|
||||
const AvoidXP& avoid = proc.cast<AvoidXP>();
|
||||
|
||||
fColorAndTolUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorAndTolUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"colorAndTol");
|
||||
const char* kColorandTolUni = uniformHandler->getUniformCStr(fColorAndTolUni);
|
||||
|
@ -724,12 +724,12 @@ void GrGLRectBlurEffect::emitCode(EmitArgs& args) {
|
||||
const char *profileSizeName;
|
||||
|
||||
const char* precisionString = GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, rbe.precision());
|
||||
fProxyRectUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fProxyRectUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
rbe.precision(),
|
||||
"proxyRect",
|
||||
&rectName);
|
||||
fProfileSizeUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fProfileSizeUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"profileSize",
|
||||
@ -1066,17 +1066,17 @@ void GrGLRRectBlurEffect::emitCode(EmitArgs& args) {
|
||||
// The proxy rect has left, top, right, and bottom edges correspond to
|
||||
// components x, y, z, and w, respectively.
|
||||
|
||||
fProxyRectUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fProxyRectUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"proxyRect",
|
||||
&rectName);
|
||||
fCornerRadiusUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fCornerRadiusUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"cornerRadius",
|
||||
&cornerRadiusName);
|
||||
fBlurRadiusUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fBlurRadiusUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"blurRadius",
|
||||
|
@ -238,11 +238,11 @@ void GrColorCubeEffect::GLSLProcessor::emitCode(EmitArgs& args) {
|
||||
}
|
||||
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fColorCubeSizeUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorCubeSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"Size");
|
||||
const char* colorCubeSizeUni = uniformHandler->getUniformCStr(fColorCubeSizeUni);
|
||||
fColorCubeInvSizeUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorCubeInvSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"InvSize");
|
||||
const char* colorCubeInvSizeUni = uniformHandler->getUniformCStr(fColorCubeInvSizeUni);
|
||||
|
@ -539,7 +539,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
|
||||
const GrDisplacementMapEffect& displacementMap = args.fFp.cast<GrDisplacementMapEffect>();
|
||||
const GrTextureDomain& domain = displacementMap.domain();
|
||||
|
||||
fScaleUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fScaleUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision, "Scale");
|
||||
const char* scaleUni = args.fUniformHandler->getUniformCStr(fScaleUni);
|
||||
const char* dColor = "dColor";
|
||||
|
@ -1653,10 +1653,10 @@ void GrGLLightingEffect::emitCode(EmitArgs& args) {
|
||||
}
|
||||
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fImageIncrementUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fImageIncrementUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ImageIncrement");
|
||||
fSurfaceScaleUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fSurfaceScaleUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"SurfaceScale");
|
||||
fLight->emitLightColorUniform(uniformHandler);
|
||||
@ -1769,7 +1769,7 @@ void GrGLDiffuseLightingEffect::emitLightFunc(GrGLSLUniformHandler* uniformHandl
|
||||
GrGLSLFragmentBuilder* fragBuilder,
|
||||
SkString* funcName) {
|
||||
const char* kd;
|
||||
fKDUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fKDUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"KD", &kd);
|
||||
|
||||
@ -1851,9 +1851,9 @@ void GrGLSpecularLightingEffect::emitLightFunc(GrGLSLUniformHandler* uniformHand
|
||||
const char* ks;
|
||||
const char* shininess;
|
||||
|
||||
fKSUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fKSUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision, "KS", &ks);
|
||||
fShininessUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fShininessUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Shininess",
|
||||
@ -1887,7 +1887,7 @@ void GrGLSpecularLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void GrGLLight::emitLightColorUniform(GrGLSLUniformHandler* uniformHandler) {
|
||||
fColorUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"LightColor");
|
||||
}
|
||||
@ -1918,7 +1918,7 @@ void GrGLDistantLight::emitSurfaceToLight(GrGLSLUniformHandler* uniformHandler,
|
||||
GrGLSLFragmentBuilder* fragBuilder,
|
||||
const char* z) {
|
||||
const char* dir;
|
||||
fDirectionUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fDirectionUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"LightDirection", &dir);
|
||||
fragBuilder->codeAppend(dir);
|
||||
@ -1938,7 +1938,7 @@ void GrGLPointLight::emitSurfaceToLight(GrGLSLUniformHandler* uniformHandler,
|
||||
GrGLSLFragmentBuilder* fragBuilder,
|
||||
const char* z) {
|
||||
const char* loc;
|
||||
fLocationUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fLocationUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"LightLocation", &loc);
|
||||
fragBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))",
|
||||
@ -1964,7 +1964,7 @@ void GrGLSpotLight::emitSurfaceToLight(GrGLSLUniformHandler* uniformHandler,
|
||||
GrGLSLFragmentBuilder* fragBuilder,
|
||||
const char* z) {
|
||||
const char* location;
|
||||
fLocationUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fLocationUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"LightLocation", &location);
|
||||
|
||||
@ -1983,19 +1983,19 @@ void GrGLSpotLight::emitLightColor(GrGLSLUniformHandler* uniformHandler,
|
||||
const char* cosOuter;
|
||||
const char* coneScale;
|
||||
const char* s;
|
||||
fExponentUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fExponentUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"Exponent", &exponent);
|
||||
fCosInnerConeAngleUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fCosInnerConeAngleUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"CosInnerConeAngle", &cosInner);
|
||||
fCosOuterConeAngleUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fCosOuterConeAngleUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"CosOuterConeAngle", &cosOuter);
|
||||
fConeScaleUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fConeScaleUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"ConeScale", &coneScale);
|
||||
fSUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fSUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision, "S", &s);
|
||||
|
||||
static const GrGLSLShaderVar gLightColorArgs[] = {
|
||||
|
@ -116,16 +116,16 @@ private:
|
||||
|
||||
void GrGLMagnifierEffect::emitCode(EmitArgs& args) {
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fOffsetVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fOffsetVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Offset");
|
||||
fInvZoomVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fInvZoomVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"InvZoom");
|
||||
fInvInsetVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fInvInsetVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"InvInset");
|
||||
fBoundsVar = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fBoundsVar = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Bounds");
|
||||
|
||||
|
@ -271,11 +271,11 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) {
|
||||
const GrMorphologyEffect& me = args.fFp.cast<GrMorphologyEffect>();
|
||||
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fPixelSizeUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fPixelSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"PixelSize");
|
||||
const char* pixelSizeInc = uniformHandler->getUniformCStr(fPixelSizeUni);
|
||||
fRangeUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fRangeUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Range");
|
||||
const char* range = uniformHandler->getUniformCStr(fRangeUni);
|
||||
|
@ -598,14 +598,14 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
SkString vCoords = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
|
||||
|
||||
fBaseFrequencyUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"baseFrequency");
|
||||
const char* baseFrequencyUni = uniformHandler->getUniformCStr(fBaseFrequencyUni);
|
||||
|
||||
const char* stitchDataUni = nullptr;
|
||||
if (pne.stitchTiles()) {
|
||||
fStitchDataUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fStitchDataUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"stitchData");
|
||||
stitchDataUni = uniformHandler->getUniformCStr(fStitchDataUni);
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
SkString dstColor("dstColor");
|
||||
this->emitChild(0, nullptr, &dstColor, args);
|
||||
|
||||
fOpColorUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fOpColorUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kHigh_GrSLPrecision,
|
||||
"opColor");
|
||||
const char* kOpColorUni = args.fUniformHandler->getUniformCStr(fOpColorUni);
|
||||
@ -279,7 +279,7 @@ private:
|
||||
const char* outColor,
|
||||
const char* outColorSecondary,
|
||||
const GrXferProcessor& proc) override {
|
||||
fOpColorUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fOpColorUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kHigh_GrSLPrecision,
|
||||
"opColor");
|
||||
const char* kOpColorUni = uniformHandler->getUniformCStr(fOpColorUni);
|
||||
|
@ -410,7 +410,7 @@ void GLColorTableEffect::onSetData(const GrGLSLProgramDataManager& pdm, const Gr
|
||||
|
||||
void GLColorTableEffect::emitCode(EmitArgs& args) {
|
||||
const char* yoffsets;
|
||||
fRGBAYValuesUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fRGBAYValuesUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"yoffsets", &yoffsets);
|
||||
static const float kColorScaleFactor = 255.0f / 256.0f;
|
||||
|
@ -917,26 +917,26 @@ void GrGLGradientEffect::emitUniforms(GrGLSLUniformHandler* uniformHandler,
|
||||
const GrGradientEffect& ge) {
|
||||
|
||||
if (SkGradientShaderBase::kTwo_GpuColorType == ge.getColorType()) { // 2 Color case
|
||||
fColorStartUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorStartUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"GradientStartColor");
|
||||
fColorEndUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorEndUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"GradientEndColor");
|
||||
|
||||
} else if (SkGradientShaderBase::kThree_GpuColorType == ge.getColorType()) { // 3 Color Case
|
||||
fColorStartUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorStartUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"GradientStartColor");
|
||||
fColorMidUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorMidUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"GradientMidColor");
|
||||
fColorEndUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorEndUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"GradientEndColor");
|
||||
|
||||
} else { // if not a fast case
|
||||
fFSYUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fFSYUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"GradientYCoordFS");
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void GLEdge2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
const Edge2PtConicalEffect& ge = args.fFp.cast<Edge2PtConicalEffect>();
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
this->emitUniforms(uniformHandler, ge);
|
||||
fParamUni = uniformHandler->addUniformArray(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fParamUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"Conical2FSParams", 3);
|
||||
|
||||
@ -510,7 +510,7 @@ void GLFocalOutside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
const FocalOutside2PtConicalEffect& ge = args.fFp.cast<FocalOutside2PtConicalEffect>();
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
this->emitUniforms(uniformHandler, ge);
|
||||
fParamUni = uniformHandler->addUniformArray(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fParamUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"Conical2FSParams", 2);
|
||||
SkString tName("t");
|
||||
@ -720,7 +720,7 @@ void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
const FocalInside2PtConicalEffect& ge = args.fFp.cast<FocalInside2PtConicalEffect>();
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
this->emitUniforms(uniformHandler, ge);
|
||||
fFocalUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fFocalUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"Conical2FSParams");
|
||||
SkString tName("t");
|
||||
@ -972,10 +972,10 @@ void GLCircleInside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
const CircleInside2PtConicalEffect& ge = args.fFp.cast<CircleInside2PtConicalEffect>();
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
this->emitUniforms(uniformHandler, ge);
|
||||
fCenterUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fCenterUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Conical2FSCenter");
|
||||
fParamUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fParamUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Conical2FSParams");
|
||||
SkString tName("t");
|
||||
@ -1209,10 +1209,10 @@ void GLCircleOutside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
const CircleOutside2PtConicalEffect& ge = args.fFp.cast<CircleOutside2PtConicalEffect>();
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
this->emitUniforms(uniformHandler, ge);
|
||||
fCenterUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fCenterUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Conical2FSCenter");
|
||||
fParamUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fParamUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Conical2FSParams");
|
||||
SkString tName("t");
|
||||
|
@ -129,12 +129,11 @@ public:
|
||||
fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
|
||||
} else {
|
||||
const char* fragCoverage;
|
||||
fCoverageUniform = uniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Coverage",
|
||||
&fragCoverage);
|
||||
fCoverageUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Coverage",
|
||||
&fragCoverage);
|
||||
fragBuilder->codeAppendf("%s = vec4(%s);", args.fOutputCoverage, fragCoverage);
|
||||
}
|
||||
}
|
||||
|
@ -226,10 +226,10 @@ const GrFragmentProcessor* GrFragmentProcessor::OverrideInput(const GrFragmentPr
|
||||
GLFP() : fHaveSetColor(false) {}
|
||||
void emitCode(EmitArgs& args) override {
|
||||
const char* colorName;
|
||||
fColorUni = args.fUniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Color", &colorName);
|
||||
fColorUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Color", &colorName);
|
||||
this->emitChild(0, colorName, args);
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,11 @@ public:
|
||||
// Setup uniform color
|
||||
if (pathProc.overrides().readsColor()) {
|
||||
const char* stagedLocalVarName;
|
||||
fColorUniform = args.fUniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Color",
|
||||
&stagedLocalVarName);
|
||||
fColorUniform = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Color",
|
||||
&stagedLocalVarName);
|
||||
fragBuilder->codeAppendf("%s = %s;", args.fOutputColor, stagedLocalVarName);
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ public:
|
||||
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
|
||||
fUseEvenOdd = uniformHandler->addUniform(GrGLUniformHandler::kFragment_Visibility,
|
||||
fUseEvenOdd = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kLow_GrSLPrecision,
|
||||
"useEvenOdd");
|
||||
const char* useEvenOdd = uniformHandler->getUniformCStr(fUseEvenOdd);
|
||||
|
@ -215,12 +215,11 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
// TODO should we really be doing this?
|
||||
if (gp.coverageScale() != 0xff) {
|
||||
const char* coverageScale;
|
||||
fCoverageScaleUniform = uniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kFloat_GrSLType,
|
||||
kHigh_GrSLPrecision,
|
||||
"Coverage",
|
||||
&coverageScale);
|
||||
fCoverageScaleUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kHigh_GrSLPrecision,
|
||||
"Coverage",
|
||||
&coverageScale);
|
||||
fragBuilder->codeAppendf("%s = vec4(%s * %s);",
|
||||
args.fOutputCoverage, coverageScale, edgeAlpha.c_str());
|
||||
} else {
|
||||
@ -433,12 +432,11 @@ void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
|
||||
if (0xff != gp.coverageScale()) {
|
||||
const char* coverageScale;
|
||||
fCoverageScaleUniform = uniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Coverage",
|
||||
&coverageScale);
|
||||
fCoverageScaleUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Coverage",
|
||||
&coverageScale);
|
||||
fragBuilder->codeAppendf("%s = vec4(%s * edgeAlpha);", args.fOutputCoverage, coverageScale);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = vec4(edgeAlpha);", args.fOutputCoverage);
|
||||
|
@ -48,10 +48,10 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
|
||||
const GrTextureDomain& domain = args.fFp.cast<GrBicubicEffect>().domain();
|
||||
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fCoefficientsUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fCoefficientsUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kMat44f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Coefficients");
|
||||
fImageIncrementUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fImageIncrementUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ImageIncrement");
|
||||
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
void emitCode(EmitArgs& args) override {
|
||||
GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
|
||||
const char* colorUni;
|
||||
fColorUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fColorUniform = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kMedium_GrSLPrecision,
|
||||
"constantColor",
|
||||
&colorUni);
|
||||
|
@ -104,7 +104,7 @@ void GLAARectEffect::emitCode(EmitArgs& args) {
|
||||
const char *rectName;
|
||||
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5),
|
||||
// respectively.
|
||||
fRectUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fRectUniform = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"rect",
|
||||
@ -188,7 +188,7 @@ void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
|
||||
const GrConvexPolyEffect& cpe = args.fFp.cast<GrConvexPolyEffect>();
|
||||
|
||||
const char *edgeArrayName;
|
||||
fEdgeUniform = args.fUniformHandler->addUniformArray(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fEdgeUniform = args.fUniformHandler->addUniformArray(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"edges",
|
||||
|
@ -35,18 +35,18 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
|
||||
const GrConvolutionEffect& ce = args.fFp.cast<GrConvolutionEffect>();
|
||||
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fImageIncrementUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fImageIncrementUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ImageIncrement");
|
||||
if (ce.useBounds()) {
|
||||
fBoundsUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fBoundsUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"Bounds");
|
||||
}
|
||||
|
||||
int width = Gr1DKernelEffect::WidthFromRadius(ce.radius());
|
||||
|
||||
fKernelUni = uniformHandler->addUniformArray(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fKernelUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"Kernel", width);
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
// adjust based on gamma
|
||||
const char* distanceAdjustUniName = nullptr;
|
||||
// width, height, 1/(3*width)
|
||||
fDistanceAdjustUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fDistanceAdjustUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"DistanceAdjust", &distanceAdjustUniName);
|
||||
#endif
|
||||
@ -316,7 +316,7 @@ public:
|
||||
args.fTransformsOut);
|
||||
|
||||
const char* textureSizeUniName = nullptr;
|
||||
fTextureSizeUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fTextureSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"TextureSize", &textureSizeUniName);
|
||||
|
||||
@ -594,7 +594,7 @@ public:
|
||||
|
||||
// adjust width based on gamma
|
||||
const char* distanceAdjustUniName = nullptr;
|
||||
fDistanceAdjustUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fDistanceAdjustUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec3f_GrSLType, kDefault_GrSLPrecision,
|
||||
"DistanceAdjust", &distanceAdjustUniName);
|
||||
fragBuilder->codeAppendf("distance -= %s;", distanceAdjustUniName);
|
||||
|
@ -40,19 +40,19 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
|
||||
int kHeight = mce.kernelSize().height();
|
||||
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
fImageIncrementUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fImageIncrementUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ImageIncrement");
|
||||
fKernelUni = uniformHandler->addUniformArray(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fKernelUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
"Kernel",
|
||||
kWidth * kHeight);
|
||||
fKernelOffsetUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fKernelOffsetUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"KernelOffset");
|
||||
fGainUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fGainUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision, "Gain");
|
||||
fBiasUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fBiasUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision, "Bias");
|
||||
|
||||
const char* kernelOffset = uniformHandler->getUniformCStr(fKernelOffsetUni);
|
||||
|
@ -115,7 +115,7 @@ void GLCircleEffect::emitCode(EmitArgs& args) {
|
||||
const char *circleName;
|
||||
// The circle uniform is (center.x, center.y, radius + 0.5, 1 / (radius + 0.5)) for regular
|
||||
// fills and (..., radius - 0.5, 1 / (radius - 0.5)) for inverse fills.
|
||||
fCircleUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fCircleUniform = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"circle",
|
||||
&circleName);
|
||||
@ -286,7 +286,7 @@ void GLEllipseEffect::emitCode(EmitArgs& args) {
|
||||
const char *ellipseName;
|
||||
// The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2)
|
||||
// The last two terms can underflow on mediump, so we use highp.
|
||||
fEllipseUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fEllipseUniform = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kHigh_GrSLPrecision,
|
||||
"ellipse",
|
||||
&ellipseName);
|
||||
@ -297,7 +297,7 @@ void GLEllipseEffect::emitCode(EmitArgs& args) {
|
||||
const char* scaleName = nullptr;
|
||||
if (args.fGLSLCaps->floatPrecisionVaries()) {
|
||||
fScaleUniform = args.fUniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility, kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
kFragment_GrShaderFlag, kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"scale", &scaleName);
|
||||
}
|
||||
|
||||
|
@ -156,12 +156,12 @@ void GLCircularRRectEffect::emitCode(EmitArgs& args) {
|
||||
// edges correspond to components x, y, z, and w, respectively. When a side of the rrect has
|
||||
// only rectangular corners, that side's value corresponds to the rect edge's value outset by
|
||||
// half a pixel.
|
||||
fInnerRectUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fInnerRectUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"innerRect",
|
||||
&rectName);
|
||||
// x is (r + .5) and y is 1/(r + .5)
|
||||
fRadiusPlusHalfUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fRadiusPlusHalfUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"radiusPlusHalf",
|
||||
&radiusPlusHalfName);
|
||||
@ -508,7 +508,7 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
|
||||
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
|
||||
const char *rectName;
|
||||
// The inner rect is the rrect bounds inset by the x/y radii
|
||||
fInnerRectUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fInnerRectUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"innerRect",
|
||||
&rectName);
|
||||
@ -535,7 +535,7 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
|
||||
// radii uniform values are already in this normalized space.
|
||||
const char* scaleName = nullptr;
|
||||
if (args.fGLSLCaps->floatPrecisionVaries()) {
|
||||
fScaleUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fScaleUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"scale", &scaleName);
|
||||
}
|
||||
@ -544,11 +544,11 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
|
||||
switch (erre.getRRect().getType()) {
|
||||
case SkRRect::kSimple_Type: {
|
||||
const char *invRadiiXYSqdName;
|
||||
fInvRadiiSqdUniform = uniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kVec2f_GrSLType, kDefault_GrSLPrecision,
|
||||
"invRadiiXY",
|
||||
&invRadiiXYSqdName);
|
||||
fInvRadiiSqdUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"invRadiiXY",
|
||||
&invRadiiXYSqdName);
|
||||
fragBuilder->codeAppend("vec2 dxy = max(max(dxy0, dxy1), 0.0);");
|
||||
if (scaleName) {
|
||||
fragBuilder->codeAppendf("dxy *= %s.y;", scaleName);
|
||||
@ -559,11 +559,11 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
|
||||
}
|
||||
case SkRRect::kNinePatch_Type: {
|
||||
const char *invRadiiLTRBSqdName;
|
||||
fInvRadiiSqdUniform = uniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"invRadiiLTRB",
|
||||
&invRadiiLTRBSqdName);
|
||||
fInvRadiiSqdUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"invRadiiLTRB",
|
||||
&invRadiiLTRBSqdName);
|
||||
if (scaleName) {
|
||||
fragBuilder->codeAppendf("dxy0 *= %s.y;", scaleName);
|
||||
fragBuilder->codeAppendf("dxy1 *= %s.y;", scaleName);
|
||||
|
@ -60,7 +60,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
|
||||
if (textureDomain.fIndex >= 0) {
|
||||
uniName.appendS32(textureDomain.fIndex);
|
||||
}
|
||||
fDomainUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fDomainUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
uniName.c_str(), &name);
|
||||
fDomainName = name;
|
||||
|
@ -102,10 +102,9 @@ public:
|
||||
GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
|
||||
|
||||
const char* colorSpaceMatrix = nullptr;
|
||||
fMatrixUni = args.fUniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kMat44f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ColorSpaceMatrix", &colorSpaceMatrix);
|
||||
fMatrixUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kMat44f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ColorSpaceMatrix", &colorSpaceMatrix);
|
||||
fragBuilder->codeAppendf("%s = vec4(", args.fOutputColor);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_str(),
|
||||
args.fCoords[0].getType());
|
||||
@ -236,7 +235,7 @@ public:
|
||||
switch (oc) {
|
||||
case kYUV_OutputChannels:
|
||||
fRGBToYUVUni = args.fUniformHandler->addUniformArray(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"RGBToYUV", 3, &uniName);
|
||||
fragBuilder->codeAppendf("%s = vec4(dot(rgbColor.rgb, %s[0].rgb) + %s[0].a,"
|
||||
@ -248,7 +247,7 @@ public:
|
||||
break;
|
||||
case kUV_OutputChannels:
|
||||
fRGBToYUVUni = args.fUniformHandler->addUniformArray(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"RGBToUV", 2, &uniName);
|
||||
fragBuilder->codeAppendf("%s = vec4(dot(rgbColor.rgb, %s[0].rgb) + %s[0].a,"
|
||||
@ -261,7 +260,7 @@ public:
|
||||
case kU_OutputChannels:
|
||||
case kV_OutputChannels:
|
||||
fRGBToYUVUni = args.fUniformHandler->addUniform(
|
||||
GrGLSLUniformHandler::kFragment_Visibility,
|
||||
kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType, kDefault_GrSLPrecision,
|
||||
"RGBToYUorV", &uniName);
|
||||
fragBuilder->codeAppendf("%s = vec4(dot(rgbColor.rgb, %s.rgb) + %s.a);\n",
|
||||
|
@ -32,12 +32,12 @@ GrGLProgramDataManager::GrGLProgramDataManager(GrGLGpu* gpu, GrGLuint programID,
|
||||
);
|
||||
// TODO: Move the Xoom uniform array in both FS and VS bug workaround here.
|
||||
|
||||
if (GrGLSLUniformHandler::kVertex_Visibility & builderUniform.fVisibility) {
|
||||
if (kVertex_GrShaderFlag & builderUniform.fVisibility) {
|
||||
uniform.fVSLocation = builderUniform.fLocation;
|
||||
} else {
|
||||
uniform.fVSLocation = kUnusedUniform;
|
||||
}
|
||||
if (GrGLSLUniformHandler::kFragment_Visibility & builderUniform.fVisibility) {
|
||||
if (kFragment_GrShaderFlag & builderUniform.fVisibility) {
|
||||
uniform.fFSLocation = builderUniform.fLocation;
|
||||
} else {
|
||||
uniform.fFSLocation = kUnusedUniform;
|
||||
|
@ -23,8 +23,8 @@ GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray(
|
||||
int arrayCount,
|
||||
const char** outName) {
|
||||
SkASSERT(name && strlen(name));
|
||||
SkDEBUGCODE(static const uint32_t kVisibilityMask = kVertex_Visibility | kFragment_Visibility);
|
||||
SkASSERT(0 == (~kVisibilityMask & visibility));
|
||||
SkDEBUGCODE(static const uint32_t kVisMask = kVertex_GrShaderFlag | kFragment_GrShaderFlag);
|
||||
SkASSERT(0 == (~kVisMask & visibility));
|
||||
SkASSERT(0 != visibility);
|
||||
SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type));
|
||||
|
||||
@ -52,7 +52,7 @@ GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray(
|
||||
return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
|
||||
}
|
||||
|
||||
void GrGLUniformHandler::appendUniformDecls(ShaderVisibility visibility, SkString* out) const {
|
||||
void GrGLUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const {
|
||||
for (int i = 0; i < fUniforms.count(); ++i) {
|
||||
if (fUniforms[i].fVisibility & visibility) {
|
||||
fUniforms[i].fVariable.appendDecl(fProgramBuilder->glslCaps(), out);
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
int arrayCount,
|
||||
const char** outName) override;
|
||||
|
||||
void appendUniformDecls(ShaderVisibility, SkString*) const override;
|
||||
void appendUniformDecls(GrShaderFlags visibility, SkString*) const override;
|
||||
|
||||
// Manually set uniform locations for all our uniforms.
|
||||
void bindUniformLocations(GrGLuint programID, const GrGLCaps& caps);
|
||||
|
@ -88,10 +88,8 @@ void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor,
|
||||
for (int t = 0; t < numTextures; ++t) {
|
||||
name.printf("Sampler%d", t);
|
||||
GrSLType samplerType = get_sampler_type(processor.textureAccess(t));
|
||||
localSamplerUniforms[t] =
|
||||
fUniformHandler.addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
samplerType, kDefault_GrSLPrecision,
|
||||
name.c_str());
|
||||
localSamplerUniforms[t] = fUniformHandler.addUniform(kFragment_GrShaderFlag, samplerType,
|
||||
kDefault_GrSLPrecision, name.c_str());
|
||||
outSamplers->emplace_back(localSamplerUniforms[t], processor.textureAccess(t));
|
||||
if (kSamplerExternal_GrSLType == samplerType) {
|
||||
const char* externalFeatureString = this->glslCaps()->externalTextureExtensionString();
|
||||
|
@ -50,7 +50,7 @@ void GrGLSLGeometryProcessor::emitTransforms(GrGLSLVertexBuilder* vb,
|
||||
|
||||
const char* uniName;
|
||||
fInstalledTransforms[i][t].fHandle =
|
||||
uniformHandler->addUniform(GrGLSLUniformHandler::kVertex_Visibility,
|
||||
uniformHandler->addUniform(kVertex_GrShaderFlag,
|
||||
kMat33f_GrSLType, precision,
|
||||
strUniName.c_str(),
|
||||
&uniName).toIndex();
|
||||
@ -139,7 +139,7 @@ void GrGLSLGeometryProcessor::setupPosition(GrGLSLVertexBuilder* vertBuilder,
|
||||
vertBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
|
||||
} else {
|
||||
const char* viewMatrixName;
|
||||
*viewMatrixUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kVertex_Visibility,
|
||||
*viewMatrixUniform = uniformHandler->addUniform(kVertex_GrShaderFlag,
|
||||
kMat33f_GrSLType, kHigh_GrSLPrecision,
|
||||
"uViewM",
|
||||
&viewMatrixName);
|
||||
|
@ -40,7 +40,7 @@ void GrGLSLPrimitiveProcessor::setupUniformColor(GrGLSLFragmentBuilder* fragBuil
|
||||
UniformHandle* colorUniform) {
|
||||
SkASSERT(colorUniform);
|
||||
const char* stagedLocalVarName;
|
||||
*colorUniform = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
*colorUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"Color",
|
||||
|
@ -255,8 +255,7 @@ void GrGLSLProgramBuilder::nameExpression(GrGLSLExpr4* output, const char* baseN
|
||||
*output = outName;
|
||||
}
|
||||
|
||||
void GrGLSLProgramBuilder::appendUniformDecls(ShaderVisibility visibility,
|
||||
SkString* out) const {
|
||||
void GrGLSLProgramBuilder::appendUniformDecls(GrShaderFlags visibility, SkString* out) const {
|
||||
this->uniformHandler()->appendUniformDecls(visibility, out);
|
||||
}
|
||||
|
||||
@ -265,7 +264,7 @@ void GrGLSLProgramBuilder::addRTAdjustmentUniform(GrSLPrecision precision,
|
||||
const char** outName) {
|
||||
SkASSERT(!fUniformHandles.fRTAdjustmentUni.isValid());
|
||||
fUniformHandles.fRTAdjustmentUni =
|
||||
this->uniformHandler()->addUniform(GrGLSLUniformHandler::kVertex_Visibility,
|
||||
this->uniformHandler()->addUniform(kVertex_GrShaderFlag,
|
||||
kVec4f_GrSLType,
|
||||
precision,
|
||||
name,
|
||||
@ -276,7 +275,7 @@ void GrGLSLProgramBuilder::addRTHeightUniform(const char* name, const char** out
|
||||
SkASSERT(!fUniformHandles.fRTHeightUni.isValid());
|
||||
GrGLSLUniformHandler* uniformHandler = this->uniformHandler();
|
||||
fUniformHandles.fRTHeightUni =
|
||||
uniformHandler->internalAddUniformArray(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
uniformHandler->internalAddUniformArray(kFragment_GrShaderFlag,
|
||||
kFloat_GrSLType, kDefault_GrSLPrecision,
|
||||
name, false, 0, outName);
|
||||
}
|
||||
@ -289,7 +288,7 @@ void GrGLSLProgramBuilder::cleanupFragmentProcessors() {
|
||||
|
||||
void GrGLSLProgramBuilder::finalizeShaders() {
|
||||
this->varyingHandler()->finalize();
|
||||
fVS.finalize(GrGLSLUniformHandler::kVertex_Visibility);
|
||||
fFS.finalize(GrGLSLUniformHandler::kFragment_Visibility);
|
||||
fVS.finalize(kVertex_GrShaderFlag);
|
||||
fFS.finalize(kFragment_GrShaderFlag);
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ typedef SkSTArray<8, GrGLSLFragmentProcessor*, true> GrGLSLFragProcs;
|
||||
class GrGLSLProgramBuilder {
|
||||
public:
|
||||
typedef GrGpu::DrawArgs DrawArgs;
|
||||
typedef GrGLSLUniformHandler::ShaderVisibility ShaderVisibility;
|
||||
typedef GrGLSLUniformHandler::UniformHandle UniformHandle;
|
||||
|
||||
virtual ~GrGLSLProgramBuilder() {}
|
||||
@ -41,7 +40,7 @@ public:
|
||||
const GrProgramDesc& desc() const { return *fArgs.fDesc; }
|
||||
const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(); }
|
||||
|
||||
void appendUniformDecls(ShaderVisibility, SkString*) const;
|
||||
void appendUniformDecls(GrShaderFlags visibility, SkString*) const;
|
||||
|
||||
// Handles for program uniforms (other than per-effect uniforms)
|
||||
struct BuiltinUniformHandles {
|
||||
|
@ -158,8 +158,7 @@ void GrGLSLShaderBuilder::finalize(uint32_t visibility) {
|
||||
this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString();
|
||||
this->compileAndAppendLayoutQualifiers();
|
||||
SkASSERT(visibility);
|
||||
fProgramBuilder->appendUniformDecls((GrGLSLUniformHandler::ShaderVisibility) visibility,
|
||||
&this->uniforms());
|
||||
fProgramBuilder->appendUniformDecls((GrShaderFlags) visibility, &this->uniforms());
|
||||
this->appendDecls(fInputs, &this->inputs());
|
||||
this->appendDecls(fOutputs, &this->outputs());
|
||||
this->onFinalize();
|
||||
|
@ -15,19 +15,13 @@ class GrGLSLProgramBuilder;
|
||||
|
||||
class GrGLSLUniformHandler {
|
||||
public:
|
||||
enum ShaderVisibility {
|
||||
kVertex_Visibility = 1 << kVertex_GrShaderType,
|
||||
kGeometry_Visibility = 1 << kGeometry_GrShaderType,
|
||||
kFragment_Visibility = 1 << kFragment_GrShaderType,
|
||||
};
|
||||
|
||||
virtual ~GrGLSLUniformHandler() {}
|
||||
|
||||
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
|
||||
|
||||
/** Add a uniform variable to the current program, that has visibility in one or more shaders.
|
||||
visibility is a bitfield of ShaderVisibility values indicating from which shaders the
|
||||
uniform should be accessible. At least one bit must be set. Geometry shader uniforms are not
|
||||
visibility is a bitfield of GrShaderFlag values indicating from which shaders the uniform
|
||||
should be accessible. At least one bit must be set. Geometry shader uniforms are not
|
||||
supported at this time. The actual uniform name will be mangled. If outName is not nullptr
|
||||
then it will refer to the final uniform name after return. Use the addUniformArray variant
|
||||
to add an array of uniforms. */
|
||||
@ -70,7 +64,7 @@ private:
|
||||
int arrayCount,
|
||||
const char** outName) = 0;
|
||||
|
||||
virtual void appendUniformDecls(ShaderVisibility, SkString*) const = 0;
|
||||
virtual void appendUniformDecls(GrShaderFlags visibility, SkString*) const = 0;
|
||||
|
||||
friend class GrGLSLProgramBuilder;
|
||||
};
|
||||
|
@ -36,12 +36,12 @@ void GrGLSLXferProcessor::emitCode(const EmitArgs& args) {
|
||||
const char* dstTopLeftName;
|
||||
const char* dstCoordScaleName;
|
||||
|
||||
fDstTopLeftUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fDstTopLeftUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"DstTextureUpperLeft",
|
||||
&dstTopLeftName);
|
||||
fDstScaleUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
|
||||
fDstScaleUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
|
||||
kVec2f_GrSLType,
|
||||
kDefault_GrSLPrecision,
|
||||
"DstTextureCoordScale",
|
||||
|
Loading…
Reference in New Issue
Block a user