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

Issue 25048002: Express (GLSL expression, possibly known value) pairs as a class (Closed)

Created:
7 years, 2 months ago by Kimmo Kinnunen
Modified:
7 years, 2 months ago
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

Express (GLSL expression, possibly known value) pairs as a class Express (GLSL expression, possibly known value) pairs as a class instead of two variables Introduces GrGLSLExpr<N> to encapsulate the expression and possibly constant-folded value of the expression. This simplifies passing of the expressions to functions. Changes the shaders with following patterns: { // Stage 0: Linear Gradient vec4 colorTemp = mix(uGradientStartColor_Stage0, uGradientEndColor_Stage0, clamp(vMatrixCoord_Stage0.x, 0.0, 1 colorTemp.rgb *= colorTemp.a; - output_Stage0 = vec4((vColor) * (colorTemp)); + output_Stage0 = (vColor * colorTemp); + } Previously the vector cast was always added if constant folding was effective, regardless of the term dimensions. Now the vector upcast is not inserted in places where it is not needed, ie. when the binary operator term is of the target dimension. Also, some parentheses can be omitted. It is assumed that GrGLSLExpr<N>("string") constructors construct a simple expression or parenthesized expression. Otherwise the shader code remains identical. Committed: http://code.google.com/p/skia/source/detail?r=11690

Patch Set 1 #

Patch Set 2 : for review #

Patch Set 3 : clarify commit msg #

Patch Set 4 : rebase #

Total comments: 28

Patch Set 5 : address most comments #

Patch Set 6 : rebase #

Patch Set 7 : rebase #

Patch Set 8 : rebase #

Total comments: 11

Patch Set 9 : addressing comments #

Total comments: 2

Patch Set 10 : addressing review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+416 lines, -566 lines) Patch
M src/core/SkXfermode.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M src/effects/SkArithmeticMode.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M src/effects/SkBitmapAlphaThresholdShader.cpp View 1 2 3 4 5 1 chunk +2 lines, -6 lines 0 comments Download
M src/effects/SkColorMatrixFilter.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M src/effects/SkLumaColorFilter.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M src/effects/SkLumaXfermode.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M src/effects/gradients/SkGradientShader.cpp View 1 2 3 4 5 6 7 8 2 chunks +4 lines, -10 lines 0 comments Download
M src/gpu/GrAAConvexPathRenderer.cpp View 1 2 3 4 5 6 1 chunk +3 lines, -3 lines 0 comments Download
M src/gpu/GrAARectRenderer.cpp View 1 2 3 4 5 6 2 chunks +6 lines, -6 lines 0 comments Download
M src/gpu/GrOvalRenderer.cpp View 1 2 3 4 5 6 3 chunks +6 lines, -9 lines 0 comments Download
M src/gpu/effects/GrBezierEffect.cpp View 1 2 3 4 5 6 3 chunks +7 lines, -9 lines 0 comments Download
M src/gpu/gl/GrGLProgram.cpp View 1 2 3 4 5 6 7 8 9 6 chunks +29 lines, -102 lines 0 comments Download
M src/gpu/gl/GrGLProgramDesc.h View 1 2 3 4 5 6 1 chunk +0 lines, -11 lines 0 comments Download
M src/gpu/gl/GrGLSL.h View 1 2 3 4 5 6 7 8 9 4 chunks +187 lines, -122 lines 0 comments Download
M src/gpu/gl/GrGLSL.cpp View 1 2 3 4 5 6 7 8 2 chunks +11 lines, -62 lines 0 comments Download
M src/gpu/gl/GrGLSL_impl.h View 1 2 3 4 5 6 7 8 1 chunk +116 lines, -168 lines 0 comments Download
M src/gpu/gl/GrGLShaderBuilder.h View 1 2 3 4 5 6 6 chunks +12 lines, -31 lines 0 comments Download
M src/gpu/gl/GrGLShaderBuilder.cpp View 1 2 3 4 5 6 7 8 9 8 chunks +28 lines, -22 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
Kimmo Kinnunen
7 years, 2 months ago (2013-10-01 12:32:17 UTC) #1
Kimmo Kinnunen
Sorry for the "refactor" type commit without proper functionality change, but in simplified https://codereview.chromium.org/25023003/
7 years, 2 months ago (2013-10-01 12:58:12 UTC) #2
bsalomon
Kimmo, I'm so glad you did this! I've had a change like this on the ...
7 years, 2 months ago (2013-10-02 13:20:25 UTC) #3
bsalomon
https://codereview.chromium.org/25048002/diff/10001/src/effects/SkArithmeticMode.cpp File src/effects/SkArithmeticMode.cpp (right): https://codereview.chromium.org/25048002/diff/10001/src/effects/SkArithmeticMode.cpp#newcode371 src/effects/SkArithmeticMode.cpp:371: builder->fsCodeAppendf("\t\tconst vec4 src = %s;\n", GrGLSLExpr<4>(1).c_str()); Hmm.. This feels ...
7 years, 2 months ago (2013-10-02 15:18:03 UTC) #4
Kimmo Kinnunen
Thanks. New version + some discussion. https://chromiumcodereview.appspot.com/25048002/diff/10001/src/effects/SkArithmeticMode.cpp File src/effects/SkArithmeticMode.cpp (right): https://chromiumcodereview.appspot.com/25048002/diff/10001/src/effects/SkArithmeticMode.cpp#newcode371 src/effects/SkArithmeticMode.cpp:371: builder->fsCodeAppendf("\t\tconst vec4 src ...
7 years, 2 months ago (2013-10-08 12:18:28 UTC) #5
bsalomon
https://chromiumcodereview.appspot.com/25048002/diff/10001/src/effects/SkArithmeticMode.cpp File src/effects/SkArithmeticMode.cpp (right): https://chromiumcodereview.appspot.com/25048002/diff/10001/src/effects/SkArithmeticMode.cpp#newcode371 src/effects/SkArithmeticMode.cpp:371: builder->fsCodeAppendf("\t\tconst vec4 src = %s;\n", GrGLSLExpr<4>(1).c_str()); On 2013/10/08 12:18:29, ...
7 years, 2 months ago (2013-10-08 14:45:27 UTC) #6
Kimmo Kinnunen
Thanks. New version. There's a lot of text. If you're in hurry, I'm primarily interested ...
7 years, 2 months ago (2013-10-09 13:39:59 UTC) #7
bsalomon
lgtm. I noticed two "this->"s that should be removed (noted inline below). You should be ...
7 years, 2 months ago (2013-10-09 19:53:31 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/kkinnunen@nvidia.com/25048002/78001
7 years, 2 months ago (2013-10-10 06:20:48 UTC) #9
commit-bot: I haz the power
7 years, 2 months ago (2013-10-10 06:30:22 UTC) #10
Message was sent while issue was closed.
Change committed as 11690

Powered by Google App Engine
This is Rietveld 408576698