타입
이 페이지에서

타입

스칼라와 벡터 이름은 WGSL의 것입니다. 소스 하나가 두 타깃을 모두 맡아야 하기 때문입니다. GLSL 생성기가 그 이름을 이 타깃의 말로 옮기므로, 선언에 f32라고 적은 것이 생성된 셰이더에서는 float가 됩니다.

스칼라

GLSL ES 3.00TypeShade
float
f32
int
i32
uint
u32
bool
bool

벡터

GLSL ES 3.00TypeShade
vec3
vec3
ivec3
vec3i
uvec3
vec3u
bvec3
vec3b

vec2와 vec4도 같은 방식으로 읽고, 각각의 정수형과 부호 없는 정수형과 불리언 형태도 마찬가지입니다. 배정밀도 벡터는 어느 타깃에도 형태가 없어서 생성기가 돌기 전에 f32 레인으로 하향 변환됩니다.

행렬과 배열

GLSL ES 3.00TypeShade
mat4
mat4
mat3
mat3
mat2x3
mat2x3

정사각 행렬은 드라이버 오류 메시지가 쓰는 짧은 이름을 그대로 씁니다. 나머지 여섯 가지 모양은 이 타깃이 적는 방식과 똑같이 matCxR로, 앞이 열이고 뒤가 행입니다.

GLSL ES 3.00TypeShade
float[4]
array<f32, 4>
float[2]
[f32, f32]

튜플은 타입이 길이를 고정한 목록이므로 [f32, f32]와 array<f32, 2>는 같은 타입에 닿습니다. 실행해 봐야 길이를 아는 배열은 스토리지 버퍼이고 이 타깃에는 그 형태가 없어서, 그런 모듈은 데이터 텍스처에서 읽도록 다시 쓰입니다.

샘플러

이 타깃은 텍스처와 샘플러를 결합 샘플러 하나로 합치고, WebGPU는 둘을 따로 둡니다. TypeShade 파일은 둘을 WebGPU 방식으로 선언하고 GLSL 생성기가 합치므로, 샘플러 인자는 모든 읽기에서 사라지고 그 자리를 차지하던 바인딩도 호스트가 바인딩하는 레이아웃에서 빠집니다.

GLSL ES 3.00TypeShade
sampler2D
texture_2d<f32>
usampler2D
texture_2d<u32>
isampler2D
texture_2d<i32>
sampler2DArray
texture_2d_array<f32>
samplerCube
texture_cube<f32>
sampler3D
texture_3d<f32>
sampler2DShadow
texture_depth_2d

standalone sampler — fused into the combined sampler2D

sampler

standalone comparison sampler — fused into the combined sampler2DShadow

sampler_comparison

깊이 텍스처는 그 합치기의 예외입니다. 결합 타입이 모듈이 그것을 어떻게 읽느냐에 달려 있어서 바인딩 생성 단계가 결정합니다. 이 인터페이스가 허용하는 깊이 텍스처 읽기는 모두 비교이고, 그래서 항상 shadow 형태가 됩니다.

GLSL 형태가 없는 타입

아래 타입은 모두 생성기가 거부하며, 옆 칸은 생성기가 던지는 문장 그대로입니다. 그런 타입을 든 모듈도 WGSL은 생성하므로, 셰이더를 WebGPU 전용으로 만드는 줄이 바로 이것들입니다.

TypeShade컴파일러의 말
texture_1d<f32>

texture_1d<f32> has no GLSL ES 3.00 spelling (no 1d or cube-array samplers)

texture_cube_array<f32>

texture_cube_array<f32> has no GLSL ES 3.00 spelling (no 1d or cube-array samplers)

texture_multisampled_2d<f32>

multisampled texture load — sampler2DMS is ES 3.10 (msaaTextureLoad fails the module closed first)

texture_storage_2d<"rgba8unorm", "write">

texture_storage_2d<rgba8unorm, write> has no GLSL ES 3.00 spelling (image load/store is ES 3.10)

atomic<u32>

atomic<u32> has no GLSL ES 3.00 spelling (no storage buffers, no atomics)

이 페이지 편집 문제 보고