Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: src/gpu/effects/GrRRectEffect.cpp

Issue 1438003003: Move all ShaderBuilder files to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@glslProgBuild
Patch Set: nits Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrPorterDuffXferProcessor.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrRRectEffect.cpp
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index aeab0e4dbf5eff8bafed3b5c56de81690ef6600c..398edccb64b51a0d3d2b921c525bbb26ca0b3df7 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -13,7 +13,8 @@
#include "GrOvalEffect.h"
#include "SkRRect.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
// The effects defined here only handle rrect radii >= kRadiusMin.
@@ -155,16 +156,16 @@ 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 = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType, kDefault_GrSLPrecision,
- "innerRect",
- &rectName);
- fRadiusPlusHalfUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kFloat_GrSLType, kDefault_GrSLPrecision,
- "radiusPlusHalf",
- &radiusPlusHalfName);
-
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ fInnerRectUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
+ kVec4f_GrSLType, kDefault_GrSLPrecision,
+ "innerRect",
+ &rectName);
+ fRadiusPlusHalfUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
+ kFloat_GrSLType, kDefault_GrSLPrecision,
+ "radiusPlusHalf",
+ &radiusPlusHalfName);
+
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
// At each quarter-circle corner we compute a vector that is the offset of the fragment position
// from the circle center. The vector is pinned in x and y to be in the quarter-plane relevant
@@ -364,7 +365,7 @@ void GLCircularRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
////////////////////////////////////////////////////////////////////////////////////////////////////
void CircularRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GLCircularRRectEffect::GenKey(*this, caps, b);
}
@@ -497,12 +498,12 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
const EllipticalRRectEffect& erre = args.fFp.cast<EllipticalRRectEffect>();
const char *rectName;
// The inner rect is the rrect bounds inset by the x/y radii
- fInnerRectUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fInnerRectUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
"innerRect",
&rectName);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
// At each quarter-ellipse corner we compute a vector that is the offset of the fragment pos
// to the ellipse center. The vector is pinned in x and y to be in the quarter-plane relevant
@@ -522,10 +523,11 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
switch (erre.getRRect().getType()) {
case SkRRect::kSimple_Type: {
const char *invRadiiXYSqdName;
- fInvRadiiSqdUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kHigh_GrSLPrecision,
- "invRadiiXY",
- &invRadiiXYSqdName);
+ fInvRadiiSqdUniform = args.fBuilder->addUniform(
+ GrGLSLProgramBuilder::kFragment_Visibility,
+ kVec2f_GrSLType, kHigh_GrSLPrecision,
+ "invRadiiXY",
+ &invRadiiXYSqdName);
fsBuilder->codeAppend("\t\tvec2 dxy = max(max(dxy0, dxy1), 0.0);\n");
// Z is the x/y offsets divided by squared radii.
fsBuilder->codeAppendf("\t\tvec2 Z = dxy * %s;\n", invRadiiXYSqdName);
@@ -533,10 +535,11 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
}
case SkRRect::kNinePatch_Type: {
const char *invRadiiLTRBSqdName;
- fInvRadiiSqdUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType, kHigh_GrSLPrecision,
- "invRadiiLTRB",
- &invRadiiLTRBSqdName);
+ fInvRadiiSqdUniform = args.fBuilder->addUniform(
+ GrGLSLProgramBuilder::kFragment_Visibility,
+ kVec4f_GrSLType, kHigh_GrSLPrecision,
+ "invRadiiLTRB",
+ &invRadiiLTRBSqdName);
fsBuilder->codeAppend("\t\tvec2 dxy = max(max(dxy0, dxy1), 0.0);\n");
// Z is the x/y offsets divided by squared radii. We only care about the (at most) one
// corner where both the x and y offsets are positive, hence the maxes. (The inverse
@@ -613,7 +616,7 @@ void GLEllipticalRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
////////////////////////////////////////////////////////////////////////////////////////////////////
void EllipticalRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GLEllipticalRRectEffect::GenKey(*this, caps, b);
}
« no previous file with comments | « src/gpu/effects/GrPorterDuffXferProcessor.cpp ('k') | src/gpu/effects/GrSimpleTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698