---
title: "규칙 11.12: 대상과 오라클, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 11.12(대상과 오라클)입니다. An integer division, remainder and shift, and a float's conversion to an integer…"
url: https://typeshade.dev/ko/reference/rules/11-12/
language: ko
---

# 규칙 11.12

11장, 대상과 오라클 테스트

An integer division, remainder and shift, and a float’s conversion to an integer, must give WGSL’s answer on GLSL ES 3.00 for every input WGSL settles: the GLSL writer spells each through a helper that settles the inputs GLSL ES 3.00 leaves undefined, and uses the bare operator only where the operands cannot reach one.

규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

## 근거

GLSL ES 3.00 gives a zero divisor, the least `int` over -1, a negative operand of `%`, a shift amount past the width and a float the integer cannot hold no result (its §5.9, §4.1.3 and §5.4.1), and a WebGL2 driver answers otherwise than WGSL on all but the shift ([#382](https://github.com/typeshade/typeshade/issues/382)); the oracle follows WGSL ([Rule 11.5](https://typeshade.dev/ko/reference/rules/11-5/)), so without the helpers a program means one thing on WebGPU and on the CPU tier and another on WebGL2, a kernel function’s WebGL2 tier included.

## 출처

change `0027` in `changes/`; [#382](https://github.com/typeshade/typeshade/issues/382); [Arithmetic Expressions](https://gpuweb.github.io/gpuweb/wgsl/#arithmetic-expr), [Bit Expressions](https://gpuweb.github.io/gpuweb/wgsl/#bit-expr) and [Conversion Expressions](https://gpuweb.github.io/gpuweb/wgsl/#conversion-expr).

## 검증 방식

테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.

컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.

`src/core/backends/glsl-int.ts`, which the GLSL writer’s `intBinop` and `floatToInt` spellings call; pinned by `src/core/backends/glsl-int-answers.test.ts` on both halves; the compile gate for every example’s GLSL; and the WebGL2 arm of `scripts/gpu-differential.ts`, which holds these operations to the oracle over generated programs and requires the corpus to reach the inputs GLSL leaves undefined.

커밋 af54ddad5에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.

- [`scripts/gpu-differential.ts:36`](https://github.com/typeshade/typeshade/blob/af54ddad5/scripts/gpu-differential.ts#L36)
- [`src/core/backends/glsl-int-answers.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/glsl-int-answers.test.ts#L1)
- [`src/core/backends/glsl-int.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/glsl-int.ts#L1)

## 설명하는 절

커밋 af54ddad5의 언어 문서에서 이 규칙을 설명하는 절입니다.

- [§11 Vector constructors](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#11-vector-constructors)
- [§22 Constant checks on a shift amount and a divisor](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#22-constant-checks-on-a-shift-amount-and-a-divisor)

## 함께 보기

- [규칙 11.11](https://typeshade.dev/ko/reference/rules/11-11/) 테스트
- [규칙 11.13](https://typeshade.dev/ko/reference/rules/11-13/) 테스트
- [규칙 11.5](https://typeshade.dev/ko/reference/rules/11-5/)
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

- [`docs/language-design.md:1569`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L1569) (설계 문서)
- [`reqs/rules/RULE-1112.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-1112.md) (추적 항목)
