Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e3b3950

Browse files
author
Jonah Williams
authored
Revert "[dart:ui] add documentation to FragmentShader setSampler/setFloat (#37503)" (#37549)
This reverts commit b57e45e.
1 parent 4b559e6 commit e3b3950

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

lib/ui/painting.dart

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4267,58 +4267,13 @@ class FragmentShader extends Shader {
42674267
Float32List _floats = _kEmptyFloat32List;
42684268

42694269
/// Sets the float uniform at [index] to [value].
4270-
///
4271-
/// All uniforms defined in a fragment shader that are not samplers must be
4272-
/// set through this method. This includes floats and vec2, vec3, and vec4.
4273-
/// The correct index for each uniform is determined by the order of the
4274-
/// uniforms as defined in the fragment program, ignoring any samplers. For
4275-
/// data types that are composed of multiple floats such as a vec4, more than
4276-
/// one call to [setFloat] is required.
4277-
///
4278-
/// For example, given the following uniforms in a fragment program:
4279-
///
4280-
/// ```glsl
4281-
/// uniform float uScale;
4282-
/// uniform sampler2D uTexture;
4283-
/// uniform vec2 uMagnitude;
4284-
/// uniform vec4 uColor;
4285-
/// ```
4286-
///
4287-
/// Then the corresponding Dart code to correctly initialize these uniforms
4288-
/// is:
4289-
///
4290-
/// ```dart
4291-
/// void updateShader(Shader shader, Color color, ImageShader sampler) {
4292-
/// shader.setFloat(0, 23); // uScale
4293-
/// shader.setFloat(1, 114); // uMagnitude x
4294-
/// shader.setFloat(2, 83); // uMagnitude y
4295-
///
4296-
/// // Convert color to premultiplied opacity.
4297-
/// shader.setFloat(3, color.red / 255 * color.opacity); // uColor r
4298-
/// shader.setFloat(4, color.green / 255 * color.opacity); // uColor g
4299-
/// shader.setFloat(5, color.blue / 255 * color.opacity); // uColor b
4300-
/// shader.setFloat(6, color.opacity); // uColor a
4301-
///
4302-
/// // initialize sampler uniform.
4303-
/// shader.setSampler(0, sampler);
4304-
/// }
4305-
/// ```
4306-
///
4307-
/// Note how the indexes used does not count the `sampler2D` uniform. This
4308-
/// uniform will be set separately with [setSampler], with the index starting
4309-
/// over at 0.
4310-
///
4311-
/// Any float uniforms that are left uninitialized will default to `0`.
43124270
void setFloat(int index, double value) {
43134271
assert(!debugDisposed, 'Tried to accesss uniforms on a disposed Shader: $this');
43144272
_floats[index] = value;
43154273
}
43164274

43174275
/// Sets the sampler uniform at [index] to [sampler].
43184276
///
4319-
/// The index of the setSampler is the index of the sampler uniform defined
4320-
/// in the fragment program, excluding all non-sampler uniforms.
4321-
///
43224277
/// All the sampler uniforms that a shader expects must be provided or the
43234278
/// results will be undefined.
43244279
void setSampler(int index, ImageShader sampler) {

0 commit comments

Comments
 (0)