bsalomon@google.com | 798c8c4 | 2013-03-27 19:50:27 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
bsalomon@google.com | 798c8c4 | 2013-03-27 19:50:27 +0000 | [diff] [blame] | 7 | #include "GrGLProgramDesc.h" |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 8 | |
| 9 | #include "GrGLProcessor.h" |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 10 | #include "GrProcessor.h" |
bsalomon@google.com | 798c8c4 | 2013-03-27 19:50:27 +0000 | [diff] [blame] | 11 | #include "GrGpuGL.h" |
egdaniel | 170f90b | 2014-09-16 12:54:40 -0700 | [diff] [blame] | 12 | #include "GrOptDrawState.h" |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 13 | #include "SkChecksum.h" |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 14 | #include "gl/builders/GrGLFragmentShaderBuilder.h" |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 15 | |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 16 | /** |
| 17 | * The key for an individual coord transform is made up of a matrix type and a bit that |
| 18 | * indicates the source of the input coords. |
| 19 | */ |
| 20 | enum { |
| 21 | kMatrixTypeKeyBits = 1, |
| 22 | kMatrixTypeKeyMask = (1 << kMatrixTypeKeyBits) - 1, |
| 23 | kPositionCoords_Flag = (1 << kMatrixTypeKeyBits), |
| 24 | kTransformKeyBits = kMatrixTypeKeyBits + 1, |
| 25 | }; |
| 26 | |
| 27 | /** |
| 28 | * We specialize the vertex code for each of these matrix types. |
| 29 | */ |
| 30 | enum MatrixType { |
| 31 | kNoPersp_MatrixType = 0, |
| 32 | kGeneral_MatrixType = 1, |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * Do we need to either map r,g,b->a or a->r. configComponentMask indicates which channels are |
| 37 | * present in the texture's config. swizzleComponentMask indicates the channels present in the |
| 38 | * shader swizzle. |
| 39 | */ |
| 40 | static bool swizzle_requires_alpha_remapping(const GrGLCaps& caps, |
| 41 | uint32_t configComponentMask, |
| 42 | uint32_t swizzleComponentMask) { |
| 43 | if (caps.textureSwizzleSupport()) { |
| 44 | // Any remapping is handled using texture swizzling not shader modifications. |
| 45 | return false; |
| 46 | } |
| 47 | // check if the texture is alpha-only |
| 48 | if (kA_GrColorComponentFlag == configComponentMask) { |
| 49 | if (caps.textureRedSupport() && (kA_GrColorComponentFlag & swizzleComponentMask)) { |
| 50 | // we must map the swizzle 'a's to 'r'. |
| 51 | return true; |
| 52 | } |
| 53 | if (kRGB_GrColorComponentFlags & swizzleComponentMask) { |
| 54 | // The 'r', 'g', and/or 'b's must be mapped to 'a' according to our semantics that |
| 55 | // alpha-only textures smear alpha across all four channels when read. |
| 56 | return true; |
| 57 | } |
| 58 | } |
| 59 | return false; |
| 60 | } |
| 61 | |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 62 | static uint32_t gen_attrib_key(const GrGeometryProcessor& proc) { |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 63 | uint32_t key = 0; |
| 64 | |
joshualitt | 2dd1ae0 | 2014-12-03 06:24:10 -0800 | [diff] [blame] | 65 | const GrGeometryProcessor::VertexAttribArray& vars = proc.getAttribs(); |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 66 | int numAttributes = vars.count(); |
joshualitt | 2dd1ae0 | 2014-12-03 06:24:10 -0800 | [diff] [blame] | 67 | SkASSERT(numAttributes <= GrGeometryProcessor::kMaxVertexAttribs); |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 68 | for (int a = 0; a < numAttributes; ++a) { |
| 69 | uint32_t value = 1 << a; |
| 70 | key |= value; |
| 71 | } |
| 72 | return key; |
| 73 | } |
| 74 | |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 75 | static uint32_t gen_transform_key(const GrPendingFragmentStage& stage, |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 76 | bool useExplicitLocalCoords) { |
| 77 | uint32_t totalKey = 0; |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 78 | int numTransforms = stage.getProcessor()->numTransforms(); |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 79 | for (int t = 0; t < numTransforms; ++t) { |
| 80 | uint32_t key = 0; |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 81 | if (stage.isPerspectiveCoordTransform(t)) { |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 82 | key |= kGeneral_MatrixType; |
| 83 | } else { |
| 84 | key |= kNoPersp_MatrixType; |
| 85 | } |
| 86 | |
bsalomon | ae59b77 | 2014-11-19 08:23:49 -0800 | [diff] [blame] | 87 | const GrCoordTransform& coordTransform = stage.getProcessor()->coordTransform(t); |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 88 | if (kLocal_GrCoordSet != coordTransform.sourceCoords() && useExplicitLocalCoords) { |
| 89 | key |= kPositionCoords_Flag; |
| 90 | } |
| 91 | key <<= kTransformKeyBits * t; |
| 92 | SkASSERT(0 == (totalKey & key)); // keys for each transform ought not to overlap |
| 93 | totalKey |= key; |
| 94 | } |
| 95 | return totalKey; |
| 96 | } |
| 97 | |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 98 | static uint32_t gen_texture_key(const GrProcessor& proc, const GrGLCaps& caps) { |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 99 | uint32_t key = 0; |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 100 | int numTextures = proc.numTextures(); |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 101 | for (int t = 0; t < numTextures; ++t) { |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 102 | const GrTextureAccess& access = proc.textureAccess(t); |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 103 | uint32_t configComponentMask = GrPixelConfigComponentMask(access.getTexture()->config()); |
| 104 | if (swizzle_requires_alpha_remapping(caps, configComponentMask, access.swizzleMask())) { |
| 105 | key |= 1 << t; |
| 106 | } |
| 107 | } |
| 108 | return key; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * A function which emits a meta key into the key builder. This is required because shader code may |
| 113 | * be dependent on properties of the effect that the effect itself doesn't use |
| 114 | * in its key (e.g. the pixel format of textures used). So we create a meta-key for |
| 115 | * every effect using this function. It is also responsible for inserting the effect's class ID |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 116 | * which must be different for every GrProcessor subclass. It can fail if an effect uses too many |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 117 | * textures, transforms, etc, for the space allotted in the meta-key. NOTE, both FPs and GPs share |
| 118 | * this function because it is hairy, though FPs do not have attribs, and GPs do not have transforms |
joshualitt | 23e280d | 2014-09-18 12:26:38 -0700 | [diff] [blame] | 119 | */ |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 120 | static bool get_meta_key(const GrProcessor& proc, |
| 121 | const GrGLCaps& caps, |
| 122 | uint32_t transformKey, |
| 123 | uint32_t attribKey, |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 124 | GrProcessorKeyBuilder* b) { |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 125 | size_t processorKeySize = b->size(); |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 126 | uint32_t textureKey = gen_texture_key(proc, caps); |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame^] | 127 | uint32_t classID = proc.classID(); |
joshualitt | 89c7a2e | 2014-10-10 14:11:59 -0700 | [diff] [blame] | 128 | |
| 129 | // Currently we allow 16 bits for each of the above portions of the meta-key. Fail if they |
| 130 | // don't fit. |
| 131 | static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16); |
| 132 | if ((textureKey | transformKey | classID) & kMetaKeyInvalidMask) { |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 133 | return false; |
joshualitt | 89c7a2e | 2014-10-10 14:11:59 -0700 | [diff] [blame] | 134 | } |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 135 | if (processorKeySize > SK_MaxU16) { |
joshualitt | 6517134 | 2014-10-09 07:25:36 -0700 | [diff] [blame] | 136 | return false; |
| 137 | } |
| 138 | |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 139 | uint32_t* key = b->add32n(2); |
| 140 | key[0] = (textureKey << 16 | transformKey); |
| 141 | key[1] = (classID << 16 | SkToU16(processorKeySize)); |
joshualitt | 6517134 | 2014-10-09 07:25:36 -0700 | [diff] [blame] | 142 | return true; |
| 143 | } |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 144 | |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 145 | bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, |
joshualitt | 4dd9988 | 2014-11-11 08:51:30 -0800 | [diff] [blame] | 146 | const GrProgramDesc::DescInfo& descInfo, |
| 147 | GrGpu::DrawType drawType, |
| 148 | GrGpuGL* gpu, |
joshualitt | 4dd9988 | 2014-11-11 08:51:30 -0800 | [diff] [blame] | 149 | GrProgramDesc* desc) { |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 150 | bool inputColorIsUsed = descInfo.fInputColorIsUsed; |
| 151 | bool inputCoverageIsUsed = descInfo.fInputCoverageIsUsed; |
bsalomon@google.com | 798c8c4 | 2013-03-27 19:50:27 +0000 | [diff] [blame] | 152 | |
| 153 | // The descriptor is used as a cache key. Thus when a field of the |
| 154 | // descriptor will not affect program generation (because of the attribute |
| 155 | // bindings in use or other descriptor field settings) it should be set |
| 156 | // to a canonical value to avoid duplicate programs with different keys. |
| 157 | |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 158 | bool requiresLocalCoordAttrib = descInfo.fRequiresLocalCoordAttrib; |
kkinnunen | ec56e45 | 2014-08-25 22:21:16 -0700 | [diff] [blame] | 159 | |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 160 | GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t)); |
| 161 | // Make room for everything up to the effect keys. |
bsalomon | 848faf0 | 2014-07-11 10:01:02 -0700 | [diff] [blame] | 162 | desc->fKey.reset(); |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 163 | desc->fKey.push_back_n(kProcessorKeysOffset); |
joshualitt | bd769d0 | 2014-09-04 08:56:46 -0700 | [diff] [blame] | 164 | |
joshualitt | bd769d0 | 2014-09-04 08:56:46 -0700 | [diff] [blame] | 165 | // We can only have one effect which touches the vertex shader |
egdaniel | 170f90b | 2014-09-16 12:54:40 -0700 | [diff] [blame] | 166 | if (optState.hasGeometryProcessor()) { |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 167 | const GrGeometryProcessor& gp = *optState.getGeometryProcessor(); |
| 168 | GrProcessorKeyBuilder b(&desc->fKey); |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame^] | 169 | gp.getGLProcessorKey(optState.getBatchTracker(), gpu->glCaps(), &b); |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 170 | if (!get_meta_key(gp, gpu->glCaps(), 0, gen_attrib_key(gp), &b)) { |
| 171 | desc->fKey.reset(); |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 172 | return false; |
| 173 | } |
bsalomon@google.com | eb6879f | 2013-06-13 19:34:18 +0000 | [diff] [blame] | 174 | } |
bsalomon | 929f29a | 2014-07-17 07:55:11 -0700 | [diff] [blame] | 175 | |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 176 | for (int s = 0; s < optState.numFragmentStages(); ++s) { |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 177 | const GrPendingFragmentStage& fps = optState.getFragmentStage(s); |
joshualitt | 87f48d9 | 2014-12-04 10:41:40 -0800 | [diff] [blame] | 178 | const GrFragmentProcessor& fp = *fps.getProcessor(); |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 179 | GrProcessorKeyBuilder b(&desc->fKey); |
joshualitt | eb2a676 | 2014-12-04 11:35:33 -0800 | [diff] [blame^] | 180 | fp.getGLProcessorKey(gpu->glCaps(), &b); |
egdaniel | c67870c | 2014-11-26 08:50:50 -0800 | [diff] [blame] | 181 | if (!get_meta_key(*fps.getProcessor(), gpu->glCaps(), |
| 182 | gen_transform_key(fps, requiresLocalCoordAttrib), 0, &b)) { |
| 183 | desc->fKey.reset(); |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 184 | return false; |
| 185 | } |
bsalomon@google.com | 798c8c4 | 2013-03-27 19:50:27 +0000 | [diff] [blame] | 186 | } |
egdaniel | 170f90b | 2014-09-16 12:54:40 -0700 | [diff] [blame] | 187 | |
joshualitt | 6517134 | 2014-10-09 07:25:36 -0700 | [diff] [blame] | 188 | // --------DO NOT MOVE HEADER ABOVE THIS LINE-------------------------------------------------- |
bsalomon | 848faf0 | 2014-07-11 10:01:02 -0700 | [diff] [blame] | 189 | // Because header is a pointer into the dynamic array, we can't push any new data into the key |
| 190 | // below here. |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 191 | GLKeyHeader* header = desc->atOffset<GLKeyHeader, kHeaderOffset>(); |
bsalomon@google.com | 798c8c4 | 2013-03-27 19:50:27 +0000 | [diff] [blame] | 192 | |
joshualitt | 6517134 | 2014-10-09 07:25:36 -0700 | [diff] [blame] | 193 | // make sure any padding in the header is zeroed. |
| 194 | memset(header, 0, kHeaderSize); |
| 195 | |
| 196 | header->fHasGeometryProcessor = optState.hasGeometryProcessor(); |
egdaniel | ae44496 | 2014-09-22 12:29:52 -0700 | [diff] [blame] | 197 | |
joshualitt | 0e60282 | 2014-10-28 10:27:44 -0700 | [diff] [blame] | 198 | bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType); |
| 199 | if (gpu->caps()->pathRenderingSupport() && isPathRendering) { |
| 200 | header->fUseNvpr = true; |
bsalomon | cd523eb | 2014-09-23 08:19:00 -0700 | [diff] [blame] | 201 | SkASSERT(!optState.hasGeometryProcessor()); |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 202 | } else { |
joshualitt | 0e60282 | 2014-10-28 10:27:44 -0700 | [diff] [blame] | 203 | header->fUseNvpr = false; |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 204 | } |
| 205 | |
joshualitt | 2dd1ae0 | 2014-12-03 06:24:10 -0800 | [diff] [blame] | 206 | bool hasUniformColor = inputColorIsUsed && (isPathRendering || !descInfo.fHasVertexColor); |
bsalomon | cd523eb | 2014-09-23 08:19:00 -0700 | [diff] [blame] | 207 | |
| 208 | if (!inputColorIsUsed) { |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 209 | header->fColorInput = GrProgramDesc::kAllOnes_ColorInput; |
joshualitt | 0e60282 | 2014-10-28 10:27:44 -0700 | [diff] [blame] | 210 | } else if (hasUniformColor) { |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 211 | header->fColorInput = GrProgramDesc::kUniform_ColorInput; |
bsalomon | cd523eb | 2014-09-23 08:19:00 -0700 | [diff] [blame] | 212 | } else { |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 213 | header->fColorInput = GrProgramDesc::kAttribute_ColorInput; |
joshualitt | 0e60282 | 2014-10-28 10:27:44 -0700 | [diff] [blame] | 214 | SkASSERT(!header->fUseNvpr); |
bsalomon | cd523eb | 2014-09-23 08:19:00 -0700 | [diff] [blame] | 215 | } |
| 216 | |
joshualitt | 2dd1ae0 | 2014-12-03 06:24:10 -0800 | [diff] [blame] | 217 | bool hasVertexCoverage = !isPathRendering && descInfo.fHasVertexCoverage; |
| 218 | |
| 219 | bool covIsSolidWhite = !hasVertexCoverage && 0xffffffff == optState.getCoverageColor(); |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 220 | |
egdaniel | 170f90b | 2014-09-16 12:54:40 -0700 | [diff] [blame] | 221 | if (covIsSolidWhite || !inputCoverageIsUsed) { |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 222 | header->fCoverageInput = GrProgramDesc::kAllOnes_ColorInput; |
joshualitt | 2dd1ae0 | 2014-12-03 06:24:10 -0800 | [diff] [blame] | 223 | } else if (!hasVertexCoverage) { |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 224 | header->fCoverageInput = GrProgramDesc::kUniform_ColorInput; |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 225 | } else { |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 226 | header->fCoverageInput = GrProgramDesc::kAttribute_ColorInput; |
joshualitt | 0e60282 | 2014-10-28 10:27:44 -0700 | [diff] [blame] | 227 | SkASSERT(!header->fUseNvpr); |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 228 | } |
| 229 | |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 230 | if (descInfo.fReadsDst) { |
joshualitt | 9176e2c | 2014-11-20 07:28:52 -0800 | [diff] [blame] | 231 | const GrDeviceCoordTexture* dstCopy = optState.getDstCopy(); |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 232 | SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 233 | const GrTexture* dstCopyTexture = NULL; |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 234 | if (dstCopy) { |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 235 | dstCopyTexture = dstCopy->texture(); |
| 236 | } |
joshualitt | 30ba436 | 2014-08-21 20:18:45 -0700 | [diff] [blame] | 237 | header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTexture, |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 238 | gpu->glCaps()); |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 239 | SkASSERT(0 != header->fDstReadKey); |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 240 | } else { |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 241 | header->fDstReadKey = 0; |
bsalomon@google.com | b515881 | 2013-05-13 18:50:25 +0000 | [diff] [blame] | 242 | } |
| 243 | |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 244 | if (descInfo.fReadsFragPosition) { |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 245 | header->fFragPosKey = |
| 246 | GrGLFragmentShaderBuilder::KeyForFragmentPosition(optState.getRenderTarget(), |
| 247 | gpu->glCaps()); |
bsalomon@google.com | b515881 | 2013-05-13 18:50:25 +0000 | [diff] [blame] | 248 | } else { |
bsalomon@google.com | 2db3ded | 2013-05-22 14:34:04 +0000 | [diff] [blame] | 249 | header->fFragPosKey = 0; |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 250 | } |
| 251 | |
joshualitt | 79f8fae | 2014-10-28 17:59:26 -0700 | [diff] [blame] | 252 | header->fPrimaryOutputType = descInfo.fPrimaryOutputType; |
| 253 | header->fSecondaryOutputType = descInfo.fSecondaryOutputType; |
joshualitt | bd769d0 | 2014-09-04 08:56:46 -0700 | [diff] [blame] | 254 | |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame] | 255 | header->fColorEffectCnt = optState.numColorStages(); |
| 256 | header->fCoverageEffectCnt = optState.numCoverageStages(); |
bsalomon | 848faf0 | 2014-07-11 10:01:02 -0700 | [diff] [blame] | 257 | desc->finalize(); |
| 258 | return true; |
| 259 | } |