aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLSL.cpp
Commit message (Collapse)AuthorAge
* Remove tab parameter from GrGLSLMulVarBy4f functionGravatar egdaniel2014-10-09
| | | | | | | | | With pretty printing of shader code, there is no longer a need to explictily have tabs in our code. BUG=skia: Review URL: https://codereview.chromium.org/648463002
* "NULL !=" = NULLGravatar bsalomon2014-09-05
| | | | | | | | R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/544233002
* Convert GrCrash->SkFAIL GrDebugCrash->SkDEBUGFAILGravatar commit-bot@chromium.org2014-04-30
| | | | | | | | | | R=robertphillips@google.com, reed@google.com, mtklein@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/257393004 git-svn-id: http://skia.googlecode.com/svn/trunk@14460 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fail to create GrContext when we get a NULL for a GL/GLSL version stringGravatar commit-bot@chromium.org2014-04-30
| | | | | | | | | | | BUG=368107 R=jvanverth@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/254083002 git-svn-id: http://skia.googlecode.com/svn/trunk@14452 2bbb7eff-a529-9590-31e7-b0007b416f81
* SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.hGravatar commit-bot@chromium.org2014-03-28
| | | | | | | | | | | BUG=skia: R=bsalomon@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/216503004 git-svn-id: http://skia.googlecode.com/svn/trunk@13982 2bbb7eff-a529-9590-31e7-b0007b416f81
* Rename GrGLBinding->GrGLStandard, no longer a bitfieldGravatar commit-bot@chromium.org2014-01-16
| | | | | | | | | | | 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
* Minor fix in Ganesh shader generation.Gravatar commit-bot@chromium.org2013-11-21
| | | | | | | | | | R=bsalomon@google.com Author: skaslev@chromium.org Review URL: https://codereview.chromium.org/78843006 git-svn-id: http://skia.googlecode.com/svn/trunk@12343 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement SkColorFilter as a GrGLEffectGravatar commit-bot@chromium.org2013-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-10-10
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@11691 2bbb7eff-a529-9590-31e7-b0007b416f81
* Express (GLSL expression, possibly known value) pairs as a classGravatar commit-bot@chromium.org2013-10-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Move the GL shader compilation step into GrGLShaderBuilderGravatar commit-bot@chromium.org2013-09-30
| | | | | | | | | | | | | | 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
* Modify GLSL version declaration to allow access to compat. featuresGravatar commit-bot@chromium.org2013-08-30
| | | | | | | | | | 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
* Replace uses of GrAssert by SkASSERT.Gravatar tfarina@chromium.org2013-08-17
| | | | | | | | 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
* Rename kES2_GrGLBinding to kES_GrGLBinding. Step 0 for supporting ES3.Gravatar bsalomon@google.com2013-08-15
| | | | | | | | R=robertphillips@google.com Review URL: https://codereview.chromium.org/23185004 git-svn-id: http://skia.googlecode.com/svn/trunk@10747 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-04-19
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8759 2bbb7eff-a529-9590-31e7-b0007b416f81
* Expand modulate, add, subtract, extract component glsl helpers.Gravatar bsalomon@google.com2013-04-18
| | | | | | Review URL: https://codereview.chromium.org/13895006 git-svn-id: http://skia.googlecode.com/svn/trunk@8755 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reland 8459 with fix for #extension after default precision in FS.Gravatar bsalomon@google.com2013-04-02
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8479 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reverting r8459 due to shader error on Nexus 10Gravatar robertphillips@google.com2013-04-01
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8474 2bbb7eff-a529-9590-31e7-b0007b416f81
* Take two for r8466:Gravatar jvanverth@google.com2013-04-01
| | | | | | | | | | | | | | | Replace the old attribute binding and index interface with one where we include the binding as part of the attribute array. Also removed the fixed attribute indices for constant color and coverage attributes, and replaced with dynamic ones based on current attribute set. Removed binding of color and coverage attributes unless they're actually set. Original author: bsalomon@google.com Author: jvanverth@google.com Reviewed By: bsalomon@google.com,robertphillips@google.com Review URL: https://chromiumcodereview.appspot.com/13296005 git-svn-id: http://skia.googlecode.com/svn/trunk@8468 2bbb7eff-a529-9590-31e7-b0007b416f81
* Rolling back r8466. Gravatar jvanverth@google.com2013-04-01
| | | | | | | Not reviewed. git-svn-id: http://skia.googlecode.com/svn/trunk@8467 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revise attribute binding interface.Gravatar commit-bot@chromium.org2013-04-01
| | | | | | | | | | | | | | Replace the old attribute binding and index interface with one where we include the binding as part of the attribute array. Also removed the fixed attribute indices for constant color and coverage attributes, and replaced with dynamic ones based on current attribute set. Removed binding of color and coverage attributes unless they're actually set. Original author: bsalomon@google.com Author: jvanverth@google.com Reviewed By: bsalomon@google.com,robertphillips@google.com Review URL: https://chromiumcodereview.appspot.com/13296005 git-svn-id: http://skia.googlecode.com/svn/trunk@8466 2bbb7eff-a529-9590-31e7-b0007b416f81
* Make GrGLShaderBuilder responsible for enabling GLSL extensionsGravatar bsalomon@google.com2013-04-01
| | | | | | Review URL: https://codereview.chromium.org/12668019 git-svn-id: http://skia.googlecode.com/svn/trunk@8459 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add support for GLSL 1.40.Gravatar bsalomon@google.com2012-10-23
| | | | | | Review URL: https://codereview.appspot.com/6709070 git-svn-id: http://skia.googlecode.com/svn/trunk@6046 2bbb7eff-a529-9590-31e7-b0007b416f81
* Addressed xcode analysis complaintsGravatar robertphillips@google.com2012-09-24
| | | | | | | | http://codereview.appspot.com/6558048/ git-svn-id: http://skia.googlecode.com/svn/trunk@5646 2bbb7eff-a529-9590-31e7-b0007b416f81
* Recommit r5350 with fix for image failures (which affected GLs that don't ↵Gravatar bsalomon@google.com2012-08-30
| | | | | | support ARB_texture_swizzle). git-svn-id: http://skia.googlecode.com/svn/trunk@5353 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert 5350 while image changes are diagnosed.Gravatar bsalomon@google.com2012-08-30
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@5351 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove fModulate from GrGLShaderBuilderGravatar bsalomon@google.com2012-08-30
| | | | | | | | | Review URL: https://codereview.appspot.com/6495051/ git-svn-id: http://skia.googlecode.com/svn/trunk@5350 2bbb7eff-a529-9590-31e7-b0007b416f81
* Linux warning fixesGravatar bsalomon@google.com2012-08-29
| | | | | | | | Review URL: https://codereview.appspot.com/6500045/ git-svn-id: http://skia.googlecode.com/svn/trunk@5337 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add helpers to add/modulate glsl vec4s.Gravatar bsalomon@google.com2012-08-29
| | | | | | | | Review URL: https://codereview.appspot.com/6497046/ git-svn-id: http://skia.googlecode.com/svn/trunk@5332 2bbb7eff-a529-9590-31e7-b0007b416f81
* Some GrGLShaderBuilder cleanupGravatar bsalomon@google.com2012-08-28
| | | | | | | | Review URL: https://codereview.appspot.com/6500043/ git-svn-id: http://skia.googlecode.com/svn/trunk@5322 2bbb7eff-a529-9590-31e7-b0007b416f81
* uniquely name FS functions, add lighting effects to unit testGravatar bsalomon@google.com2012-08-07
| | | | | | | Review URL: http://codereview.appspot.com/6458080/ git-svn-id: http://skia.googlecode.com/svn/trunk@4992 2bbb7eff-a529-9590-31e7-b0007b416f81
* Refactor how precision is handled with GrGLShaderVarGravatar bsalomon@google.com2012-07-12
| | | | | | | Review URL: http://codereview.appspot.com/6392049/ git-svn-id: http://skia.googlecode.com/svn/trunk@4575 2bbb7eff-a529-9590-31e7-b0007b416f81
* Infrastructure for new Ganesh shader pipeline: base classes for GPUGravatar tomhudson@google.com2012-04-18
| | | | | | | | | | 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
* Move GL-specific source code to make room for D3D back end.Gravatar tomhudson@google.com2012-02-10
git-svn-id: http://skia.googlecode.com/svn/trunk@3165 2bbb7eff-a529-9590-31e7-b0007b416f81