---
title: "pointwiseOp"
description: "Wrap a compiled GPU function as a pointwise filter effect: the child's color goes in first, then `args`."
group: "define"
groupTitle: "Defining a shader"
categoryId: "invoke"
categorySlug: "invoke"
categoryTitle: "Context & invocation"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/invoke.ts#L207"
---

# pointwiseOp

Wrap a compiled GPU function as a pointwise filter effect: the child's color goes in first, then `args`.

```ts
pointwiseOp(
  fn: unknown,
  hint: string,
  args: ArgSpec[],
  extra?: {compose?: PointwiseEffect['compose']; setup?: PointwiseEffect['setup']},
): PointwiseEffect
```

Import `pointwiseOp` from `shaders/std`.

This is how the library's color words are made. `fn` takes `(color: vec4f, ...args)` and returns the new color; `hint` names it in the generated code; `args` are the values that follow the color, given as prop refs, scalars, context tokens or numbers. `extra.compose` post-processes the result and `extra.setup` runs once per build.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `fn` | `unknown` |  |
| `hint` | `string` |  |
| `args` | `ArgSpec[]` |  |
| `extra` | `{compose?: PointwiseEffect['compose']; setup?: PointwiseEffect['setup']}` | Optional. |

## Example

```ts
export function saturate(intensity: ArgSpec): PointwiseEffect {
  return pointwiseOp(colorOps.saturate, 'saturate', [intensity])
}
```

## See also

- [`resolveArg`](/docs/primitives/invoke/resolvearg) — Any input value a word accepts (a prop ref, a `Scalar`, a context token, a number) as a GPU value inside a filter's builder.
- [`p`](/docs/primitives/values/p) — Reference one of the definition's props by name, wherever a word asks for a value.