---
title: "규칙 11.9: 대상과 오라클, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 11.9(대상과 오라클)입니다. A console call computes nothing a shader reads: its arguments must be evaluated once, in order…"
url: https://typeshade.dev/ko/reference/rules/11-9/
language: ko
---

# 규칙 11.9

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

A `console` call computes nothing a shader reads: its arguments must be evaluated once, in order, on every target, and the call then delivers an event, `{ method, args, span, invocation }`. A `console.table` call must take exactly one value, and a matrix it takes must be delivered as its columns, on every path that delivers the event. On the CPU (the oracle, the generated CPU code, the lockstep dispatch) the event goes to the host’s sink. On WGSL under `console: 'gpu'`, a call a compute or fragment entry reaches must be written into the console buffer ([Rule 6.11](https://typeshade.dev/ko/reference/rules/6-11/)), and `decodeConsole` must turn the buffer into the same events in the order the CPU runs a dispatch in: by invocation, `z`, then `y`, then `x`, and in program order within one. Normal builds retain a recorded variant for reachable, recordable entry calls without enabling recording. An explicit `console: 'never'` omits it. Production does not record or print unless the host selects recording (change 0085). A call the WGSL cannot record (one a vertex entry reaches, one with an argument that has no fixed size or is not a value, one in a stage that already binds eight storage buffers) must be a [`TS8071`](https://typeshade.dev/ko/reference/errors/ts8071/) warning on the call; GLSL ES 3.00 records nothing, with no diagnostic ([Rule 10.5](https://typeshade.dev/ko/reference/rules/10-5/)).

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

## 근거

the GPU is an optimization level of the CPU program (`docs/dx.md`), so what a program logs must not depend on where it ran; the order a GPU wrote in is the scheduler’s and means nothing, so the decoder restores the CPU’s.

## 출처

`changes/0014-gpu-console.md`, `changes/0019-console-table.md`, measured on Tint and SwiftShader in Chromium 141 (a vertex stage that reaches the buffer: `var with 'storage' address space and 'read_write' access mode cannot be used by vertex pipeline stage`); a fragment’s helper invocations and a discarded one write nothing, measured on the same browser; surface §66.

## 검증 방식

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

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

`src/core/passes/console-buffer.test.ts`, which runs the lowered module on the oracle and holds the decoded events equal to the sink’s, overflow included, and pins each [`TS8071`](https://typeshade.dev/ko/reference/errors/ts8071/) reason; `src/compiler/ts/console.test.ts`, for the CPU delivery and `console.table` in both halves; `src/debug/console.test.ts`, for a stepped run.

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

- [`src/compiler/ts/console-variants.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/console-variants.test.ts#L1)
- [`src/compiler/ts/console.test.ts:8`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/console.test.ts#L8)
- [`src/core/passes/console-buffer.test.ts:9`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/console-buffer.test.ts#L9)
- [`src/core/passes/console-buffer.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/console-buffer.ts#L1)
- [`src/debug/console.test.ts:8`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/debug/console.test.ts#L8)
- [`src/runtime/console-variants.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/runtime/console-variants.test.ts#L1)
- [`src/vite-console-variants.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/vite-console-variants.test.ts#L1)

## 설명하는 절

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

- [§66 `console`: what reaches the host](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#66-console-what-reaches-the-host)

## 적용하는 오류 코드

규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.

**[`TS8071`](https://typeshade.dev/ko/reference/errors/ts8071/) `CONSOLE_NOT_RECORDED`**

`compile(src, { console: 'gpu' })`에서 나오는 경고입니다. WGSL이 기록하지 않는 `console` 호출이 있습니다. 메시지가 이유를 알려 줍니다. 정점 진입점이 그 호출에 닿거나, 인자의 크기가 정해져 있지 않거나 값이 아니거나, 스테이지에 스토리지 버퍼를 더 둘 자리가 없습니다. 호출은 CPU에서는 여전히 싱크에 닿습니다(규칙 11.9).

## 함께 보기

- [규칙 11.8](https://typeshade.dev/ko/reference/rules/11-8/) 테스트
- [규칙 11.10](https://typeshade.dev/ko/reference/rules/11-10/) 테스트
- [규칙 6.11](https://typeshade.dev/ko/reference/rules/6-11/)
- [규칙 10.5](https://typeshade.dev/ko/reference/rules/10-5/)
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

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