• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching +full:argument +full:- +full:count

4  * Use of this source code is governed by a BSD-style license that can be
19 const int offset = base->fOffset; in Convert()
20 const Type& baseType = base->type(); in Convert()
25 SkASSERT(inComponents.count() >= 1 && inComponents.count() <= 4); in Convert()
61 // First, we need a vector expression that is the non-constant portion of the swizzle, packed: in Convert()
62 // scalar.xxx -> type3(scalar) in Convert()
63 // scalar.x0x0 -> type2(scalar) in Convert()
64 // vector.zyx -> vector.zyx in Convert()
65 // vector.x0y0 -> vector.xy in Convert()
69 if (maskComponents.count() == inComponents.count()) { in Convert()
75 // scalar.x0x0 -> type4(type2(x), ...) in Convert()
76 // vector.y111 -> type4(vector.y, ...) in Convert()
77 // vector.z10x -> type4(vector.zx, ...) in Convert()
86 // scalar.x0x0 -> type4(type2(x), 0).xyxy in Convert()
87 // vector.y111 -> type4(vector.y, 1).xyyy in Convert()
88 // vector.z10x -> type4(vector.zx, 1, 0).xzwy in Convert()
93 int constantZeroIdx = -1, constantOneIdx = -1; in Convert()
95 for (int i = 0; i < inComponents.count(); i++) { in Convert()
98 if (constantZeroIdx == -1) { in Convert()
99 // Synthesize a 'type(0)' argument at the end of the constructor. in Convert()
108 if (constantOneIdx == -1) { in Convert()
109 // Synthesize a 'type(1)' argument at the end of the constructor. in Convert()
118 // The non-constant fields are already in the expected order. in Convert()
125 numberType->toCompound(context, constantFieldIdx, /*rows=*/1), in Convert()
137 const Type& exprType = expr->type(); in Make()
140 SkASSERT(components.count() >= 1 && components.count() <= 4); in Make()
151 // Replace swizzles with equivalent splat constructors (`scalar.xxx` --> `half3(value)`). in Make()
153 int offset = expr->fOffset; in Make()
159 if (context.fConfig->fSettings.fOptimize) { in Make()
160 // Detect identity swizzles like `color.rgba` and return the base-expression as-is. in Make()
161 if (components.count() == exprType.columns()) { in Make()
163 for (int i = 0; i < components.count(); ++i) { in Make()
175 if (expr->is<Swizzle>()) { in Make()
176 Swizzle& base = expr->as<Swizzle>(); in Make()
183 // (e.g. `color.abgr.abgr` --> `color.rgba` --> `color`.) in Make()
194 if (value->is<ConstructorSplat>()) { in Make()
195 const ConstructorSplat& splat = value->as<ConstructorSplat>(); in Make()
199 splat.argument()->clone()); in Make()
203 if (value->isAnyConstructor()) { in Make()
204 const AnyConstructor& base = value->asAnyConstructor(); in Make()
211 // `half4(1, 2, 3, 4).xxz` --> `half3(1, 1, 3)`. However, there are constraints: in Make()
212 // - Expressions with side effects need to occur exactly once, even if they in Make()
213 // would otherwise be swizzle-eliminated in Make()
214 // - Non-trivial expressions should not be repeated, but elimination is OK. in Make()
216 // Look up the argument for the constructor at each index. This is typically simple in Make()
242 // Count up the number of times each constructor argument is used by the in Make()
244 // `half4(bar.yz, half2(foo)).xwxy` -> { 3, 1 } in Make()
245 // - bar.yz is referenced 3 times, by `.x_xy` in Make()
246 // - half(foo) is referenced 1 time, by `._w__` in Make()
257 // Check that non-trivial expressions are not swizzled in more than once. in Make()
262 // Check that side-effect-bearing expressions are swizzled in exactly once. in Make()
276 const ConstructorArgMap& argument = argMap[c]; in Make() local
277 const Expression& baseArg = *baseArguments[argument.fArgIndex]; in Make()
280 // This argument is a scalar; add it to the list as-is. in Make()
281 SkASSERT(argument.fComponent == 0); in Make()
282 reorderedArgs.push_back({argument.fArgIndex, in Make()
285 // This argument is a component from a vector. in Make()
286 SkASSERT(argument.fComponent < baseArg.type().columns()); in Make()
288 reorderedArgs.back().fArgIndex != argument.fArgIndex) { in Make()
289 // This can't be combined with the previous argument. Add a new one. in Make()
290 reorderedArgs.push_back({argument.fArgIndex, in Make()
291 ComponentArray{argument.fComponent}}); in Make()
293 // Since we know this argument uses components, it should already in Make()
296 // Build up the current argument with one more component. in Make()
297 reorderedArgs.back().fComponents.push_back(argument.fComponent); in Make()
302 // Convert our reordered argument list to an actual array of expressions, with in Make()
308 baseArguments[reorderedArg.fArgIndex]->clone(); in Make()
318 // Wrap the new argument list in a constructor. in Make()