Move SamplerKind out of ast and into type.
This CL moves the SamplerKind enum out of ast/sampler and into type/sampler_kind. This breaks the dependency on ast from type. Change-Id: Icaf82dd1cca5782bf66993441c7b478332bb76a2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117607 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
7f3d54c4fa
commit
3085e23fc7
|
@ -476,6 +476,7 @@ libtint_source_set("libtint_core_all_src") {
|
|||
"type/reference.h",
|
||||
"type/sampled_texture.h",
|
||||
"type/sampler.h",
|
||||
"type/sampler_kind.h",
|
||||
"type/short_name.h",
|
||||
"type/storage_texture.h",
|
||||
"type/struct.h",
|
||||
|
@ -739,6 +740,8 @@ libtint_source_set("libtint_type_src") {
|
|||
"type/sampled_texture.h",
|
||||
"type/sampler.cc",
|
||||
"type/sampler.h",
|
||||
"type/sampler_kind.cc",
|
||||
"type/sampler_kind.h",
|
||||
"type/short_name.cc",
|
||||
"type/short_name.h",
|
||||
"type/storage_texture.cc",
|
||||
|
|
|
@ -508,6 +508,8 @@ list(APPEND TINT_LIB_SRCS
|
|||
type/sampled_texture.h
|
||||
type/sampler.cc
|
||||
type/sampler.h
|
||||
type/sampler_kind.cc
|
||||
type/sampler_kind.h
|
||||
type/storage_texture.cc
|
||||
type/storage_texture.h
|
||||
type/struct.cc
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace tint::ast::builtin::test {
|
|||
TextureOverloadCase::TextureOverloadCase(ValidTextureOverload o,
|
||||
const char* desc,
|
||||
TextureKind tk,
|
||||
ast::SamplerKind sk,
|
||||
type::SamplerKind sk,
|
||||
type::TextureDimension dims,
|
||||
TextureDataType datatype,
|
||||
const char* f,
|
||||
|
@ -186,7 +186,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensions1d,
|
||||
"textureDimensions(t : texture_1d<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k1d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -196,7 +196,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensions2d,
|
||||
"textureDimensions(t : texture_2d<f32>) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -207,7 +207,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_2d<f32>,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -217,7 +217,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensions2dArray,
|
||||
"textureDimensions(t : texture_2d_array<f32>) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -228,7 +228,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_2d_array<f32>,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -238,7 +238,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensions3d,
|
||||
"textureDimensions(t : texture_3d<f32>) -> vec3<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -249,7 +249,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_3d<f32>,\n"
|
||||
" level : i32) -> vec3<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -259,7 +259,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsCube,
|
||||
"textureDimensions(t : texture_cube<f32>) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -270,7 +270,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_cube<f32>,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -280,7 +280,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsCubeArray,
|
||||
"textureDimensions(t : texture_cube_array<f32>) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -291,7 +291,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_cube_array<f32>,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -301,7 +301,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsMultisampled2d,
|
||||
"textureDimensions(t : texture_multisampled_2d<f32>)-> vec2<u32>",
|
||||
TextureKind::kMultisampled,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -311,7 +311,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsDepth2d,
|
||||
"textureDimensions(t : texture_depth_2d) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -322,7 +322,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_depth_2d,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -332,7 +332,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsDepth2dArray,
|
||||
"textureDimensions(t : texture_depth_2d_array) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -343,7 +343,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_depth_2d_array,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -353,7 +353,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsDepthCube,
|
||||
"textureDimensions(t : texture_depth_cube) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -364,7 +364,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_depth_cube,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -374,7 +374,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsDepthCubeArray,
|
||||
"textureDimensions(t : texture_depth_cube_array) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -385,7 +385,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions(t : texture_depth_cube_array,\n"
|
||||
" level : i32) -> vec2<u32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -395,7 +395,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsDepthMultisampled2d,
|
||||
"textureDimensions(t : texture_depth_multisampled_2d) -> vec2<u32>",
|
||||
TextureKind::kDepthMultisampled,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
|
@ -449,7 +449,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec2<f32>) -> vec4<T>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -468,7 +468,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" offset : vec2<i32>) -> vec4<T>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -488,7 +488,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" array_index : i32) -> vec4<T>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -509,7 +509,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : u32,\n"
|
||||
" offset : vec2<i32>) -> vec4<T>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -529,7 +529,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec3<f32>) -> vec4<T>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -548,7 +548,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" array_index : u32) -> vec4<T>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -566,7 +566,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec2<f32>) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -583,7 +583,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -601,7 +601,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" array_index : u32) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -620,7 +620,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -638,7 +638,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec3<f32>) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -655,7 +655,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" array_index : u32) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGather",
|
||||
|
@ -673,7 +673,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" depth_ref : f32) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureGatherCompare",
|
||||
|
@ -692,7 +692,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" depth_ref : f32,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureGatherCompare",
|
||||
|
@ -712,7 +712,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" depth_ref : f32) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGatherCompare",
|
||||
|
@ -733,7 +733,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" depth_ref : f32,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGatherCompare",
|
||||
|
@ -753,7 +753,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" depth_ref : f32) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureGatherCompare",
|
||||
|
@ -772,7 +772,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : u32,\n"
|
||||
" depth_ref : f32) -> vec4<f32>",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureGatherCompare",
|
||||
|
@ -788,7 +788,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLayers2dArray,
|
||||
"textureNumLayers(t : texture_2d_array<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLayers",
|
||||
|
@ -798,7 +798,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLayersCubeArray,
|
||||
"textureNumLayers(t : texture_cube_array<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLayers",
|
||||
|
@ -808,7 +808,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLayersDepth2dArray,
|
||||
"textureNumLayers(t : texture_depth_2d_array) -> u32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLayers",
|
||||
|
@ -818,7 +818,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLayersDepthCubeArray,
|
||||
"textureNumLayers(t : texture_depth_cube_array) -> u32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLayers",
|
||||
|
@ -838,7 +838,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevels2d,
|
||||
"textureNumLevels(t : texture_2d<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -848,7 +848,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevels2dArray,
|
||||
"textureNumLevels(t : texture_2d_array<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -858,7 +858,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevels3d,
|
||||
"textureNumLevels(t : texture_3d<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -868,7 +868,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevelsCube,
|
||||
"textureNumLevels(t : texture_cube<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -878,7 +878,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevelsCubeArray,
|
||||
"textureNumLevels(t : texture_cube_array<f32>) -> u32",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -888,7 +888,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevelsDepth2d,
|
||||
"textureNumLevels(t : texture_depth_2d) -> u32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -898,7 +898,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevelsDepth2dArray,
|
||||
"textureNumLevels(t : texture_depth_2d_array) -> u32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -908,7 +908,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevelsDepthCube,
|
||||
"textureNumLevels(t : texture_depth_cube) -> u32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -918,7 +918,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumLevelsDepthCubeArray,
|
||||
"textureNumLevels(t : texture_depth_cube_array) -> u32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureNumLevels",
|
||||
|
@ -928,7 +928,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumSamplesMultisampled2d,
|
||||
"textureNumSamples(t : texture_multisampled_2d<f32>) -> u32",
|
||||
TextureKind::kMultisampled,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureNumSamples",
|
||||
|
@ -938,7 +938,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kNumSamplesDepthMultisampled2d,
|
||||
"textureNumSamples(t : texture_depth_multisampled_2d<f32>) -> u32",
|
||||
TextureKind::kMultisampled,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureNumSamples",
|
||||
|
@ -950,7 +950,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k1d,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -966,7 +966,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec2<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -983,7 +983,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1001,7 +1001,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" array_index : i32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1020,7 +1020,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : u32\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1038,7 +1038,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec3<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1055,7 +1055,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>\n"
|
||||
" offset : vec3<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1072,7 +1072,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec3<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1089,7 +1089,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" array_index : i32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1106,7 +1106,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec2<f32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1123,7 +1123,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1141,7 +1141,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" array_index : i32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1160,7 +1160,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1178,7 +1178,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" s : sampler,\n"
|
||||
" coords : vec3<f32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1195,7 +1195,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" array_index : u32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSample",
|
||||
|
@ -1213,7 +1213,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" bias : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1232,7 +1232,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" bias : f32,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1252,7 +1252,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : u32,\n"
|
||||
" bias : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1273,7 +1273,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" bias : f32,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1293,7 +1293,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" bias : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1312,7 +1312,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" bias : f32,\n"
|
||||
" offset : vec3<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1331,7 +1331,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" bias : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1350,7 +1350,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" bias : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleBias",
|
||||
|
@ -1369,7 +1369,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" level : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1388,7 +1388,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" level : f32,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1408,7 +1408,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" level : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1429,7 +1429,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" level : f32,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1449,7 +1449,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" level : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1468,7 +1468,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" level : f32,\n"
|
||||
" offset : vec3<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1487,7 +1487,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" level : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1506,7 +1506,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" level : f32) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1525,7 +1525,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" level : u32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1544,7 +1544,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" level : i32,\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1564,7 +1564,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : u32,\n"
|
||||
" level : u32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1585,7 +1585,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" level : u32,\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1605,7 +1605,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" level : i32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1624,7 +1624,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" level : i32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleLevel",
|
||||
|
@ -1644,7 +1644,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddx : vec2<f32>,\n"
|
||||
" ddy : vec2<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1665,7 +1665,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddy : vec2<f32>,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1687,7 +1687,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddx : vec2<f32>,\n"
|
||||
" ddy : vec2<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1710,7 +1710,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddy : vec2<f32>,\n"
|
||||
" offset : vec2<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1732,7 +1732,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddx : vec3<f32>,\n"
|
||||
" ddy : vec3<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1753,7 +1753,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddy : vec3<f32>,\n"
|
||||
" offset : vec3<i32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1774,7 +1774,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddx : vec3<f32>,\n"
|
||||
" ddy : vec3<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1795,7 +1795,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" ddx : vec3<f32>,\n"
|
||||
" ddy : vec3<f32>) -> vec4<f32>",
|
||||
TextureKind::kRegular,
|
||||
ast::SamplerKind::kSampler,
|
||||
type::SamplerKind::kSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleGrad",
|
||||
|
@ -1815,7 +1815,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompare",
|
||||
|
@ -1834,7 +1834,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" depth_ref : f32,\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompare",
|
||||
|
@ -1854,7 +1854,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompare",
|
||||
|
@ -1875,7 +1875,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" depth_ref : f32,\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompare",
|
||||
|
@ -1895,7 +1895,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompare",
|
||||
|
@ -1914,7 +1914,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompare",
|
||||
|
@ -1933,7 +1933,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<f32>,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompareLevel",
|
||||
|
@ -1952,7 +1952,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" depth_ref : f32,\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompareLevel",
|
||||
|
@ -1972,7 +1972,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompareLevel",
|
||||
|
@ -1993,7 +1993,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" depth_ref : f32,\n"
|
||||
" offset : vec2<i32>) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompareLevel",
|
||||
|
@ -2013,7 +2013,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec3<f32>,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::kCube,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompareLevel",
|
||||
|
@ -2032,7 +2032,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" array_index : i32,\n"
|
||||
" depth_ref : f32) -> f32",
|
||||
TextureKind::kDepth,
|
||||
ast::SamplerKind::kComparisonSampler,
|
||||
type::SamplerKind::kComparisonSampler,
|
||||
type::TextureDimension::kCubeArray,
|
||||
TextureDataType::kF32,
|
||||
"textureSampleCompareLevel",
|
||||
|
|
|
@ -185,7 +185,7 @@ struct TextureOverloadCase {
|
|||
TextureOverloadCase(ValidTextureOverload,
|
||||
const char*,
|
||||
TextureKind,
|
||||
ast::SamplerKind,
|
||||
type::SamplerKind,
|
||||
type::TextureDimension,
|
||||
TextureDataType,
|
||||
const char*,
|
||||
|
@ -236,7 +236,7 @@ struct TextureOverloadCase {
|
|||
const TextureKind texture_kind;
|
||||
/// The sampler kind for the sampler parameter
|
||||
/// Used only when texture_kind is not kStorage
|
||||
ast::SamplerKind const sampler_kind = ast::SamplerKind::kSampler;
|
||||
type::SamplerKind const sampler_kind = type::SamplerKind::kSampler;
|
||||
/// The access control for the storage texture
|
||||
/// Used only when texture_kind is kStorage
|
||||
type::Access const access = type::Access::kReadWrite;
|
||||
|
|
|
@ -20,19 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Sampler);
|
|||
|
||||
namespace tint::ast {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, SamplerKind kind) {
|
||||
switch (kind) {
|
||||
case SamplerKind::kSampler:
|
||||
out << "sampler";
|
||||
break;
|
||||
case SamplerKind::kComparisonSampler:
|
||||
out << "comparison_sampler";
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Sampler::Sampler(ProgramID pid, NodeID nid, const Source& src, SamplerKind k)
|
||||
Sampler::Sampler(ProgramID pid, NodeID nid, const Source& src, type::SamplerKind k)
|
||||
: Base(pid, nid, src), kind(k) {}
|
||||
|
||||
Sampler::Sampler(Sampler&&) = default;
|
||||
|
@ -40,7 +28,7 @@ Sampler::Sampler(Sampler&&) = default;
|
|||
Sampler::~Sampler() = default;
|
||||
|
||||
std::string Sampler::FriendlyName(const SymbolTable&) const {
|
||||
return kind == SamplerKind::kSampler ? "sampler" : "sampler_comparison";
|
||||
return kind == type::SamplerKind::kSampler ? "sampler" : "sampler_comparison";
|
||||
}
|
||||
|
||||
const Sampler* Sampler::Clone(CloneContext* ctx) const {
|
||||
|
|
|
@ -18,22 +18,10 @@
|
|||
#include <string>
|
||||
|
||||
#include "src/tint/ast/type.h"
|
||||
#include "src/tint/type/sampler_kind.h"
|
||||
|
||||
namespace tint::ast {
|
||||
|
||||
/// The different kinds of samplers
|
||||
enum class SamplerKind {
|
||||
/// A regular sampler
|
||||
kSampler,
|
||||
/// A comparison sampler
|
||||
kComparisonSampler
|
||||
};
|
||||
|
||||
/// @param out the std::ostream to write to
|
||||
/// @param kind the SamplerKind
|
||||
/// @return the std::ostream so calls can be chained
|
||||
std::ostream& operator<<(std::ostream& out, SamplerKind kind);
|
||||
|
||||
/// A sampler type.
|
||||
class Sampler final : public Castable<Sampler, Type> {
|
||||
public:
|
||||
|
@ -42,13 +30,13 @@ class Sampler final : public Castable<Sampler, Type> {
|
|||
/// @param nid the unique node identifier
|
||||
/// @param src the source of this node
|
||||
/// @param kind the kind of sampler
|
||||
Sampler(ProgramID pid, NodeID nid, const Source& src, SamplerKind kind);
|
||||
Sampler(ProgramID pid, NodeID nid, const Source& src, type::SamplerKind kind);
|
||||
/// Move constructor
|
||||
Sampler(Sampler&&);
|
||||
~Sampler() override;
|
||||
|
||||
/// @returns true if this is a comparison sampler
|
||||
bool IsComparison() const { return kind == SamplerKind::kComparisonSampler; }
|
||||
bool IsComparison() const { return kind == type::SamplerKind::kComparisonSampler; }
|
||||
|
||||
/// @param symbols the program's symbol table
|
||||
/// @returns the name for this type that closely resembles how it would be
|
||||
|
@ -61,7 +49,7 @@ class Sampler final : public Castable<Sampler, Type> {
|
|||
const Sampler* Clone(CloneContext* ctx) const override;
|
||||
|
||||
/// The sampler type
|
||||
const SamplerKind kind;
|
||||
const type::SamplerKind kind;
|
||||
};
|
||||
|
||||
} // namespace tint::ast
|
||||
|
|
|
@ -22,23 +22,23 @@ namespace {
|
|||
using AstSamplerTest = TestHelper;
|
||||
|
||||
TEST_F(AstSamplerTest, Creation) {
|
||||
auto* s = create<Sampler>(SamplerKind::kSampler);
|
||||
EXPECT_EQ(s->kind, SamplerKind::kSampler);
|
||||
auto* s = create<Sampler>(type::SamplerKind::kSampler);
|
||||
EXPECT_EQ(s->kind, type::SamplerKind::kSampler);
|
||||
}
|
||||
|
||||
TEST_F(AstSamplerTest, Creation_ComparisonSampler) {
|
||||
auto* s = create<Sampler>(SamplerKind::kComparisonSampler);
|
||||
EXPECT_EQ(s->kind, SamplerKind::kComparisonSampler);
|
||||
auto* s = create<Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
EXPECT_EQ(s->kind, type::SamplerKind::kComparisonSampler);
|
||||
EXPECT_TRUE(s->IsComparison());
|
||||
}
|
||||
|
||||
TEST_F(AstSamplerTest, FriendlyNameSampler) {
|
||||
auto* s = create<Sampler>(SamplerKind::kSampler);
|
||||
auto* s = create<Sampler>(type::SamplerKind::kSampler);
|
||||
EXPECT_EQ(s->FriendlyName(Symbols()), "sampler");
|
||||
}
|
||||
|
||||
TEST_F(AstSamplerTest, FriendlyNameComparisonSampler) {
|
||||
auto* s = create<Sampler>(SamplerKind::kComparisonSampler);
|
||||
auto* s = create<Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
EXPECT_EQ(s->FriendlyName(Symbols()), "sampler_comparison");
|
||||
}
|
||||
|
||||
|
|
|
@ -333,11 +333,11 @@ class InspectorBuilder : public ProgramBuilder {
|
|||
Inspector& Build();
|
||||
|
||||
/// @returns the type for a SamplerKind::kSampler
|
||||
const ast::Sampler* sampler_type() { return ty.sampler(ast::SamplerKind::kSampler); }
|
||||
const ast::Sampler* sampler_type() { return ty.sampler(type::SamplerKind::kSampler); }
|
||||
|
||||
/// @returns the type for a SamplerKind::kComparison
|
||||
const ast::Sampler* comparison_sampler_type() {
|
||||
return ty.sampler(ast::SamplerKind::kComparisonSampler);
|
||||
return ty.sampler(type::SamplerKind::kComparisonSampler);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -1000,14 +1000,14 @@ class ProgramBuilder {
|
|||
|
||||
/// @param kind the kind of sampler
|
||||
/// @returns the sampler
|
||||
const ast::Sampler* sampler(ast::SamplerKind kind) const {
|
||||
const ast::Sampler* sampler(type::SamplerKind kind) const {
|
||||
return builder->create<ast::Sampler>(kind);
|
||||
}
|
||||
|
||||
/// @param source the Source of the node
|
||||
/// @param kind the kind of sampler
|
||||
/// @returns the sampler
|
||||
const ast::Sampler* sampler(const Source& source, ast::SamplerKind kind) const {
|
||||
const ast::Sampler* sampler(const Source& source, type::SamplerKind kind) const {
|
||||
return builder->create<ast::Sampler>(source, kind);
|
||||
}
|
||||
|
||||
|
|
|
@ -2456,8 +2456,8 @@ const Type* ParserImpl::GetHandleTypeForSpirvHandle(const spvtools::opt::Instruc
|
|||
const Type* ast_handle_type = nullptr;
|
||||
if (usage.IsSampler()) {
|
||||
ast_handle_type =
|
||||
ty_.Sampler(usage.IsComparisonSampler() ? ast::SamplerKind::kComparisonSampler
|
||||
: ast::SamplerKind::kSampler);
|
||||
ty_.Sampler(usage.IsComparisonSampler() ? type::SamplerKind::kComparisonSampler
|
||||
: type::SamplerKind::kSampler);
|
||||
} else if (usage.IsTexture()) {
|
||||
const spvtools::opt::analysis::Image* image_type =
|
||||
type_mgr_->GetType(raw_handle_type->result_id())->AsImage();
|
||||
|
|
|
@ -216,7 +216,7 @@ const ast::Type* Array::Build(ProgramBuilder& b) const {
|
|||
}
|
||||
}
|
||||
|
||||
Sampler::Sampler(ast::SamplerKind k) : kind(k) {}
|
||||
Sampler::Sampler(type::SamplerKind k) : kind(k) {}
|
||||
Sampler::Sampler(const Sampler&) = default;
|
||||
|
||||
const ast::Type* Sampler::Build(ProgramBuilder& b) const {
|
||||
|
@ -491,7 +491,7 @@ const spirv::Struct* TypeManager::Struct(Symbol name, TypeList members) {
|
|||
return state->structs_.Get(name, std::move(members));
|
||||
}
|
||||
|
||||
const spirv::Sampler* TypeManager::Sampler(ast::SamplerKind kind) {
|
||||
const spirv::Sampler* TypeManager::Sampler(type::SamplerKind kind) {
|
||||
return state->samplers_.Get(kind);
|
||||
}
|
||||
|
||||
|
@ -574,9 +574,9 @@ std::string Array::String() const {
|
|||
|
||||
std::string Sampler::String() const {
|
||||
switch (kind) {
|
||||
case ast::SamplerKind::kSampler:
|
||||
case type::SamplerKind::kSampler:
|
||||
return "sampler";
|
||||
case ast::SamplerKind::kComparisonSampler:
|
||||
case type::SamplerKind::kComparisonSampler:
|
||||
return "sampler_comparison";
|
||||
}
|
||||
return "<unknown sampler>";
|
||||
|
|
|
@ -306,7 +306,7 @@ struct Array final : public Castable<Array, Type> {
|
|||
struct Sampler final : public Castable<Sampler, Type> {
|
||||
/// Constructor
|
||||
/// @param k the sampler kind
|
||||
explicit Sampler(ast::SamplerKind k);
|
||||
explicit Sampler(type::SamplerKind k);
|
||||
|
||||
/// Copy constructor
|
||||
/// @param other the other type to copy
|
||||
|
@ -322,7 +322,7 @@ struct Sampler final : public Castable<Sampler, Type> {
|
|||
#endif // NDEBUG
|
||||
|
||||
/// the sampler kind
|
||||
ast::SamplerKind const kind;
|
||||
type::SamplerKind const kind;
|
||||
};
|
||||
|
||||
/// Base class for texture types
|
||||
|
@ -591,7 +591,7 @@ class TypeManager {
|
|||
/// @param k the sampler kind
|
||||
/// @return a Sampler type. Repeated calls with the same arguments will return
|
||||
/// the same pointer.
|
||||
const spirv::Sampler* Sampler(ast::SamplerKind k);
|
||||
const spirv::Sampler* Sampler(type::SamplerKind k);
|
||||
/// @param d the texture dimensions
|
||||
/// @return a DepthTexture type. Repeated calls with the same arguments will
|
||||
/// return the same pointer.
|
||||
|
|
|
@ -36,7 +36,7 @@ TEST(SpvParserTypeTest, SameArgumentsGivesSamePointer) {
|
|||
EXPECT_EQ(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 2));
|
||||
EXPECT_EQ(ty.Alias(sym, ty.I32()), ty.Alias(sym, ty.I32()));
|
||||
EXPECT_EQ(ty.Struct(sym, {ty.I32()}), ty.Struct(sym, {ty.I32()}));
|
||||
EXPECT_EQ(ty.Sampler(ast::SamplerKind::kSampler), ty.Sampler(ast::SamplerKind::kSampler));
|
||||
EXPECT_EQ(ty.Sampler(type::SamplerKind::kSampler), ty.Sampler(type::SamplerKind::kSampler));
|
||||
EXPECT_EQ(ty.DepthTexture(type::TextureDimension::k2d),
|
||||
ty.DepthTexture(type::TextureDimension::k2d));
|
||||
EXPECT_EQ(ty.MultisampledTexture(type::TextureDimension::k2d, ty.I32()),
|
||||
|
@ -68,8 +68,8 @@ TEST(SpvParserTypeTest, DifferentArgumentsGivesDifferentPointer) {
|
|||
EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 3));
|
||||
EXPECT_NE(ty.Alias(sym_a, ty.I32()), ty.Alias(sym_b, ty.I32()));
|
||||
EXPECT_NE(ty.Struct(sym_a, {ty.I32()}), ty.Struct(sym_b, {ty.I32()}));
|
||||
EXPECT_NE(ty.Sampler(ast::SamplerKind::kSampler),
|
||||
ty.Sampler(ast::SamplerKind::kComparisonSampler));
|
||||
EXPECT_NE(ty.Sampler(type::SamplerKind::kSampler),
|
||||
ty.Sampler(type::SamplerKind::kComparisonSampler));
|
||||
EXPECT_NE(ty.DepthTexture(type::TextureDimension::k2d),
|
||||
ty.DepthTexture(type::TextureDimension::k1d));
|
||||
EXPECT_NE(ty.MultisampledTexture(type::TextureDimension::k2d, ty.I32()),
|
||||
|
|
|
@ -790,11 +790,11 @@ Maybe<const ast::Type*> ParserImpl::texture_and_sampler_types() {
|
|||
Maybe<const ast::Type*> ParserImpl::sampler_type() {
|
||||
Source source;
|
||||
if (match(Token::Type::kSampler, &source)) {
|
||||
return builder_.ty.sampler(source, ast::SamplerKind::kSampler);
|
||||
return builder_.ty.sampler(source, type::SamplerKind::kSampler);
|
||||
}
|
||||
|
||||
if (match(Token::Type::kComparisonSampler, &source)) {
|
||||
return builder_.ty.sampler(source, ast::SamplerKind::kComparisonSampler);
|
||||
return builder_.ty.sampler(source, type::SamplerKind::kComparisonSampler);
|
||||
}
|
||||
|
||||
return Failure::kNoMatch;
|
||||
|
|
|
@ -363,7 +363,7 @@ TEST_F(ResolverAssignmentValidationTest, AssignToPhony_Pass) {
|
|||
});
|
||||
GlobalVar("tex", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(0_a),
|
||||
Binding(0_a));
|
||||
GlobalVar("smp", ty.sampler(ast::SamplerKind::kSampler), Group(0_a), Binding(1_a));
|
||||
GlobalVar("smp", ty.sampler(type::SamplerKind::kSampler), Group(0_a), Binding(1_a));
|
||||
GlobalVar("u", ty.Of(U), type::AddressSpace::kUniform, Group(0_a), Binding(2_a));
|
||||
GlobalVar("s", ty.Of(S), type::AddressSpace::kStorage, Group(0_a), Binding(3_a));
|
||||
GlobalVar("wg", ty.array<f32, 10>(), type::AddressSpace::kWorkgroup);
|
||||
|
|
|
@ -507,7 +507,7 @@ TEST_F(EntryPointParameterAttributeTest, DuplicateAttribute) {
|
|||
}
|
||||
|
||||
TEST_F(EntryPointParameterAttributeTest, DuplicateInternalAttribute) {
|
||||
auto* s = Param("s", ty.sampler(ast::SamplerKind::kSampler),
|
||||
auto* s = Param("s", ty.sampler(type::SamplerKind::kSampler),
|
||||
utils::Vector{
|
||||
Binding(0_a),
|
||||
Group(0_a),
|
||||
|
@ -873,7 +873,7 @@ TEST_P(VariableAttributeTest, IsValid) {
|
|||
auto attrs = createAttributes(Source{{12, 34}}, *this, params.kind);
|
||||
auto* attr = attrs[0];
|
||||
if (IsBindingAttribute(params.kind)) {
|
||||
GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler), attrs);
|
||||
GlobalVar("a", ty.sampler(type::SamplerKind::kSampler), attrs);
|
||||
} else {
|
||||
GlobalVar("a", ty.f32(), type::AddressSpace::kPrivate, attrs);
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverAttributeValidationTest,
|
|||
TestParams{AttributeKind::kBindingAndGroup, true}));
|
||||
|
||||
TEST_F(VariableAttributeTest, DuplicateAttribute) {
|
||||
GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler), Binding(Source{{12, 34}}, 2_a),
|
||||
GlobalVar("a", ty.sampler(type::SamplerKind::kSampler), Binding(Source{{12, 34}}, 2_a),
|
||||
Group(2_a), Binding(Source{{56, 78}}, 3_a));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
@ -1175,7 +1175,7 @@ TEST_F(ResourceAttributeTest, TextureMissingBinding) {
|
|||
}
|
||||
|
||||
TEST_F(ResourceAttributeTest, SamplerMissingBinding) {
|
||||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler));
|
||||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(type::SamplerKind::kSampler));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
|
@ -1183,7 +1183,7 @@ TEST_F(ResourceAttributeTest, SamplerMissingBinding) {
|
|||
}
|
||||
|
||||
TEST_F(ResourceAttributeTest, BindingPairMissingBinding) {
|
||||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler), Group(1_a));
|
||||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(type::SamplerKind::kSampler), Group(1_a));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
|
@ -1191,7 +1191,7 @@ TEST_F(ResourceAttributeTest, BindingPairMissingBinding) {
|
|||
}
|
||||
|
||||
TEST_F(ResourceAttributeTest, BindingPairMissingGroup) {
|
||||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(ast::SamplerKind::kSampler), Binding(1_a));
|
||||
GlobalVar(Source{{12, 34}}, "G", ty.sampler(type::SamplerKind::kSampler), Binding(1_a));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "src/tint/ast/pointer.h"
|
||||
#include "src/tint/ast/return_statement.h"
|
||||
#include "src/tint/ast/sampled_texture.h"
|
||||
#include "src/tint/ast/sampler.h"
|
||||
#include "src/tint/ast/stage_attribute.h"
|
||||
#include "src/tint/ast/storage_texture.h"
|
||||
#include "src/tint/ast/stride_attribute.h"
|
||||
|
|
|
@ -1298,7 +1298,7 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) {
|
|||
GlobalVar(Sym(), ty.multisampled_texture(type::TextureDimension::k2d, T));
|
||||
GlobalVar(Sym(), ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
|
||||
type::Access::kRead)); //
|
||||
GlobalVar(Sym(), ty.sampler(ast::SamplerKind::kSampler));
|
||||
GlobalVar(Sym(), ty.sampler(type::SamplerKind::kSampler));
|
||||
|
||||
GlobalVar(Sym(), ty.i32(), utils::Vector{Binding(V), Group(V)});
|
||||
GlobalVar(Sym(), ty.i32(), utils::Vector{Location(V)});
|
||||
|
|
|
@ -585,11 +585,11 @@ bool match_sampler(MatchState&, const type::Type* ty) {
|
|||
if (ty->Is<Any>()) {
|
||||
return true;
|
||||
}
|
||||
return ty->Is([](const type::Sampler* s) { return s->kind() == ast::SamplerKind::kSampler; });
|
||||
return ty->Is([](const type::Sampler* s) { return s->kind() == type::SamplerKind::kSampler; });
|
||||
}
|
||||
|
||||
const type::Sampler* build_sampler(MatchState& state) {
|
||||
return state.builder.create<type::Sampler>(ast::SamplerKind::kSampler);
|
||||
return state.builder.create<type::Sampler>(type::SamplerKind::kSampler);
|
||||
}
|
||||
|
||||
bool match_sampler_comparison(MatchState&, const type::Type* ty) {
|
||||
|
@ -597,11 +597,11 @@ bool match_sampler_comparison(MatchState&, const type::Type* ty) {
|
|||
return true;
|
||||
}
|
||||
return ty->Is(
|
||||
[](const type::Sampler* s) { return s->kind() == ast::SamplerKind::kComparisonSampler; });
|
||||
[](const type::Sampler* s) { return s->kind() == type::SamplerKind::kComparisonSampler; });
|
||||
}
|
||||
|
||||
const type::Sampler* build_sampler_comparison(MatchState& state) {
|
||||
return state.builder.create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
return state.builder.create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
}
|
||||
|
||||
bool match_texture(MatchState&,
|
||||
|
|
|
@ -282,7 +282,7 @@ TEST_F(IntrinsicTableTest, MatchSampler) {
|
|||
auto* vec2_f32 = create<type::Vector>(f32, 2u);
|
||||
auto* vec4_f32 = create<type::Vector>(f32, 4u);
|
||||
auto* tex = create<type::SampledTexture>(type::TextureDimension::k2d, f32);
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
|
||||
auto result = table->Lookup(BuiltinType::kTextureSample, utils::Vector{tex, sampler, vec2_f32},
|
||||
sem::EvaluationStage::kConstant, Source{});
|
||||
ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
|
||||
|
|
|
@ -221,11 +221,12 @@ TEST_F(ResolverLoadTest, FunctionArg_Handles) {
|
|||
// f(t, s);
|
||||
GlobalVar("t", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()),
|
||||
utils::Vector{Group(0_a), Binding(0_a)});
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), utils::Vector{Group(0_a), Binding(1_a)});
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler),
|
||||
utils::Vector{Group(0_a), Binding(1_a)});
|
||||
Func("f",
|
||||
utils::Vector{
|
||||
Param("tp", ty.sampled_texture(type::TextureDimension::k2d, ty.f32())),
|
||||
Param("sp", ty.sampler(ast::SamplerKind::kSampler)),
|
||||
Param("sp", ty.sampler(type::SamplerKind::kSampler)),
|
||||
},
|
||||
ty.vec4<f32>(),
|
||||
utils::Vector{
|
||||
|
|
|
@ -1878,7 +1878,7 @@ TEST_F(ResolverTest, AddressSpace_SetsIfMissing) {
|
|||
}
|
||||
|
||||
TEST_F(ResolverTest, AddressSpace_SetForSampler) {
|
||||
auto* t = ty.sampler(ast::SamplerKind::kSampler);
|
||||
auto* t = ty.sampler(type::SamplerKind::kSampler);
|
||||
auto* var = GlobalVar("var", t, Binding(0_a), Group(0_a));
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
@ -1920,8 +1920,8 @@ TEST_F(ResolverTest, Access_SetForStorageBuffer) {
|
|||
TEST_F(ResolverTest, BindingPoint_SetForResources) {
|
||||
// @group(1) @binding(2) var s1 : sampler;
|
||||
// @group(3) @binding(4) var s2 : sampler;
|
||||
auto* s1 = GlobalVar(Sym(), ty.sampler(ast::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
auto* s2 = GlobalVar(Sym(), ty.sampler(ast::SamplerKind::kSampler), Group(3_a), Binding(4_a));
|
||||
auto* s1 = GlobalVar(Sym(), ty.sampler(type::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
auto* s2 = GlobalVar(Sym(), ty.sampler(type::SamplerKind::kSampler), Group(3_a), Binding(4_a));
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
|
||||
|
@ -2126,7 +2126,7 @@ TEST_F(ResolverTest, UnaryOp_Negation) {
|
|||
TEST_F(ResolverTest, TextureSampler_TextureSample) {
|
||||
GlobalVar("t", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(1_a),
|
||||
Binding(1_a));
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
|
||||
auto* call = CallStmt(Call("textureSample", "t", "s", vec2<f32>(1_f, 2_f)));
|
||||
const ast::Function* f = Func("test_function", utils::Empty, ty.void_(), utils::Vector{call},
|
||||
|
@ -2144,7 +2144,7 @@ TEST_F(ResolverTest, TextureSampler_TextureSample) {
|
|||
TEST_F(ResolverTest, TextureSampler_TextureSampleInFunction) {
|
||||
GlobalVar("t", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(1_a),
|
||||
Binding(1_a));
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
|
||||
auto* inner_call = CallStmt(Call("textureSample", "t", "s", vec2<f32>(1_f, 2_f)));
|
||||
const ast::Function* inner_func =
|
||||
|
@ -2170,7 +2170,7 @@ TEST_F(ResolverTest, TextureSampler_TextureSampleInFunction) {
|
|||
TEST_F(ResolverTest, TextureSampler_TextureSampleFunctionDiamondSameVariables) {
|
||||
GlobalVar("t", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(1_a),
|
||||
Binding(1_a));
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
|
||||
auto* inner_call_1 = CallStmt(Call("textureSample", "t", "s", vec2<f32>(1_f, 2_f)));
|
||||
const ast::Function* inner_func_1 =
|
||||
|
@ -2207,7 +2207,7 @@ TEST_F(ResolverTest, TextureSampler_TextureSampleFunctionDiamondDifferentVariabl
|
|||
Binding(1_a));
|
||||
GlobalVar("t2", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(1_a),
|
||||
Binding(2_a));
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(1_a), Binding(3_a));
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Group(1_a), Binding(3_a));
|
||||
|
||||
auto* inner_call_1 = CallStmt(Call("textureSample", "t1", "s", vec2<f32>(1_f, 2_f)));
|
||||
const ast::Function* inner_func_1 =
|
||||
|
@ -2270,7 +2270,7 @@ TEST_F(ResolverTest, TextureSampler_Bug1715) { // crbug.com/tint/1715
|
|||
// fn helper(sl: ptr<function, sampler>, tl: ptr<function, texture_2d<f32>>) -> vec4<f32> {
|
||||
// return textureSampleLevel(*tl, *sl, c, 0.0);
|
||||
// }
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(0_a), Binding(0_a));
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Group(0_a), Binding(0_a));
|
||||
GlobalVar("t", ty.sampled_texture(type::TextureDimension::k2d, ty.f32()), Group(0_a),
|
||||
Binding(1_a));
|
||||
GlobalVar("c", ty.vec2<f32>(), type::AddressSpace::kUniform, Group(0_a), Binding(2_a));
|
||||
|
@ -2288,7 +2288,7 @@ TEST_F(ResolverTest, TextureSampler_Bug1715) { // crbug.com/tint/1715
|
|||
|
||||
Func("helper",
|
||||
utils::Vector{
|
||||
Param("sl", ty.pointer(ty.sampler(ast::SamplerKind::kSampler),
|
||||
Param("sl", ty.pointer(ty.sampler(type::SamplerKind::kSampler),
|
||||
type::AddressSpace::kFunction)),
|
||||
Param("tl", ty.pointer(ty.sampled_texture(type::TextureDimension::k2d, ty.f32()),
|
||||
type::AddressSpace::kFunction)),
|
||||
|
|
|
@ -193,9 +193,9 @@ TEST_P(SideEffectsBuiltinTest, Test) {
|
|||
ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
|
||||
type::Access::kWrite),
|
||||
Group(0_a), Binding(AInt(next_binding++)));
|
||||
GlobalVar("s2d", ty.sampler(ast::SamplerKind::kSampler), Group(0_a),
|
||||
GlobalVar("s2d", ty.sampler(type::SamplerKind::kSampler), Group(0_a),
|
||||
Binding(AInt(next_binding++)));
|
||||
GlobalVar("scomp", ty.sampler(ast::SamplerKind::kComparisonSampler), Group(0_a),
|
||||
GlobalVar("scomp", ty.sampler(type::SamplerKind::kComparisonSampler), Group(0_a),
|
||||
Binding(AInt(next_binding++)));
|
||||
}
|
||||
|
||||
|
|
|
@ -3210,7 +3210,7 @@ TEST_F(ResolverTypeInitializerValidationTest, NonConstructibleType_AtomicStructM
|
|||
|
||||
TEST_F(ResolverTypeInitializerValidationTest, NonConstructibleType_Sampler) {
|
||||
WrapInFunction(
|
||||
Assign(Phony(), Construct(Source{{12, 34}}, ty.sampler(ast::SamplerKind::kSampler))));
|
||||
Assign(Phony(), Construct(Source{{12, 34}}, ty.sampler(type::SamplerKind::kSampler))));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: type is not constructible");
|
||||
|
|
|
@ -336,7 +336,7 @@ TEST_F(ResolverValidationTest, AddressSpace_FunctionVariableI32) {
|
|||
}
|
||||
|
||||
TEST_F(ResolverValidationTest, AddressSpace_SamplerExplicitAddressSpace) {
|
||||
auto* t = ty.sampler(ast::SamplerKind::kSampler);
|
||||
auto* t = ty.sampler(type::SamplerKind::kSampler);
|
||||
GlobalVar(Source{{12, 34}}, "var", t, type::AddressSpace::kHandle, Binding(0_a), Group(0_a));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
|
|
@ -349,7 +349,7 @@ TEST_F(ResolverVariableValidationTest, NonConstructibleType_InferredType) {
|
|||
// fn foo() {
|
||||
// var v = s;
|
||||
// }
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(0_a), Binding(0_a));
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Group(0_a), Binding(0_a));
|
||||
auto* v = Var(Source{{12, 34}}, "v", Expr("s"));
|
||||
WrapInFunction(v);
|
||||
|
||||
|
|
|
@ -110,11 +110,11 @@ Function::TransitivelyReferencedBuiltinVariables() const {
|
|||
}
|
||||
|
||||
Function::VariableBindings Function::TransitivelyReferencedSamplerVariables() const {
|
||||
return TransitivelyReferencedSamplerVariablesImpl(ast::SamplerKind::kSampler);
|
||||
return TransitivelyReferencedSamplerVariablesImpl(type::SamplerKind::kSampler);
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::TransitivelyReferencedComparisonSamplerVariables() const {
|
||||
return TransitivelyReferencedSamplerVariablesImpl(ast::SamplerKind::kComparisonSampler);
|
||||
return TransitivelyReferencedSamplerVariablesImpl(type::SamplerKind::kComparisonSampler);
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::TransitivelyReferencedSampledTextureVariables() const {
|
||||
|
@ -149,7 +149,7 @@ bool Function::HasAncestorEntryPoint(Symbol symbol) const {
|
|||
}
|
||||
|
||||
Function::VariableBindings Function::TransitivelyReferencedSamplerVariablesImpl(
|
||||
ast::SamplerKind kind) const {
|
||||
type::SamplerKind kind) const {
|
||||
VariableBindings ret;
|
||||
|
||||
for (auto* global : TransitivelyReferencedGlobals()) {
|
||||
|
|
|
@ -260,7 +260,7 @@ class Function final : public Castable<Function, CallTarget> {
|
|||
Function(const Function&) = delete;
|
||||
Function(Function&&) = delete;
|
||||
|
||||
VariableBindings TransitivelyReferencedSamplerVariablesImpl(ast::SamplerKind kind) const;
|
||||
VariableBindings TransitivelyReferencedSamplerVariablesImpl(type::SamplerKind kind) const;
|
||||
VariableBindings TransitivelyReferencedSampledTextureVariablesImpl(bool multisampled) const;
|
||||
|
||||
const ast::Function* const declaration_;
|
||||
|
|
|
@ -640,7 +640,7 @@ struct BuiltinPolyfill::State {
|
|||
b.Func(name,
|
||||
utils::Vector{
|
||||
b.Param("t", b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
|
||||
b.Param("s", b.ty.sampler(ast::SamplerKind::kSampler)),
|
||||
b.Param("s", b.ty.sampler(type::SamplerKind::kSampler)),
|
||||
b.Param("coord", b.ty.vec2<f32>()),
|
||||
},
|
||||
b.ty.vec4<f32>(), body);
|
||||
|
|
|
@ -123,9 +123,9 @@ struct CombineSamplers::State {
|
|||
/// Creates placeholder global sampler variables.
|
||||
/// @param kind the sampler kind to create for
|
||||
/// @returns the newly-created global variable
|
||||
const ast::Variable* CreatePlaceholder(ast::SamplerKind kind) {
|
||||
const ast::Variable* CreatePlaceholder(type::SamplerKind kind) {
|
||||
const ast::Type* type = ctx.dst->ty.sampler(kind);
|
||||
const char* name = kind == ast::SamplerKind::kComparisonSampler
|
||||
const char* name = kind == type::SamplerKind::kComparisonSampler
|
||||
? "placeholder_comparison_sampler"
|
||||
: "placeholder_sampler";
|
||||
Symbol symbol = ctx.dst->Symbols().New(name);
|
||||
|
@ -265,8 +265,8 @@ struct CombineSamplers::State {
|
|||
[new_pair];
|
||||
args.Push(ctx.dst->Expr(var->symbol));
|
||||
} else if (auto* sampler_type = type->As<type::Sampler>()) {
|
||||
ast::SamplerKind kind = sampler_type->kind();
|
||||
int index = (kind == ast::SamplerKind::kSampler) ? 0 : 1;
|
||||
type::SamplerKind kind = sampler_type->kind();
|
||||
int index = (kind == type::SamplerKind::kSampler) ? 0 : 1;
|
||||
const ast::Variable*& p = placeholder_samplers_[index];
|
||||
if (!p) {
|
||||
p = CreatePlaceholder(kind);
|
||||
|
|
|
@ -426,7 +426,7 @@ struct MultiplanarExternalTexture::State {
|
|||
b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
|
||||
b.Param("plane1",
|
||||
b.ty.sampled_texture(type::TextureDimension::k2d, b.ty.f32())),
|
||||
b.Param("smp", b.ty.sampler(ast::SamplerKind::kSampler)),
|
||||
b.Param("smp", b.ty.sampler(type::SamplerKind::kSampler)),
|
||||
b.Param("coord", b.ty.vec2(b.ty.f32())),
|
||||
b.Param("params", b.ty.type_name(params_struct_sym)),
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::type::Sampler);
|
|||
|
||||
namespace tint::type {
|
||||
|
||||
Sampler::Sampler(ast::SamplerKind kind)
|
||||
Sampler::Sampler(SamplerKind kind)
|
||||
: Base(utils::Hash(TypeInfo::Of<Sampler>().full_hashcode, kind), type::Flags{}), kind_(kind) {}
|
||||
|
||||
Sampler::~Sampler() = default;
|
||||
|
@ -34,7 +34,7 @@ bool Sampler::Equals(const UniqueNode& other) const {
|
|||
}
|
||||
|
||||
std::string Sampler::FriendlyName(const SymbolTable&) const {
|
||||
return kind_ == ast::SamplerKind::kSampler ? "sampler" : "sampler_comparison";
|
||||
return kind_ == SamplerKind::kSampler ? "sampler" : "sampler_comparison";
|
||||
}
|
||||
|
||||
Sampler* Sampler::Clone(CloneContext& ctx) const {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "src/tint/ast/sampler.h"
|
||||
#include "src/tint/type/sampler_kind.h"
|
||||
#include "src/tint/type/type.h"
|
||||
|
||||
namespace tint::type {
|
||||
|
@ -27,7 +27,7 @@ class Sampler final : public Castable<Sampler, Type> {
|
|||
public:
|
||||
/// Constructor
|
||||
/// @param kind the kind of sampler
|
||||
explicit Sampler(ast::SamplerKind kind);
|
||||
explicit Sampler(SamplerKind kind);
|
||||
|
||||
/// Destructor
|
||||
~Sampler() override;
|
||||
|
@ -37,10 +37,10 @@ class Sampler final : public Castable<Sampler, Type> {
|
|||
bool Equals(const UniqueNode& other) const override;
|
||||
|
||||
/// @returns the sampler type
|
||||
ast::SamplerKind kind() const { return kind_; }
|
||||
SamplerKind kind() const { return kind_; }
|
||||
|
||||
/// @returns true if this is a comparison sampler
|
||||
bool IsComparison() const { return kind_ == ast::SamplerKind::kComparisonSampler; }
|
||||
bool IsComparison() const { return kind_ == SamplerKind::kComparisonSampler; }
|
||||
|
||||
/// @param symbols the program's symbol table
|
||||
/// @returns the name for this type that closely resembles how it would be
|
||||
|
@ -52,7 +52,7 @@ class Sampler final : public Castable<Sampler, Type> {
|
|||
Sampler* Clone(CloneContext& ctx) const override;
|
||||
|
||||
private:
|
||||
ast::SamplerKind const kind_;
|
||||
SamplerKind const kind_;
|
||||
};
|
||||
|
||||
} // namespace tint::type
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2023 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/tint/type/sampler_kind.h"
|
||||
|
||||
namespace tint::type {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, SamplerKind kind) {
|
||||
switch (kind) {
|
||||
case SamplerKind::kSampler:
|
||||
out << "sampler";
|
||||
break;
|
||||
case SamplerKind::kComparisonSampler:
|
||||
out << "comparison_sampler";
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace tint::type
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright 2023 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SRC_TINT_TYPE_SAMPLER_KIND_H_
|
||||
#define SRC_TINT_TYPE_SAMPLER_KIND_H_
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace tint::type {
|
||||
|
||||
/// The different kinds of samplers
|
||||
enum class SamplerKind {
|
||||
/// A regular sampler
|
||||
kSampler,
|
||||
/// A comparison sampler
|
||||
kComparisonSampler
|
||||
};
|
||||
|
||||
/// @param out the std::ostream to write to
|
||||
/// @param kind the SamplerKind
|
||||
/// @return the std::ostream so calls can be chained
|
||||
std::ostream& operator<<(std::ostream& out, SamplerKind kind);
|
||||
|
||||
} // namespace tint::type
|
||||
|
||||
#endif // SRC_TINT_TYPE_SAMPLER_KIND_H_
|
|
@ -22,12 +22,12 @@ namespace {
|
|||
using SamplerTest = TestHelper;
|
||||
|
||||
TEST_F(SamplerTest, Creation) {
|
||||
auto* a = create<Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* b = create<Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* c = create<Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
auto* a = create<Sampler>(SamplerKind::kSampler);
|
||||
auto* b = create<Sampler>(SamplerKind::kSampler);
|
||||
auto* c = create<Sampler>(SamplerKind::kComparisonSampler);
|
||||
|
||||
EXPECT_EQ(a->kind(), ast::SamplerKind::kSampler);
|
||||
EXPECT_EQ(c->kind(), ast::SamplerKind::kComparisonSampler);
|
||||
EXPECT_EQ(a->kind(), SamplerKind::kSampler);
|
||||
EXPECT_EQ(c->kind(), SamplerKind::kComparisonSampler);
|
||||
|
||||
EXPECT_FALSE(a->IsComparison());
|
||||
EXPECT_TRUE(c->IsComparison());
|
||||
|
@ -37,16 +37,16 @@ TEST_F(SamplerTest, Creation) {
|
|||
}
|
||||
|
||||
TEST_F(SamplerTest, Hash) {
|
||||
auto* a = create<Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* b = create<Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* a = create<Sampler>(SamplerKind::kSampler);
|
||||
auto* b = create<Sampler>(SamplerKind::kSampler);
|
||||
|
||||
EXPECT_EQ(a->unique_hash, b->unique_hash);
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, Equals) {
|
||||
auto* a = create<Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* b = create<Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* c = create<Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
auto* a = create<Sampler>(SamplerKind::kSampler);
|
||||
auto* b = create<Sampler>(SamplerKind::kSampler);
|
||||
auto* c = create<Sampler>(SamplerKind::kComparisonSampler);
|
||||
|
||||
EXPECT_TRUE(a->Equals(*b));
|
||||
EXPECT_FALSE(a->Equals(*c));
|
||||
|
@ -54,23 +54,23 @@ TEST_F(SamplerTest, Equals) {
|
|||
}
|
||||
|
||||
TEST_F(SamplerTest, FriendlyNameSampler) {
|
||||
Sampler s{ast::SamplerKind::kSampler};
|
||||
Sampler s{SamplerKind::kSampler};
|
||||
EXPECT_EQ(s.FriendlyName(Symbols()), "sampler");
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, FriendlyNameComparisonSampler) {
|
||||
Sampler s{ast::SamplerKind::kComparisonSampler};
|
||||
Sampler s{SamplerKind::kComparisonSampler};
|
||||
EXPECT_EQ(s.FriendlyName(Symbols()), "sampler_comparison");
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, Clone) {
|
||||
auto* a = create<Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* a = create<Sampler>(SamplerKind::kSampler);
|
||||
|
||||
type::Manager mgr;
|
||||
type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
|
||||
|
||||
auto* mt = a->Clone(ctx);
|
||||
EXPECT_EQ(mt->kind(), ast::SamplerKind::kSampler);
|
||||
EXPECT_EQ(mt->kind(), SamplerKind::kSampler);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -91,8 +91,9 @@ TEST_F(FlattenBindingsTest, NotFlat_MultipleNamespaces) {
|
|||
b.Group(2_a), b.Binding(2_a));
|
||||
|
||||
const size_t num_samplers = 2;
|
||||
b.GlobalVar("sampler1", b.ty.sampler(ast::SamplerKind::kSampler), b.Group(3_a), b.Binding(3_a));
|
||||
b.GlobalVar("sampler2", b.ty.sampler(ast::SamplerKind::kComparisonSampler), b.Group(4_a),
|
||||
b.GlobalVar("sampler1", b.ty.sampler(type::SamplerKind::kSampler), b.Group(3_a),
|
||||
b.Binding(3_a));
|
||||
b.GlobalVar("sampler2", b.ty.sampler(type::SamplerKind::kComparisonSampler), b.Group(4_a),
|
||||
b.Binding(4_a));
|
||||
|
||||
const size_t num_textures = 6;
|
||||
|
|
|
@ -280,7 +280,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Void) {
|
|||
}
|
||||
|
||||
TEST_F(GlslGeneratorImplTest_Type, EmitSampler) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
@ -291,7 +291,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitSampler) {
|
|||
}
|
||||
|
||||
TEST_F(GlslGeneratorImplTest_Type, EmitSamplerComparison) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Void) {
|
|||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitSampler) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
@ -285,7 +285,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitSampler) {
|
|||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Type, EmitSamplerComparison) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
|
|
@ -731,7 +731,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Void) {
|
|||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, EmitType_Sampler) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
@ -741,7 +741,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Sampler) {
|
|||
}
|
||||
|
||||
TEST_F(MslGeneratorImplTest, EmitType_SamplerComparison) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
|
|
@ -3735,11 +3735,11 @@ uint32_t Builder::GenerateTypeIfNeeded(const type::Type* type) {
|
|||
|
||||
// Register both of the sampler type names. In SPIR-V they're the same
|
||||
// sampler type, so we need to match that when we do the dedup check.
|
||||
if (s->kind() == ast::SamplerKind::kSampler) {
|
||||
if (s->kind() == type::SamplerKind::kSampler) {
|
||||
type_to_id_[builder_.create<type::Sampler>(
|
||||
ast::SamplerKind::kComparisonSampler)] = id;
|
||||
type::SamplerKind::kComparisonSampler)] = id;
|
||||
} else {
|
||||
type_to_id_[builder_.create<type::Sampler>(ast::SamplerKind::kSampler)] = id;
|
||||
type_to_id_[builder_.create<type::Sampler>(type::SamplerKind::kSampler)] = id;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
|
|
@ -41,7 +41,7 @@ inline std::ostream& operator<<(std::ostream& out, BuiltinData data) {
|
|||
|
||||
// This tests that we do not push OpTypeSampledImage and float_0 type twice.
|
||||
TEST_F(BuiltinBuilderTest, Call_TextureSampleCompare_Twice) {
|
||||
auto* s = ty.sampler(ast::SamplerKind::kComparisonSampler);
|
||||
auto* s = ty.sampler(type::SamplerKind::kComparisonSampler);
|
||||
auto* t = ty.depth_texture(type::TextureDimension::k2d);
|
||||
|
||||
auto* tex = GlobalVar("texture", t, Binding(0_a), Group(0_a));
|
||||
|
|
|
@ -234,7 +234,7 @@ TEST_F(BuilderTest, GlobalConst_Nested_Vec_Initializer) {
|
|||
}
|
||||
|
||||
TEST_F(BuilderTest, GlobalVar_WithBindingAndGroup) {
|
||||
auto* v = GlobalVar("var", ty.sampler(ast::SamplerKind::kSampler), Binding(2_a), Group(3_a));
|
||||
auto* v = GlobalVar("var", ty.sampler(type::SamplerKind::kSampler), Binding(2_a), Group(3_a));
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
||||
|
|
|
@ -965,7 +965,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_SampledTypeUint_Format_r32uint)
|
|||
}
|
||||
|
||||
TEST_F(BuilderTest_Type, Sampler) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
||||
|
@ -975,7 +975,7 @@ TEST_F(BuilderTest_Type, Sampler) {
|
|||
}
|
||||
|
||||
TEST_F(BuilderTest_Type, ComparisonSampler) {
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
||||
|
@ -985,8 +985,8 @@ TEST_F(BuilderTest_Type, ComparisonSampler) {
|
|||
}
|
||||
|
||||
TEST_F(BuilderTest_Type, Dedup_Sampler_And_ComparisonSampler) {
|
||||
auto* comp_sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
|
||||
auto* comp_sampler = create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
|
||||
|
||||
spirv::Builder& b = Build();
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) {
|
|||
}
|
||||
|
||||
TEST_F(WgslGeneratorImplTest, Emit_Global_Sampler) {
|
||||
GlobalVar("s", ty.sampler(ast::SamplerKind::kSampler), Group(0_a), Binding(0_a));
|
||||
GlobalVar("s", ty.sampler(type::SamplerKind::kSampler), Group(0_a), Binding(0_a));
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
|
|
@ -528,7 +528,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
ImageFormatData{type::TexelFormat::kRgba32Float, "rgba32float"}));
|
||||
|
||||
TEST_F(WgslGeneratorImplTest, EmitType_Sampler) {
|
||||
auto* sampler = ty.sampler(ast::SamplerKind::kSampler);
|
||||
auto* sampler = ty.sampler(type::SamplerKind::kSampler);
|
||||
Alias("make_type_reachable", sampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -539,7 +539,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Sampler) {
|
|||
}
|
||||
|
||||
TEST_F(WgslGeneratorImplTest, EmitType_SamplerComparison) {
|
||||
auto* sampler = ty.sampler(ast::SamplerKind::kComparisonSampler);
|
||||
auto* sampler = ty.sampler(type::SamplerKind::kComparisonSampler);
|
||||
Alias("make_type_reachable", sampler);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
|
|
@ -66,7 +66,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Access_ReadWrite) {
|
|||
}
|
||||
|
||||
TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) {
|
||||
auto* v = GlobalVar("a", ty.sampler(ast::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
auto* v = GlobalVar("a", ty.sampler(type::SamplerKind::kSampler), Group(1_a), Binding(2_a));
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
|
|
Loading…
Reference in New Issue