tint/ast: Remove ast::DepthTexture and ast::DepthMultisampledTexture
Instead use ast::TypeName. Bug: tint:1810 Change-Id: Id9fe641d193967cb27cea97e9c25b75c5fe2f1a2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119122 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
parent
63b777b552
commit
a5fec206c9
|
@ -260,8 +260,6 @@ libtint_source_set("libtint_syntax_tree_src") {
|
||||||
"ast/const.h",
|
"ast/const.h",
|
||||||
"ast/const_assert.h",
|
"ast/const_assert.h",
|
||||||
"ast/continue_statement.h",
|
"ast/continue_statement.h",
|
||||||
"ast/depth_multisampled_texture.h",
|
|
||||||
"ast/depth_texture.h",
|
|
||||||
"ast/diagnostic_attribute.h",
|
"ast/diagnostic_attribute.h",
|
||||||
"ast/diagnostic_control.h",
|
"ast/diagnostic_control.h",
|
||||||
"ast/diagnostic_directive.h",
|
"ast/diagnostic_directive.h",
|
||||||
|
@ -586,10 +584,6 @@ libtint_source_set("libtint_ast_src") {
|
||||||
"ast/const_assert.h",
|
"ast/const_assert.h",
|
||||||
"ast/continue_statement.cc",
|
"ast/continue_statement.cc",
|
||||||
"ast/continue_statement.h",
|
"ast/continue_statement.h",
|
||||||
"ast/depth_multisampled_texture.cc",
|
|
||||||
"ast/depth_multisampled_texture.h",
|
|
||||||
"ast/depth_texture.cc",
|
|
||||||
"ast/depth_texture.h",
|
|
||||||
"ast/diagnostic_attribute.cc",
|
"ast/diagnostic_attribute.cc",
|
||||||
"ast/diagnostic_attribute.h",
|
"ast/diagnostic_attribute.h",
|
||||||
"ast/diagnostic_control.cc",
|
"ast/diagnostic_control.cc",
|
||||||
|
|
|
@ -124,10 +124,6 @@ list(APPEND TINT_LIB_SRCS
|
||||||
ast/const_assert.h
|
ast/const_assert.h
|
||||||
ast/continue_statement.cc
|
ast/continue_statement.cc
|
||||||
ast/continue_statement.h
|
ast/continue_statement.h
|
||||||
ast/depth_multisampled_texture.cc
|
|
||||||
ast/depth_multisampled_texture.h
|
|
||||||
ast/depth_texture.cc
|
|
||||||
ast/depth_texture.h
|
|
||||||
ast/diagnostic_attribute.cc
|
ast/diagnostic_attribute.cc
|
||||||
ast/diagnostic_attribute.h
|
ast/diagnostic_attribute.h
|
||||||
ast/diagnostic_control.cc
|
ast/diagnostic_control.cc
|
||||||
|
@ -832,8 +828,6 @@ if(TINT_BUILD_TESTS)
|
||||||
ast/compound_assignment_statement_test.cc
|
ast/compound_assignment_statement_test.cc
|
||||||
ast/const_assert_test.cc
|
ast/const_assert_test.cc
|
||||||
ast/continue_statement_test.cc
|
ast/continue_statement_test.cc
|
||||||
ast/depth_multisampled_texture_test.cc
|
|
||||||
ast/depth_texture_test.cc
|
|
||||||
ast/diagnostic_attribute_test.cc
|
ast/diagnostic_attribute_test.cc
|
||||||
ast/diagnostic_control_test.cc
|
ast/diagnostic_control_test.cc
|
||||||
ast/diagnostic_directive_test.cc
|
ast/diagnostic_directive_test.cc
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
// Copyright 2021 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/ast/depth_multisampled_texture.h"
|
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::DepthMultisampledTexture);
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool IsValidDepthDimension(type::TextureDimension dim) {
|
|
||||||
return dim == type::TextureDimension::k2d;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
DepthMultisampledTexture::DepthMultisampledTexture(ProgramID pid,
|
|
||||||
NodeID nid,
|
|
||||||
const Source& src,
|
|
||||||
type::TextureDimension d)
|
|
||||||
: Base(pid, nid, src, d) {
|
|
||||||
TINT_ASSERT(AST, IsValidDepthDimension(dim));
|
|
||||||
}
|
|
||||||
|
|
||||||
DepthMultisampledTexture::DepthMultisampledTexture(DepthMultisampledTexture&&) = default;
|
|
||||||
|
|
||||||
DepthMultisampledTexture::~DepthMultisampledTexture() = default;
|
|
||||||
|
|
||||||
std::string DepthMultisampledTexture::FriendlyName(const SymbolTable&) const {
|
|
||||||
std::ostringstream out;
|
|
||||||
out << "texture_depth_multisampled_" << dim;
|
|
||||||
return out.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
const DepthMultisampledTexture* DepthMultisampledTexture::Clone(CloneContext* ctx) const {
|
|
||||||
auto src = ctx->Clone(source);
|
|
||||||
return ctx->dst->create<DepthMultisampledTexture>(src, dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
|
@ -1,54 +0,0 @@
|
||||||
// Copyright 2021 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_AST_DEPTH_MULTISAMPLED_TEXTURE_H_
|
|
||||||
#define SRC_TINT_AST_DEPTH_MULTISAMPLED_TEXTURE_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "src/tint/ast/texture.h"
|
|
||||||
#include "src/tint/type/texture_dimension.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
|
|
||||||
/// A multisampled depth texture type.
|
|
||||||
class DepthMultisampledTexture final : public Castable<DepthMultisampledTexture, Texture> {
|
|
||||||
public:
|
|
||||||
/// Constructor
|
|
||||||
/// @param pid the identifier of the program that owns this node
|
|
||||||
/// @param nid the unique node identifier
|
|
||||||
/// @param src the source of this node
|
|
||||||
/// @param dim the dimensionality of the texture
|
|
||||||
DepthMultisampledTexture(ProgramID pid,
|
|
||||||
NodeID nid,
|
|
||||||
const Source& src,
|
|
||||||
type::TextureDimension dim);
|
|
||||||
/// Move constructor
|
|
||||||
DepthMultisampledTexture(DepthMultisampledTexture&&);
|
|
||||||
~DepthMultisampledTexture() override;
|
|
||||||
|
|
||||||
/// @param symbols the program's symbol table
|
|
||||||
/// @returns the name for this type that closely resembles how it would be
|
|
||||||
/// declared in WGSL.
|
|
||||||
std::string FriendlyName(const SymbolTable& symbols) const override;
|
|
||||||
|
|
||||||
/// Clones this type and all transitive types using the `CloneContext` `ctx`.
|
|
||||||
/// @param ctx the clone context
|
|
||||||
/// @return the newly cloned type
|
|
||||||
const DepthMultisampledTexture* Clone(CloneContext* ctx) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
||||||
|
|
||||||
#endif // SRC_TINT_AST_DEPTH_MULTISAMPLED_TEXTURE_H_
|
|
|
@ -1,35 +0,0 @@
|
||||||
// Copyright 2021 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/ast/depth_multisampled_texture.h"
|
|
||||||
|
|
||||||
#include "src/tint/ast/test_helper.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using AstDepthMultisampledTextureTest = TestHelper;
|
|
||||||
|
|
||||||
TEST_F(AstDepthMultisampledTextureTest, Dim) {
|
|
||||||
auto* d = create<DepthMultisampledTexture>(type::TextureDimension::k2d);
|
|
||||||
EXPECT_EQ(d->dim, type::TextureDimension::k2d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(AstDepthMultisampledTextureTest, FriendlyName) {
|
|
||||||
auto* d = create<DepthMultisampledTexture>(type::TextureDimension::k2d);
|
|
||||||
EXPECT_EQ(d->FriendlyName(Symbols()), "texture_depth_multisampled_2d");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace tint::ast
|
|
|
@ -1,51 +0,0 @@
|
||||||
// Copyright 2020 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/ast/depth_texture.h"
|
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::DepthTexture);
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool IsValidDepthDimension(type::TextureDimension dim) {
|
|
||||||
return dim == type::TextureDimension::k2d || dim == type::TextureDimension::k2dArray ||
|
|
||||||
dim == type::TextureDimension::kCube || dim == type::TextureDimension::kCubeArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
DepthTexture::DepthTexture(ProgramID pid, NodeID nid, const Source& src, type::TextureDimension d)
|
|
||||||
: Base(pid, nid, src, d) {
|
|
||||||
TINT_ASSERT(AST, IsValidDepthDimension(dim));
|
|
||||||
}
|
|
||||||
|
|
||||||
DepthTexture::DepthTexture(DepthTexture&&) = default;
|
|
||||||
|
|
||||||
DepthTexture::~DepthTexture() = default;
|
|
||||||
|
|
||||||
std::string DepthTexture::FriendlyName(const SymbolTable&) const {
|
|
||||||
std::ostringstream out;
|
|
||||||
out << "texture_depth_" << dim;
|
|
||||||
return out.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
const DepthTexture* DepthTexture::Clone(CloneContext* ctx) const {
|
|
||||||
auto src = ctx->Clone(source);
|
|
||||||
return ctx->dst->create<DepthTexture>(src, dim);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
|
@ -1,51 +0,0 @@
|
||||||
// Copyright 2020 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_AST_DEPTH_TEXTURE_H_
|
|
||||||
#define SRC_TINT_AST_DEPTH_TEXTURE_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "src/tint/ast/texture.h"
|
|
||||||
#include "src/tint/type/texture_dimension.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
|
|
||||||
/// A depth texture type.
|
|
||||||
class DepthTexture final : public Castable<DepthTexture, Texture> {
|
|
||||||
public:
|
|
||||||
/// Constructor
|
|
||||||
/// @param pid the identifier of the program that owns this node
|
|
||||||
/// @param nid the unique node identifier
|
|
||||||
/// @param src the source of this node
|
|
||||||
/// @param dim the dimensionality of the texture
|
|
||||||
DepthTexture(ProgramID pid, NodeID nid, const Source& src, type::TextureDimension dim);
|
|
||||||
/// Move constructor
|
|
||||||
DepthTexture(DepthTexture&&);
|
|
||||||
~DepthTexture() override;
|
|
||||||
|
|
||||||
/// @param symbols the program's symbol table
|
|
||||||
/// @returns the name for this type that closely resembles how it would be
|
|
||||||
/// declared in WGSL.
|
|
||||||
std::string FriendlyName(const SymbolTable& symbols) const override;
|
|
||||||
|
|
||||||
/// Clones this type and all transitive types using the `CloneContext` `ctx`.
|
|
||||||
/// @param ctx the clone context
|
|
||||||
/// @return the newly cloned type
|
|
||||||
const DepthTexture* Clone(CloneContext* ctx) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
||||||
|
|
||||||
#endif // SRC_TINT_AST_DEPTH_TEXTURE_H_
|
|
|
@ -1,42 +0,0 @@
|
||||||
// Copyright 2020 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/ast/depth_texture.h"
|
|
||||||
|
|
||||||
#include "src/tint/ast/test_helper.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using AstDepthTextureTest = TestHelper;
|
|
||||||
|
|
||||||
TEST_F(AstDepthTextureTest, IsTexture) {
|
|
||||||
Texture* ty = create<DepthTexture>(type::TextureDimension::kCube);
|
|
||||||
EXPECT_TRUE(ty->Is<DepthTexture>());
|
|
||||||
EXPECT_FALSE(ty->Is<SampledTexture>());
|
|
||||||
EXPECT_FALSE(ty->Is<StorageTexture>());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(AstDepthTextureTest, Dim) {
|
|
||||||
auto* d = create<DepthTexture>(type::TextureDimension::kCube);
|
|
||||||
EXPECT_EQ(d->dim, type::TextureDimension::kCube);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(AstDepthTextureTest, FriendlyName) {
|
|
||||||
auto* d = create<DepthTexture>(type::TextureDimension::kCube);
|
|
||||||
EXPECT_EQ(d->FriendlyName(Symbols()), "texture_depth_cube");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace tint::ast
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
#include "src/tint/ast/alias.h"
|
#include "src/tint/ast/alias.h"
|
||||||
#include "src/tint/ast/array.h"
|
#include "src/tint/ast/array.h"
|
||||||
#include "src/tint/ast/depth_texture.h"
|
|
||||||
#include "src/tint/ast/matrix.h"
|
#include "src/tint/ast/matrix.h"
|
||||||
#include "src/tint/ast/pointer.h"
|
#include "src/tint/ast/pointer.h"
|
||||||
#include "src/tint/ast/sampled_texture.h"
|
#include "src/tint/ast/sampled_texture.h"
|
||||||
|
@ -34,7 +33,6 @@ using AstMultisampledTextureTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(AstMultisampledTextureTest, IsTexture) {
|
TEST_F(AstMultisampledTextureTest, IsTexture) {
|
||||||
Texture* t = create<MultisampledTexture>(type::TextureDimension::kCube, ty.f32());
|
Texture* t = create<MultisampledTexture>(type::TextureDimension::kCube, ty.f32());
|
||||||
EXPECT_FALSE(t->Is<DepthTexture>());
|
|
||||||
EXPECT_TRUE(t->Is<MultisampledTexture>());
|
EXPECT_TRUE(t->Is<MultisampledTexture>());
|
||||||
EXPECT_FALSE(t->Is<SampledTexture>());
|
EXPECT_FALSE(t->Is<SampledTexture>());
|
||||||
EXPECT_FALSE(t->Is<StorageTexture>());
|
EXPECT_FALSE(t->Is<StorageTexture>());
|
||||||
|
|
|
@ -23,7 +23,6 @@ using AstSampledTextureTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(AstSampledTextureTest, IsTexture) {
|
TEST_F(AstSampledTextureTest, IsTexture) {
|
||||||
Texture* t = create<SampledTexture>(type::TextureDimension::kCube, ty.f32());
|
Texture* t = create<SampledTexture>(type::TextureDimension::kCube, ty.f32());
|
||||||
EXPECT_FALSE(t->Is<DepthTexture>());
|
|
||||||
EXPECT_TRUE(t->Is<SampledTexture>());
|
EXPECT_TRUE(t->Is<SampledTexture>());
|
||||||
EXPECT_FALSE(t->Is<StorageTexture>());
|
EXPECT_FALSE(t->Is<StorageTexture>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ TEST_F(AstStorageTextureTest, IsTexture) {
|
||||||
Texture* ty =
|
Texture* ty =
|
||||||
create<StorageTexture>(type::TextureDimension::k2dArray, type::TexelFormat::kRgba32Float,
|
create<StorageTexture>(type::TextureDimension::k2dArray, type::TexelFormat::kRgba32Float,
|
||||||
subtype, type::Access::kRead);
|
subtype, type::Access::kRead);
|
||||||
EXPECT_FALSE(ty->Is<DepthTexture>());
|
|
||||||
EXPECT_FALSE(ty->Is<SampledTexture>());
|
EXPECT_FALSE(ty->Is<SampledTexture>());
|
||||||
EXPECT_TRUE(ty->Is<StorageTexture>());
|
EXPECT_TRUE(ty->Is<StorageTexture>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,12 @@ enum builtin_type {
|
||||||
// https://www.w3.org/TR/WGSL/#sampler-type
|
// https://www.w3.org/TR/WGSL/#sampler-type
|
||||||
sampler
|
sampler
|
||||||
sampler_comparison
|
sampler_comparison
|
||||||
|
// https://www.w3.org/TR/WGSL/#texture-depth
|
||||||
|
texture_depth_2d
|
||||||
|
texture_depth_2d_array
|
||||||
|
texture_depth_cube
|
||||||
|
texture_depth_cube_array
|
||||||
|
texture_depth_multisampled_2d
|
||||||
// https://www.w3.org/TR/WGSL/#external-texture-type
|
// https://www.w3.org/TR/WGSL/#external-texture-type
|
||||||
texture_external
|
texture_external
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@
|
||||||
#include "src/tint/ast/const.h"
|
#include "src/tint/ast/const.h"
|
||||||
#include "src/tint/ast/const_assert.h"
|
#include "src/tint/ast/const_assert.h"
|
||||||
#include "src/tint/ast/continue_statement.h"
|
#include "src/tint/ast/continue_statement.h"
|
||||||
#include "src/tint/ast/depth_multisampled_texture.h"
|
|
||||||
#include "src/tint/ast/depth_texture.h"
|
|
||||||
#include "src/tint/ast/diagnostic_attribute.h"
|
#include "src/tint/ast/diagnostic_attribute.h"
|
||||||
#include "src/tint/ast/diagnostic_control.h"
|
#include "src/tint/ast/diagnostic_control.h"
|
||||||
#include "src/tint/ast/diagnostic_directive.h"
|
#include "src/tint/ast/diagnostic_directive.h"
|
||||||
|
@ -980,33 +978,50 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param dims the dimensionality of the texture
|
/// @param dims the dimensionality of the texture
|
||||||
/// @returns the depth texture
|
/// @returns the depth texture typename
|
||||||
const ast::DepthTexture* depth_texture(type::TextureDimension dims) const {
|
const ast::TypeName* depth_texture(type::TextureDimension dims) const {
|
||||||
return builder->create<ast::DepthTexture>(dims);
|
return depth_texture(builder->source_, dims);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the Source of the node
|
/// @param source the Source of the node
|
||||||
/// @param dims the dimensionality of the texture
|
/// @param dims the dimensionality of the texture
|
||||||
/// @returns the depth texture
|
/// @returns the depth texture typename
|
||||||
const ast::DepthTexture* depth_texture(const Source& source,
|
const ast::TypeName* depth_texture(const Source& source,
|
||||||
type::TextureDimension dims) const {
|
type::TextureDimension dims) const {
|
||||||
return builder->create<ast::DepthTexture>(source, dims);
|
switch (dims) {
|
||||||
|
case type::TextureDimension::k2d:
|
||||||
|
return (*this)(source, "texture_depth_2d");
|
||||||
|
case type::TextureDimension::k2dArray:
|
||||||
|
return (*this)(source, "texture_depth_2d_array");
|
||||||
|
case type::TextureDimension::kCube:
|
||||||
|
return (*this)(source, "texture_depth_cube");
|
||||||
|
case type::TextureDimension::kCubeArray:
|
||||||
|
return (*this)(source, "texture_depth_cube_array");
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TINT_ICE(ProgramBuilder, builder->Diagnostics())
|
||||||
|
<< "invalid depth_texture dimensions: " << dims;
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param dims the dimensionality of the texture
|
/// @param dims the dimensionality of the texture
|
||||||
/// @returns the multisampled depth texture
|
/// @returns the multisampled depth texture typename
|
||||||
const ast::DepthMultisampledTexture* depth_multisampled_texture(
|
const ast::TypeName* depth_multisampled_texture(type::TextureDimension dims) const {
|
||||||
type::TextureDimension dims) const {
|
return depth_multisampled_texture(builder->source_, dims);
|
||||||
return builder->create<ast::DepthMultisampledTexture>(dims);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the Source of the node
|
/// @param source the Source of the node
|
||||||
/// @param dims the dimensionality of the texture
|
/// @param dims the dimensionality of the texture
|
||||||
/// @returns the multisampled depth texture
|
/// @returns the multisampled depth texture typename
|
||||||
const ast::DepthMultisampledTexture* depth_multisampled_texture(
|
const ast::TypeName* depth_multisampled_texture(const Source& source,
|
||||||
const Source& source,
|
type::TextureDimension dims) const {
|
||||||
type::TextureDimension dims) const {
|
if (dims == type::TextureDimension::k2d) {
|
||||||
return builder->create<ast::DepthMultisampledTexture>(source, dims);
|
return (*this)(source, "texture_depth_multisampled_2d");
|
||||||
|
}
|
||||||
|
TINT_ICE(ProgramBuilder, builder->Diagnostics())
|
||||||
|
<< "invalid depth_multisampled_texture dimensions: " << dims;
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param dims the dimensionality of the texture
|
/// @param dims the dimensionality of the texture
|
||||||
|
|
|
@ -33,9 +33,8 @@ TEST_F(ParserImplTest, DepthTextureType_2d) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
ASSERT_TRUE(t->Is<ast::Texture>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_TRUE(t->Is<ast::DepthTexture>());
|
"texture_depth_2d");
|
||||||
EXPECT_EQ(t->As<ast::Texture>()->dim, type::TextureDimension::k2d);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}}));
|
||||||
}
|
}
|
||||||
|
@ -46,9 +45,8 @@ TEST_F(ParserImplTest, DepthTextureType_2dArray) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
ASSERT_TRUE(t->Is<ast::Texture>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_TRUE(t->Is<ast::DepthTexture>());
|
"texture_depth_2d_array");
|
||||||
EXPECT_EQ(t->As<ast::Texture>()->dim, type::TextureDimension::k2dArray);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 23u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 23u}}));
|
||||||
}
|
}
|
||||||
|
@ -59,9 +57,8 @@ TEST_F(ParserImplTest, DepthTextureType_Cube) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
ASSERT_TRUE(t->Is<ast::Texture>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_TRUE(t->Is<ast::DepthTexture>());
|
"texture_depth_cube");
|
||||||
EXPECT_EQ(t->As<ast::Texture>()->dim, type::TextureDimension::kCube);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 19u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 19u}}));
|
||||||
}
|
}
|
||||||
|
@ -72,9 +69,8 @@ TEST_F(ParserImplTest, DepthTextureType_CubeArray) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
ASSERT_TRUE(t->Is<ast::Texture>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_TRUE(t->Is<ast::DepthTexture>());
|
"texture_depth_cube_array");
|
||||||
EXPECT_EQ(t->As<ast::Texture>()->dim, type::TextureDimension::kCubeArray);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 25u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 25u}}));
|
||||||
}
|
}
|
||||||
|
@ -85,9 +81,8 @@ TEST_F(ParserImplTest, DepthTextureType_Multisampled2d) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
ASSERT_TRUE(t->Is<ast::Texture>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_TRUE(t->Is<ast::DepthMultisampledTexture>());
|
"texture_depth_multisampled_2d");
|
||||||
EXPECT_EQ(t->As<ast::Texture>()->dim, type::TextureDimension::k2d);
|
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 30u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 30u}}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,8 @@ TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr);
|
ASSERT_NE(t.value, nullptr);
|
||||||
ASSERT_TRUE(t->Is<ast::Texture>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_TRUE(t->Is<ast::DepthTexture>());
|
"texture_depth_2d");
|
||||||
EXPECT_EQ(t->As<ast::Texture>()->dim, type::TextureDimension::k2d);
|
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 17u}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
#include "src/tint/ast/compound_assignment_statement.h"
|
#include "src/tint/ast/compound_assignment_statement.h"
|
||||||
#include "src/tint/ast/const.h"
|
#include "src/tint/ast/const.h"
|
||||||
#include "src/tint/ast/continue_statement.h"
|
#include "src/tint/ast/continue_statement.h"
|
||||||
#include "src/tint/ast/depth_multisampled_texture.h"
|
|
||||||
#include "src/tint/ast/depth_texture.h"
|
|
||||||
#include "src/tint/ast/diagnostic_attribute.h"
|
#include "src/tint/ast/diagnostic_attribute.h"
|
||||||
#include "src/tint/ast/discard_statement.h"
|
#include "src/tint/ast/discard_statement.h"
|
||||||
#include "src/tint/ast/for_loop_statement.h"
|
#include "src/tint/ast/for_loop_statement.h"
|
||||||
|
@ -403,11 +401,7 @@ class DependencyScanner {
|
||||||
[&](const ast::StorageTexture* tex) { //
|
[&](const ast::StorageTexture* tex) { //
|
||||||
TraverseType(tex->type);
|
TraverseType(tex->type);
|
||||||
},
|
},
|
||||||
[&](Default) {
|
[&](Default) { UnhandledNode(diagnostics_, ty); });
|
||||||
if (!ty->IsAnyOf<ast::DepthTexture, ast::DepthMultisampledTexture>()) {
|
|
||||||
UnhandledNode(diagnostics_, ty);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Traverses the attribute list, performing symbol resolution and
|
/// Traverses the attribute list, performing symbol resolution and
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "src/tint/ast/break_statement.h"
|
#include "src/tint/ast/break_statement.h"
|
||||||
#include "src/tint/ast/call_statement.h"
|
#include "src/tint/ast/call_statement.h"
|
||||||
#include "src/tint/ast/continue_statement.h"
|
#include "src/tint/ast/continue_statement.h"
|
||||||
#include "src/tint/ast/depth_texture.h"
|
|
||||||
#include "src/tint/ast/disable_validation_attribute.h"
|
#include "src/tint/ast/disable_validation_attribute.h"
|
||||||
#include "src/tint/ast/discard_statement.h"
|
#include "src/tint/ast/discard_statement.h"
|
||||||
#include "src/tint/ast/for_loop_statement.h"
|
#include "src/tint/ast/for_loop_statement.h"
|
||||||
|
@ -309,10 +308,6 @@ type::Type* Resolver::Type(const ast::Type* ty) {
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
},
|
},
|
||||||
[&](const ast::DepthTexture* t) { return builder_->create<type::DepthTexture>(t->dim); },
|
|
||||||
[&](const ast::DepthMultisampledTexture* t) {
|
|
||||||
return builder_->create<type::DepthMultisampledTexture>(t->dim);
|
|
||||||
},
|
|
||||||
[&](const ast::StorageTexture* t) -> type::StorageTexture* {
|
[&](const ast::StorageTexture* t) -> type::StorageTexture* {
|
||||||
if (auto* el = Type(t->type)) {
|
if (auto* el = Type(t->type)) {
|
||||||
if (!validator_.StorageTexture(t)) {
|
if (!validator_.StorageTexture(t)) {
|
||||||
|
@ -2527,6 +2522,16 @@ type::Type* Resolver::BuiltinType(type::Builtin builtin_ty, const ast::Identifie
|
||||||
return builder_->create<type::Sampler>(type::SamplerKind::kSampler);
|
return builder_->create<type::Sampler>(type::SamplerKind::kSampler);
|
||||||
case type::Builtin::kSamplerComparison:
|
case type::Builtin::kSamplerComparison:
|
||||||
return builder_->create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
return builder_->create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||||
|
case type::Builtin::kTextureDepth2D:
|
||||||
|
return builder_->create<type::DepthTexture>(type::TextureDimension::k2d);
|
||||||
|
case type::Builtin::kTextureDepth2DArray:
|
||||||
|
return builder_->create<type::DepthTexture>(type::TextureDimension::k2dArray);
|
||||||
|
case type::Builtin::kTextureDepthCube:
|
||||||
|
return builder_->create<type::DepthTexture>(type::TextureDimension::kCube);
|
||||||
|
case type::Builtin::kTextureDepthCubeArray:
|
||||||
|
return builder_->create<type::DepthTexture>(type::TextureDimension::kCubeArray);
|
||||||
|
case type::Builtin::kTextureDepthMultisampled2D:
|
||||||
|
return builder_->create<type::DepthMultisampledTexture>(type::TextureDimension::k2d);
|
||||||
case type::Builtin::kTextureExternal:
|
case type::Builtin::kTextureExternal:
|
||||||
return builder_->create<type::ExternalTexture>();
|
return builder_->create<type::ExternalTexture>();
|
||||||
case type::Builtin::kUndefined:
|
case type::Builtin::kUndefined:
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "src/tint/ast/break_statement.h"
|
#include "src/tint/ast/break_statement.h"
|
||||||
#include "src/tint/ast/call_statement.h"
|
#include "src/tint/ast/call_statement.h"
|
||||||
#include "src/tint/ast/continue_statement.h"
|
#include "src/tint/ast/continue_statement.h"
|
||||||
#include "src/tint/ast/depth_texture.h"
|
|
||||||
#include "src/tint/ast/disable_validation_attribute.h"
|
#include "src/tint/ast/disable_validation_attribute.h"
|
||||||
#include "src/tint/ast/discard_statement.h"
|
#include "src/tint/ast/discard_statement.h"
|
||||||
#include "src/tint/ast/for_loop_statement.h"
|
#include "src/tint/ast/for_loop_statement.h"
|
||||||
|
|
|
@ -147,10 +147,10 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const type::Type
|
||||||
return ctx.dst->create<ast::Atomic>(CreateASTTypeFor(ctx, a->Type()));
|
return ctx.dst->create<ast::Atomic>(CreateASTTypeFor(ctx, a->Type()));
|
||||||
}
|
}
|
||||||
if (auto* t = ty->As<type::DepthTexture>()) {
|
if (auto* t = ty->As<type::DepthTexture>()) {
|
||||||
return ctx.dst->create<ast::DepthTexture>(t->dim());
|
return ctx.dst->ty.depth_texture(t->dim());
|
||||||
}
|
}
|
||||||
if (auto* t = ty->As<type::DepthMultisampledTexture>()) {
|
if (auto* t = ty->As<type::DepthMultisampledTexture>()) {
|
||||||
return ctx.dst->create<ast::DepthMultisampledTexture>(t->dim());
|
return ctx.dst->ty.depth_multisampled_texture(t->dim());
|
||||||
}
|
}
|
||||||
if (ty->Is<type::ExternalTexture>()) {
|
if (ty->Is<type::ExternalTexture>()) {
|
||||||
return ctx.dst->ty.external_texture();
|
return ctx.dst->ty.external_texture();
|
||||||
|
|
|
@ -100,6 +100,21 @@ Builtin ParseBuiltin(std::string_view str) {
|
||||||
if (str == "sampler_comparison") {
|
if (str == "sampler_comparison") {
|
||||||
return Builtin::kSamplerComparison;
|
return Builtin::kSamplerComparison;
|
||||||
}
|
}
|
||||||
|
if (str == "texture_depth_2d") {
|
||||||
|
return Builtin::kTextureDepth2D;
|
||||||
|
}
|
||||||
|
if (str == "texture_depth_2d_array") {
|
||||||
|
return Builtin::kTextureDepth2DArray;
|
||||||
|
}
|
||||||
|
if (str == "texture_depth_cube") {
|
||||||
|
return Builtin::kTextureDepthCube;
|
||||||
|
}
|
||||||
|
if (str == "texture_depth_cube_array") {
|
||||||
|
return Builtin::kTextureDepthCubeArray;
|
||||||
|
}
|
||||||
|
if (str == "texture_depth_multisampled_2d") {
|
||||||
|
return Builtin::kTextureDepthMultisampled2D;
|
||||||
|
}
|
||||||
if (str == "texture_external") {
|
if (str == "texture_external") {
|
||||||
return Builtin::kTextureExternal;
|
return Builtin::kTextureExternal;
|
||||||
}
|
}
|
||||||
|
@ -197,6 +212,16 @@ std::ostream& operator<<(std::ostream& out, Builtin value) {
|
||||||
return out << "sampler";
|
return out << "sampler";
|
||||||
case Builtin::kSamplerComparison:
|
case Builtin::kSamplerComparison:
|
||||||
return out << "sampler_comparison";
|
return out << "sampler_comparison";
|
||||||
|
case Builtin::kTextureDepth2D:
|
||||||
|
return out << "texture_depth_2d";
|
||||||
|
case Builtin::kTextureDepth2DArray:
|
||||||
|
return out << "texture_depth_2d_array";
|
||||||
|
case Builtin::kTextureDepthCube:
|
||||||
|
return out << "texture_depth_cube";
|
||||||
|
case Builtin::kTextureDepthCubeArray:
|
||||||
|
return out << "texture_depth_cube_array";
|
||||||
|
case Builtin::kTextureDepthMultisampled2D:
|
||||||
|
return out << "texture_depth_multisampled_2d";
|
||||||
case Builtin::kTextureExternal:
|
case Builtin::kTextureExternal:
|
||||||
return out << "texture_external";
|
return out << "texture_external";
|
||||||
case Builtin::kU32:
|
case Builtin::kU32:
|
||||||
|
|
|
@ -54,6 +54,11 @@ enum class Builtin {
|
||||||
kMat4X4H,
|
kMat4X4H,
|
||||||
kSampler,
|
kSampler,
|
||||||
kSamplerComparison,
|
kSamplerComparison,
|
||||||
|
kTextureDepth2D,
|
||||||
|
kTextureDepth2DArray,
|
||||||
|
kTextureDepthCube,
|
||||||
|
kTextureDepthCubeArray,
|
||||||
|
kTextureDepthMultisampled2D,
|
||||||
kTextureExternal,
|
kTextureExternal,
|
||||||
kU32,
|
kU32,
|
||||||
kVec2F,
|
kVec2F,
|
||||||
|
@ -105,6 +110,11 @@ constexpr const char* kBuiltinStrings[] = {
|
||||||
"mat4x4h",
|
"mat4x4h",
|
||||||
"sampler",
|
"sampler",
|
||||||
"sampler_comparison",
|
"sampler_comparison",
|
||||||
|
"texture_depth_2d",
|
||||||
|
"texture_depth_2d_array",
|
||||||
|
"texture_depth_cube",
|
||||||
|
"texture_depth_cube_array",
|
||||||
|
"texture_depth_multisampled_2d",
|
||||||
"texture_external",
|
"texture_external",
|
||||||
"u32",
|
"u32",
|
||||||
"vec2f",
|
"vec2f",
|
||||||
|
|
|
@ -199,104 +199,139 @@ void BuiltinParser(::benchmark::State& state) {
|
||||||
"samplpLL_comparisI",
|
"samplpLL_comparisI",
|
||||||
"smplerfomparison",
|
"smplerfomparison",
|
||||||
"sYmpURDr_comprison",
|
"sYmpURDr_comprison",
|
||||||
"texturh_external",
|
"texturh_depth_2d",
|
||||||
"teqtureuIIextnal",
|
"teqtureuIIdep_2d",
|
||||||
"texture_externaH",
|
"texture_depth_2H",
|
||||||
|
"texture_depth_2d",
|
||||||
|
"texre_depth_2Qvv",
|
||||||
|
"te66ue_depeh_2d",
|
||||||
|
"textue_d7pOh_2d",
|
||||||
|
"textureDDde0th_255_array",
|
||||||
|
"texture_IIepth_Hd_array",
|
||||||
|
"txture_depth_2d_array",
|
||||||
|
"texture_depth_2d_array",
|
||||||
|
"txture_depth_2r_array",
|
||||||
|
"tlxture_depth_2d_array",
|
||||||
|
"ttexturGdeth_2d_arrJJy",
|
||||||
|
"yexture_depth_cbe",
|
||||||
|
"texturedepth_cube",
|
||||||
|
"texture_IIeptBB_cube",
|
||||||
|
"texture_depth_cube",
|
||||||
|
"textKre_depth_c83TTe",
|
||||||
|
"texSnnYUUure_depth_cube",
|
||||||
|
"textuxe_5eptCCdZube",
|
||||||
|
"texturekkdepth_cube_arraq",
|
||||||
|
"exture_dppt00iicube5array",
|
||||||
|
"texIIurenndepth_cube_array",
|
||||||
|
"texture_depth_cube_array",
|
||||||
|
"ccextue_depth_cube_aKWa",
|
||||||
|
"texture_epth_cube_raKK",
|
||||||
|
"texture_depth_cube_a66ray",
|
||||||
|
"textEPPeKKdept_multisampled_2",
|
||||||
|
"texture_depth_mutisampledxx2d",
|
||||||
|
"texture_depth_qultisampled_2d",
|
||||||
|
"texture_depth_multisampled_2d",
|
||||||
|
"textureyydMMptr_mutisampleSS_2d",
|
||||||
|
"txture_depth_muluisampled2d",
|
||||||
|
"texSure_ept_mutisampled_2d",
|
||||||
|
"textu5e_externFFl",
|
||||||
|
"text44rrr_exterzal",
|
||||||
|
"texue_eWWtenal",
|
||||||
"texture_external",
|
"texture_external",
|
||||||
"texre_externaQvv",
|
"textuXe_ZZxtJJrnal",
|
||||||
"te66ue_external",
|
"textuPPe_eternal",
|
||||||
"textue_e7tOrnal",
|
"texturc_external",
|
||||||
"550DD",
|
"ull62",
|
||||||
"II3H",
|
"93yy",
|
||||||
"u3",
|
"u3KK",
|
||||||
"u32",
|
"u32",
|
||||||
"r2",
|
"x_",
|
||||||
"u3l",
|
"K",
|
||||||
"uGt",
|
"kVz",
|
||||||
"ey2f",
|
"veKSf",
|
||||||
"vc2f",
|
"vc2f",
|
||||||
"IIeBB2f",
|
"ec2VV",
|
||||||
"vec2f",
|
"vec2f",
|
||||||
"TTec338",
|
"IAAc2f",
|
||||||
"veUUSS2nnd",
|
|
||||||
"vZx5CC",
|
|
||||||
"kkec2q",
|
|
||||||
"v005ih",
|
|
||||||
"vnIIc2h",
|
|
||||||
"vec2h",
|
|
||||||
"cceW",
|
|
||||||
"cKK",
|
|
||||||
"vec66h",
|
|
||||||
"vePPK",
|
|
||||||
"vexxi",
|
|
||||||
"qec2i",
|
|
||||||
"vec2i",
|
|
||||||
"veSyMMr",
|
|
||||||
"v2u",
|
|
||||||
"ec",
|
|
||||||
"5eFF2u",
|
|
||||||
"rrecz44",
|
|
||||||
"vWW",
|
|
||||||
"vec2u",
|
|
||||||
"XJecCZZ",
|
|
||||||
"vePP2",
|
|
||||||
"vec2c",
|
|
||||||
"ve6ll3f",
|
|
||||||
"vcyy99",
|
|
||||||
"Jec3KK",
|
|
||||||
"vec3f",
|
|
||||||
"_ex3",
|
|
||||||
"Ky3",
|
|
||||||
"zek3f",
|
|
||||||
"veKSh",
|
|
||||||
"vc3h",
|
|
||||||
"ec3VV",
|
|
||||||
"vec3h",
|
|
||||||
"IAAc3h",
|
|
||||||
"jbR",
|
"jbR",
|
||||||
"veY4",
|
"veY4",
|
||||||
"ec3i",
|
"ec2h",
|
||||||
"vc911",
|
"vc911",
|
||||||
"mmcci",
|
"mmcch",
|
||||||
"vec3i",
|
"vec2h",
|
||||||
"vJJci",
|
"vJJch",
|
||||||
"lDDcUfC",
|
"lDDcUfC",
|
||||||
"vec3g",
|
"vec2g",
|
||||||
"CCe",
|
"CCe",
|
||||||
"ec3u",
|
"ec2i",
|
||||||
"vIc__u",
|
"vIc__i",
|
||||||
"vec3u",
|
"vec2i",
|
||||||
"ePPtt",
|
"ePPtt",
|
||||||
"v3dc3u",
|
"v3dc2i",
|
||||||
"vcyyu",
|
"vcyyi",
|
||||||
"u4",
|
"u2",
|
||||||
"v03nnf",
|
"v03nnu",
|
||||||
"Cuuecnv",
|
"Cuuecnv",
|
||||||
"vec4f",
|
"vec2u",
|
||||||
"vX4ll",
|
"vX2ll",
|
||||||
"vocppf",
|
"vocppu",
|
||||||
"vwwc4",
|
"vwwc2",
|
||||||
"veuug",
|
"veuug",
|
||||||
"vaac",
|
"vaac",
|
||||||
"TRZccch",
|
"TRZcccf",
|
||||||
"vec4h",
|
"vec3f",
|
||||||
"vTc4O8",
|
"vTc3O8",
|
||||||
"vem04h",
|
"vem03f",
|
||||||
"meBB4h",
|
"meBB3f",
|
||||||
"Mpp4",
|
"Mpp3",
|
||||||
"OOe4i",
|
"OOe3h",
|
||||||
"veG4G",
|
"veG3G",
|
||||||
"vec4i",
|
"vec3h",
|
||||||
"11eHH4i",
|
"11eHH3h",
|
||||||
"veFFe6",
|
"veFFe6",
|
||||||
"ve4",
|
"ve3",
|
||||||
"vKii4l",
|
"vKii3l",
|
||||||
"ec4u",
|
"ec3i",
|
||||||
"v994IIv",
|
"v993IIv",
|
||||||
|
"vec3i",
|
||||||
|
"veci",
|
||||||
|
"vechi",
|
||||||
|
"vczllPi",
|
||||||
|
"u",
|
||||||
|
"vffqq3",
|
||||||
|
"vJdd3u",
|
||||||
|
"vec3u",
|
||||||
|
"vecXX",
|
||||||
|
"ve32",
|
||||||
|
"Nyyc3u",
|
||||||
|
"vO4",
|
||||||
|
"PEruZ",
|
||||||
|
"vlc2edd",
|
||||||
|
"vec4f",
|
||||||
|
"ec9f",
|
||||||
|
"ve1II",
|
||||||
|
"veb4f",
|
||||||
|
"vi7",
|
||||||
|
"oec4ii",
|
||||||
|
"ec4",
|
||||||
|
"vec4h",
|
||||||
|
"veci",
|
||||||
|
"22ec",
|
||||||
|
"vGc4C",
|
||||||
|
"ffec48",
|
||||||
|
"c4i",
|
||||||
|
"JJecSSi",
|
||||||
|
"vec4i",
|
||||||
|
"94i",
|
||||||
|
"vbbJJ4TT",
|
||||||
|
"e66i",
|
||||||
|
"u664u",
|
||||||
|
"vW4u",
|
||||||
|
"v4u",
|
||||||
"vec4u",
|
"vec4u",
|
||||||
"vecu",
|
"vecu",
|
||||||
"vechu",
|
"rec4u",
|
||||||
"vczllPu",
|
"2ec4B",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto* str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
|
|
|
@ -67,6 +67,11 @@ static constexpr Case kValidCases[] = {
|
||||||
{"mat4x4h", Builtin::kMat4X4H},
|
{"mat4x4h", Builtin::kMat4X4H},
|
||||||
{"sampler", Builtin::kSampler},
|
{"sampler", Builtin::kSampler},
|
||||||
{"sampler_comparison", Builtin::kSamplerComparison},
|
{"sampler_comparison", Builtin::kSamplerComparison},
|
||||||
|
{"texture_depth_2d", Builtin::kTextureDepth2D},
|
||||||
|
{"texture_depth_2d_array", Builtin::kTextureDepth2DArray},
|
||||||
|
{"texture_depth_cube", Builtin::kTextureDepthCube},
|
||||||
|
{"texture_depth_cube_array", Builtin::kTextureDepthCubeArray},
|
||||||
|
{"texture_depth_multisampled_2d", Builtin::kTextureDepthMultisampled2D},
|
||||||
{"texture_external", Builtin::kTextureExternal},
|
{"texture_external", Builtin::kTextureExternal},
|
||||||
{"u32", Builtin::kU32},
|
{"u32", Builtin::kU32},
|
||||||
{"vec2f", Builtin::kVec2F},
|
{"vec2f", Builtin::kVec2F},
|
||||||
|
@ -156,48 +161,63 @@ static constexpr Case kInvalidCases[] = {
|
||||||
{"sWWpleq_compari44on", Builtin::kUndefined},
|
{"sWWpleq_compari44on", Builtin::kUndefined},
|
||||||
{"sampler_compaisoOO", Builtin::kUndefined},
|
{"sampler_compaisoOO", Builtin::kUndefined},
|
||||||
{"smpeoo_coYparison", Builtin::kUndefined},
|
{"smpeoo_coYparison", Builtin::kUndefined},
|
||||||
{"eture_eternal", Builtin::kUndefined},
|
{"eture_dpth_2d", Builtin::kUndefined},
|
||||||
{"texture_exeFnal", Builtin::kUndefined},
|
{"texture_detF_2d", Builtin::kUndefined},
|
||||||
{"textureewternal", Builtin::kUndefined},
|
{"texturedwpth_2d", Builtin::kUndefined},
|
||||||
{"Gf", Builtin::kUndefined},
|
{"teKuffe_Gepth_2d_arry", Builtin::kUndefined},
|
||||||
{"KK3q", Builtin::kUndefined},
|
{"texture_dKKptq_2d_array", Builtin::kUndefined},
|
||||||
{"umm2", Builtin::kUndefined},
|
{"texture_depmmh32d_arraF", Builtin::kUndefined},
|
||||||
{"vecf", Builtin::kUndefined},
|
{"textur_depth_cube", Builtin::kUndefined},
|
||||||
{"qc2f", Builtin::kUndefined},
|
{"texure_depqh_cube", Builtin::kUndefined},
|
||||||
{"vecbb", Builtin::kUndefined},
|
{"texture_debth_cube", Builtin::kUndefined},
|
||||||
{"iic2", Builtin::kUndefined},
|
{"txture_deptii_cube_arry", Builtin::kUndefined},
|
||||||
{"vqOOh", Builtin::kUndefined},
|
{"textureqdepth_OOube_arry", Builtin::kUndefined},
|
||||||
{"vevvTTh", Builtin::kUndefined},
|
{"texture_deTvvth_cube_array", Builtin::kUndefined},
|
||||||
{"veFF2i", Builtin::kUndefined},
|
{"texture_depth_multiFFampled_2d", Builtin::kUndefined},
|
||||||
{"00PfQ", Builtin::kUndefined},
|
{"textue_depthPmfl00isampled_Qd", Builtin::kUndefined},
|
||||||
{"vec2P", Builtin::kUndefined},
|
{"textuPe_depth_multisampled_2d", Builtin::kUndefined},
|
||||||
{"vec77s", Builtin::kUndefined},
|
{"texture_exernss77", Builtin::kUndefined},
|
||||||
{"vecbbCu", Builtin::kUndefined},
|
{"texture_bbxternRRl", Builtin::kUndefined},
|
||||||
{"vecXXu", Builtin::kUndefined},
|
{"textureXXexternal", Builtin::kUndefined},
|
||||||
{"CCOOec3", Builtin::kUndefined},
|
{"qOOO2", Builtin::kUndefined},
|
||||||
{"vs3u", Builtin::kUndefined},
|
{"us", Builtin::kUndefined},
|
||||||
{"Xec3f", Builtin::kUndefined},
|
{"u3X", Builtin::kUndefined},
|
||||||
{"ve3h", Builtin::kUndefined},
|
{"ve2f", Builtin::kUndefined},
|
||||||
{"qq3", Builtin::kUndefined},
|
{"qq2", Builtin::kUndefined},
|
||||||
{"vec322", Builtin::kUndefined},
|
{"vec222", Builtin::kUndefined},
|
||||||
{"vezzXy", Builtin::kUndefined},
|
{"vezzXy", Builtin::kUndefined},
|
||||||
{"ieVVP", Builtin::kUndefined},
|
{"ieVVP", Builtin::kUndefined},
|
||||||
{"venCi", Builtin::kUndefined},
|
{"venCh", Builtin::kUndefined},
|
||||||
{"vHc3Aq", Builtin::kUndefined},
|
{"vHc2Aq", Builtin::kUndefined},
|
||||||
{"ve3u", Builtin::kUndefined},
|
{"ve2i", Builtin::kUndefined},
|
||||||
{"vefK", Builtin::kUndefined},
|
{"vefK", Builtin::kUndefined},
|
||||||
{"vgg4", Builtin::kUndefined},
|
{"vgg2", Builtin::kUndefined},
|
||||||
{"vecf", Builtin::kUndefined},
|
{"vecu", Builtin::kUndefined},
|
||||||
{"4TNc4f", Builtin::kUndefined},
|
{"4TNc2u", Builtin::kUndefined},
|
||||||
{"ppec7l", Builtin::kUndefined},
|
{"ppec7l", Builtin::kUndefined},
|
||||||
{"zNe4h", Builtin::kUndefined},
|
{"zNe3f", Builtin::kUndefined},
|
||||||
{"uXXb4h", Builtin::kUndefined},
|
{"uXXb3f", Builtin::kUndefined},
|
||||||
{"vec4", Builtin::kUndefined},
|
{"vec3", Builtin::kUndefined},
|
||||||
{"884K", Builtin::kUndefined},
|
{"883K", Builtin::kUndefined},
|
||||||
{"vq9i", Builtin::kUndefined},
|
{"vq9h", Builtin::kUndefined},
|
||||||
{"vec411", Builtin::kUndefined},
|
{"vec311", Builtin::kUndefined},
|
||||||
{"22ciiu", Builtin::kUndefined},
|
{"22ciii", Builtin::kUndefined},
|
||||||
{"ec77u", Builtin::kUndefined},
|
{"ec77i", Builtin::kUndefined},
|
||||||
|
{"NN23u", Builtin::kUndefined},
|
||||||
|
{"vVVc3u", Builtin::kUndefined},
|
||||||
|
{"WW11w3u", Builtin::kUndefined},
|
||||||
|
{"vcwwf", Builtin::kUndefined},
|
||||||
|
{"vDc4f", Builtin::kUndefined},
|
||||||
|
{"vecK", Builtin::kUndefined},
|
||||||
|
{"f11r4PP", Builtin::kUndefined},
|
||||||
|
{"ve4h", Builtin::kUndefined},
|
||||||
|
{"vec4YY", Builtin::kUndefined},
|
||||||
|
{"vkktHH", Builtin::kUndefined},
|
||||||
|
{"rrec4i", Builtin::kUndefined},
|
||||||
|
{"vWWssi", Builtin::kUndefined},
|
||||||
|
{"veYu", Builtin::kUndefined},
|
||||||
|
{"eq4f", Builtin::kUndefined},
|
||||||
|
{"u22ec4u", Builtin::kUndefined},
|
||||||
};
|
};
|
||||||
|
|
||||||
using BuiltinParseTest = testing::TestWithParam<Case>;
|
using BuiltinParseTest = testing::TestWithParam<Case>;
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "src/tint/ast/atomic.h"
|
#include "src/tint/ast/atomic.h"
|
||||||
#include "src/tint/ast/bool_literal_expression.h"
|
#include "src/tint/ast/bool_literal_expression.h"
|
||||||
#include "src/tint/ast/call_statement.h"
|
#include "src/tint/ast/call_statement.h"
|
||||||
#include "src/tint/ast/depth_texture.h"
|
|
||||||
#include "src/tint/ast/float_literal_expression.h"
|
#include "src/tint/ast/float_literal_expression.h"
|
||||||
#include "src/tint/ast/id_attribute.h"
|
#include "src/tint/ast/id_attribute.h"
|
||||||
#include "src/tint/ast/internal_attribute.h"
|
#include "src/tint/ast/internal_attribute.h"
|
||||||
|
@ -455,14 +454,6 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) {
|
||||||
out << "texture_";
|
out << "texture_";
|
||||||
bool ok = Switch(
|
bool ok = Switch(
|
||||||
texture,
|
texture,
|
||||||
[&](const ast::DepthTexture*) { //
|
|
||||||
out << "depth_";
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
[&](const ast::DepthMultisampledTexture*) { //
|
|
||||||
out << "depth_multisampled_";
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
[&](const ast::SampledTexture*) { //
|
[&](const ast::SampledTexture*) { //
|
||||||
/* nothing to emit */
|
/* nothing to emit */
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue