tint/ast: Remove ast::ExternalTexture
Instead use ast::TypeName. Bug: tint:1810 Change-Id: Ia1ae61b2bffd386f8958c8164e2223df5f8ac91c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119121 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Ben Clayton <bclayton@chromium.org> Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
parent
ed3389faee
commit
4906b03963
|
@ -270,7 +270,6 @@ libtint_source_set("libtint_syntax_tree_src") {
|
||||||
"ast/enable.h",
|
"ast/enable.h",
|
||||||
"ast/expression.h",
|
"ast/expression.h",
|
||||||
"ast/extension.h",
|
"ast/extension.h",
|
||||||
"ast/external_texture.h",
|
|
||||||
"ast/float_literal_expression.h",
|
"ast/float_literal_expression.h",
|
||||||
"ast/for_loop_statement.h",
|
"ast/for_loop_statement.h",
|
||||||
"ast/function.h",
|
"ast/function.h",
|
||||||
|
@ -607,8 +606,6 @@ libtint_source_set("libtint_ast_src") {
|
||||||
"ast/expression.h",
|
"ast/expression.h",
|
||||||
"ast/extension.cc",
|
"ast/extension.cc",
|
||||||
"ast/extension.h",
|
"ast/extension.h",
|
||||||
"ast/external_texture.cc",
|
|
||||||
"ast/external_texture.h",
|
|
||||||
"ast/float_literal_expression.cc",
|
"ast/float_literal_expression.cc",
|
||||||
"ast/float_literal_expression.h",
|
"ast/float_literal_expression.h",
|
||||||
"ast/for_loop_statement.cc",
|
"ast/for_loop_statement.cc",
|
||||||
|
@ -1318,7 +1315,6 @@ if (tint_build_unittests) {
|
||||||
"ast/discard_statement_test.cc",
|
"ast/discard_statement_test.cc",
|
||||||
"ast/enable_test.cc",
|
"ast/enable_test.cc",
|
||||||
"ast/extension_test.cc",
|
"ast/extension_test.cc",
|
||||||
"ast/external_texture_test.cc",
|
|
||||||
"ast/float_literal_expression_test.cc",
|
"ast/float_literal_expression_test.cc",
|
||||||
"ast/for_loop_statement_test.cc",
|
"ast/for_loop_statement_test.cc",
|
||||||
"ast/function_test.cc",
|
"ast/function_test.cc",
|
||||||
|
|
|
@ -142,8 +142,6 @@ list(APPEND TINT_LIB_SRCS
|
||||||
ast/enable.h
|
ast/enable.h
|
||||||
ast/expression.cc
|
ast/expression.cc
|
||||||
ast/expression.h
|
ast/expression.h
|
||||||
ast/external_texture.cc
|
|
||||||
ast/external_texture.h
|
|
||||||
ast/float_literal_expression.cc
|
ast/float_literal_expression.cc
|
||||||
ast/float_literal_expression.h
|
ast/float_literal_expression.h
|
||||||
ast/for_loop_statement.cc
|
ast/for_loop_statement.cc
|
||||||
|
@ -841,7 +839,6 @@ if(TINT_BUILD_TESTS)
|
||||||
ast/diagnostic_directive_test.cc
|
ast/diagnostic_directive_test.cc
|
||||||
ast/discard_statement_test.cc
|
ast/discard_statement_test.cc
|
||||||
ast/enable_test.cc
|
ast/enable_test.cc
|
||||||
ast/external_texture_test.cc
|
|
||||||
ast/float_literal_expression_test.cc
|
ast/float_literal_expression_test.cc
|
||||||
ast/for_loop_statement_test.cc
|
ast/for_loop_statement_test.cc
|
||||||
ast/function_test.cc
|
ast/function_test.cc
|
||||||
|
|
|
@ -1,40 +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/external_texture.h"
|
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
|
||||||
#include "src/tint/type/texture_dimension.h"
|
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::ExternalTexture);
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
|
|
||||||
// ExternalTexture::ExternalTexture() : Base(type::TextureDimension::k2d) {}
|
|
||||||
ExternalTexture::ExternalTexture(ProgramID pid, NodeID nid, const Source& src)
|
|
||||||
: Base(pid, nid, src, type::TextureDimension::k2d) {}
|
|
||||||
|
|
||||||
ExternalTexture::ExternalTexture(ExternalTexture&&) = default;
|
|
||||||
|
|
||||||
ExternalTexture::~ExternalTexture() = default;
|
|
||||||
|
|
||||||
std::string ExternalTexture::FriendlyName(const SymbolTable&) const {
|
|
||||||
return "texture_external";
|
|
||||||
}
|
|
||||||
|
|
||||||
const ExternalTexture* ExternalTexture::Clone(CloneContext* ctx) const {
|
|
||||||
return ctx->dst->create<ExternalTexture>();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
|
@ -1,50 +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_EXTERNAL_TEXTURE_H_
|
|
||||||
#define SRC_TINT_AST_EXTERNAL_TEXTURE_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "src/tint/ast/texture.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
|
|
||||||
/// An external texture type
|
|
||||||
class ExternalTexture final : public Castable<ExternalTexture, 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
|
|
||||||
ExternalTexture(ProgramID pid, NodeID nid, const Source& src);
|
|
||||||
|
|
||||||
/// Move constructor
|
|
||||||
ExternalTexture(ExternalTexture&&);
|
|
||||||
~ExternalTexture() 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 ExternalTexture* Clone(CloneContext* ctx) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
||||||
|
|
||||||
#endif // SRC_TINT_AST_EXTERNAL_TEXTURE_H_
|
|
|
@ -1,45 +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/external_texture.h"
|
|
||||||
|
|
||||||
#include "src/tint/ast/test_helper.h"
|
|
||||||
#include "src/tint/type/texture_dimension.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using AstExternalTextureTest = TestHelper;
|
|
||||||
|
|
||||||
TEST_F(AstExternalTextureTest, IsTexture) {
|
|
||||||
Texture* ty = create<ExternalTexture>();
|
|
||||||
EXPECT_FALSE(ty->Is<DepthTexture>());
|
|
||||||
EXPECT_TRUE(ty->Is<ExternalTexture>());
|
|
||||||
EXPECT_FALSE(ty->Is<MultisampledTexture>());
|
|
||||||
EXPECT_FALSE(ty->Is<SampledTexture>());
|
|
||||||
EXPECT_FALSE(ty->Is<StorageTexture>());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(AstExternalTextureTest, Dim) {
|
|
||||||
auto* ty = create<ExternalTexture>();
|
|
||||||
EXPECT_EQ(ty->dim, type::TextureDimension::k2d);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(AstExternalTextureTest, FriendlyName) {
|
|
||||||
auto* ty = create<ExternalTexture>();
|
|
||||||
EXPECT_EQ(ty->FriendlyName(Symbols()), "texture_external");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace tint::ast
|
|
|
@ -170,6 +170,8 @@ 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/#external-texture-type
|
||||||
|
texture_external
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
#include "src/tint/ast/discard_statement.h"
|
#include "src/tint/ast/discard_statement.h"
|
||||||
#include "src/tint/ast/enable.h"
|
#include "src/tint/ast/enable.h"
|
||||||
#include "src/tint/ast/extension.h"
|
#include "src/tint/ast/extension.h"
|
||||||
#include "src/tint/ast/external_texture.h"
|
|
||||||
#include "src/tint/ast/float_literal_expression.h"
|
#include "src/tint/ast/float_literal_expression.h"
|
||||||
#include "src/tint/ast/for_loop_statement.h"
|
#include "src/tint/ast/for_loop_statement.h"
|
||||||
#include "src/tint/ast/id_attribute.h"
|
#include "src/tint/ast/id_attribute.h"
|
||||||
|
@ -1071,14 +1070,12 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @returns the external texture
|
/// @returns the external texture
|
||||||
const ast::ExternalTexture* external_texture() const {
|
const ast::TypeName* external_texture() const { return external_texture(builder->source_); }
|
||||||
return builder->create<ast::ExternalTexture>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @param source the Source of the node
|
/// @param source the Source of the node
|
||||||
/// @returns the external texture
|
/// @returns the external texture typename
|
||||||
const ast::ExternalTexture* external_texture(const Source& source) const {
|
const ast::TypeName* external_texture(const Source& source) const {
|
||||||
return builder->create<ast::ExternalTexture>(source);
|
return (*this)(source, "texture_external");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a TypeName for the type declaration.
|
/// Constructs a TypeName for the type declaration.
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#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/discard_statement.h"
|
#include "src/tint/ast/discard_statement.h"
|
||||||
#include "src/tint/ast/external_texture.h"
|
|
||||||
#include "src/tint/ast/id_attribute.h"
|
#include "src/tint/ast/id_attribute.h"
|
||||||
#include "src/tint/ast/if_statement.h"
|
#include "src/tint/ast/if_statement.h"
|
||||||
#include "src/tint/ast/increment_decrement_statement.h"
|
#include "src/tint/ast/increment_decrement_statement.h"
|
||||||
|
|
|
@ -2116,7 +2116,8 @@ class ResolverBuiltinTest_TextureOperation : public ResolverTestWithParam<Textur
|
||||||
|
|
||||||
void add_call_param(std::string name, const ast::Type* type, ExpressionList* call_params) {
|
void add_call_param(std::string name, const ast::Type* type, ExpressionList* call_params) {
|
||||||
if (auto* type_name = type->As<ast::TypeName>()) {
|
if (auto* type_name = type->As<ast::TypeName>()) {
|
||||||
if (utils::HasPrefix(Symbols().NameFor(type_name->name->symbol), "sampler")) {
|
auto n = Symbols().NameFor(type_name->name->symbol);
|
||||||
|
if (utils::HasPrefix(n, "texture") || utils::HasPrefix(n, "sampler")) {
|
||||||
GlobalVar(name, type, Binding(0_a), Group(0_a));
|
GlobalVar(name, type, Binding(0_a), Group(0_a));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "src/tint/ast/depth_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/external_texture.h"
|
|
||||||
#include "src/tint/ast/for_loop_statement.h"
|
#include "src/tint/ast/for_loop_statement.h"
|
||||||
#include "src/tint/ast/id_attribute.h"
|
#include "src/tint/ast/id_attribute.h"
|
||||||
#include "src/tint/ast/identifier.h"
|
#include "src/tint/ast/identifier.h"
|
||||||
|
@ -405,8 +404,7 @@ class DependencyScanner {
|
||||||
TraverseType(tex->type);
|
TraverseType(tex->type);
|
||||||
},
|
},
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
if (!ty->IsAnyOf<ast::DepthTexture, ast::DepthMultisampledTexture,
|
if (!ty->IsAnyOf<ast::DepthTexture, ast::DepthMultisampledTexture>()) {
|
||||||
ast::ExternalTexture>()) {
|
|
||||||
UnhandledNode(diagnostics_, ty);
|
UnhandledNode(diagnostics_, ty);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
#include "src/tint/type/builtin.h"
|
#include "src/tint/type/builtin.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
|
#include "src/tint/type/external_texture.h"
|
||||||
#include "src/tint/type/multisampled_texture.h"
|
#include "src/tint/type/multisampled_texture.h"
|
||||||
#include "src/tint/type/pointer.h"
|
#include "src/tint/type/pointer.h"
|
||||||
#include "src/tint/type/reference.h"
|
#include "src/tint/type/reference.h"
|
||||||
|
@ -321,7 +322,6 @@ type::Type* Resolver::Type(const ast::Type* ty) {
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
},
|
},
|
||||||
[&](const ast::ExternalTexture*) { return builder_->create<type::ExternalTexture>(); },
|
|
||||||
[&](const ast::TypeName* t) -> type::Type* {
|
[&](const ast::TypeName* t) -> type::Type* {
|
||||||
Mark(t->name);
|
Mark(t->name);
|
||||||
|
|
||||||
|
@ -2527,6 +2527,8 @@ 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::kTextureExternal:
|
||||||
|
return builder_->create<type::ExternalTexture>();
|
||||||
case type::Builtin::kUndefined:
|
case type::Builtin::kUndefined:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const type::Type
|
||||||
return ctx.dst->create<ast::DepthMultisampledTexture>(t->dim());
|
return ctx.dst->create<ast::DepthMultisampledTexture>(t->dim());
|
||||||
}
|
}
|
||||||
if (ty->Is<type::ExternalTexture>()) {
|
if (ty->Is<type::ExternalTexture>()) {
|
||||||
return ctx.dst->create<ast::ExternalTexture>();
|
return ctx.dst->ty.external_texture();
|
||||||
}
|
}
|
||||||
if (auto* t = ty->As<type::MultisampledTexture>()) {
|
if (auto* t = ty->As<type::MultisampledTexture>()) {
|
||||||
return ctx.dst->create<ast::MultisampledTexture>(t->dim(),
|
return ctx.dst->create<ast::MultisampledTexture>(t->dim(),
|
||||||
|
|
|
@ -100,6 +100,9 @@ Builtin ParseBuiltin(std::string_view str) {
|
||||||
if (str == "sampler_comparison") {
|
if (str == "sampler_comparison") {
|
||||||
return Builtin::kSamplerComparison;
|
return Builtin::kSamplerComparison;
|
||||||
}
|
}
|
||||||
|
if (str == "texture_external") {
|
||||||
|
return Builtin::kTextureExternal;
|
||||||
|
}
|
||||||
if (str == "u32") {
|
if (str == "u32") {
|
||||||
return Builtin::kU32;
|
return Builtin::kU32;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +197,8 @@ 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::kTextureExternal:
|
||||||
|
return out << "texture_external";
|
||||||
case Builtin::kU32:
|
case Builtin::kU32:
|
||||||
return out << "u32";
|
return out << "u32";
|
||||||
case Builtin::kVec2F:
|
case Builtin::kVec2F:
|
||||||
|
|
|
@ -54,6 +54,7 @@ enum class Builtin {
|
||||||
kMat4X4H,
|
kMat4X4H,
|
||||||
kSampler,
|
kSampler,
|
||||||
kSamplerComparison,
|
kSamplerComparison,
|
||||||
|
kTextureExternal,
|
||||||
kU32,
|
kU32,
|
||||||
kVec2F,
|
kVec2F,
|
||||||
kVec2H,
|
kVec2H,
|
||||||
|
@ -80,12 +81,43 @@ std::ostream& operator<<(std::ostream& out, Builtin value);
|
||||||
Builtin ParseBuiltin(std::string_view str);
|
Builtin ParseBuiltin(std::string_view str);
|
||||||
|
|
||||||
constexpr const char* kBuiltinStrings[] = {
|
constexpr const char* kBuiltinStrings[] = {
|
||||||
"bool", "f16", "f32", "i32", "mat2x2f", "mat2x2h",
|
"bool",
|
||||||
"mat2x3f", "mat2x3h", "mat2x4f", "mat2x4h", "mat3x2f", "mat3x2h",
|
"f16",
|
||||||
"mat3x3f", "mat3x3h", "mat3x4f", "mat3x4h", "mat4x2f", "mat4x2h",
|
"f32",
|
||||||
"mat4x3f", "mat4x3h", "mat4x4f", "mat4x4h", "sampler", "sampler_comparison",
|
"i32",
|
||||||
"u32", "vec2f", "vec2h", "vec2i", "vec2u", "vec3f",
|
"mat2x2f",
|
||||||
"vec3h", "vec3i", "vec3u", "vec4f", "vec4h", "vec4i",
|
"mat2x2h",
|
||||||
|
"mat2x3f",
|
||||||
|
"mat2x3h",
|
||||||
|
"mat2x4f",
|
||||||
|
"mat2x4h",
|
||||||
|
"mat3x2f",
|
||||||
|
"mat3x2h",
|
||||||
|
"mat3x3f",
|
||||||
|
"mat3x3h",
|
||||||
|
"mat3x4f",
|
||||||
|
"mat3x4h",
|
||||||
|
"mat4x2f",
|
||||||
|
"mat4x2h",
|
||||||
|
"mat4x3f",
|
||||||
|
"mat4x3h",
|
||||||
|
"mat4x4f",
|
||||||
|
"mat4x4h",
|
||||||
|
"sampler",
|
||||||
|
"sampler_comparison",
|
||||||
|
"texture_external",
|
||||||
|
"u32",
|
||||||
|
"vec2f",
|
||||||
|
"vec2h",
|
||||||
|
"vec2i",
|
||||||
|
"vec2u",
|
||||||
|
"vec3f",
|
||||||
|
"vec3h",
|
||||||
|
"vec3i",
|
||||||
|
"vec3u",
|
||||||
|
"vec4f",
|
||||||
|
"vec4h",
|
||||||
|
"vec4i",
|
||||||
"vec4u",
|
"vec4u",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -199,97 +199,104 @@ void BuiltinParser(::benchmark::State& state) {
|
||||||
"samplpLL_comparisI",
|
"samplpLL_comparisI",
|
||||||
"smplerfomparison",
|
"smplerfomparison",
|
||||||
"sYmpURDr_comprison",
|
"sYmpURDr_comprison",
|
||||||
"u3h",
|
"texturh_external",
|
||||||
"IIq",
|
"teqtureuIIextnal",
|
||||||
"u3H",
|
"texture_externaH",
|
||||||
|
"texture_external",
|
||||||
|
"texre_externaQvv",
|
||||||
|
"te66ue_external",
|
||||||
|
"textue_e7tOrnal",
|
||||||
|
"550DD",
|
||||||
|
"II3H",
|
||||||
|
"u3",
|
||||||
"u32",
|
"u32",
|
||||||
"Qvv",
|
"r2",
|
||||||
"66",
|
"u3l",
|
||||||
"73",
|
"uGt",
|
||||||
"ve055DD",
|
"ey2f",
|
||||||
"IIec2f",
|
"vc2f",
|
||||||
"vec2",
|
"IIeBB2f",
|
||||||
"vec2f",
|
"vec2f",
|
||||||
"rec2",
|
|
||||||
"lec2f",
|
|
||||||
"GeJ2f",
|
|
||||||
"ey2h",
|
|
||||||
"vc2h",
|
|
||||||
"IIeBB2h",
|
|
||||||
"vec2h",
|
|
||||||
"TTec338",
|
"TTec338",
|
||||||
"veUUSS2nnd",
|
"veUUSS2nnd",
|
||||||
"vZx5CC",
|
"vZx5CC",
|
||||||
"kkec2q",
|
"kkec2q",
|
||||||
"v005ii",
|
"v005ih",
|
||||||
"vnIIc2i",
|
"vnIIc2h",
|
||||||
"vec2i",
|
"vec2h",
|
||||||
"cceW",
|
"cceW",
|
||||||
"cKK",
|
"cKK",
|
||||||
"vec66i",
|
"vec66h",
|
||||||
"vePPK",
|
"vePPK",
|
||||||
"vexxu",
|
"vexxi",
|
||||||
"qec2u",
|
"qec2i",
|
||||||
"vec2u",
|
"vec2i",
|
||||||
"veSyMMr",
|
"veSyMMr",
|
||||||
"v2u",
|
"v2u",
|
||||||
"ec",
|
"ec",
|
||||||
"5eFF3f",
|
"5eFF2u",
|
||||||
"rrecz44",
|
"rrecz44",
|
||||||
"vWW",
|
"vWW",
|
||||||
"vec3f",
|
"vec2u",
|
||||||
"XJecCZZ",
|
"XJecCZZ",
|
||||||
"vePP3",
|
"vePP2",
|
||||||
"vec3c",
|
"vec2c",
|
||||||
"ve6ll3h",
|
"ve6ll3f",
|
||||||
"vcyy99",
|
"vcyy99",
|
||||||
"Jec3KK",
|
"Jec3KK",
|
||||||
"vec3h",
|
"vec3f",
|
||||||
"_ex3",
|
"_ex3",
|
||||||
"Ky3",
|
"Ky3",
|
||||||
"zek3h",
|
"zek3f",
|
||||||
"veKSi",
|
"veKSh",
|
||||||
"vc3i",
|
"vc3h",
|
||||||
"ec3VV",
|
"ec3VV",
|
||||||
"vec3i",
|
"vec3h",
|
||||||
"IAAc3i",
|
"IAAc3h",
|
||||||
"jbR",
|
"jbR",
|
||||||
"veY4",
|
"veY4",
|
||||||
"ec3u",
|
"ec3i",
|
||||||
"vc911",
|
"vc911",
|
||||||
"mmccu",
|
"mmcci",
|
||||||
"vec3u",
|
"vec3i",
|
||||||
"vJJcu",
|
"vJJci",
|
||||||
"lDDcUfC",
|
"lDDcUfC",
|
||||||
"vec3g",
|
"vec3g",
|
||||||
"CCe",
|
"CCe",
|
||||||
"ec4f",
|
"ec3u",
|
||||||
"vIc__f",
|
"vIc__u",
|
||||||
"vec4f",
|
"vec3u",
|
||||||
"ePPtt",
|
"ePPtt",
|
||||||
"v3dc4f",
|
"v3dc3u",
|
||||||
"vcyyf",
|
"vcyyu",
|
||||||
"u4",
|
"u4",
|
||||||
"v03nnh",
|
"v03nnf",
|
||||||
"Cuuecnv",
|
"Cuuecnv",
|
||||||
"vec4h",
|
"vec4f",
|
||||||
"vX4ll",
|
"vX4ll",
|
||||||
"vocpph",
|
"vocppf",
|
||||||
"vwwc4",
|
"vwwc4",
|
||||||
"veuug",
|
"veuug",
|
||||||
"vaac",
|
"vaac",
|
||||||
"TRZccci",
|
"TRZccch",
|
||||||
"vec4i",
|
"vec4h",
|
||||||
"vTc4O8",
|
"vTc4O8",
|
||||||
"vem04i",
|
"vem04h",
|
||||||
"meBB4i",
|
"meBB4h",
|
||||||
"Mpp4",
|
"Mpp4",
|
||||||
"OOe4u",
|
"OOe4i",
|
||||||
"veG4G",
|
"veG4G",
|
||||||
"vec4u",
|
"vec4i",
|
||||||
"11eHH4u",
|
"11eHH4i",
|
||||||
"veFFe6",
|
"veFFe6",
|
||||||
"ve4",
|
"ve4",
|
||||||
|
"vKii4l",
|
||||||
|
"ec4u",
|
||||||
|
"v994IIv",
|
||||||
|
"vec4u",
|
||||||
|
"vecu",
|
||||||
|
"vechu",
|
||||||
|
"vczllPu",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto* str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
|
|
|
@ -43,24 +43,43 @@ inline std::ostream& operator<<(std::ostream& out, Case c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Case kValidCases[] = {
|
static constexpr Case kValidCases[] = {
|
||||||
{"bool", Builtin::kBool}, {"f16", Builtin::kF16},
|
{"bool", Builtin::kBool},
|
||||||
{"f32", Builtin::kF32}, {"i32", Builtin::kI32},
|
{"f16", Builtin::kF16},
|
||||||
{"mat2x2f", Builtin::kMat2X2F}, {"mat2x2h", Builtin::kMat2X2H},
|
{"f32", Builtin::kF32},
|
||||||
{"mat2x3f", Builtin::kMat2X3F}, {"mat2x3h", Builtin::kMat2X3H},
|
{"i32", Builtin::kI32},
|
||||||
{"mat2x4f", Builtin::kMat2X4F}, {"mat2x4h", Builtin::kMat2X4H},
|
{"mat2x2f", Builtin::kMat2X2F},
|
||||||
{"mat3x2f", Builtin::kMat3X2F}, {"mat3x2h", Builtin::kMat3X2H},
|
{"mat2x2h", Builtin::kMat2X2H},
|
||||||
{"mat3x3f", Builtin::kMat3X3F}, {"mat3x3h", Builtin::kMat3X3H},
|
{"mat2x3f", Builtin::kMat2X3F},
|
||||||
{"mat3x4f", Builtin::kMat3X4F}, {"mat3x4h", Builtin::kMat3X4H},
|
{"mat2x3h", Builtin::kMat2X3H},
|
||||||
{"mat4x2f", Builtin::kMat4X2F}, {"mat4x2h", Builtin::kMat4X2H},
|
{"mat2x4f", Builtin::kMat2X4F},
|
||||||
{"mat4x3f", Builtin::kMat4X3F}, {"mat4x3h", Builtin::kMat4X3H},
|
{"mat2x4h", Builtin::kMat2X4H},
|
||||||
{"mat4x4f", Builtin::kMat4X4F}, {"mat4x4h", Builtin::kMat4X4H},
|
{"mat3x2f", Builtin::kMat3X2F},
|
||||||
{"sampler", Builtin::kSampler}, {"sampler_comparison", Builtin::kSamplerComparison},
|
{"mat3x2h", Builtin::kMat3X2H},
|
||||||
{"u32", Builtin::kU32}, {"vec2f", Builtin::kVec2F},
|
{"mat3x3f", Builtin::kMat3X3F},
|
||||||
{"vec2h", Builtin::kVec2H}, {"vec2i", Builtin::kVec2I},
|
{"mat3x3h", Builtin::kMat3X3H},
|
||||||
{"vec2u", Builtin::kVec2U}, {"vec3f", Builtin::kVec3F},
|
{"mat3x4f", Builtin::kMat3X4F},
|
||||||
{"vec3h", Builtin::kVec3H}, {"vec3i", Builtin::kVec3I},
|
{"mat3x4h", Builtin::kMat3X4H},
|
||||||
{"vec3u", Builtin::kVec3U}, {"vec4f", Builtin::kVec4F},
|
{"mat4x2f", Builtin::kMat4X2F},
|
||||||
{"vec4h", Builtin::kVec4H}, {"vec4i", Builtin::kVec4I},
|
{"mat4x2h", Builtin::kMat4X2H},
|
||||||
|
{"mat4x3f", Builtin::kMat4X3F},
|
||||||
|
{"mat4x3h", Builtin::kMat4X3H},
|
||||||
|
{"mat4x4f", Builtin::kMat4X4F},
|
||||||
|
{"mat4x4h", Builtin::kMat4X4H},
|
||||||
|
{"sampler", Builtin::kSampler},
|
||||||
|
{"sampler_comparison", Builtin::kSamplerComparison},
|
||||||
|
{"texture_external", Builtin::kTextureExternal},
|
||||||
|
{"u32", Builtin::kU32},
|
||||||
|
{"vec2f", Builtin::kVec2F},
|
||||||
|
{"vec2h", Builtin::kVec2H},
|
||||||
|
{"vec2i", Builtin::kVec2I},
|
||||||
|
{"vec2u", Builtin::kVec2U},
|
||||||
|
{"vec3f", Builtin::kVec3F},
|
||||||
|
{"vec3h", Builtin::kVec3H},
|
||||||
|
{"vec3i", Builtin::kVec3I},
|
||||||
|
{"vec3u", Builtin::kVec3U},
|
||||||
|
{"vec4f", Builtin::kVec4F},
|
||||||
|
{"vec4h", Builtin::kVec4H},
|
||||||
|
{"vec4i", Builtin::kVec4I},
|
||||||
{"vec4u", Builtin::kVec4U},
|
{"vec4u", Builtin::kVec4U},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,45 +156,48 @@ 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},
|
||||||
{"", Builtin::kUndefined},
|
{"eture_eternal", Builtin::kUndefined},
|
||||||
{"u3", Builtin::kUndefined},
|
{"texture_exeFnal", Builtin::kUndefined},
|
||||||
{"3w", Builtin::kUndefined},
|
{"textureewternal", Builtin::kUndefined},
|
||||||
{"veff", Builtin::kUndefined},
|
{"Gf", Builtin::kUndefined},
|
||||||
{"KKeq2f", Builtin::kUndefined},
|
{"KK3q", Builtin::kUndefined},
|
||||||
{"vFmm2f", Builtin::kUndefined},
|
{"umm2", Builtin::kUndefined},
|
||||||
{"vech", Builtin::kUndefined},
|
{"vecf", Builtin::kUndefined},
|
||||||
{"qc2h", Builtin::kUndefined},
|
{"qc2f", Builtin::kUndefined},
|
||||||
{"vecbb", Builtin::kUndefined},
|
{"vecbb", Builtin::kUndefined},
|
||||||
{"iic2", Builtin::kUndefined},
|
{"iic2", Builtin::kUndefined},
|
||||||
{"vqOOi", Builtin::kUndefined},
|
{"vqOOh", Builtin::kUndefined},
|
||||||
{"vevvTTi", Builtin::kUndefined},
|
{"vevvTTh", Builtin::kUndefined},
|
||||||
{"veFF2u", Builtin::kUndefined},
|
{"veFF2i", Builtin::kUndefined},
|
||||||
{"00PfQ", Builtin::kUndefined},
|
{"00PfQ", Builtin::kUndefined},
|
||||||
{"vec2P", Builtin::kUndefined},
|
{"vec2P", Builtin::kUndefined},
|
||||||
{"vec77s", Builtin::kUndefined},
|
{"vec77s", Builtin::kUndefined},
|
||||||
{"vecbbCf", Builtin::kUndefined},
|
{"vecbbCu", Builtin::kUndefined},
|
||||||
{"vecXXf", Builtin::kUndefined},
|
{"vecXXu", Builtin::kUndefined},
|
||||||
{"CCOOec3", Builtin::kUndefined},
|
{"CCOOec3", Builtin::kUndefined},
|
||||||
{"vs3u", Builtin::kUndefined},
|
{"vs3u", Builtin::kUndefined},
|
||||||
{"Xec3h", Builtin::kUndefined},
|
{"Xec3f", Builtin::kUndefined},
|
||||||
{"ve3i", Builtin::kUndefined},
|
{"ve3h", Builtin::kUndefined},
|
||||||
{"qq3", Builtin::kUndefined},
|
{"qq3", Builtin::kUndefined},
|
||||||
{"vec322", Builtin::kUndefined},
|
{"vec322", Builtin::kUndefined},
|
||||||
{"vezzXy", Builtin::kUndefined},
|
{"vezzXy", Builtin::kUndefined},
|
||||||
{"ieVVP", Builtin::kUndefined},
|
{"ieVVP", Builtin::kUndefined},
|
||||||
{"venCu", Builtin::kUndefined},
|
{"venCi", Builtin::kUndefined},
|
||||||
{"vHc4Aq", Builtin::kUndefined},
|
{"vHc3Aq", Builtin::kUndefined},
|
||||||
{"ve4f", Builtin::kUndefined},
|
{"ve3u", Builtin::kUndefined},
|
||||||
{"vefK", Builtin::kUndefined},
|
{"vefK", Builtin::kUndefined},
|
||||||
{"vgg4", Builtin::kUndefined},
|
{"vgg4", Builtin::kUndefined},
|
||||||
{"vech", Builtin::kUndefined},
|
{"vecf", Builtin::kUndefined},
|
||||||
{"4TNc4h", Builtin::kUndefined},
|
{"4TNc4f", Builtin::kUndefined},
|
||||||
{"ppec7l", Builtin::kUndefined},
|
{"ppec7l", Builtin::kUndefined},
|
||||||
{"zNe4i", Builtin::kUndefined},
|
{"zNe4h", Builtin::kUndefined},
|
||||||
{"uXXb4i", Builtin::kUndefined},
|
{"uXXb4h", Builtin::kUndefined},
|
||||||
{"vec4", Builtin::kUndefined},
|
{"vec4", Builtin::kUndefined},
|
||||||
{"884K", Builtin::kUndefined},
|
{"884K", Builtin::kUndefined},
|
||||||
{"vq9u", Builtin::kUndefined},
|
{"vq9i", Builtin::kUndefined},
|
||||||
|
{"vec411", Builtin::kUndefined},
|
||||||
|
{"22ciiu", Builtin::kUndefined},
|
||||||
|
{"ec77u", Builtin::kUndefined},
|
||||||
};
|
};
|
||||||
|
|
||||||
using BuiltinParseTest = testing::TestWithParam<Case>;
|
using BuiltinParseTest = testing::TestWithParam<Case>;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "src/tint/ast/external_texture.h"
|
|
||||||
#include "src/tint/ast/module.h"
|
#include "src/tint/ast/module.h"
|
||||||
#include "src/tint/program.h"
|
#include "src/tint/program.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#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/depth_texture.h"
|
||||||
#include "src/tint/ast/external_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"
|
||||||
|
@ -452,10 +451,6 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) {
|
||||||
out << ">";
|
out << ">";
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[&](const ast::ExternalTexture*) {
|
|
||||||
out << "texture_external";
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
[&](const ast::Texture* texture) {
|
[&](const ast::Texture* texture) {
|
||||||
out << "texture_";
|
out << "texture_";
|
||||||
bool ok = Switch(
|
bool ok = Switch(
|
||||||
|
|
Loading…
Reference in New Issue