builtin
타입
A WebGPU builtin value, of the type WGSL gives it: i: builtin<"vertex_index"> on an entry parameter is a u32, pos: builtin<"position"> on an entry IO field a vec4.
시그니처와 이름 아래 문장, 컴파일러 메시지는 커밋 af54ddad5의 컴파일러가 쓴 영어 원문입니다.
구문
type builtin<N extends 'vertex_index' | 'instance_index' | 'position' | 'front_facing' | 'frag_depth' | 'sample_index' | 'sample_mask' | 'primitive_index' | 'local_invocation_id' | 'local_invocation_index' | 'global_invocation_id' | 'workgroup_id' | 'num_workgroups' | 'subgroup_invocation_id' | 'subgroup_size' | 'subgroup_id' | 'num_subgroups' | 'clip_distances', T = (N extends 'vertex_index' ? u32 : N extends 'instance_index' ? u32 : N extends 'position' ? vec4 : N extends 'front_facing' ? bool : N extends 'frag_depth' ? f32 : N extends 'sample_index' ? u32 : N extends 'sample_mask' ? u32 : N extends 'primitive_index' ? u32 : N extends 'local_invocation_id' ? vec3u : N extends 'local_invocation_index' ? u32 : N extends 'global_invocation_id' ? vec3u : N extends 'workgroup_id' ? vec3u : N extends 'num_workgroups' ? vec3u : N extends 'subgroup_invocation_id' ? u32 : N extends 'subgroup_size' ? u32 : N extends 'subgroup_id' ? u32 : N extends 'num_subgroups' ? u32 : never), O extends { readonly invariant?: true } = {}> = T extends boolean ? T : T extends { readonly invariant?: true } ? (N extends 'vertex_index' ? u32 : N extends 'instance_index' ? u32 : N extends 'position' ? vec4 : N extends 'front_facing' ? bool : N extends 'frag_depth' ? f32 : N extends 'sample_index' ? u32 : N extends 'sample_mask' ? u32 : N extends 'primitive_index' ? u32 : N extends 'local_invocation_id' ? vec3u : N extends 'local_invocation_index' ? u32 : N extends 'global_invocation_id' ? vec3u : N extends 'workgroup_id' ? vec3u : N extends 'num_workgroups' ? vec3u : N extends 'subgroup_invocation_id' ? u32 : N extends 'subgroup_size' ? u32 : N extends 'subgroup_id' ? u32 : N extends 'num_subgroups' ? u32 : never) : T매개변수
-
N'vertex_index' | 'instance_index' | 'position' | 'front_facing' | 'frag_depth' | 'sample_index' | 'sample_mask' | 'primitive_index' | 'local_invocation_id' | 'local_invocation_index' | 'global_invocation_id' | 'workgroup_id' | 'num_workgroups' | 'subgroup_invocation_id' | 'subgroup_size' | 'subgroup_id' | 'num_subgroups' | 'clip_distances' -
T선택 사항 -
O선택 사항{ readonly invariant?: true }
설명
An option is the second argument: builtin<"position", { invariant: true }>. clip_distances is the one name that writes its type, builtin<"clip_distances", array<f32, 4>>. A written type that WGSL fixes, builtin<"vertex_index", u32>, is the migration form: the compiler warns on it (TS8028), and tshc migrate rewrites it.
예제
path/uv-gradient/uv-gradient.shade.tspath/moving-wave/moving-wave.shade.tspath/sdf-shapes/sdf-shapes.shade.tspath/tile-pattern/tile-pattern.shade.tspath/fractal/fractal.shade.tspath/palette/palette.shade.tspath/bouncing-balls/bouncing-balls.shade.tspath/double-array/double-array.shade.tspath/image-blur/image-blur.shade.tspath/parallel-sum/parallel-sum.shade.tspath/histogram/histogram.shade.tspath/ray-tracer/ray-tracer.shade.tsgallery/capsule-corp-namek-class/capsule-corp-namek-class.shade.tsgallery/domain-warp-twin/domain-warp-twin.shade.tsgallery/hillshade-twin/hillshade-twin.shade.tsgallery/julia-twin/julia-twin.shade.tsgallery/kaleidoscope-twin/kaleidoscope-twin.shade.tsgallery/mandelbrot-twin/mandelbrot-twin.shade.tsgallery/ocean-twin/ocean-twin.shade.tsgallery/path-tracer/path-tracer.shade.tsgallery/plasma-twin/plasma-twin.shade.tsgallery/rt-renderer-class/rt-renderer-class.shade.tsgallery/starfield-twin/starfield-twin.shade.tsgallery/tunnel-twin/tunnel-twin.shade.tsgallery/voronoi-twin/voronoi-twin.shade.tsgallery/fp64-burning-ship-twin/fp64-burning-ship-twin.shade.tsgallery/fp64-cancellation-twin/fp64-cancellation-twin.shade.tsgallery/fp64-checker-plane-twin/fp64-checker-plane-twin.shade.tsgallery/fp64-clock-twin/fp64-clock-twin.shade.tsgallery/fp64-deep-zoom-twin/fp64-deep-zoom-twin.shade.tsgallery/fp64-julia-twin/fp64-julia-twin.shade.tsgallery/fp64-lane-stripes/fp64-lane-stripes.shade.tsgallery/fp64-loran-twin/fp64-loran-twin.shade.tsgallery/fp64-mandelbrot-de-twin/fp64-mandelbrot-de-twin.shade.tsgallery/fp64-newton-twin/fp64-newton-twin.shade.tsgallery/fp64-rtc-twin/fp64-rtc-twin.shade.tsgallery/fp64-sine-sweep-twin/fp64-sine-sweep-twin.shade.tsgallery/array-length/array-length.shade.tsgallery/array-literal-ramp/array-literal-ramp.shade.tsgallery/array-methods/array-methods.shade.tsgallery/atomic-histogram/atomic-histogram.shade.tsgallery/bare-position/bare-position.shade.tsgallery/bit-bump/bit-bump.shade.tsgallery/bitfield-bands/bitfield-bands.shade.tsgallery/block-scope/block-scope.shade.tsgallery/bool-select/bool-select.shade.tsgallery/class-builder/class-builder.shade.tsgallery/class-parts/class-parts.shade.tsgallery/class-syntax/class-syntax.shade.tsgallery/clip-planes/clip-planes.shade.tsgallery/closures/closures.shade.tsgallery/compute-reduction-twin/compute-reduction-twin.shade.tsgallery/compute-sync/compute-sync.shade.tsgallery/convert-grid/convert-grid.shade.tsgallery/cube-array-gather/cube-array-gather.shade.tsgallery/cube-env/cube-env.shade.tsgallery/cutout/cutout.shade.tsgallery/default-args/default-args.shade.tsgallery/feedback-trail/feedback-trail.shade.tsgallery/generic-class/generic-class.shade.tsgallery/generic-helpers/generic-helpers.shade.tsgallery/gpu-console/gpu-console.shade.tsgallery/gradient-twin/gradient-twin.shade.tsgallery/hello/hello.shade.tsgallery/hello-uniform/hello-uniform.shade.tsgallery/hello-uniform-struct/hello-uniform-struct.shade.tsgallery/hello-vsin/hello-vsin.shade.tsgallery/hello-vsout/hello-vsout.shade.tsgallery/higher-order/higher-order.shade.tsgallery/id-pick/id-pick.shade.tsgallery/imported-noise/imported-noise.shade.tsgallery/inferred-returns/inferred-returns.shade.tsgallery/integer-math/integer-math.shade.tsgallery/loops-over-data/loops-over-data.shade.tsgallery/mixin-surface/mixin-surface.shade.tsgallery/module-const/module-const.shade.tsgallery/msaa-resolve/msaa-resolve.shade.tsgallery/normal-matrix/normal-matrix.shade.tsgallery/null-values/null-values.shade.tsgallery/optional-fields/optional-fields.shade.tsgallery/optional-values/optional-values.shade.tsgallery/orbit-inout/orbit-inout.shade.tsgallery/packed-bytes/packed-bytes.shade.tsgallery/packing-bitcast/packing-bitcast.shade.tsgallery/palette-const/palette-const.shade.tsgallery/particle-step/particle-step.shade.tsgallery/pick-composite/pick-composite.shade.tsgallery/private-state/private-state.shade.tsgallery/ray-class/ray-class.shade.tsgallery/reference-parameters/reference-parameters.shade.tsgallery/rng-method/rng-method.shade.tsgallery/sample-branch/sample-branch.shade.tsgallery/separable-blur/separable-blur.shade.tsgallery/shadow-compare/shadow-compare.shade.tsgallery/shape-inheritance/shape-inheritance.shade.tsgallery/storage-texture/storage-texture.shade.tsgallery/subgroup-reduce/subgroup-reduce.shade.tsgallery/textured-quad/textured-quad.shade.tsgallery/tuple-and-brand/tuple-and-brand.shade.tsgallery/twin-structs/twin-structs.shade.tsgallery/uniform-array/uniform-array.shade.tsgallery/workgroup-override/workgroup-override.shade.tsgallery/workgroup-reduce/workgroup-reduce.shade.tsgallery/workgroup-scratch/workgroup-scratch.shade.tsgallery/workgroup-tile-2d/workgroup-tile-2d.shade.ts