| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "GrGLProgramDesc.h" | 7 #include "GrGLProgramDesc.h" |
| 8 | 8 |
| 9 #include "GrGLFragmentProcessor.h" | 9 #include "GrGLFragmentProcessor.h" |
| 10 #include "GrProcessor.h" | 10 #include "GrProcessor.h" |
| 11 #include "GrGLGpu.h" | 11 #include "GrGLGpu.h" |
| 12 #include "GrPipeline.h" | 12 #include "GrPipeline.h" |
| 13 #include "SkChecksum.h" | 13 #include "SkChecksum.h" |
| 14 #include "gl/builders/GrGLFragmentShaderBuilder.h" | 14 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Do we need to either map r,g,b->a or a->r. configComponentMask indicates whic
h channels are | 17 * Do we need to either map r,g,b->a or a->r. configComponentMask indicates whic
h channels are |
| 18 * present in the texture's config. swizzleComponentMask indicates the channels
present in the | 18 * present in the texture's config. swizzleComponentMask indicates the channels
present in the |
| 19 * shader swizzle. | 19 * shader swizzle. |
| 20 */ | 20 */ |
| 21 static bool swizzle_requires_alpha_remapping(const GrGLSLCaps& caps, GrPixelConf
ig config) { | 21 static bool swizzle_requires_alpha_remapping(const GrGLSLCaps& caps, GrPixelConf
ig config) { |
| 22 if (!caps.mustSwizzleInShader()) { | 22 if (!caps.mustSwizzleInShader()) { |
| 23 // Any remapping is handled using texture swizzling not shader modificat
ions. | 23 // Any remapping is handled using texture swizzling not shader modificat
ions. |
| 24 return false; | 24 return false; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- | 139 // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------
------------------- |
| 140 // Because header is a pointer into the dynamic array, we can't push any new
data into the key | 140 // Because header is a pointer into the dynamic array, we can't push any new
data into the key |
| 141 // below here. | 141 // below here. |
| 142 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); | 142 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); |
| 143 | 143 |
| 144 // make sure any padding in the header is zeroed. | 144 // make sure any padding in the header is zeroed. |
| 145 memset(header, 0, kHeaderSize); | 145 memset(header, 0, kHeaderSize); |
| 146 | 146 |
| 147 if (pipeline.readsFragPosition()) { | 147 if (pipeline.readsFragPosition()) { |
| 148 header->fFragPosKey = | 148 header->fFragPosKey = |
| 149 GrGLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRe
nderTarget()); | 149 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get
RenderTarget()); |
| 150 } else { | 150 } else { |
| 151 header->fFragPosKey = 0; | 151 header->fFragPosKey = 0; |
| 152 } | 152 } |
| 153 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); | 153 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); |
| 154 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); | 154 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); |
| 155 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); | 155 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); |
| 156 glDesc->finalize(); | 156 glDesc->finalize(); |
| 157 return true; | 157 return true; |
| 158 } | 158 } |
| OLD | NEW |