joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [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 | */ |
| 7 | |
| 8 | #ifndef GrPrimitiveProcessor_DEFINED |
| 9 | #define GrPrimitiveProcessor_DEFINED |
| 10 | |
| 11 | #include "GrColor.h" |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 12 | #include "GrNonAtomicRef.h" |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 13 | #include "GrProcessor.h" |
Brian Salomon | ee78396 | 2018-08-01 09:55:10 -0400 | [diff] [blame] | 14 | #include "GrProxyRef.h" |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 15 | #include "GrShaderVar.h" |
| 16 | |
Brian Salomon | f7dcd76 | 2018-07-30 14:48:15 -0400 | [diff] [blame] | 17 | class GrCoordTransform; |
| 18 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 19 | /* |
| 20 | * The GrPrimitiveProcessor represents some kind of geometric primitive. This includes the shape |
| 21 | * of the primitive and the inherent color of the primitive. The GrPrimitiveProcessor is |
| 22 | * responsible for providing a color and coverage input into the Ganesh rendering pipeline. Through |
| 23 | * optimization, Ganesh may decide a different color, no color, and / or no coverage are required |
| 24 | * from the GrPrimitiveProcessor, so the GrPrimitiveProcessor must be able to support this |
Brian Salomon | 09d994e | 2016-12-21 11:14:46 -0500 | [diff] [blame] | 25 | * functionality. |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 26 | * |
| 27 | * There are two feedback loops between the GrFragmentProcessors, the GrXferProcessor, and the |
Brian Salomon | cb30bb2 | 2017-02-12 09:28:54 -0500 | [diff] [blame] | 28 | * GrPrimitiveProcessor. These loops run on the CPU and to determine known properties of the final |
| 29 | * color and coverage inputs to the GrXferProcessor in order to perform optimizations that preserve |
| 30 | * correctness. The GrDrawOp seeds these loops with initial color and coverage, in its |
Brian Salomon | a811b12 | 2017-03-30 08:21:32 -0400 | [diff] [blame] | 31 | * getProcessorAnalysisInputs implementation. These seed values are processed by the |
Brian Salomon | 5298dc8 | 2017-02-22 11:52:03 -0500 | [diff] [blame] | 32 | * subsequent |
Brian Salomon | 92aee3d | 2016-12-21 09:20:25 -0500 | [diff] [blame] | 33 | * stages of the rendering pipeline and the output is then fed back into the GrDrawOp in |
| 34 | * the applyPipelineOptimizations call, where the op can use the information to inform decisions |
| 35 | * about GrPrimitiveProcessor creation. |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 36 | */ |
| 37 | |
egdaniel | e659a58 | 2015-11-13 09:55:43 -0800 | [diff] [blame] | 38 | class GrGLSLPrimitiveProcessor; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 39 | |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 40 | /** |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 41 | * GrPrimitiveProcessor defines an interface which all subclasses must implement. All |
| 42 | * GrPrimitiveProcessors must proivide seed color and coverage for the Ganesh color / coverage |
| 43 | * pipelines, and they must provide some notion of equality |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 44 | * |
| 45 | * TODO: This class does not really need to be ref counted. Instances should be allocated using |
| 46 | * GrOpFlushState's arena and destroyed when the arena is torn down. |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 47 | */ |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 48 | class GrPrimitiveProcessor : public GrProcessor, public GrNonAtomicRef<GrPrimitiveProcessor> { |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 49 | public: |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 50 | class TextureSampler; |
| 51 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 52 | /** Describes a vertex or instance attribute. */ |
Brian Salomon | 70132d0 | 2018-05-29 15:33:06 -0400 | [diff] [blame] | 53 | class Attribute { |
| 54 | public: |
Brian Salomon | 70132d0 | 2018-05-29 15:33:06 -0400 | [diff] [blame] | 55 | constexpr Attribute() = default; |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 56 | constexpr Attribute(const char* name, GrVertexAttribType type) : fName(name), fType(type) {} |
| 57 | constexpr Attribute(const Attribute&) = default; |
Brian Salomon | 70132d0 | 2018-05-29 15:33:06 -0400 | [diff] [blame] | 58 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 59 | Attribute& operator=(const Attribute&) = default; |
Brian Salomon | 70132d0 | 2018-05-29 15:33:06 -0400 | [diff] [blame] | 60 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 61 | constexpr bool isInitialized() const { return SkToBool(fName); } |
| 62 | |
| 63 | constexpr const char* name() const { return fName; } |
| 64 | constexpr GrVertexAttribType type() const { return fType; } |
| 65 | |
| 66 | inline constexpr size_t size() const; |
| 67 | constexpr size_t sizeAlign4() const { return SkAlign4(this->size()); } |
Brian Salomon | 70132d0 | 2018-05-29 15:33:06 -0400 | [diff] [blame] | 68 | |
| 69 | GrShaderVar asShaderVar() const { |
| 70 | return {fName, GrVertexAttribTypeToSLType(fType), GrShaderVar::kIn_TypeModifier}; |
| 71 | } |
| 72 | |
| 73 | private: |
| 74 | const char* fName = nullptr; |
| 75 | GrVertexAttribType fType = kFloat_GrVertexAttribType; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 76 | }; |
| 77 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 78 | GrPrimitiveProcessor(ClassID); |
Ethan Nicholas | abff956 | 2017-10-09 10:54:08 -0400 | [diff] [blame] | 79 | |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 80 | int numTextureSamplers() const { return fTextureSamplerCnt; } |
| 81 | const TextureSampler& textureSampler(int index) const; |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 82 | int numVertexAttributes() const { return fVertexAttributeCnt; } |
| 83 | const Attribute& vertexAttribute(int i) const; |
| 84 | int numInstanceAttributes() const { return fInstanceAttributeCnt; } |
| 85 | const Attribute& instanceAttribute(int i) const; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 86 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 87 | bool hasVertexAttributes() const { return SkToBool(fVertexAttributeCnt); } |
| 88 | bool hasInstanceAttributes() const { return SkToBool(fInstanceAttributeCnt); } |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 89 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 90 | #ifdef SK_DEBUG |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 91 | /** |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 92 | * A common practice is to populate the the vertex/instance's memory using an implicit array of |
| 93 | * structs. In this case, it is best to assert that: |
| 94 | * debugOnly_stride == sizeof(struct) and |
| 95 | * offsetof(struct, field[i]) == debugOnly_AttributeOffset(i) |
| 96 | * In general having Op subclasses assert that attribute offsets and strides agree with their |
| 97 | * tessellation code's expectations is good practice. |
| 98 | * However, these functions walk the attributes to compute offsets and call virtual functions |
| 99 | * to access the attributes. Thus, they are only available in debug builds. |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 100 | */ |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 101 | size_t debugOnly_vertexStride() const; |
| 102 | size_t debugOnly_instanceStride() const; |
| 103 | size_t debugOnly_vertexAttributeOffset(int) const; |
| 104 | size_t debugOnly_instanceAttributeOffset(int) const; |
| 105 | #endif |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 106 | |
| 107 | // Only the GrGeometryProcessor subclass actually has a geo shader or vertex attributes, but |
| 108 | // we put these calls on the base class to prevent having to cast |
| 109 | virtual bool willUseGeoShader() const = 0; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 110 | |
| 111 | /** |
wangyix | a7f4c43 | 2015-08-20 07:25:02 -0700 | [diff] [blame] | 112 | * Computes a transformKey from an array of coord transforms. Will only look at the first |
| 113 | * <numCoords> transforms in the array. |
| 114 | * |
| 115 | * TODO: A better name for this function would be "compute" instead of "get". |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 116 | */ |
wangyix | a7f4c43 | 2015-08-20 07:25:02 -0700 | [diff] [blame] | 117 | uint32_t getTransformKey(const SkTArray<const GrCoordTransform*, true>& coords, |
| 118 | int numCoords) const; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 119 | |
| 120 | /** |
| 121 | * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this geometry |
| 122 | * processor's GL backend implementation. |
wangyix | a7f4c43 | 2015-08-20 07:25:02 -0700 | [diff] [blame] | 123 | * |
| 124 | * TODO: A better name for this function would be "compute" instead of "get". |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 125 | */ |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 126 | virtual void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 127 | |
| 128 | |
| 129 | /** Returns a new instance of the appropriate *GL* implementation class |
| 130 | for the given GrProcessor; caller is responsible for deleting |
| 131 | the object. */ |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 132 | virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const = 0; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 133 | |
ethannicholas | 2279325 | 2016-01-30 09:59:10 -0800 | [diff] [blame] | 134 | virtual bool isPathRendering() const { return false; } |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 135 | |
ethannicholas | 2279325 | 2016-01-30 09:59:10 -0800 | [diff] [blame] | 136 | /** |
| 137 | * If non-null, overrides the dest color returned by GrGLSLFragmentShaderBuilder::dstColor(). |
| 138 | */ |
| 139 | virtual const char* getDestColorOverride() const { return nullptr; } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 140 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 141 | virtual float getSampleShading() const { return 0.0; } |
ethannicholas | 28ef445 | 2016-03-25 09:26:03 -0700 | [diff] [blame] | 142 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 143 | protected: |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 144 | void setVertexAttributeCnt(int cnt) { |
| 145 | SkASSERT(cnt >= 0); |
| 146 | fVertexAttributeCnt = cnt; |
| 147 | } |
| 148 | void setInstanceAttributeCnt(int cnt) { |
| 149 | SkASSERT(cnt >= 0); |
| 150 | fInstanceAttributeCnt = cnt; |
| 151 | } |
| 152 | void setTextureSamplerCnt(int cnt) { |
| 153 | SkASSERT(cnt >= 0); |
| 154 | fTextureSamplerCnt = cnt; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Helper for implementing onTextureSampler(). E.g.: |
| 159 | * return IthTexureSampler(i, fMyFirstSampler, fMySecondSampler, fMyThirdSampler); |
| 160 | */ |
| 161 | template <typename... Args> |
| 162 | static const TextureSampler& IthTextureSampler(int i, const TextureSampler& samp0, |
| 163 | const Args&... samps) { |
| 164 | return (0 == i) ? samp0 : IthTextureSampler(i - 1, samps...); |
| 165 | } |
| 166 | inline static const TextureSampler& IthTextureSampler(int i); |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 167 | |
| 168 | private: |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 169 | virtual const Attribute& onVertexAttribute(int) const = 0; |
| 170 | virtual const Attribute& onInstanceAttribute(int) const = 0; |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 171 | virtual const TextureSampler& onTextureSampler(int) const { return IthTextureSampler(0); } |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 172 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 173 | int fVertexAttributeCnt = 0; |
| 174 | int fInstanceAttributeCnt = 0; |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 175 | int fTextureSamplerCnt = 0; |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 176 | typedef GrProcessor INHERITED; |
| 177 | }; |
| 178 | |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 179 | ////////////////////////////////////////////////////////////////////////////// |
| 180 | |
| 181 | /** |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 182 | * Used to represent a texture that is required by a GrPrimitiveProcessor. It holds a GrTextureProxy |
| 183 | * along with an associated GrSamplerState. TextureSamplers don't perform any coord manipulation to |
| 184 | * account for texture origin. |
| 185 | */ |
| 186 | class GrPrimitiveProcessor::TextureSampler { |
| 187 | public: |
| 188 | TextureSampler() = default; |
| 189 | |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 190 | TextureSampler(GrTextureType, GrPixelConfig, const GrSamplerState&, GrShaderFlags visibility); |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 191 | |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 192 | explicit TextureSampler(GrTextureType, GrPixelConfig, |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 193 | GrSamplerState::Filter = GrSamplerState::Filter::kNearest, |
| 194 | GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp, |
| 195 | GrShaderFlags visibility = kFragment_GrShaderFlag); |
| 196 | |
| 197 | TextureSampler(const TextureSampler&) = delete; |
| 198 | TextureSampler& operator=(const TextureSampler&) = delete; |
| 199 | |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 200 | void reset(GrTextureType, GrPixelConfig, const GrSamplerState&, |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 201 | GrShaderFlags visibility = kFragment_GrShaderFlag); |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 202 | void reset(GrTextureType, GrPixelConfig, |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 203 | GrSamplerState::Filter = GrSamplerState::Filter::kNearest, |
| 204 | GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp, |
| 205 | GrShaderFlags visibility = kFragment_GrShaderFlag); |
| 206 | |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 207 | GrTextureType textureType() const { return fTextureType; } |
| 208 | GrPixelConfig config() const { return fConfig; } |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 209 | |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 210 | GrShaderFlags visibility() const { return fVisibility; } |
| 211 | const GrSamplerState& samplerState() const { return fSamplerState; } |
| 212 | |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 213 | bool isInitialized() const { return fConfig != kUnknown_GrPixelConfig; } |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 214 | |
| 215 | private: |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 216 | GrSamplerState fSamplerState; |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame^] | 217 | GrTextureType fTextureType = GrTextureType::k2D; |
| 218 | GrPixelConfig fConfig = kUnknown_GrPixelConfig; |
Brian Salomon | e782f84 | 2018-07-31 13:53:11 -0400 | [diff] [blame] | 219 | GrShaderFlags fVisibility = kNone_GrShaderFlags; |
| 220 | }; |
| 221 | |
| 222 | const GrPrimitiveProcessor::TextureSampler& GrPrimitiveProcessor::IthTextureSampler(int i) { |
| 223 | SK_ABORT("Illegal texture sampler index"); |
| 224 | static const TextureSampler kBogus; |
| 225 | return kBogus; |
| 226 | } |
| 227 | |
| 228 | ////////////////////////////////////////////////////////////////////////////// |
| 229 | |
| 230 | /** |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 231 | * Returns the size of the attrib type in bytes. |
| 232 | * This was moved from include/private/GrTypesPriv.h in service of Skia dependents that build |
| 233 | * with C++11. |
| 234 | */ |
| 235 | static constexpr inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { |
| 236 | switch (type) { |
| 237 | case kFloat_GrVertexAttribType: |
| 238 | return sizeof(float); |
| 239 | case kFloat2_GrVertexAttribType: |
| 240 | return 2 * sizeof(float); |
| 241 | case kFloat3_GrVertexAttribType: |
| 242 | return 3 * sizeof(float); |
| 243 | case kFloat4_GrVertexAttribType: |
| 244 | return 4 * sizeof(float); |
| 245 | case kHalf_GrVertexAttribType: |
| 246 | return sizeof(float); |
| 247 | case kHalf2_GrVertexAttribType: |
| 248 | return 2 * sizeof(float); |
| 249 | case kHalf3_GrVertexAttribType: |
| 250 | return 3 * sizeof(float); |
| 251 | case kHalf4_GrVertexAttribType: |
| 252 | return 4 * sizeof(float); |
| 253 | case kInt2_GrVertexAttribType: |
| 254 | return 2 * sizeof(int32_t); |
| 255 | case kInt3_GrVertexAttribType: |
| 256 | return 3 * sizeof(int32_t); |
| 257 | case kInt4_GrVertexAttribType: |
| 258 | return 4 * sizeof(int32_t); |
Ruiqi Mao | b609e6d | 2018-07-17 10:19:38 -0400 | [diff] [blame] | 259 | case kByte_GrVertexAttribType: |
| 260 | return 1 * sizeof(char); |
| 261 | case kByte2_GrVertexAttribType: |
| 262 | return 2 * sizeof(char); |
| 263 | case kByte3_GrVertexAttribType: |
| 264 | return 3 * sizeof(char); |
| 265 | case kByte4_GrVertexAttribType: |
| 266 | return 4 * sizeof(char); |
| 267 | case kUByte_GrVertexAttribType: |
| 268 | return 1 * sizeof(char); |
| 269 | case kUByte2_GrVertexAttribType: |
| 270 | return 2 * sizeof(char); |
| 271 | case kUByte3_GrVertexAttribType: |
| 272 | return 3 * sizeof(char); |
| 273 | case kUByte4_GrVertexAttribType: |
| 274 | return 4 * sizeof(char); |
Brian Salomon | 92be2f7 | 2018-06-19 14:33:47 -0400 | [diff] [blame] | 275 | case kUByte_norm_GrVertexAttribType: |
| 276 | return 1 * sizeof(char); |
| 277 | case kUByte4_norm_GrVertexAttribType: |
| 278 | return 4 * sizeof(char); |
| 279 | case kShort2_GrVertexAttribType: |
| 280 | return 2 * sizeof(int16_t); |
| 281 | case kUShort2_GrVertexAttribType: // fall through |
| 282 | case kUShort2_norm_GrVertexAttribType: |
| 283 | return 2 * sizeof(uint16_t); |
| 284 | case kInt_GrVertexAttribType: |
| 285 | return sizeof(int32_t); |
| 286 | case kUint_GrVertexAttribType: |
| 287 | return sizeof(uint32_t); |
| 288 | } |
| 289 | // GCC fails because SK_ABORT evaluates to non constexpr. clang and cl.exe think this is |
| 290 | // unreachable and don't complain. |
| 291 | #if defined(__clang__) || !defined(__GNUC__) |
| 292 | SK_ABORT("Unsupported type conversion"); |
| 293 | #endif |
| 294 | return 0; |
| 295 | } |
| 296 | |
| 297 | constexpr size_t GrPrimitiveProcessor::Attribute::size() const { |
| 298 | return GrVertexAttribTypeSize(fType); |
| 299 | } |
| 300 | |
joshualitt | 8072caa | 2015-02-12 14:20:52 -0800 | [diff] [blame] | 301 | #endif |