Commit Graph

24 Commits

Author SHA1 Message Date
commit-bot@chromium.org
9e90aed5de Rename GrGLBinding->GrGLStandard, no longer a bitfield
BUG=skia:2042
R=jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/133413003

git-svn-id: http://skia.googlecode.com/svn/trunk@13108 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-16 16:35:09 +00:00
commit-bot@chromium.org
a34995e18b Implement SkColorFilter as a GrGLEffect
Adds GrEffect::willUseInputColor() which indicates whether or not the
input color affects the output of the effect. This is needed for
certain Xfermodes, such as kSrc_Mode. For these modes the color filter
will not use the input color.

An effect with GrEffect::willUseInputColor() true will cause all color
or coverage effects before it to be discarded, as their computations
cannot affect the output. In these cases program is marked as having
white input color.

This fixes an assert when Skia is compiled in a mode that prefers
using uniforms instead of attributes for constants. (Flags
GR_GL_USE_NV_PATH_RENDERING or GR_GL_NO_CONSTANT_ATTRIBUTES). Using
attributes hides the problem where the fragment shader does not need
input color for color filters that ignore DST part of the filter. The
assert would be hit when uniform manager tries to bind an uniform which
has been optimized away by the shader compiler.

Adds specific GrGLSLExpr4 and GrGLSLExpr1 classes. This way the GLSL
expressions like "(v - src.a)" can remain somewhat readable in form of
"(v - src.a())". The GrGLSLExpr<typename> template implements the
generic functionality, GrGLSLExprX is the specialization that exposes
the type-safe interface to this functionality.

Also adds operators so that GLSL binary operators of the form
"(float * vecX)" can be expressed in C++. Before only the equivalent
"(vecX * float)" was possible. This reverts the common blending
calculations to more conventional order, such as "(1-a) * c" instead of
"c * (1-a)".

Changes GrGLSLExpr1::OnesStr from 1 to 1.0 in order to preserve the
color filter blending formula string the same (with the exception of
variable name change).

Shaders change in case of input color being needed:
 -   vec4 filteredColor;
 -   filteredColor = (((1.0 - uFilterColor.a) * output_Stage0) + uFilterColor);
 -   fsColorOut = filteredColor;
 +   vec4 output_Stage1;
 +   { // Stage 1: ModeColorFilterEffect
 +   output_Stage1 = (((1.0 - uFilterColor_Stage1.a) * output_Stage0) + uFilterColor_Stage1);
 +   }
 +   fsColorOut = output_Stage1;

Shaders change in case of input color being not needed:
 -uniform vec4 uFilterColor;
 -in vec4 vColor;
 +uniform vec4 uFilterColor_Stage0;
  out vec4 fsColorOut;
  void main() {
 -   vec4 filteredColor;
 -   filteredColor = uFilterColor;
 -   fsColorOut = filteredColor;
 +   vec4 output_Stage0;
 +   { // Stage 0: ModeColorFilterEffect
 +   output_Stage0 = uFilterColor_Stage0;
 +   }
 +   fsColorOut = output_Stage0;
  }

R=bsalomon@google.com, robertphillips@google.com, jvanverth@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/25023003

git-svn-id: http://skia.googlecode.com/svn/trunk@11912 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-23 05:42:03 +00:00
commit-bot@chromium.org
824c346b6e 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.

R=jvanverth@google.com, bsalomon@google.com, robertphillips@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/25048002

git-svn-id: http://skia.googlecode.com/svn/trunk@11690 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-10 06:30:18 +00:00
commit-bot@chromium.org
410552a73d Move the GL shader compilation step into GrGLShaderBuilder
Moves the compilation step and a few other blocks of code from
GrGLProgram to GrGLShaderBuilder. This way GrGLProgram doesn't have to
know whether or not there is a vertex shader.

R=bsalomon@google.com

Author: cdalton@nvidia.com

Review URL: https://codereview.chromium.org/23533066

git-svn-id: http://skia.googlecode.com/svn/trunk@11523 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-30 15:30:27 +00:00
commit-bot@chromium.org
06f0598957 Modify GLSL version declaration to allow access to compat. features
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/23526008

git-svn-id: http://skia.googlecode.com/svn/trunk@11033 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-30 15:52:36 +00:00
tfarina@chromium.org
f6de475e5c Replace uses of GrAssert by SkASSERT.
R=bsalomon@google.com

Review URL: https://codereview.chromium.org/22850006

git-svn-id: http://skia.googlecode.com/svn/trunk@10789 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-08-17 00:02:59 +00:00
commit-bot@chromium.org
5d7ca957ed Fix gyp files to allow ninja to build 64 bit on Mac.
Fix warnings that cropped up building as 64-bit.

BUG=
R=bsalomon@google.com, bungeman@google.com

Author: mtklein@google.com

Review URL: https://chromiumcodereview.appspot.com/13852013

git-svn-id: http://skia.googlecode.com/svn/trunk@8814 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-22 20:26:44 +00:00
bsalomon@google.com
018f179efb Expand modulate, add, subtract, extract component glsl helpers.
Review URL: https://codereview.chromium.org/13895006

git-svn-id: http://skia.googlecode.com/svn/trunk@8755 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-04-18 19:36:09 +00:00
commit-bot@chromium.org
ff6ea2663f Add GrEllipseEdgeEffect.
Adds the effect that replaces the old oval rendering code. Also hooks in code to set attribute names and indices for effects.

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/12462008

git-svn-id: http://skia.googlecode.com/svn/trunk@8092 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-03-12 12:26:08 +00:00
humper@google.com
05af1afd42 eliminate all warnings in non-thirdparty code on mac
Most of these issues were due to functions whose definitions appear in header files; I changed those functions to be 'static inline' instead of just 'static' or 'inline', which kills the warning for such functions.

Other functions that were static or anonymous-namespaced but were unused in cpp files were probably called at some point but are no longer; someone who knows more than I do should probably scrub all the functions I either deleted or #if 0'ed out and make sure that the right thing is happening here.

Lots of unused variables removed, and one nasty const issue handled.

There remains a single warning in thirdparty/externals/cityhash/src/city.cc on line 146 related to a signed/unsigned mismatch.  I don't know if we have control over this library so I didn't fix this one, but perhaps someone could do something about that one.

BUG=

Review URL: https://codereview.appspot.com/7067044

git-svn-id: http://skia.googlecode.com/svn/trunk@7051 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-01-07 16:47:43 +00:00
bsalomon@google.com
d698f77c13 GrGLProgramStage Renaming Part 1.
Renamed cpp and h
s/GrGLProgramStage/GrGLEffect/
Review URL: https://codereview.appspot.com/6759054

git-svn-id: http://skia.googlecode.com/svn/trunk@6090 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-10-25 13:22:00 +00:00
bsalomon@google.com
f271cc7183 GrCustomStage Renaming Part 3
Rename all things *CUSTOM_STAGE*, customStage*, and other miscellany

R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6769048

git-svn-id: http://skia.googlecode.com/svn/trunk@6081 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-10-24 19:35:13 +00:00
bsalomon@google.com
281c726c76 Add support for GLSL 1.40.
Review URL: https://codereview.appspot.com/6709070

git-svn-id: http://skia.googlecode.com/svn/trunk@6046 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-10-23 14:31:30 +00:00
bsalomon@google.com
868a8e7fc8 Recommit r5350 with fix for image failures (which affected GLs that don't support ARB_texture_swizzle).
git-svn-id: http://skia.googlecode.com/svn/trunk@5353 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-30 19:11:34 +00:00
bsalomon@google.com
a3d707b4ec Revert 5350 while image changes are diagnosed.
git-svn-id: http://skia.googlecode.com/svn/trunk@5351 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-30 18:11:48 +00:00
bsalomon@google.com
b41b2bc29c Remove fModulate from GrGLShaderBuilder
Review URL: https://codereview.appspot.com/6495051/




git-svn-id: http://skia.googlecode.com/svn/trunk@5350 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-30 17:54:14 +00:00
bsalomon@google.com
4af0af612f Add helpers to add/modulate glsl vec4s.
Review URL: https://codereview.appspot.com/6497046/



git-svn-id: http://skia.googlecode.com/svn/trunk@5332 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-29 12:59:57 +00:00
bsalomon@google.com
34bcb9f803 Some GrGLShaderBuilder cleanup
Review URL: https://codereview.appspot.com/6500043/



git-svn-id: http://skia.googlecode.com/svn/trunk@5322 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-28 18:20:18 +00:00
rmistry@google.com
fbfcd56021 Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part I of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6485054

git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-23 18:09:54 +00:00
bsalomon@google.com
a1bf0fffff uniquely name FS functions, add lighting effects to unit test
Review URL: http://codereview.appspot.com/6458080/


git-svn-id: http://skia.googlecode.com/svn/trunk@4992 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-07 17:36:29 +00:00
bsalomon@google.com
d7727ceb82 Refactor how precision is handled with GrGLShaderVar
Review URL: http://codereview.appspot.com/6392049/


git-svn-id: http://skia.googlecode.com/svn/trunk@4575 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-07-12 16:40:03 +00:00
tomhudson@google.com
168e63418c Infrastructure for new Ganesh shader pipeline: base classes for GPU
implementation of user-defined effects.

http://codereview.appspot.com/6052047/



git-svn-id: http://skia.googlecode.com/svn/trunk@3726 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-04-18 17:49:20 +00:00
tomhudson@google.com
6bf38b59c9 Move GL-specific include files to their own subdirectory, to better
coexist alongside D3D backend.
Requires gyp change.

http://codereview.appspot.com/5665045/



git-svn-id: http://skia.googlecode.com/svn/trunk@3185 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-02-14 15:11:59 +00:00
tomhudson@google.com
dd182cbca6 Move GL-specific source code to make room for D3D back end.
git-svn-id: http://skia.googlecode.com/svn/trunk@3165 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-02-10 21:01:00 +00:00