textureDimensions
함수
Returns the size of the texture's base mip level: width and height as a vec2u, width, height and depth as a vec3u on a texture_3d, or the width alone as a u32 on a texture_1d.
이름마다 붙은 시그니처와 설명은 커밋 26de7be8의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
declare function textureDimensions<E extends TextureElem = f32>( tex: texture_2d<E> | texture_2d_array<E>, level?: number,): vec2udeclare function textureDimensions<E extends TextureElem = f32>( tex: texture_cube<E> | texture_cube_array<E>, level?: number,): vec2udeclare function textureDimensions<E extends TextureElem = f32>( tex: texture_3d<E>, level?: number,): vec3udeclare function textureDimensions<E extends TextureElem = f32>(tex: texture_1d<E>, level?: number): u32declare function textureDimensions<E extends TextureElem = f32>(tex: texture_multisampled_2d<E>): vec2udeclare function textureDimensions( tex: | texture_depth_2d | texture_depth_2d_array | texture_depth_cube | texture_depth_cube_array | texture_depth_multisampled_2d, level?: number,): vec2udeclare function textureDimensions<F extends StorageFormat, A extends StorageAccess>( tex: texture_storage_2d<F, A> | texture_storage_2d_array<F, A>,): vec2u매개변수나 반환 위치에 쓰인 number는 스칼라가 들어갈 자리입니다. 앰비언트 파일은 GPU 스칼라를 브랜드가 붙은 number로 선언하고 그 브랜드는 선택이라서, 리터럴도 브랜드가 붙은 스칼라도 이 자리에 들어갑니다.
type f32 = number & { readonly [f32Tag]?: true }
직접 쓰는 선언에는 여전히 너비가 필요합니다. 필드나 매개변수에 number만 적으면 거부되며, 그 행과 컴파일러가 낸 메시지는 TypeScript에서 페이지에 있습니다.
시그니처에는 앰비언트 파일이 스스로 쓰려고 선언한 타입이 나올 수 있습니다. 아래가 그 선언입니다.
TextureElemtype TextureElem = f32 | i32 | u32StorageFormattype StorageFormat = 'rgba8unorm' | 'rgba8snorm' | 'rgba8uint' | 'rgba8sint' | 'rgba16uint' | 'rgba16sint' | 'rgba16float' | 'r32uint' | 'r32sint' | 'r32float' | 'rg32uint' | 'rg32sint' | 'rg32float' | 'rgba32uint' | 'rgba32sint' | 'rgba32float' | 'bgra8unorm'StorageAccesstype StorageAccess = 'write' | 'read' | 'read_write'
매개변수
-
textexture_2d<E> | texture_2d_array<E>texture_cube<E> | texture_cube_array<E>texture_3d<E>texture_1d<E>texture_multisampled_2d<E>| texture_depth_2d | texture_depth_2d_array | texture_depth_cube | texture_depth_cube_array | texture_depth_multisampled_2dtexture_storage_2d<F, A> | texture_storage_2d_array<F, A> -
level선택 사항number
반환값
설명
On a cube texture it is the size of one face.
대상별 출력
- WGSL
-
textureDimensions(a) - GLSL ES 3.00
-
uvec2(textureSize(a, 0))