---
title: "dpdx(): typeshade/core/ir의 IR 빌더 함수, TypeShade 컴파일러 API"
description: "dpdx, typeshade/core/ir의 IR 빌더 함수입니다. dpdx(x): x의 화면 공간 편미분을 X축 방향으로 구합니다. 성분별로 적용합니다."
url: https://typeshade.dev/ko/api/dpdx/
language: ko
---

# `dpdx()`

함수, 내장 함수 분류

`dpdx(x)`: x의 화면 공간 편미분을 X축 방향으로 구합니다. 성분별로 적용합니다.

`import { dpdx } from 'typeshade/core/ir'`

이 export는 IR 노드를 반환합니다. `"use typeshade"` 파일에서는 내장 함수 자체를 부릅니다: [`dpdx()`](https://typeshade.dev/ko/reference/functions/dpdx/)

설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.

## 구문

```ts
const dpdx: <K extends FloatKey>(x: ReadonlyNode<K>) => Node<K>
```

## 매개변수

**`x` `ReadonlyNode<K>`**

## 반환값

`Node<K>`

## 예외

**[`SD0109`](https://typeshade.dev/ko/reference/errors/sd0109/)**

fwidth와 같이 GPU에서만, 그리고 프래그먼트 셰이더에서만 존재합니다. fragment-only-builtin 린트 규칙이 다른 곳에서는 SD0109를 냅니다.

## 설명

[`fwidth`](https://typeshade.dev/ko/api/fwidth/)와 같이 GPU에서만 존재하며(CPU 계산은 0을 돌려준다) 프래그먼트 셰이더에서만 쓸 수 있습니다. 다른 곳에서 쓰면 `fragment-only-builtin` 린트 규칙이 [`SD0109`](https://typeshade.dev/ko/reference/errors/sd0109/)를 냅니다. WGSL에서는 `dpdx`, GLSL ES 3.00에서는 `dFdx`로 씁니다. [`dpdy`](https://typeshade.dev/ko/api/dpdy/)는 Y축 방향의 짝입니다.

## 대상별 지원

| 대상 | 지원 | 비고 |
| --- | --- | --- |
| WGSL (WebGPU) | 지원 | `dpdx(x)`. |
| GLSL ES 3.00 (WebGL2) | 지원 | `dFdx(x)`. |
| CPU 오라클 | 스텁 | 오라클에는 텍스처 메모리가 없고 이웃 프래그먼트도 없습니다. `{ gpuStubs: true }` 옵션으로 모듈을 컴파일하지 않았다면 이 호출은 예외를 던집니다. 이 옵션을 켜면 플레이스홀더 값을 돌려줍니다. |

## 관련 가이드

- [레이아웃과 리소스](https://typeshade.dev/ko/guide/internals/layouts-and-resources/)
- [CPU 오라클 안내서](https://typeshade.dev/ko/guide/internals/the-cpu-oracle/)

## 함께 보기

- [`dpdx()`](https://typeshade.dev/ko/reference/functions/dpdx/)
- [`fwidth`](https://typeshade.dev/ko/api/fwidth/)
- [`dpdy`](https://typeshade.dev/ko/api/dpdy/)

## 소스

[`src/core/ir/node.ts`, 1979행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L1979), 커밋 af54ddad5 기준
