tint/ast: Remove ast::Sampler
Instead use ast::TypeName. Bug: tint:1810 Change-Id: Ia2641d661cab70d110c975d5f0d0e76628816cb0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119120 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@chromium.org> Kokoro: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
parent
c9aa57d039
commit
ed3389faee
|
@ -302,7 +302,6 @@ libtint_source_set("libtint_syntax_tree_src") {
|
||||||
"ast/pointer.h",
|
"ast/pointer.h",
|
||||||
"ast/return_statement.h",
|
"ast/return_statement.h",
|
||||||
"ast/sampled_texture.h",
|
"ast/sampled_texture.h",
|
||||||
"ast/sampler.h",
|
|
||||||
"ast/stage_attribute.h",
|
"ast/stage_attribute.h",
|
||||||
"ast/statement.h",
|
"ast/statement.h",
|
||||||
"ast/storage_texture.h",
|
"ast/storage_texture.h",
|
||||||
|
@ -671,8 +670,6 @@ libtint_source_set("libtint_ast_src") {
|
||||||
"ast/return_statement.h",
|
"ast/return_statement.h",
|
||||||
"ast/sampled_texture.cc",
|
"ast/sampled_texture.cc",
|
||||||
"ast/sampled_texture.h",
|
"ast/sampled_texture.h",
|
||||||
"ast/sampler.cc",
|
|
||||||
"ast/sampler.h",
|
|
||||||
"ast/stage_attribute.cc",
|
"ast/stage_attribute.cc",
|
||||||
"ast/stage_attribute.h",
|
"ast/stage_attribute.h",
|
||||||
"ast/statement.cc",
|
"ast/statement.cc",
|
||||||
|
@ -1345,7 +1342,6 @@ if (tint_build_unittests) {
|
||||||
"ast/pointer_test.cc",
|
"ast/pointer_test.cc",
|
||||||
"ast/return_statement_test.cc",
|
"ast/return_statement_test.cc",
|
||||||
"ast/sampled_texture_test.cc",
|
"ast/sampled_texture_test.cc",
|
||||||
"ast/sampler_test.cc",
|
|
||||||
"ast/stage_attribute_test.cc",
|
"ast/stage_attribute_test.cc",
|
||||||
"ast/storage_texture_test.cc",
|
"ast/storage_texture_test.cc",
|
||||||
"ast/stride_attribute_test.cc",
|
"ast/stride_attribute_test.cc",
|
||||||
|
|
|
@ -203,8 +203,6 @@ list(APPEND TINT_LIB_SRCS
|
||||||
ast/return_statement.h
|
ast/return_statement.h
|
||||||
ast/sampled_texture.cc
|
ast/sampled_texture.cc
|
||||||
ast/sampled_texture.h
|
ast/sampled_texture.h
|
||||||
ast/sampler.cc
|
|
||||||
ast/sampler.h
|
|
||||||
ast/stage_attribute.cc
|
ast/stage_attribute.cc
|
||||||
ast/stage_attribute.h
|
ast/stage_attribute.h
|
||||||
ast/statement.cc
|
ast/statement.cc
|
||||||
|
@ -866,7 +864,6 @@ if(TINT_BUILD_TESTS)
|
||||||
ast/pointer_test.cc
|
ast/pointer_test.cc
|
||||||
ast/return_statement_test.cc
|
ast/return_statement_test.cc
|
||||||
ast/sampled_texture_test.cc
|
ast/sampled_texture_test.cc
|
||||||
ast/sampler_test.cc
|
|
||||||
ast/stage_attribute_test.cc
|
ast/stage_attribute_test.cc
|
||||||
ast/storage_texture_test.cc
|
ast/storage_texture_test.cc
|
||||||
ast/stride_attribute_test.cc
|
ast/stride_attribute_test.cc
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "src/tint/ast/array.h"
|
#include "src/tint/ast/array.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/sampler.h"
|
|
||||||
#include "src/tint/ast/struct.h"
|
#include "src/tint/ast/struct.h"
|
||||||
#include "src/tint/ast/test_helper.h"
|
#include "src/tint/ast/test_helper.h"
|
||||||
#include "src/tint/ast/texture.h"
|
#include "src/tint/ast/texture.h"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,6 +24,12 @@
|
||||||
|
|
||||||
namespace tint::ast::builtin::test {
|
namespace tint::ast::builtin::test {
|
||||||
|
|
||||||
|
/// The name of the texture global variable used by the tests.
|
||||||
|
static constexpr const char* kTextureName = "Texture";
|
||||||
|
|
||||||
|
/// The name of the sampler global variable used by the tests.
|
||||||
|
static constexpr const char* kSamplerName = "Sampler";
|
||||||
|
|
||||||
enum class TextureKind { kRegular, kDepth, kDepthMultisampled, kMultisampled, kStorage };
|
enum class TextureKind { kRegular, kDepth, kDepthMultisampled, kMultisampled, kStorage };
|
||||||
enum class TextureDataType { kF32, kU32, kI32 };
|
enum class TextureDataType { kF32, kU32, kI32 };
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace tint::ast {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void BuiltinValueParser(::benchmark::State& state) {
|
void BuiltinValueParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"fragdeccth",
|
"fragdeccth",
|
||||||
"flaget3",
|
"flaget3",
|
||||||
"fVag_depth",
|
"fVag_depth",
|
||||||
|
@ -117,7 +117,7 @@ void BuiltinValueParser(::benchmark::State& state) {
|
||||||
"hrkgYooup_d",
|
"hrkgYooup_d",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseBuiltinValue(str);
|
auto result = ParseBuiltinValue(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,14 @@ namespace tint::ast {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void DiagnosticSeverityParser(::benchmark::State& state) {
|
void DiagnosticSeverityParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"erccr", "3o", "eVror", "error", "erro1", "qqrJr", "errll7r",
|
"erccr", "3o", "eVror", "error", "erro1", "qqrJr", "errll7r",
|
||||||
"ppqnfH", "c", "iGf", "info", "invii", "inWWo", "Mxxo",
|
"ppqnfH", "c", "iGf", "info", "invii", "inWWo", "Mxxo",
|
||||||
"ogg", "X", "3ff", "off", "oEf", "oPTT", "dxxf",
|
"ogg", "X", "3ff", "off", "oEf", "oPTT", "dxxf",
|
||||||
"w44rning", "waSSniVVg", "RarR22g", "warning", "wFni9g", "waring", "VOORRHng",
|
"w44rning", "waSSniVVg", "RarR22g", "warning", "wFni9g", "waring", "VOORRHng",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseDiagnosticSeverity(str);
|
auto result = ParseDiagnosticSeverity(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ void DiagnosticSeverityParser(::benchmark::State& state) {
|
||||||
BENCHMARK(DiagnosticSeverityParser);
|
BENCHMARK(DiagnosticSeverityParser);
|
||||||
|
|
||||||
void DiagnosticRuleParser(::benchmark::State& state) {
|
void DiagnosticRuleParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"hromium_unyeachable_code", "chrorrillmGunnreachable_c77de", "chromium_unreachable4cod00",
|
"hromium_unyeachable_code", "chrorrillmGunnreachable_c77de", "chromium_unreachable4cod00",
|
||||||
"chromium_unreachable_code", "chromium_unracaboo_code", "chromium_unrzzchabl_code",
|
"chromium_unreachable_code", "chromium_unracaboo_code", "chromium_unrzzchabl_code",
|
||||||
"ciipp11ium_unreachable_cod", "derivXXtive_uniformity", "55erivativeIIunifonn99ity",
|
"ciipp11ium_unreachable_cod", "derivXXtive_uniformity", "55erivativeIIunifonn99ity",
|
||||||
|
@ -55,7 +55,7 @@ void DiagnosticRuleParser(::benchmark::State& state) {
|
||||||
"jerivaive_uniforRgty", "derivatbve_unformiy",
|
"jerivaive_uniforRgty", "derivatbve_unformiy",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseDiagnosticRule(str);
|
auto result = ParseDiagnosticRule(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace tint::ast {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void ExtensionParser(::benchmark::State& state) {
|
void ExtensionParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"chromium_disableuniformiccy_analysis",
|
"chromium_disableuniformiccy_analysis",
|
||||||
"chromil3_disable_unifority_analss",
|
"chromil3_disable_unifority_analss",
|
||||||
"chromium_disable_Vniformity_analysis",
|
"chromium_disable_Vniformity_analysis",
|
||||||
|
@ -68,7 +68,7 @@ void ExtensionParser(::benchmark::State& state) {
|
||||||
"f",
|
"f",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseExtension(str);
|
auto result = ParseExtension(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace tint::ast {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void InterpolationTypeParser(::benchmark::State& state) {
|
void InterpolationTypeParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"ccat", "3", "fVat", "flat", "1lat",
|
"ccat", "3", "fVat", "flat", "1lat",
|
||||||
"fqaJ", "flla77", "lippeHHr", "cin", "lbGea",
|
"fqaJ", "flla77", "lippeHHr", "cin", "lbGea",
|
||||||
"linear", "liveaii", "liWWe8r", "xxiner", "perggpctXve",
|
"linear", "liveaii", "liWWe8r", "xxiner", "perggpctXve",
|
||||||
|
@ -38,7 +38,7 @@ void InterpolationTypeParser(::benchmark::State& state) {
|
||||||
"pxxdrspectve",
|
"pxxdrspectve",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseInterpolationType(str);
|
auto result = ParseInterpolationType(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
@ -48,13 +48,13 @@ void InterpolationTypeParser(::benchmark::State& state) {
|
||||||
BENCHMARK(InterpolationTypeParser);
|
BENCHMARK(InterpolationTypeParser);
|
||||||
|
|
||||||
void InterpolationSamplingParser(::benchmark::State& state) {
|
void InterpolationSamplingParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"44enter", "cSSVVter", "centRr", "center", "ent9r", "cente", "VentORr",
|
"44enter", "cSSVVter", "centRr", "center", "ent9r", "cente", "VentORr",
|
||||||
"cenyroi", "77errtrllnid", "04entroid", "centroid", "enooid", "centzzd", "ceiippr1i",
|
"cenyroi", "77errtrllnid", "04entroid", "centroid", "enooid", "centzzd", "ceiippr1i",
|
||||||
"saXXple", "55IImpnn99", "aHHrrmplSS", "sample", "kkle", "jagRR", "smbe",
|
"saXXple", "55IImpnn99", "aHHrrmplSS", "sample", "kkle", "jagRR", "smbe",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseInterpolationSampling(str);
|
auto result = ParseInterpolationSampling(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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/pointer.h"
|
#include "src/tint/ast/pointer.h"
|
||||||
#include "src/tint/ast/sampler.h"
|
|
||||||
#include "src/tint/ast/struct.h"
|
#include "src/tint/ast/struct.h"
|
||||||
#include "src/tint/ast/test_helper.h"
|
#include "src/tint/ast/test_helper.h"
|
||||||
#include "src/tint/ast/texture.h"
|
#include "src/tint/ast/texture.h"
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#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"
|
||||||
#include "src/tint/ast/sampler.h"
|
|
||||||
#include "src/tint/ast/storage_texture.h"
|
#include "src/tint/ast/storage_texture.h"
|
||||||
#include "src/tint/ast/struct.h"
|
#include "src/tint/ast/struct.h"
|
||||||
#include "src/tint/ast/test_helper.h"
|
#include "src/tint/ast/test_helper.h"
|
||||||
|
|
|
@ -1,39 +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/sampler.h"
|
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::Sampler);
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
|
|
||||||
Sampler::Sampler(ProgramID pid, NodeID nid, const Source& src, type::SamplerKind k)
|
|
||||||
: Base(pid, nid, src), kind(k) {}
|
|
||||||
|
|
||||||
Sampler::Sampler(Sampler&&) = default;
|
|
||||||
|
|
||||||
Sampler::~Sampler() = default;
|
|
||||||
|
|
||||||
std::string Sampler::FriendlyName(const SymbolTable&) const {
|
|
||||||
return kind == type::SamplerKind::kSampler ? "sampler" : "sampler_comparison";
|
|
||||||
}
|
|
||||||
|
|
||||||
const Sampler* Sampler::Clone(CloneContext* ctx) const {
|
|
||||||
auto src = ctx->Clone(source);
|
|
||||||
return ctx->dst->create<Sampler>(src, kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
|
@ -1,57 +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_SAMPLER_H_
|
|
||||||
#define SRC_TINT_AST_SAMPLER_H_
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "src/tint/ast/type.h"
|
|
||||||
#include "src/tint/type/sampler_kind.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
|
|
||||||
/// A sampler type.
|
|
||||||
class Sampler final : public Castable<Sampler, Type> {
|
|
||||||
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 kind the kind of sampler
|
|
||||||
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 == type::SamplerKind::kComparisonSampler; }
|
|
||||||
|
|
||||||
/// @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 Sampler* Clone(CloneContext* ctx) const override;
|
|
||||||
|
|
||||||
/// The sampler type
|
|
||||||
const type::SamplerKind kind;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace tint::ast
|
|
||||||
|
|
||||||
#endif // SRC_TINT_AST_SAMPLER_H_
|
|
|
@ -1,46 +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/sampler.h"
|
|
||||||
|
|
||||||
#include "src/tint/ast/test_helper.h"
|
|
||||||
|
|
||||||
namespace tint::ast {
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
using AstSamplerTest = TestHelper;
|
|
||||||
|
|
||||||
TEST_F(AstSamplerTest, Creation) {
|
|
||||||
auto* s = create<Sampler>(type::SamplerKind::kSampler);
|
|
||||||
EXPECT_EQ(s->kind, type::SamplerKind::kSampler);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(AstSamplerTest, Creation_ComparisonSampler) {
|
|
||||||
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>(type::SamplerKind::kSampler);
|
|
||||||
EXPECT_EQ(s->FriendlyName(Symbols()), "sampler");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(AstSamplerTest, FriendlyNameComparisonSampler) {
|
|
||||||
auto* s = create<Sampler>(type::SamplerKind::kComparisonSampler);
|
|
||||||
EXPECT_EQ(s->FriendlyName(Symbols()), "sampler_comparison");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
} // namespace tint::ast
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "src/tint/ast/array.h"
|
#include "src/tint/ast/array.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/sampler.h"
|
|
||||||
#include "src/tint/ast/test_helper.h"
|
#include "src/tint/ast/test_helper.h"
|
||||||
#include "src/tint/ast/texture.h"
|
#include "src/tint/ast/texture.h"
|
||||||
#include "src/tint/ast/vector.h"
|
#include "src/tint/ast/vector.h"
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "src/tint/ast/array.h"
|
#include "src/tint/ast/array.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/sampler.h"
|
|
||||||
#include "src/tint/ast/struct.h"
|
#include "src/tint/ast/struct.h"
|
||||||
#include "src/tint/ast/test_helper.h"
|
#include "src/tint/ast/test_helper.h"
|
||||||
#include "src/tint/ast/vector.h"
|
#include "src/tint/ast/vector.h"
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "src/tint/ast/alias.h"
|
#include "src/tint/ast/alias.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/sampler.h"
|
|
||||||
#include "src/tint/ast/texture.h"
|
#include "src/tint/ast/texture.h"
|
||||||
#include "src/tint/ast/vector.h"
|
#include "src/tint/ast/vector.h"
|
||||||
#include "src/tint/symbol_table.h"
|
#include "src/tint/symbol_table.h"
|
||||||
|
|
|
@ -171,13 +171,15 @@ void InspectorBuilder::MakeStructVariableReferenceBodyFunction(
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorBuilder::AddSampler(const std::string& name, uint32_t group, uint32_t binding) {
|
void InspectorBuilder::AddSampler(const std::string& name, uint32_t group, uint32_t binding) {
|
||||||
GlobalVar(name, sampler_type(), Binding(AInt(binding)), Group(AInt(group)));
|
GlobalVar(name, ty.sampler(type::SamplerKind::kSampler), Binding(AInt(binding)),
|
||||||
|
Group(AInt(group)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorBuilder::AddComparisonSampler(const std::string& name,
|
void InspectorBuilder::AddComparisonSampler(const std::string& name,
|
||||||
uint32_t group,
|
uint32_t group,
|
||||||
uint32_t binding) {
|
uint32_t binding) {
|
||||||
GlobalVar(name, comparison_sampler_type(), Binding(AInt(binding)), Group(AInt(group)));
|
GlobalVar(name, ty.sampler(type::SamplerKind::kComparisonSampler), Binding(AInt(binding)),
|
||||||
|
Group(AInt(group)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorBuilder::AddResource(const std::string& name,
|
void InspectorBuilder::AddResource(const std::string& name,
|
||||||
|
|
|
@ -332,14 +332,6 @@ class InspectorBuilder : public ProgramBuilder {
|
||||||
/// @returns a reference to the Inspector for the built Program.
|
/// @returns a reference to the Inspector for the built Program.
|
||||||
Inspector& Build();
|
Inspector& Build();
|
||||||
|
|
||||||
/// @returns the type for a 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(type::SamplerKind::kComparisonSampler);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Program built by this builder.
|
/// Program built by this builder.
|
||||||
std::unique_ptr<Program> program_;
|
std::unique_ptr<Program> program_;
|
||||||
|
|
|
@ -167,6 +167,9 @@ enum builtin_type {
|
||||||
vec4h
|
vec4h
|
||||||
vec4i
|
vec4i
|
||||||
vec4u
|
vec4u
|
||||||
|
// https://www.w3.org/TR/WGSL/#sampler-type
|
||||||
|
sampler
|
||||||
|
sampler_comparison
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -70,7 +70,6 @@
|
||||||
#include "src/tint/ast/pointer.h"
|
#include "src/tint/ast/pointer.h"
|
||||||
#include "src/tint/ast/return_statement.h"
|
#include "src/tint/ast/return_statement.h"
|
||||||
#include "src/tint/ast/sampled_texture.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/stage_attribute.h"
|
||||||
#include "src/tint/ast/storage_texture.h"
|
#include "src/tint/ast/storage_texture.h"
|
||||||
#include "src/tint/ast/stride_attribute.h"
|
#include "src/tint/ast/stride_attribute.h"
|
||||||
|
@ -105,6 +104,7 @@
|
||||||
#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/sampled_texture.h"
|
#include "src/tint/type/sampled_texture.h"
|
||||||
|
#include "src/tint/type/sampler_kind.h"
|
||||||
#include "src/tint/type/storage_texture.h"
|
#include "src/tint/type/storage_texture.h"
|
||||||
#include "src/tint/type/texture_dimension.h"
|
#include "src/tint/type/texture_dimension.h"
|
||||||
#include "src/tint/type/u32.h"
|
#include "src/tint/type/u32.h"
|
||||||
|
@ -961,16 +961,23 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param kind the kind of sampler
|
/// @param kind the kind of sampler
|
||||||
/// @returns the sampler
|
/// @returns the sampler typename
|
||||||
const ast::Sampler* sampler(type::SamplerKind kind) const {
|
const ast::TypeName* sampler(type::SamplerKind kind) const {
|
||||||
return builder->create<ast::Sampler>(kind);
|
return sampler(builder->source_, kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the Source of the node
|
/// @param source the Source of the node
|
||||||
/// @param kind the kind of sampler
|
/// @param kind the kind of sampler
|
||||||
/// @returns the sampler
|
/// @returns the sampler typename
|
||||||
const ast::Sampler* sampler(const Source& source, type::SamplerKind kind) const {
|
const ast::TypeName* sampler(const Source& source, type::SamplerKind kind) const {
|
||||||
return builder->create<ast::Sampler>(source, kind);
|
switch (kind) {
|
||||||
|
case type::SamplerKind::kSampler:
|
||||||
|
return (*this)(source, "sampler");
|
||||||
|
case type::SamplerKind::kComparisonSampler:
|
||||||
|
return (*this)(source, "sampler_comparison");
|
||||||
|
}
|
||||||
|
TINT_ICE(ProgramBuilder, builder->Diagnostics()) << "invalid sampler kind " << kind;
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param dims the dimensionality of the texture
|
/// @param dims the dimensionality of the texture
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "src/tint/ast/sampler.h"
|
|
||||||
#include "src/tint/ast/storage_texture.h"
|
#include "src/tint/ast/storage_texture.h"
|
||||||
#include "src/tint/castable.h"
|
#include "src/tint/castable.h"
|
||||||
#include "src/tint/type/access.h"
|
#include "src/tint/type/access.h"
|
||||||
#include "src/tint/type/address_space.h"
|
#include "src/tint/type/address_space.h"
|
||||||
|
#include "src/tint/type/sampler_kind.h"
|
||||||
#include "src/tint/type/texture_dimension.h"
|
#include "src/tint/type/texture_dimension.h"
|
||||||
#include "src/tint/utils/block_allocator.h"
|
#include "src/tint/utils/block_allocator.h"
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ TEST_F(ParserImplTest, SamplerType_Sampler) {
|
||||||
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::Sampler>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
EXPECT_FALSE(t->As<ast::Sampler>()->IsComparison());
|
"sampler");
|
||||||
EXPECT_FALSE(p->has_error());
|
EXPECT_FALSE(p->has_error());
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ TEST_F(ParserImplTest, SamplerType_ComparisonSampler) {
|
||||||
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::Sampler>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
EXPECT_TRUE(t->As<ast::Sampler>()->IsComparison());
|
"sampler_comparison");
|
||||||
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}}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ TEST_F(ParserImplTest, TextureSamplerTypes_Sampler) {
|
||||||
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::Sampler>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_FALSE(t->As<ast::Sampler>()->IsComparison());
|
"sampler");
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ TEST_F(ParserImplTest, TextureSamplerTypes_SamplerComparison) {
|
||||||
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::Sampler>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_TRUE(t->As<ast::Sampler>()->IsComparison());
|
"sampler_comparison");
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 19u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 19u}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,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/matrix.h"
|
#include "src/tint/ast/matrix.h"
|
||||||
#include "src/tint/ast/sampler.h"
|
|
||||||
#include "src/tint/reader/wgsl/parser_impl_test_helper.h"
|
#include "src/tint/reader/wgsl/parser_impl_test_helper.h"
|
||||||
#include "src/tint/type/sampled_texture.h"
|
#include "src/tint/type/sampled_texture.h"
|
||||||
|
|
||||||
|
@ -689,8 +688,8 @@ TEST_F(ParserImplTest, TypeDecl_Sampler) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
ASSERT_TRUE(t.value->Is<ast::Sampler>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_FALSE(t.value->As<ast::Sampler>()->IsComparison());
|
"sampler");
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,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/matrix.h"
|
#include "src/tint/ast/matrix.h"
|
||||||
#include "src/tint/ast/sampler.h"
|
|
||||||
#include "src/tint/reader/wgsl/parser_impl_test_helper.h"
|
#include "src/tint/reader/wgsl/parser_impl_test_helper.h"
|
||||||
#include "src/tint/type/sampled_texture.h"
|
#include "src/tint/type/sampled_texture.h"
|
||||||
|
|
||||||
|
@ -682,8 +681,8 @@ TEST_F(ParserImplTest, TypeDeclWithoutIdent_Sampler) {
|
||||||
EXPECT_TRUE(t.matched);
|
EXPECT_TRUE(t.matched);
|
||||||
EXPECT_FALSE(t.errored);
|
EXPECT_FALSE(t.errored);
|
||||||
ASSERT_NE(t.value, nullptr) << p->error();
|
ASSERT_NE(t.value, nullptr) << p->error();
|
||||||
ASSERT_TRUE(t.value->Is<ast::Sampler>());
|
EXPECT_EQ(p->builder().Symbols().NameFor(t.value->As<ast::TypeName>()->name->symbol),
|
||||||
ASSERT_FALSE(t.value->As<ast::Sampler>()->IsComparison());
|
"sampler");
|
||||||
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
EXPECT_EQ(t.value->source.range, (Source::Range{{1u, 1u}, {1u, 8u}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "src/tint/type/sampled_texture.h"
|
#include "src/tint/type/sampled_texture.h"
|
||||||
#include "src/tint/type/test_helper.h"
|
#include "src/tint/type/test_helper.h"
|
||||||
#include "src/tint/type/texture_dimension.h"
|
#include "src/tint/type/texture_dimension.h"
|
||||||
|
#include "src/tint/utils/string.h"
|
||||||
|
|
||||||
using ::testing::ElementsAre;
|
using ::testing::ElementsAre;
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
|
@ -2114,9 +2115,15 @@ 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 (type->IsAnyOf<ast::Texture, ast::Sampler>()) {
|
if (auto* type_name = type->As<ast::TypeName>()) {
|
||||||
GlobalVar(name, type, Binding(0_a), Group(0_a));
|
if (utils::HasPrefix(Symbols().NameFor(type_name->name->symbol), "sampler")) {
|
||||||
|
GlobalVar(name, type, Binding(0_a), Group(0_a));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type->Is<ast::Texture>()) {
|
||||||
|
GlobalVar(name, type, Binding(0_a), Group(0_a));
|
||||||
} else {
|
} else {
|
||||||
GlobalVar(name, type, type::AddressSpace::kPrivate);
|
GlobalVar(name, type, type::AddressSpace::kPrivate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "src/tint/ast/pointer.h"
|
#include "src/tint/ast/pointer.h"
|
||||||
#include "src/tint/ast/return_statement.h"
|
#include "src/tint/ast/return_statement.h"
|
||||||
#include "src/tint/ast/sampled_texture.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/stage_attribute.h"
|
||||||
#include "src/tint/ast/storage_texture.h"
|
#include "src/tint/ast/storage_texture.h"
|
||||||
#include "src/tint/ast/stride_attribute.h"
|
#include "src/tint/ast/stride_attribute.h"
|
||||||
|
@ -407,7 +406,7 @@ class DependencyScanner {
|
||||||
},
|
},
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
if (!ty->IsAnyOf<ast::DepthTexture, ast::DepthMultisampledTexture,
|
if (!ty->IsAnyOf<ast::DepthTexture, ast::DepthMultisampledTexture,
|
||||||
ast::ExternalTexture, ast::Sampler>()) {
|
ast::ExternalTexture>()) {
|
||||||
UnhandledNode(diagnostics_, ty);
|
UnhandledNode(diagnostics_, ty);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "src/tint/ast/pointer.h"
|
#include "src/tint/ast/pointer.h"
|
||||||
#include "src/tint/ast/return_statement.h"
|
#include "src/tint/ast/return_statement.h"
|
||||||
#include "src/tint/ast/sampled_texture.h"
|
#include "src/tint/ast/sampled_texture.h"
|
||||||
#include "src/tint/ast/sampler.h"
|
|
||||||
#include "src/tint/ast/storage_texture.h"
|
#include "src/tint/ast/storage_texture.h"
|
||||||
#include "src/tint/ast/switch_statement.h"
|
#include "src/tint/ast/switch_statement.h"
|
||||||
#include "src/tint/ast/traverse_expressions.h"
|
#include "src/tint/ast/traverse_expressions.h"
|
||||||
|
@ -289,7 +288,6 @@ type::Type* Resolver::Type(const ast::Type* ty) {
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
},
|
},
|
||||||
[&](const ast::Sampler* t) { return builder_->create<type::Sampler>(t->kind); },
|
|
||||||
[&](const ast::SampledTexture* t) -> type::SampledTexture* {
|
[&](const ast::SampledTexture* t) -> type::SampledTexture* {
|
||||||
if (auto* el = Type(t->type)) {
|
if (auto* el = Type(t->type)) {
|
||||||
auto* sem = builder_->create<type::SampledTexture>(t->dim, el);
|
auto* sem = builder_->create<type::SampledTexture>(t->dim, el);
|
||||||
|
@ -2525,6 +2523,10 @@ type::Type* Resolver::BuiltinType(type::Builtin builtin_ty, const ast::Identifie
|
||||||
return vec(u32(), 3u);
|
return vec(u32(), 3u);
|
||||||
case type::Builtin::kVec4U:
|
case type::Builtin::kVec4U:
|
||||||
return vec(u32(), 4u);
|
return vec(u32(), 4u);
|
||||||
|
case type::Builtin::kSampler:
|
||||||
|
return builder_->create<type::Sampler>(type::SamplerKind::kSampler);
|
||||||
|
case type::Builtin::kSamplerComparison:
|
||||||
|
return builder_->create<type::Sampler>(type::SamplerKind::kComparisonSampler);
|
||||||
case type::Builtin::kUndefined:
|
case type::Builtin::kUndefined:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "src/tint/ast/pointer.h"
|
#include "src/tint/ast/pointer.h"
|
||||||
#include "src/tint/ast/return_statement.h"
|
#include "src/tint/ast/return_statement.h"
|
||||||
#include "src/tint/ast/sampled_texture.h"
|
#include "src/tint/ast/sampled_texture.h"
|
||||||
#include "src/tint/ast/sampler.h"
|
|
||||||
#include "src/tint/ast/storage_texture.h"
|
#include "src/tint/ast/storage_texture.h"
|
||||||
#include "src/tint/ast/switch_statement.h"
|
#include "src/tint/ast/switch_statement.h"
|
||||||
#include "src/tint/ast/traverse_expressions.h"
|
#include "src/tint/ast/traverse_expressions.h"
|
||||||
|
|
|
@ -173,7 +173,7 @@ INSTANTIATE_TEST_SUITE_P(ValidCases, {{$enum}}PrintTest, testing::ValuesIn(kVali
|
||||||
{{- /* ------------------------------------------------------------------ */ -}}
|
{{- /* ------------------------------------------------------------------ */ -}}
|
||||||
{{- $enum := Eval "EnumName" $ -}}
|
{{- $enum := Eval "EnumName" $ -}}
|
||||||
void {{$enum}}Parser(::benchmark::State& state) {
|
void {{$enum}}Parser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
{{- $exclude := $.NameSet -}}
|
{{- $exclude := $.NameSet -}}
|
||||||
{{- range $entry := $.PublicEntries }}
|
{{- range $entry := $.PublicEntries }}
|
||||||
"{{Scramble $entry.Name $exclude}}",
|
"{{Scramble $entry.Name $exclude}}",
|
||||||
|
@ -186,7 +186,7 @@ void {{$enum}}Parser(::benchmark::State& state) {
|
||||||
{{- end }}
|
{{- end }}
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = Parse{{$enum}}(str);
|
auto result = Parse{{$enum}}(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const type::Type
|
||||||
CreateASTTypeFor(ctx, t->type()), t->access());
|
CreateASTTypeFor(ctx, t->type()), t->access());
|
||||||
}
|
}
|
||||||
if (auto* s = ty->As<type::Sampler>()) {
|
if (auto* s = ty->As<type::Sampler>()) {
|
||||||
return ctx.dst->create<ast::Sampler>(s->kind());
|
return ctx.dst->ty.sampler(s->kind());
|
||||||
}
|
}
|
||||||
TINT_UNREACHABLE(Transform, ctx.dst->Diagnostics())
|
TINT_UNREACHABLE(Transform, ctx.dst->Diagnostics())
|
||||||
<< "Unhandled type: " << ty->TypeInfo().name;
|
<< "Unhandled type: " << ty->TypeInfo().name;
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace tint::type {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void AccessParser(::benchmark::State& state) {
|
void AccessParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"ccad", "3", "rVad", "read", "1ead",
|
"ccad", "3", "rVad", "read", "1ead",
|
||||||
"rqaJ", "rlla77", "reqqdppriHHe", "rv_wcit", "reabGwrte",
|
"rqaJ", "rlla77", "reqqdppriHHe", "rv_wcit", "reabGwrte",
|
||||||
"read_write", "read_vriite", "re8d_wriWWe", "Meadxxrite", "wggte",
|
"read_write", "read_vriite", "re8d_wriWWe", "Meadxxrite", "wggte",
|
||||||
|
@ -38,7 +38,7 @@ void AccessParser(::benchmark::State& state) {
|
||||||
"wxxidd",
|
"wxxidd",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseAccess(str);
|
auto result = ParseAccess(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace tint::type {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void AddressSpaceParser(::benchmark::State& state) {
|
void AddressSpaceParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"fccnctin", "ucti3", "functVon", "function", "1unction",
|
"fccnctin", "ucti3", "functVon", "function", "1unction",
|
||||||
"unJtqqon", "llun77tion", "ppqqivtHH", "prcv", "bivaGe",
|
"unJtqqon", "llun77tion", "ppqqivtHH", "prcv", "bivaGe",
|
||||||
"private", "priviive", "8WWivate", "pxxvate", "pXh_cggnstant",
|
"private", "priviive", "8WWivate", "pxxvate", "pXh_cggnstant",
|
||||||
|
@ -42,7 +42,7 @@ void AddressSpaceParser(::benchmark::State& state) {
|
||||||
"jgkrouRR", "wokroub",
|
"jgkrouRR", "wokroub",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseAddressSpace(str);
|
auto result = ParseAddressSpace(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,12 @@ Builtin ParseBuiltin(std::string_view str) {
|
||||||
if (str == "mat4x4h") {
|
if (str == "mat4x4h") {
|
||||||
return Builtin::kMat4X4H;
|
return Builtin::kMat4X4H;
|
||||||
}
|
}
|
||||||
|
if (str == "sampler") {
|
||||||
|
return Builtin::kSampler;
|
||||||
|
}
|
||||||
|
if (str == "sampler_comparison") {
|
||||||
|
return Builtin::kSamplerComparison;
|
||||||
|
}
|
||||||
if (str == "u32") {
|
if (str == "u32") {
|
||||||
return Builtin::kU32;
|
return Builtin::kU32;
|
||||||
}
|
}
|
||||||
|
@ -184,6 +190,10 @@ std::ostream& operator<<(std::ostream& out, Builtin value) {
|
||||||
return out << "mat4x4f";
|
return out << "mat4x4f";
|
||||||
case Builtin::kMat4X4H:
|
case Builtin::kMat4X4H:
|
||||||
return out << "mat4x4h";
|
return out << "mat4x4h";
|
||||||
|
case Builtin::kSampler:
|
||||||
|
return out << "sampler";
|
||||||
|
case Builtin::kSamplerComparison:
|
||||||
|
return out << "sampler_comparison";
|
||||||
case Builtin::kU32:
|
case Builtin::kU32:
|
||||||
return out << "u32";
|
return out << "u32";
|
||||||
case Builtin::kVec2F:
|
case Builtin::kVec2F:
|
||||||
|
|
|
@ -52,6 +52,8 @@ enum class Builtin {
|
||||||
kMat4X3H,
|
kMat4X3H,
|
||||||
kMat4X4F,
|
kMat4X4F,
|
||||||
kMat4X4H,
|
kMat4X4H,
|
||||||
|
kSampler,
|
||||||
|
kSamplerComparison,
|
||||||
kU32,
|
kU32,
|
||||||
kVec2F,
|
kVec2F,
|
||||||
kVec2H,
|
kVec2H,
|
||||||
|
@ -78,11 +80,13 @@ 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", "mat2x3f",
|
"bool", "f16", "f32", "i32", "mat2x2f", "mat2x2h",
|
||||||
"mat2x3h", "mat2x4f", "mat2x4h", "mat3x2f", "mat3x2h", "mat3x3f", "mat3x3h",
|
"mat2x3f", "mat2x3h", "mat2x4f", "mat2x4h", "mat3x2f", "mat3x2h",
|
||||||
"mat3x4f", "mat3x4h", "mat4x2f", "mat4x2h", "mat4x3f", "mat4x3h", "mat4x4f",
|
"mat3x3f", "mat3x3h", "mat3x4f", "mat3x4h", "mat4x2f", "mat4x2h",
|
||||||
"mat4x4h", "u32", "vec2f", "vec2h", "vec2i", "vec2u", "vec3f",
|
"mat4x3f", "mat4x3h", "mat4x4f", "mat4x4h", "sampler", "sampler_comparison",
|
||||||
"vec3h", "vec3i", "vec3u", "vec4f", "vec4h", "vec4i", "vec4u",
|
"u32", "vec2f", "vec2h", "vec2i", "vec2u", "vec3f",
|
||||||
|
"vec3h", "vec3i", "vec3u", "vec4f", "vec4h", "vec4i",
|
||||||
|
"vec4u",
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::type
|
} // namespace tint::type
|
||||||
|
|
|
@ -30,51 +30,269 @@ namespace tint::type {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void BuiltinParser(::benchmark::State& state) {
|
void BuiltinParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"ccol", "3", "bVol", "bool", "1ool", "bqoJ",
|
"ccol",
|
||||||
"bllo77", "fppqH", "", "Gb", "f16", "f1vi",
|
"3",
|
||||||
"f8WW", "fxx", "fgg", "X", "332", "f32",
|
"bVol",
|
||||||
"fE2", "fPTT", "dxx2", "4432", "iSVV2", "RR2",
|
"bool",
|
||||||
"i32", "92", "i3", "VOR2", "ma2xyf", "llnarr2772f",
|
"1ool",
|
||||||
"mat24200", "mat2x2f", "a2oof", "zz2x2f", "miitppx1", "mat2xXXh",
|
"bqoJ",
|
||||||
"9II5ann2x2h", "mataSSrHHYh", "mat2x2h", "makkh", "jatgRx", "mb2x2",
|
"bllo77",
|
||||||
"mat2xjf", "at2x3f", "q2x3f", "mat2x3f", "matNN3f", "at23vv",
|
"fppqH",
|
||||||
"QQt2x3f", "maffxr", "mat2xjh", "mNNw2x38", "mat2x3h", "matx3h",
|
"",
|
||||||
"mrrt2x3h", "Gat2x3h", "mat2x4FF", "at2f", "marrx4f", "mat2x4f",
|
"Gb",
|
||||||
"t2x4f", "Da2xJJf", "ma84", "m11k4", "matx4h", "maJx4h",
|
"f16",
|
||||||
"mat2x4h", "mat2c4h", "mat2x4O", "KK_atvvtt4h", "xx83x2f", "__qatF2",
|
"f1vi",
|
||||||
"matqx2f", "mat3x2f", "33atOx2f", "mtt63x9oQQ", "ma3x66f", "mtOxzz66",
|
"f8WW",
|
||||||
"mat3yy2h", "ZaHH2Z", "mat3x2h", "4WWt3q2h", "mOO3x2h", "oatY2h",
|
"fxx",
|
||||||
"matx", "ma3xFf", "at3x3w", "mat3x3f", "fGtxKf", "matqKx3f",
|
"fgg",
|
||||||
"matmmxFf", "at3x3h", "mt3x3q", "mat3xbb", "mat3x3h", "mi3x3h",
|
"X",
|
||||||
"maOO3xq", "matTvvx3h", "maFF3x4f", "Pa00xQf", "mPt3x4f", "mat3x4f",
|
"332",
|
||||||
"ma773xss", "RRCbb3x4f", "mXXt3x4f", "qaCC3xOOh", "ma3s4L", "mXt3x4h",
|
"f32",
|
||||||
"mat3x4h", "mat34h", "qa3O4", "mat3x22h", "myzz40XX", "matVViP",
|
"fE2",
|
||||||
"mannC2f", "mat4x2f", "atx2AHHq", "mat4x2", "fatK2f", "ltgg2h",
|
"fPTT",
|
||||||
"mat4xh", "NTTtcx4h", "mat4x2h", "ma7ppl2h", "mNNt4xg", "uub4XX2h",
|
"dxx2",
|
||||||
"matx3f", "Qt883f", "mt9q3f", "mat4x3f", "m11t4x3f", "22at4iif",
|
"4432",
|
||||||
"at4x377", "m2t4xNh", "mVVt4x3h", "FaWW4w11h", "mat4x3h", "mawwx3h",
|
"iSVV2",
|
||||||
"Dat4x3h", "mt4x3K", "mat41PPhf", "mat44f", "mYYt4x4f", "mat4x4f",
|
"RR2",
|
||||||
"mttHH4kk", "mat4rr4f", "WWas4x4f", "Yt4x4h", "mt4qfh", "mav224xuh",
|
"i32",
|
||||||
"mat4x4h", "t4x4h", "YYat4h", "may4x4EYY", "Mo2", "uMM",
|
"92",
|
||||||
"u552", "u32", "N", "333", "u33", "mecI",
|
"i3",
|
||||||
"vrnK2f", "v2", "vec2f", "ILLcf", "ecf", "UecRY",
|
"VOR2",
|
||||||
"vechh", "qeIIu", "Hec2h", "vec2h", "eQQvv", "e66h",
|
"ma2xyf",
|
||||||
"7Wc2", "ve055DD", "IIec2i", "vec2", "vec2i", "rec2",
|
"llnarr2772f",
|
||||||
"lec2i", "GeJ2i", "ey2u", "vc2u", "IIeBB2u", "vec2u",
|
"mat24200",
|
||||||
"TTec338", "veUUSS2nnd", "vZx5CC", "kkec3q", "v005if", "vnIIc3f",
|
"mat2x2f",
|
||||||
"vec3f", "cceW", "cKK", "vec66f", "vePPK", "vexxh",
|
"a2oof",
|
||||||
"qec3h", "vec3h", "veSyMMr", "v3u", "ec", "5eFF3i",
|
"zz2x2f",
|
||||||
"rrecz44", "vWW", "vec3i", "XJecCZZ", "vePP3", "vec3c",
|
"miitppx1",
|
||||||
"ve6ll3u", "vcyy99", "Jec3KK", "vec3u", "_ex3", "Ky3",
|
"mat2xXXh",
|
||||||
"zek3u", "veKSf", "vc4f", "ec4VV", "vec4f", "IAAc4f",
|
"9II5ann2x2h",
|
||||||
"jbR", "veY4", "ec4h", "vc911", "mmcch", "vec4h",
|
"mataSSrHHYh",
|
||||||
"vJJch", "lDDcUfC", "vec4g", "CCe", "ec4i", "vIc__i",
|
"mat2x2h",
|
||||||
"vec4i", "ePPtt", "v3dc4i", "vcyyi", "u4", "v03nnu",
|
"makkh",
|
||||||
"Cuuecnv", "vec4u", "vX4ll", "vocppu", "vwwc4",
|
"jatgRx",
|
||||||
|
"mb2x2",
|
||||||
|
"mat2xjf",
|
||||||
|
"at2x3f",
|
||||||
|
"q2x3f",
|
||||||
|
"mat2x3f",
|
||||||
|
"matNN3f",
|
||||||
|
"at23vv",
|
||||||
|
"QQt2x3f",
|
||||||
|
"maffxr",
|
||||||
|
"mat2xjh",
|
||||||
|
"mNNw2x38",
|
||||||
|
"mat2x3h",
|
||||||
|
"matx3h",
|
||||||
|
"mrrt2x3h",
|
||||||
|
"Gat2x3h",
|
||||||
|
"mat2x4FF",
|
||||||
|
"at2f",
|
||||||
|
"marrx4f",
|
||||||
|
"mat2x4f",
|
||||||
|
"t2x4f",
|
||||||
|
"Da2xJJf",
|
||||||
|
"ma84",
|
||||||
|
"m11k4",
|
||||||
|
"matx4h",
|
||||||
|
"maJx4h",
|
||||||
|
"mat2x4h",
|
||||||
|
"mat2c4h",
|
||||||
|
"mat2x4O",
|
||||||
|
"KK_atvvtt4h",
|
||||||
|
"xx83x2f",
|
||||||
|
"__qatF2",
|
||||||
|
"matqx2f",
|
||||||
|
"mat3x2f",
|
||||||
|
"33atOx2f",
|
||||||
|
"mtt63x9oQQ",
|
||||||
|
"ma3x66f",
|
||||||
|
"mtOxzz66",
|
||||||
|
"mat3yy2h",
|
||||||
|
"ZaHH2Z",
|
||||||
|
"mat3x2h",
|
||||||
|
"4WWt3q2h",
|
||||||
|
"mOO3x2h",
|
||||||
|
"oatY2h",
|
||||||
|
"matx",
|
||||||
|
"ma3xFf",
|
||||||
|
"at3x3w",
|
||||||
|
"mat3x3f",
|
||||||
|
"fGtxKf",
|
||||||
|
"matqKx3f",
|
||||||
|
"matmmxFf",
|
||||||
|
"at3x3h",
|
||||||
|
"mt3x3q",
|
||||||
|
"mat3xbb",
|
||||||
|
"mat3x3h",
|
||||||
|
"mi3x3h",
|
||||||
|
"maOO3xq",
|
||||||
|
"matTvvx3h",
|
||||||
|
"maFF3x4f",
|
||||||
|
"Pa00xQf",
|
||||||
|
"mPt3x4f",
|
||||||
|
"mat3x4f",
|
||||||
|
"ma773xss",
|
||||||
|
"RRCbb3x4f",
|
||||||
|
"mXXt3x4f",
|
||||||
|
"qaCC3xOOh",
|
||||||
|
"ma3s4L",
|
||||||
|
"mXt3x4h",
|
||||||
|
"mat3x4h",
|
||||||
|
"mat34h",
|
||||||
|
"qa3O4",
|
||||||
|
"mat3x22h",
|
||||||
|
"myzz40XX",
|
||||||
|
"matVViP",
|
||||||
|
"mannC2f",
|
||||||
|
"mat4x2f",
|
||||||
|
"atx2AHHq",
|
||||||
|
"mat4x2",
|
||||||
|
"fatK2f",
|
||||||
|
"ltgg2h",
|
||||||
|
"mat4xh",
|
||||||
|
"NTTtcx4h",
|
||||||
|
"mat4x2h",
|
||||||
|
"ma7ppl2h",
|
||||||
|
"mNNt4xg",
|
||||||
|
"uub4XX2h",
|
||||||
|
"matx3f",
|
||||||
|
"Qt883f",
|
||||||
|
"mt9q3f",
|
||||||
|
"mat4x3f",
|
||||||
|
"m11t4x3f",
|
||||||
|
"22at4iif",
|
||||||
|
"at4x377",
|
||||||
|
"m2t4xNh",
|
||||||
|
"mVVt4x3h",
|
||||||
|
"FaWW4w11h",
|
||||||
|
"mat4x3h",
|
||||||
|
"mawwx3h",
|
||||||
|
"Dat4x3h",
|
||||||
|
"mt4x3K",
|
||||||
|
"mat41PPhf",
|
||||||
|
"mat44f",
|
||||||
|
"mYYt4x4f",
|
||||||
|
"mat4x4f",
|
||||||
|
"mttHH4kk",
|
||||||
|
"mat4rr4f",
|
||||||
|
"WWas4x4f",
|
||||||
|
"Yt4x4h",
|
||||||
|
"mt4qfh",
|
||||||
|
"mav224xuh",
|
||||||
|
"mat4x4h",
|
||||||
|
"t4x4h",
|
||||||
|
"YYat4h",
|
||||||
|
"may4x4EYY",
|
||||||
|
"daplMor",
|
||||||
|
"samMMle",
|
||||||
|
"sampl55r",
|
||||||
|
"sampler",
|
||||||
|
"saNpe",
|
||||||
|
"sa3Ol33",
|
||||||
|
"s3mpler",
|
||||||
|
"Iamplercomparismn",
|
||||||
|
"sampleKrcompannison",
|
||||||
|
"samlr_copXXison",
|
||||||
|
"sampler_comparison",
|
||||||
|
"samplpLL_comparisI",
|
||||||
|
"smplerfomparison",
|
||||||
|
"sYmpURDr_comprison",
|
||||||
|
"u3h",
|
||||||
|
"IIq",
|
||||||
|
"u3H",
|
||||||
|
"u32",
|
||||||
|
"Qvv",
|
||||||
|
"66",
|
||||||
|
"73",
|
||||||
|
"ve055DD",
|
||||||
|
"IIec2f",
|
||||||
|
"vec2",
|
||||||
|
"vec2f",
|
||||||
|
"rec2",
|
||||||
|
"lec2f",
|
||||||
|
"GeJ2f",
|
||||||
|
"ey2h",
|
||||||
|
"vc2h",
|
||||||
|
"IIeBB2h",
|
||||||
|
"vec2h",
|
||||||
|
"TTec338",
|
||||||
|
"veUUSS2nnd",
|
||||||
|
"vZx5CC",
|
||||||
|
"kkec2q",
|
||||||
|
"v005ii",
|
||||||
|
"vnIIc2i",
|
||||||
|
"vec2i",
|
||||||
|
"cceW",
|
||||||
|
"cKK",
|
||||||
|
"vec66i",
|
||||||
|
"vePPK",
|
||||||
|
"vexxu",
|
||||||
|
"qec2u",
|
||||||
|
"vec2u",
|
||||||
|
"veSyMMr",
|
||||||
|
"v2u",
|
||||||
|
"ec",
|
||||||
|
"5eFF3f",
|
||||||
|
"rrecz44",
|
||||||
|
"vWW",
|
||||||
|
"vec3f",
|
||||||
|
"XJecCZZ",
|
||||||
|
"vePP3",
|
||||||
|
"vec3c",
|
||||||
|
"ve6ll3h",
|
||||||
|
"vcyy99",
|
||||||
|
"Jec3KK",
|
||||||
|
"vec3h",
|
||||||
|
"_ex3",
|
||||||
|
"Ky3",
|
||||||
|
"zek3h",
|
||||||
|
"veKSi",
|
||||||
|
"vc3i",
|
||||||
|
"ec3VV",
|
||||||
|
"vec3i",
|
||||||
|
"IAAc3i",
|
||||||
|
"jbR",
|
||||||
|
"veY4",
|
||||||
|
"ec3u",
|
||||||
|
"vc911",
|
||||||
|
"mmccu",
|
||||||
|
"vec3u",
|
||||||
|
"vJJcu",
|
||||||
|
"lDDcUfC",
|
||||||
|
"vec3g",
|
||||||
|
"CCe",
|
||||||
|
"ec4f",
|
||||||
|
"vIc__f",
|
||||||
|
"vec4f",
|
||||||
|
"ePPtt",
|
||||||
|
"v3dc4f",
|
||||||
|
"vcyyf",
|
||||||
|
"u4",
|
||||||
|
"v03nnh",
|
||||||
|
"Cuuecnv",
|
||||||
|
"vec4h",
|
||||||
|
"vX4ll",
|
||||||
|
"vocpph",
|
||||||
|
"vwwc4",
|
||||||
|
"veuug",
|
||||||
|
"vaac",
|
||||||
|
"TRZccci",
|
||||||
|
"vec4i",
|
||||||
|
"vTc4O8",
|
||||||
|
"vem04i",
|
||||||
|
"meBB4i",
|
||||||
|
"Mpp4",
|
||||||
|
"OOe4u",
|
||||||
|
"veG4G",
|
||||||
|
"vec4u",
|
||||||
|
"11eHH4u",
|
||||||
|
"veFFe6",
|
||||||
|
"ve4",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseBuiltin(str);
|
auto result = ParseBuiltin(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,74 +43,139 @@ inline std::ostream& operator<<(std::ostream& out, Case c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Case kValidCases[] = {
|
static constexpr Case kValidCases[] = {
|
||||||
{"bool", Builtin::kBool}, {"f16", Builtin::kF16}, {"f32", Builtin::kF32},
|
{"bool", Builtin::kBool}, {"f16", Builtin::kF16},
|
||||||
{"i32", Builtin::kI32}, {"mat2x2f", Builtin::kMat2X2F}, {"mat2x2h", Builtin::kMat2X2H},
|
{"f32", Builtin::kF32}, {"i32", Builtin::kI32},
|
||||||
{"mat2x3f", Builtin::kMat2X3F}, {"mat2x3h", Builtin::kMat2X3H}, {"mat2x4f", Builtin::kMat2X4F},
|
{"mat2x2f", Builtin::kMat2X2F}, {"mat2x2h", Builtin::kMat2X2H},
|
||||||
{"mat2x4h", Builtin::kMat2X4H}, {"mat3x2f", Builtin::kMat3X2F}, {"mat3x2h", Builtin::kMat3X2H},
|
{"mat2x3f", Builtin::kMat2X3F}, {"mat2x3h", Builtin::kMat2X3H},
|
||||||
{"mat3x3f", Builtin::kMat3X3F}, {"mat3x3h", Builtin::kMat3X3H}, {"mat3x4f", Builtin::kMat3X4F},
|
{"mat2x4f", Builtin::kMat2X4F}, {"mat2x4h", Builtin::kMat2X4H},
|
||||||
{"mat3x4h", Builtin::kMat3X4H}, {"mat4x2f", Builtin::kMat4X2F}, {"mat4x2h", Builtin::kMat4X2H},
|
{"mat3x2f", Builtin::kMat3X2F}, {"mat3x2h", Builtin::kMat3X2H},
|
||||||
{"mat4x3f", Builtin::kMat4X3F}, {"mat4x3h", Builtin::kMat4X3H}, {"mat4x4f", Builtin::kMat4X4F},
|
{"mat3x3f", Builtin::kMat3X3F}, {"mat3x3h", Builtin::kMat3X3H},
|
||||||
{"mat4x4h", Builtin::kMat4X4H}, {"u32", Builtin::kU32}, {"vec2f", Builtin::kVec2F},
|
{"mat3x4f", Builtin::kMat3X4F}, {"mat3x4h", Builtin::kMat3X4H},
|
||||||
{"vec2h", Builtin::kVec2H}, {"vec2i", Builtin::kVec2I}, {"vec2u", Builtin::kVec2U},
|
{"mat4x2f", Builtin::kMat4X2F}, {"mat4x2h", Builtin::kMat4X2H},
|
||||||
{"vec3f", Builtin::kVec3F}, {"vec3h", Builtin::kVec3H}, {"vec3i", Builtin::kVec3I},
|
{"mat4x3f", Builtin::kMat4X3F}, {"mat4x3h", Builtin::kMat4X3H},
|
||||||
{"vec3u", Builtin::kVec3U}, {"vec4f", Builtin::kVec4F}, {"vec4h", Builtin::kVec4H},
|
{"mat4x4f", Builtin::kMat4X4F}, {"mat4x4h", Builtin::kMat4X4H},
|
||||||
{"vec4i", Builtin::kVec4I}, {"vec4u", Builtin::kVec4U},
|
{"sampler", Builtin::kSampler}, {"sampler_comparison", Builtin::kSamplerComparison},
|
||||||
|
{"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},
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr Case kInvalidCases[] = {
|
static constexpr Case kInvalidCases[] = {
|
||||||
{"ccol", Builtin::kUndefined}, {"3", Builtin::kUndefined},
|
{"ccol", Builtin::kUndefined},
|
||||||
{"bVol", Builtin::kUndefined}, {"116", Builtin::kUndefined},
|
{"3", Builtin::kUndefined},
|
||||||
{"qJ6", Builtin::kUndefined}, {"f17ll", Builtin::kUndefined},
|
{"bVol", Builtin::kUndefined},
|
||||||
{"fppqH", Builtin::kUndefined}, {"", Builtin::kUndefined},
|
{"116", Builtin::kUndefined},
|
||||||
{"Gb", Builtin::kUndefined}, {"i3vi", Builtin::kUndefined},
|
{"qJ6", Builtin::kUndefined},
|
||||||
{"i8WW", Builtin::kUndefined}, {"ixx", Builtin::kUndefined},
|
{"f17ll", Builtin::kUndefined},
|
||||||
{"mX2x2gg", Builtin::kUndefined}, {"a2xXf", Builtin::kUndefined},
|
{"fppqH", Builtin::kUndefined},
|
||||||
{"mat232f", Builtin::kUndefined}, {"Eat2x2h", Builtin::kUndefined},
|
{"", Builtin::kUndefined},
|
||||||
{"mPTT2x2h", Builtin::kUndefined}, {"mat2xdxx", Builtin::kUndefined},
|
{"Gb", Builtin::kUndefined},
|
||||||
{"m44t2x3f", Builtin::kUndefined}, {"maSS2xVVf", Builtin::kUndefined},
|
{"i3vi", Builtin::kUndefined},
|
||||||
{"RatR22f", Builtin::kUndefined}, {"mF2x9h", Builtin::kUndefined},
|
{"i8WW", Builtin::kUndefined},
|
||||||
{"matx3h", Builtin::kUndefined}, {"VOORRH3h", Builtin::kUndefined},
|
{"ixx", Builtin::kUndefined},
|
||||||
{"ma2xyf", Builtin::kUndefined}, {"llnarr2774f", Builtin::kUndefined},
|
{"mX2x2gg", Builtin::kUndefined},
|
||||||
{"mat24400", Builtin::kUndefined}, {"a2ooh", Builtin::kUndefined},
|
{"a2xXf", Builtin::kUndefined},
|
||||||
{"zz2x4h", Builtin::kUndefined}, {"miitppx1", Builtin::kUndefined},
|
{"mat232f", Builtin::kUndefined},
|
||||||
{"mat3xXXf", Builtin::kUndefined}, {"9II5ann3x2f", Builtin::kUndefined},
|
{"Eat2x2h", Builtin::kUndefined},
|
||||||
{"mataSSrHHYf", Builtin::kUndefined}, {"makkh", Builtin::kUndefined},
|
{"mPTT2x2h", Builtin::kUndefined},
|
||||||
{"jatgRx", Builtin::kUndefined}, {"mb3x2", Builtin::kUndefined},
|
{"mat2xdxx", Builtin::kUndefined},
|
||||||
{"mat3xjf", Builtin::kUndefined}, {"at3x3f", Builtin::kUndefined},
|
{"m44t2x3f", Builtin::kUndefined},
|
||||||
{"q3x3f", Builtin::kUndefined}, {"matNN3h", Builtin::kUndefined},
|
{"maSS2xVVf", Builtin::kUndefined},
|
||||||
{"at33vv", Builtin::kUndefined}, {"QQt3x3h", Builtin::kUndefined},
|
{"RatR22f", Builtin::kUndefined},
|
||||||
{"maffxr", Builtin::kUndefined}, {"mat3xjf", Builtin::kUndefined},
|
{"mF2x9h", Builtin::kUndefined},
|
||||||
{"mNNw3x48", Builtin::kUndefined}, {"matx4h", Builtin::kUndefined},
|
{"matx3h", Builtin::kUndefined},
|
||||||
{"mrrt3x4h", Builtin::kUndefined}, {"Gat3x4h", Builtin::kUndefined},
|
{"VOORRH3h", Builtin::kUndefined},
|
||||||
{"mat4x2FF", Builtin::kUndefined}, {"at4f", Builtin::kUndefined},
|
{"ma2xyf", Builtin::kUndefined},
|
||||||
{"marrx2f", Builtin::kUndefined}, {"t4x2h", Builtin::kUndefined},
|
{"llnarr2774f", Builtin::kUndefined},
|
||||||
{"Da4xJJh", Builtin::kUndefined}, {"ma82", Builtin::kUndefined},
|
{"mat24400", Builtin::kUndefined},
|
||||||
{"m11k3", Builtin::kUndefined}, {"matx3f", Builtin::kUndefined},
|
{"a2ooh", Builtin::kUndefined},
|
||||||
{"maJx3f", Builtin::kUndefined}, {"mat4c3h", Builtin::kUndefined},
|
{"zz2x4h", Builtin::kUndefined},
|
||||||
{"mat4x3O", Builtin::kUndefined}, {"KK_atvvtt3h", Builtin::kUndefined},
|
{"miitppx1", Builtin::kUndefined},
|
||||||
{"xx84x4f", Builtin::kUndefined}, {"__qatF4", Builtin::kUndefined},
|
{"mat3xXXf", Builtin::kUndefined},
|
||||||
{"matqx4f", Builtin::kUndefined}, {"33atOx4h", Builtin::kUndefined},
|
{"9II5ann3x2f", Builtin::kUndefined},
|
||||||
{"mtt64x9oQQ", Builtin::kUndefined}, {"ma4x66h", Builtin::kUndefined},
|
{"mataSSrHHYf", Builtin::kUndefined},
|
||||||
{"zzO6", Builtin::kUndefined}, {"uyy2", Builtin::kUndefined},
|
{"makkh", Builtin::kUndefined},
|
||||||
{"HZ", Builtin::kUndefined}, {"ecWq4f", Builtin::kUndefined},
|
{"jatgRx", Builtin::kUndefined},
|
||||||
{"vOO2f", Builtin::kUndefined}, {"oYe2", Builtin::kUndefined},
|
{"mb3x2", Builtin::kUndefined},
|
||||||
{"v2", Builtin::kUndefined}, {"Fe2h", Builtin::kUndefined},
|
{"mat3xjf", Builtin::kUndefined},
|
||||||
{"vwch", Builtin::kUndefined}, {"vefi", Builtin::kUndefined},
|
{"at3x3f", Builtin::kUndefined},
|
||||||
{"KKeq2i", Builtin::kUndefined}, {"vFmm2i", Builtin::kUndefined},
|
{"q3x3f", Builtin::kUndefined},
|
||||||
{"vecu", Builtin::kUndefined}, {"qc2u", Builtin::kUndefined},
|
{"matNN3h", Builtin::kUndefined},
|
||||||
{"vecbb", Builtin::kUndefined}, {"iic3", Builtin::kUndefined},
|
{"at33vv", Builtin::kUndefined},
|
||||||
{"vqOOf", Builtin::kUndefined}, {"vevvTTf", Builtin::kUndefined},
|
{"QQt3x3h", Builtin::kUndefined},
|
||||||
{"veFF3h", Builtin::kUndefined}, {"00PfQ", Builtin::kUndefined},
|
{"maffxr", Builtin::kUndefined},
|
||||||
{"vec3P", Builtin::kUndefined}, {"vec77s", Builtin::kUndefined},
|
{"mat3xjf", Builtin::kUndefined},
|
||||||
{"vecbbCi", Builtin::kUndefined}, {"vecXXi", Builtin::kUndefined},
|
{"mNNw3x48", Builtin::kUndefined},
|
||||||
{"CCOOec3", Builtin::kUndefined}, {"vs3u", Builtin::kUndefined},
|
{"matx4h", Builtin::kUndefined},
|
||||||
{"Xec3u", Builtin::kUndefined}, {"ve4f", Builtin::kUndefined},
|
{"mrrt3x4h", Builtin::kUndefined},
|
||||||
{"qq4", Builtin::kUndefined}, {"vec422", Builtin::kUndefined},
|
{"Gat3x4h", Builtin::kUndefined},
|
||||||
{"vezzXy", Builtin::kUndefined}, {"ieVVP", Builtin::kUndefined},
|
{"mat4x2FF", Builtin::kUndefined},
|
||||||
{"venCh", Builtin::kUndefined}, {"vHc4Aq", Builtin::kUndefined},
|
{"at4f", Builtin::kUndefined},
|
||||||
{"ve4i", Builtin::kUndefined}, {"vefK", Builtin::kUndefined},
|
{"marrx2f", Builtin::kUndefined},
|
||||||
{"vgg4", Builtin::kUndefined}, {"vecu", Builtin::kUndefined},
|
{"t4x2h", Builtin::kUndefined},
|
||||||
{"4TNc4u", Builtin::kUndefined},
|
{"Da4xJJh", Builtin::kUndefined},
|
||||||
|
{"ma82", Builtin::kUndefined},
|
||||||
|
{"m11k3", Builtin::kUndefined},
|
||||||
|
{"matx3f", Builtin::kUndefined},
|
||||||
|
{"maJx3f", Builtin::kUndefined},
|
||||||
|
{"mat4c3h", Builtin::kUndefined},
|
||||||
|
{"mat4x3O", Builtin::kUndefined},
|
||||||
|
{"KK_atvvtt3h", Builtin::kUndefined},
|
||||||
|
{"xx84x4f", Builtin::kUndefined},
|
||||||
|
{"__qatF4", Builtin::kUndefined},
|
||||||
|
{"matqx4f", Builtin::kUndefined},
|
||||||
|
{"33atOx4h", Builtin::kUndefined},
|
||||||
|
{"mtt64x9oQQ", Builtin::kUndefined},
|
||||||
|
{"ma4x66h", Builtin::kUndefined},
|
||||||
|
{"smOlzz66", Builtin::kUndefined},
|
||||||
|
{"sampyyer", Builtin::kUndefined},
|
||||||
|
{"ZaHHeZ", Builtin::kUndefined},
|
||||||
|
{"sWWpleq_compari44on", Builtin::kUndefined},
|
||||||
|
{"sampler_compaisoOO", Builtin::kUndefined},
|
||||||
|
{"smpeoo_coYparison", Builtin::kUndefined},
|
||||||
|
{"", Builtin::kUndefined},
|
||||||
|
{"u3", Builtin::kUndefined},
|
||||||
|
{"3w", Builtin::kUndefined},
|
||||||
|
{"veff", Builtin::kUndefined},
|
||||||
|
{"KKeq2f", Builtin::kUndefined},
|
||||||
|
{"vFmm2f", Builtin::kUndefined},
|
||||||
|
{"vech", Builtin::kUndefined},
|
||||||
|
{"qc2h", Builtin::kUndefined},
|
||||||
|
{"vecbb", Builtin::kUndefined},
|
||||||
|
{"iic2", Builtin::kUndefined},
|
||||||
|
{"vqOOi", Builtin::kUndefined},
|
||||||
|
{"vevvTTi", Builtin::kUndefined},
|
||||||
|
{"veFF2u", Builtin::kUndefined},
|
||||||
|
{"00PfQ", Builtin::kUndefined},
|
||||||
|
{"vec2P", Builtin::kUndefined},
|
||||||
|
{"vec77s", Builtin::kUndefined},
|
||||||
|
{"vecbbCf", Builtin::kUndefined},
|
||||||
|
{"vecXXf", Builtin::kUndefined},
|
||||||
|
{"CCOOec3", Builtin::kUndefined},
|
||||||
|
{"vs3u", Builtin::kUndefined},
|
||||||
|
{"Xec3h", Builtin::kUndefined},
|
||||||
|
{"ve3i", Builtin::kUndefined},
|
||||||
|
{"qq3", Builtin::kUndefined},
|
||||||
|
{"vec322", Builtin::kUndefined},
|
||||||
|
{"vezzXy", Builtin::kUndefined},
|
||||||
|
{"ieVVP", Builtin::kUndefined},
|
||||||
|
{"venCu", Builtin::kUndefined},
|
||||||
|
{"vHc4Aq", Builtin::kUndefined},
|
||||||
|
{"ve4f", Builtin::kUndefined},
|
||||||
|
{"vefK", Builtin::kUndefined},
|
||||||
|
{"vgg4", Builtin::kUndefined},
|
||||||
|
{"vech", Builtin::kUndefined},
|
||||||
|
{"4TNc4h", Builtin::kUndefined},
|
||||||
|
{"ppec7l", Builtin::kUndefined},
|
||||||
|
{"zNe4i", Builtin::kUndefined},
|
||||||
|
{"uXXb4i", Builtin::kUndefined},
|
||||||
|
{"vec4", Builtin::kUndefined},
|
||||||
|
{"884K", Builtin::kUndefined},
|
||||||
|
{"vq9u", Builtin::kUndefined},
|
||||||
};
|
};
|
||||||
|
|
||||||
using BuiltinParseTest = testing::TestWithParam<Case>;
|
using BuiltinParseTest = testing::TestWithParam<Case>;
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace tint::type {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void TexelFormatParser(::benchmark::State& state) {
|
void TexelFormatParser(::benchmark::State& state) {
|
||||||
std::array kStrings{
|
const char* kStrings[] = {
|
||||||
"bgraunccrm", "blranr3", "bVra8unorm", "bgra8unorm", "bgra1unorm",
|
"bgraunccrm", "blranr3", "bVra8unorm", "bgra8unorm", "bgra1unorm",
|
||||||
"bgrJqqnorm", "bgr7ll8unorm", "qq32lppHat", "c2fov", "r32Goat",
|
"bgrJqqnorm", "bgr7ll8unorm", "qq32lppHat", "c2fov", "r32Goat",
|
||||||
"r32float", "r3viiloat", "r3WWflo8t", "rxxfMoat", "rXsingg",
|
"r32float", "r3viiloat", "r3WWflo8t", "rxxfMoat", "rXsingg",
|
||||||
|
@ -57,7 +57,7 @@ void TexelFormatParser(::benchmark::State& state) {
|
||||||
"rgba8unorm", "ba8unoqqHHA", "rga8unorm", "rgfa8uKKo",
|
"rgba8unorm", "ba8unoqqHHA", "rga8unorm", "rgfa8uKKo",
|
||||||
};
|
};
|
||||||
for (auto _ : state) {
|
for (auto _ : state) {
|
||||||
for (auto& str : kStrings) {
|
for (auto* str : kStrings) {
|
||||||
auto result = ParseTexelFormat(str);
|
auto result = ParseTexelFormat(str);
|
||||||
benchmark::DoNotOptimize(result);
|
benchmark::DoNotOptimize(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,41 +61,41 @@ ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverloa
|
||||||
case ValidTextureOverload::kDimensionsStorageWO3d:
|
case ValidTextureOverload::kDimensionsStorageWO3d:
|
||||||
return {"imageSize"};
|
return {"imageSize"};
|
||||||
case ValidTextureOverload::kGather2dF32:
|
case ValidTextureOverload::kGather2dF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec2(1.0f, 2.0f), 0))";
|
return R"(textureGather(Texture_Sampler, vec2(1.0f, 2.0f), 0))";
|
||||||
case ValidTextureOverload::kGather2dOffsetF32:
|
case ValidTextureOverload::kGather2dOffsetF32:
|
||||||
return R"(textureGatherOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), ivec2(3, 4), int(0u)))";
|
return R"(textureGatherOffset(Texture_Sampler, vec2(1.0f, 2.0f), ivec2(3, 4), int(0u)))";
|
||||||
case ValidTextureOverload::kGather2dArrayF32:
|
case ValidTextureOverload::kGather2dArrayF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), 0))";
|
return R"(textureGather(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), 0))";
|
||||||
case ValidTextureOverload::kGather2dArrayOffsetF32:
|
case ValidTextureOverload::kGather2dArrayOffsetF32:
|
||||||
return R"(textureGatherOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3u)), ivec2(4, 5), int(0u)))";
|
return R"(textureGatherOffset(Texture_Sampler, vec3(1.0f, 2.0f, float(3u)), ivec2(4, 5), int(0u)))";
|
||||||
case ValidTextureOverload::kGatherCubeF32:
|
case ValidTextureOverload::kGatherCubeF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 0))";
|
return R"(textureGather(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 0))";
|
||||||
case ValidTextureOverload::kGatherCubeArrayF32:
|
case ValidTextureOverload::kGatherCubeArrayF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), int(0u))";
|
return R"(textureGather(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), int(0u))";
|
||||||
case ValidTextureOverload::kGatherDepth2dF32:
|
case ValidTextureOverload::kGatherDepth2dF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec2(1.0f, 2.0f), 0.0))";
|
return R"(textureGather(Texture_Sampler, vec2(1.0f, 2.0f), 0.0))";
|
||||||
case ValidTextureOverload::kGatherDepth2dOffsetF32:
|
case ValidTextureOverload::kGatherDepth2dOffsetF32:
|
||||||
return R"(textureGatherOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), 0.0, ivec2(3, 4))";
|
return R"(textureGatherOffset(Texture_Sampler, vec2(1.0f, 2.0f), 0.0, ivec2(3, 4))";
|
||||||
case ValidTextureOverload::kGatherDepth2dArrayF32:
|
case ValidTextureOverload::kGatherDepth2dArrayF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3u)), 0.0))";
|
return R"(textureGather(Texture_Sampler, vec3(1.0f, 2.0f, float(3u)), 0.0))";
|
||||||
case ValidTextureOverload::kGatherDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kGatherDepth2dArrayOffsetF32:
|
||||||
return R"(textureGatherOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), 0.0, ivec2(4, 5)))";
|
return R"(textureGatherOffset(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), 0.0, ivec2(4, 5)))";
|
||||||
case ValidTextureOverload::kGatherDepthCubeF32:
|
case ValidTextureOverload::kGatherDepthCubeF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 0.0))";
|
return R"(textureGather(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 0.0))";
|
||||||
case ValidTextureOverload::kGatherDepthCubeArrayF32:
|
case ValidTextureOverload::kGatherDepthCubeArrayF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), 0.0))";
|
return R"(textureGather(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), 0.0))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dF32:
|
case ValidTextureOverload::kGatherCompareDepth2dF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec2(1.0f, 2.0f), 3.0f))";
|
return R"(textureGather(Texture_Sampler, vec2(1.0f, 2.0f), 3.0f))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dOffsetF32:
|
case ValidTextureOverload::kGatherCompareDepth2dOffsetF32:
|
||||||
return R"(textureGatherOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), 3.0f, ivec2(4, 5)))";
|
return R"(textureGatherOffset(Texture_Sampler, vec2(1.0f, 2.0f), 3.0f, ivec2(4, 5)))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dArrayF32:
|
case ValidTextureOverload::kGatherCompareDepth2dArrayF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), 4.0f))";
|
return R"(textureGather(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), 4.0f))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kGatherCompareDepth2dArrayOffsetF32:
|
||||||
return R"(textureGatherOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), 4.0f, ivec2(5, 6)))";
|
return R"(textureGatherOffset(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), 4.0f, ivec2(5, 6)))";
|
||||||
case ValidTextureOverload::kGatherCompareDepthCubeF32:
|
case ValidTextureOverload::kGatherCompareDepthCubeF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f))";
|
return R"(textureGather(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f))";
|
||||||
case ValidTextureOverload::kGatherCompareDepthCubeArrayF32:
|
case ValidTextureOverload::kGatherCompareDepthCubeArrayF32:
|
||||||
return R"(textureGather(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), 5.0f))";
|
return R"(textureGather(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), 5.0f))";
|
||||||
case ValidTextureOverload::kNumLayers2dArray:
|
case ValidTextureOverload::kNumLayers2dArray:
|
||||||
case ValidTextureOverload::kNumLayersDepth2dArray:
|
case ValidTextureOverload::kNumLayersDepth2dArray:
|
||||||
case ValidTextureOverload::kNumLayersCubeArray:
|
case ValidTextureOverload::kNumLayersCubeArray:
|
||||||
|
@ -117,156 +117,156 @@ ExpectedResult expected_texture_overload(ast::builtin::test::ValidTextureOverloa
|
||||||
case ValidTextureOverload::kNumSamplesMultisampled2d:
|
case ValidTextureOverload::kNumSamplesMultisampled2d:
|
||||||
return {"textureSamples"};
|
return {"textureSamples"};
|
||||||
case ValidTextureOverload::kSample1dF32:
|
case ValidTextureOverload::kSample1dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec2(1.0f, 0.5f));)";
|
return R"(texture(Texture_Sampler, vec2(1.0f, 0.5f));)";
|
||||||
case ValidTextureOverload::kSample2dF32:
|
case ValidTextureOverload::kSample2dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec2(1.0f, 2.0f));)";
|
return R"(texture(Texture_Sampler, vec2(1.0f, 2.0f));)";
|
||||||
case ValidTextureOverload::kSample2dOffsetF32:
|
case ValidTextureOverload::kSample2dOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), ivec2(3, 4));)";
|
return R"(textureOffset(Texture_Sampler, vec2(1.0f, 2.0f), ivec2(3, 4));)";
|
||||||
case ValidTextureOverload::kSample2dArrayF32:
|
case ValidTextureOverload::kSample2dArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)));)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, float(3)));)";
|
||||||
case ValidTextureOverload::kSample2dArrayOffsetF32:
|
case ValidTextureOverload::kSample2dArrayOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3u)), ivec2(4, 5));)";
|
return R"(textureOffset(Texture_Sampler, vec3(1.0f, 2.0f, float(3u)), ivec2(4, 5));)";
|
||||||
case ValidTextureOverload::kSample3dF32:
|
case ValidTextureOverload::kSample3dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
||||||
case ValidTextureOverload::kSample3dOffsetF32:
|
case ValidTextureOverload::kSample3dOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), ivec3(4, 5, 6));)";
|
return R"(textureOffset(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), ivec3(4, 5, 6));)";
|
||||||
case ValidTextureOverload::kSampleCubeF32:
|
case ValidTextureOverload::kSampleCubeF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
||||||
case ValidTextureOverload::kSampleCubeArrayF32:
|
case ValidTextureOverload::kSampleCubeArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4)));)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4)));)";
|
||||||
case ValidTextureOverload::kSampleDepth2dF32:
|
case ValidTextureOverload::kSampleDepth2dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, 0.0f));)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, 0.0f));)";
|
||||||
case ValidTextureOverload::kSampleDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleDepth2dOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 0.0f), ivec2(3, 4));)";
|
return R"(textureOffset(Texture_Sampler, vec3(1.0f, 2.0f, 0.0f), ivec2(3, 4));)";
|
||||||
case ValidTextureOverload::kSampleDepth2dArrayF32:
|
case ValidTextureOverload::kSampleDepth2dArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, float(3), 0.0f));)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, float(3), 0.0f));)";
|
||||||
case ValidTextureOverload::kSampleDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleDepth2dArrayOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec4(1.0f, 2.0f, float(3), 0.0f), ivec2(4, 5));)";
|
return R"(textureOffset(Texture_Sampler, vec4(1.0f, 2.0f, float(3), 0.0f), ivec2(4, 5));)";
|
||||||
case ValidTextureOverload::kSampleDepthCubeF32:
|
case ValidTextureOverload::kSampleDepthCubeF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, 0.0f));)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, 0.0f));)";
|
||||||
case ValidTextureOverload::kSampleDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleDepthCubeArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), 0.0f);)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), 0.0f);)";
|
||||||
case ValidTextureOverload::kSampleBias2dF32:
|
case ValidTextureOverload::kSampleBias2dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec2(1.0f, 2.0f), 3.0f);)";
|
return R"(texture(Texture_Sampler, vec2(1.0f, 2.0f), 3.0f);)";
|
||||||
case ValidTextureOverload::kSampleBias2dOffsetF32:
|
case ValidTextureOverload::kSampleBias2dOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), ivec2(4, 5), 3.0f);)";
|
return R"(textureOffset(Texture_Sampler, vec2(1.0f, 2.0f), ivec2(4, 5), 3.0f);)";
|
||||||
case ValidTextureOverload::kSampleBias2dArrayF32:
|
case ValidTextureOverload::kSampleBias2dArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, float(4u)), 3.0f);)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, float(4u)), 3.0f);)";
|
||||||
case ValidTextureOverload::kSampleBias2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleBias2dArrayOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), ivec2(5, 6), 4.0f);)";
|
return R"(textureOffset(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), ivec2(5, 6), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleBias3dF32:
|
case ValidTextureOverload::kSampleBias3dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleBias3dOffsetF32:
|
case ValidTextureOverload::kSampleBias3dOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), ivec3(5, 6, 7), 4.0f);)";
|
return R"(textureOffset(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), ivec3(5, 6, 7), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleBiasCubeF32:
|
case ValidTextureOverload::kSampleBiasCubeF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleBiasCubeArrayF32:
|
case ValidTextureOverload::kSampleBiasCubeArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(3)), 4.0f);)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(3)), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleLevel2dF32:
|
case ValidTextureOverload::kSampleLevel2dF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec2(1.0f, 2.0f), 3.0f);)";
|
return R"(textureLod(Texture_Sampler, vec2(1.0f, 2.0f), 3.0f);)";
|
||||||
case ValidTextureOverload::kSampleLevel2dOffsetF32:
|
case ValidTextureOverload::kSampleLevel2dOffsetF32:
|
||||||
return R"(textureLodOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), 3.0f, ivec2(4, 5));)";
|
return R"(textureLodOffset(Texture_Sampler, vec2(1.0f, 2.0f), 3.0f, ivec2(4, 5));)";
|
||||||
case ValidTextureOverload::kSampleLevel2dArrayF32:
|
case ValidTextureOverload::kSampleLevel2dArrayF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), 4.0f);)";
|
return R"(textureLod(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleLevel2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleLevel2dArrayOffsetF32:
|
||||||
return R"(textureLodOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), 4.0f, ivec2(5, 6));)";
|
return R"(textureLodOffset(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), 4.0f, ivec2(5, 6));)";
|
||||||
case ValidTextureOverload::kSampleLevel3dF32:
|
case ValidTextureOverload::kSampleLevel3dF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
return R"(textureLod(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleLevel3dOffsetF32:
|
case ValidTextureOverload::kSampleLevel3dOffsetF32:
|
||||||
return R"(textureLodOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f, ivec3(5, 6, 7));)";
|
return R"(textureLodOffset(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f, ivec3(5, 6, 7));)";
|
||||||
case ValidTextureOverload::kSampleLevelCubeF32:
|
case ValidTextureOverload::kSampleLevelCubeF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
return R"(textureLod(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), 4.0f);)";
|
||||||
case ValidTextureOverload::kSampleLevelCubeArrayF32:
|
case ValidTextureOverload::kSampleLevelCubeArrayF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), 5.0f);)";
|
return R"(textureLod(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), 5.0f);)";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dF32:
|
case ValidTextureOverload::kSampleLevelDepth2dF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec3(1.0f, 2.0f, 0.0f), float(3u));)";
|
return R"(textureLod(Texture_Sampler, vec3(1.0f, 2.0f, 0.0f), float(3u));)";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleLevelDepth2dOffsetF32:
|
||||||
return R"(textureLodOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 0.0f), float(3), ivec2(4, 5));)";
|
return R"(textureLodOffset(Texture_Sampler, vec3(1.0f, 2.0f, 0.0f), float(3), ivec2(4, 5));)";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dArrayF32:
|
case ValidTextureOverload::kSampleLevelDepth2dArrayF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec4(1.0f, 2.0f, float(3u), 0.0f), float(4u));)";
|
return R"(textureLod(Texture_Sampler, vec4(1.0f, 2.0f, float(3u), 0.0f), float(4u));)";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleLevelDepth2dArrayOffsetF32:
|
||||||
return R"(textureLodOffset(tint_symbol_sampler, vec4(1.0f, 2.0f, float(3u), 0.0f), float(4u), ivec2(5, 6));)";
|
return R"(textureLodOffset(Texture_Sampler, vec4(1.0f, 2.0f, float(3u), 0.0f), float(4u), ivec2(5, 6));)";
|
||||||
case ValidTextureOverload::kSampleLevelDepthCubeF32:
|
case ValidTextureOverload::kSampleLevelDepthCubeF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, 0.0f), float(4)))";
|
return R"(textureLod(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, 0.0f), float(4)))";
|
||||||
case ValidTextureOverload::kSampleLevelDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleLevelDepthCubeArrayF32:
|
||||||
return R"(textureLod(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), float(5));)";
|
return R"(textureLod(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), float(5));)";
|
||||||
case ValidTextureOverload::kSampleGrad2dF32:
|
case ValidTextureOverload::kSampleGrad2dF32:
|
||||||
return R"(textureGrad(tint_symbol_sampler, vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f));)";
|
return R"(textureGrad(Texture_Sampler, vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f));)";
|
||||||
case ValidTextureOverload::kSampleGrad2dOffsetF32:
|
case ValidTextureOverload::kSampleGrad2dOffsetF32:
|
||||||
return R"(textureGradOffset(tint_symbol_sampler, vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f), ivec2(7));)";
|
return R"(textureGradOffset(Texture_Sampler, vec2(1.0f, 2.0f), vec2(3.0f, 4.0f), vec2(5.0f, 6.0f), ivec2(7));)";
|
||||||
case ValidTextureOverload::kSampleGrad2dArrayF32:
|
case ValidTextureOverload::kSampleGrad2dArrayF32:
|
||||||
return R"(textureGrad(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3)), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));)";
|
return R"(textureGrad(Texture_Sampler, vec3(1.0f, 2.0f, float(3)), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f));)";
|
||||||
case ValidTextureOverload::kSampleGrad2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleGrad2dArrayOffsetF32:
|
||||||
return R"(textureGradOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, float(3u)), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f), ivec2(6, 7));)";
|
return R"(textureGradOffset(Texture_Sampler, vec3(1.0f, 2.0f, float(3u)), vec2(4.0f, 5.0f), vec2(6.0f, 7.0f), ivec2(6, 7));)";
|
||||||
case ValidTextureOverload::kSampleGrad3dF32:
|
case ValidTextureOverload::kSampleGrad3dF32:
|
||||||
return R"(textureGrad(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));)";
|
return R"(textureGrad(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));)";
|
||||||
case ValidTextureOverload::kSampleGrad3dOffsetF32:
|
case ValidTextureOverload::kSampleGrad3dOffsetF32:
|
||||||
return R"(textureGradOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f), ivec3(0, 1, 2));)";
|
return R"(textureGradOffset(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f), ivec3(0, 1, 2));)";
|
||||||
case ValidTextureOverload::kSampleGradCubeF32:
|
case ValidTextureOverload::kSampleGradCubeF32:
|
||||||
return R"(textureGrad(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));)";
|
return R"(textureGrad(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f), vec3(7.0f, 8.0f, 9.0f));)";
|
||||||
case ValidTextureOverload::kSampleGradCubeArrayF32:
|
case ValidTextureOverload::kSampleGradCubeArrayF32:
|
||||||
return R"(textureGrad(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), vec3(5.0f, 6.0f, 7.0f), vec3(8.0f, 9.0f, 10.0f));)";
|
return R"(textureGrad(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4u)), vec3(5.0f, 6.0f, 7.0f), vec3(8.0f, 9.0f, 10.0f));)";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dF32:
|
case ValidTextureOverload::kSampleCompareDepth2dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleCompareDepth2dOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), ivec2(4, 5));)";
|
return R"(textureOffset(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), ivec2(4, 5));)";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dArrayF32:
|
case ValidTextureOverload::kSampleCompareDepth2dArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, float(4), 3.0f));)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, float(4), 3.0f));)";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleCompareDepth2dArrayOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec4(1.0f, 2.0f, float(4u), 3.0f), ivec2(5, 6));)";
|
return R"(textureOffset(Texture_Sampler, vec4(1.0f, 2.0f, float(4u), 3.0f), ivec2(5, 6));)";
|
||||||
case ValidTextureOverload::kSampleCompareDepthCubeF32:
|
case ValidTextureOverload::kSampleCompareDepthCubeF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, 4.0f));)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, 4.0f));)";
|
||||||
case ValidTextureOverload::kSampleCompareDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleCompareDepthCubeArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), 5.0f);)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), 5.0f);)";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
return R"(texture(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f));)";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec3(1.0f, 2.0f, 3.0f), ivec2(4, 5));)";
|
return R"(textureOffset(Texture_Sampler, vec3(1.0f, 2.0f, 3.0f), ivec2(4, 5));)";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, float(3), 4.0f));)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, float(3), 4.0f));)";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayOffsetF32:
|
||||||
return R"(textureOffset(tint_symbol_sampler, vec4(1.0f, 2.0f, float(3), 4.0f), ivec2(5, 6));)";
|
return R"(textureOffset(Texture_Sampler, vec4(1.0f, 2.0f, float(3), 4.0f), ivec2(5, 6));)";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepthCubeF32:
|
case ValidTextureOverload::kSampleCompareLevelDepthCubeF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, 4.0f));)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, 4.0f));)";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleCompareLevelDepthCubeArrayF32:
|
||||||
return R"(texture(tint_symbol_sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), 5.0f);)";
|
return R"(texture(Texture_Sampler, vec4(1.0f, 2.0f, 3.0f, float(4)), 5.0f);)";
|
||||||
case ValidTextureOverload::kLoad1dLevelF32:
|
case ValidTextureOverload::kLoad1dLevelF32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(uvec2(1u, 0u)), int(3u));)";
|
return R"(texelFetch(Texture_1, ivec2(uvec2(1u, 0u)), int(3u));)";
|
||||||
case ValidTextureOverload::kLoad1dLevelU32:
|
case ValidTextureOverload::kLoad1dLevelU32:
|
||||||
case ValidTextureOverload::kLoad1dLevelI32:
|
case ValidTextureOverload::kLoad1dLevelI32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(1, 0), 3);)";
|
return R"(texelFetch(Texture_1, ivec2(1, 0), 3);)";
|
||||||
case ValidTextureOverload::kLoad2dLevelU32:
|
case ValidTextureOverload::kLoad2dLevelU32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(1, 2), 3);)";
|
return R"(texelFetch(Texture_1, ivec2(1, 2), 3);)";
|
||||||
case ValidTextureOverload::kLoad2dLevelF32:
|
case ValidTextureOverload::kLoad2dLevelF32:
|
||||||
case ValidTextureOverload::kLoad2dLevelI32:
|
case ValidTextureOverload::kLoad2dLevelI32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(uvec2(1u, 2u)), int(3u));)";
|
return R"(texelFetch(Texture_1, ivec2(uvec2(1u, 2u)), int(3u));)";
|
||||||
case ValidTextureOverload::kLoad2dArrayLevelF32:
|
case ValidTextureOverload::kLoad2dArrayLevelF32:
|
||||||
case ValidTextureOverload::kLoad2dArrayLevelU32:
|
case ValidTextureOverload::kLoad2dArrayLevelU32:
|
||||||
case ValidTextureOverload::kLoad3dLevelF32:
|
case ValidTextureOverload::kLoad3dLevelF32:
|
||||||
case ValidTextureOverload::kLoad3dLevelU32:
|
case ValidTextureOverload::kLoad3dLevelU32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec3(1, 2, 3), 4);)";
|
return R"(texelFetch(Texture_1, ivec3(1, 2, 3), 4);)";
|
||||||
case ValidTextureOverload::kLoad2dArrayLevelI32:
|
case ValidTextureOverload::kLoad2dArrayLevelI32:
|
||||||
case ValidTextureOverload::kLoad3dLevelI32:
|
case ValidTextureOverload::kLoad3dLevelI32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec3(uvec3(1u, 2u, 3u)), int(4u));)";
|
return R"(texelFetch(Texture_1, ivec3(uvec3(1u, 2u, 3u)), int(4u));)";
|
||||||
case ValidTextureOverload::kLoadMultisampled2dF32:
|
case ValidTextureOverload::kLoadMultisampled2dF32:
|
||||||
case ValidTextureOverload::kLoadMultisampled2dU32:
|
case ValidTextureOverload::kLoadMultisampled2dU32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(1, 2), 3);)";
|
return R"(texelFetch(Texture_1, ivec2(1, 2), 3);)";
|
||||||
case ValidTextureOverload::kLoadMultisampled2dI32:
|
case ValidTextureOverload::kLoadMultisampled2dI32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(uvec2(1u, 2u)), int(3u));)";
|
return R"(texelFetch(Texture_1, ivec2(uvec2(1u, 2u)), int(3u));)";
|
||||||
case ValidTextureOverload::kLoadDepth2dLevelF32:
|
case ValidTextureOverload::kLoadDepth2dLevelF32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(1, 2), 3);)";
|
return R"(texelFetch(Texture_1, ivec2(1, 2), 3);)";
|
||||||
case ValidTextureOverload::kLoadDepth2dArrayLevelF32:
|
case ValidTextureOverload::kLoadDepth2dArrayLevelF32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec3(uvec3(1u, 2u, 3u)), int(4u));)";
|
return R"(texelFetch(Texture_1, ivec3(uvec3(1u, 2u, 3u)), int(4u));)";
|
||||||
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
||||||
return R"(texelFetch(tint_symbol_2, ivec2(uvec2(1u, 2u)), int(3u)).x;)";
|
return R"(texelFetch(Texture_1, ivec2(uvec2(1u, 2u)), int(3u)).x;)";
|
||||||
case ValidTextureOverload::kStoreWO1dRgba32float:
|
case ValidTextureOverload::kStoreWO1dRgba32float:
|
||||||
return R"(imageStore(tint_symbol, ivec2(1, 0), vec4(2.0f, 3.0f, 4.0f, 5.0f));)";
|
return R"(imageStore(Texture, ivec2(1, 0), vec4(2.0f, 3.0f, 4.0f, 5.0f));)";
|
||||||
case ValidTextureOverload::kStoreWO2dRgba32float:
|
case ValidTextureOverload::kStoreWO2dRgba32float:
|
||||||
return R"(imageStore(tint_symbol, ivec2(1, 2), vec4(3.0f, 4.0f, 5.0f, 6.0f));)";
|
return R"(imageStore(Texture, ivec2(1, 2), vec4(3.0f, 4.0f, 5.0f, 6.0f));)";
|
||||||
case ValidTextureOverload::kStoreWO2dArrayRgba32float:
|
case ValidTextureOverload::kStoreWO2dArrayRgba32float:
|
||||||
return R"(imageStore(tint_symbol, ivec3(uvec3(1u, 2u, 3u)), vec4(4.0f, 5.0f, 6.0f, 7.0f));)";
|
return R"(imageStore(Texture, ivec3(uvec3(1u, 2u, 3u)), vec4(4.0f, 5.0f, 6.0f, 7.0f));)";
|
||||||
case ValidTextureOverload::kStoreWO3dRgba32float:
|
case ValidTextureOverload::kStoreWO3dRgba32float:
|
||||||
return R"(imageStore(tint_symbol, ivec3(uvec3(1u, 2u, 3u)), vec4(4.0f, 5.0f, 6.0f, 7.0f));)";
|
return R"(imageStore(Texture, ivec3(uvec3(1u, 2u, 3u)), vec4(4.0f, 5.0f, 6.0f, 7.0f));)";
|
||||||
}
|
}
|
||||||
return "<unmatched texture overload>";
|
return "<unmatched texture overload>";
|
||||||
} // NOLINT - Ignore the length of this function
|
} // NOLINT - Ignore the length of this function
|
||||||
|
|
|
@ -2025,60 +2025,81 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) {
|
||||||
out << " " << param_name;
|
out << " " << param_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type->Is<sem::Struct>()) {
|
bool ok = Switch(
|
||||||
out << " [[stage_in]]";
|
type, //
|
||||||
} else if (type->is_handle()) {
|
[&](const type::Struct*) {
|
||||||
uint32_t binding = get_binding_index(param);
|
out << " [[stage_in]]";
|
||||||
if (binding == kInvalidBindingIndex) {
|
return true;
|
||||||
return false;
|
},
|
||||||
}
|
[&](const type::Texture*) {
|
||||||
if (param->type->Is<ast::Sampler>()) {
|
|
||||||
out << " [[sampler(" << binding << ")]]";
|
|
||||||
} else if (TINT_LIKELY(param->type->Is<ast::Texture>())) {
|
|
||||||
out << " [[texture(" << binding << ")]]";
|
|
||||||
} else {
|
|
||||||
TINT_ICE(Writer, diagnostics_) << "invalid handle type entry point parameter";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (auto* ptr = param->type->As<ast::Pointer>()) {
|
|
||||||
auto sc = ptr->address_space;
|
|
||||||
if (sc == type::AddressSpace::kWorkgroup) {
|
|
||||||
auto& allocations = workgroup_allocations_[func_name];
|
|
||||||
out << " [[threadgroup(" << allocations.size() << ")]]";
|
|
||||||
allocations.push_back(program_->Sem().Get(ptr->type)->Size());
|
|
||||||
} else if (TINT_LIKELY(sc == type::AddressSpace::kStorage ||
|
|
||||||
sc == type::AddressSpace::kUniform)) {
|
|
||||||
uint32_t binding = get_binding_index(param);
|
uint32_t binding = get_binding_index(param);
|
||||||
if (binding == kInvalidBindingIndex) {
|
if (binding == kInvalidBindingIndex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out << " [[buffer(" << binding << ")]]";
|
out << " [[texture(" << binding << ")]]";
|
||||||
} else {
|
return true;
|
||||||
|
},
|
||||||
|
[&](const type::Sampler*) {
|
||||||
|
uint32_t binding = get_binding_index(param);
|
||||||
|
if (binding == kInvalidBindingIndex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
out << " [[sampler(" << binding << ")]]";
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
[&](const type::Pointer* ptr) {
|
||||||
|
switch (ptr->AddressSpace()) {
|
||||||
|
case type::AddressSpace::kWorkgroup: {
|
||||||
|
auto& allocations = workgroup_allocations_[func_name];
|
||||||
|
out << " [[threadgroup(" << allocations.size() << ")]]";
|
||||||
|
allocations.push_back(ptr->StoreType()->Size());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
case type::AddressSpace::kStorage:
|
||||||
|
case type::AddressSpace::kUniform: {
|
||||||
|
uint32_t binding = get_binding_index(param);
|
||||||
|
if (binding == kInvalidBindingIndex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
out << " [[buffer(" << binding << ")]]";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
TINT_ICE(Writer, diagnostics_)
|
TINT_ICE(Writer, diagnostics_)
|
||||||
<< "invalid pointer address space for entry point parameter";
|
<< "invalid pointer address space for entry point parameter";
|
||||||
return false;
|
return false;
|
||||||
}
|
},
|
||||||
} else {
|
[&](Default) {
|
||||||
auto& attrs = param->attributes;
|
auto& attrs = param->attributes;
|
||||||
bool builtin_found = false;
|
bool builtin_found = false;
|
||||||
for (auto* attr : attrs) {
|
for (auto* attr : attrs) {
|
||||||
auto* builtin = attr->As<ast::BuiltinAttribute>();
|
auto* builtin = attr->As<ast::BuiltinAttribute>();
|
||||||
if (!builtin) {
|
if (!builtin) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
builtin_found = true;
|
||||||
|
|
||||||
|
auto name = builtin_to_attribute(builtin->builtin);
|
||||||
|
if (name.empty()) {
|
||||||
|
diagnostics_.add_error(diag::System::Writer, "unknown builtin");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
out << " [[" << name << "]]";
|
||||||
}
|
}
|
||||||
|
if (TINT_UNLIKELY(!builtin_found)) {
|
||||||
builtin_found = true;
|
TINT_ICE(Writer, diagnostics_) << "Unsupported entry point parameter";
|
||||||
|
|
||||||
auto name = builtin_to_attribute(builtin->builtin);
|
|
||||||
if (name.empty()) {
|
|
||||||
diagnostics_.add_error(diag::System::Writer, "unknown builtin");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out << " [[" << name << "]]";
|
return true;
|
||||||
}
|
});
|
||||||
if (TINT_UNLIKELY(!builtin_found)) {
|
|
||||||
TINT_ICE(Writer, diagnostics_) << "Unsupported entry point parameter";
|
if (!ok) {
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out << ") {";
|
out << ") {";
|
||||||
|
|
|
@ -24,7 +24,7 @@ std::string expected_texture_overload(ast::builtin::test::ValidTextureOverload o
|
||||||
switch (overload) {
|
switch (overload) {
|
||||||
case ValidTextureOverload::kDimensions1d:
|
case ValidTextureOverload::kDimensions1d:
|
||||||
case ValidTextureOverload::kDimensionsStorageWO1d:
|
case ValidTextureOverload::kDimensionsStorageWO1d:
|
||||||
return R"(texture.get_width(0))";
|
return R"(Texture.get_width(0))";
|
||||||
case ValidTextureOverload::kDimensions2d:
|
case ValidTextureOverload::kDimensions2d:
|
||||||
case ValidTextureOverload::kDimensions2dArray:
|
case ValidTextureOverload::kDimensions2dArray:
|
||||||
case ValidTextureOverload::kDimensionsCube:
|
case ValidTextureOverload::kDimensionsCube:
|
||||||
|
@ -37,10 +37,10 @@ std::string expected_texture_overload(ast::builtin::test::ValidTextureOverload o
|
||||||
case ValidTextureOverload::kDimensionsDepthMultisampled2d:
|
case ValidTextureOverload::kDimensionsDepthMultisampled2d:
|
||||||
case ValidTextureOverload::kDimensionsStorageWO2d:
|
case ValidTextureOverload::kDimensionsStorageWO2d:
|
||||||
case ValidTextureOverload::kDimensionsStorageWO2dArray:
|
case ValidTextureOverload::kDimensionsStorageWO2dArray:
|
||||||
return R"(uint2(texture.get_width(), texture.get_height()))";
|
return R"(uint2(Texture.get_width(), Texture.get_height()))";
|
||||||
case ValidTextureOverload::kDimensions3d:
|
case ValidTextureOverload::kDimensions3d:
|
||||||
case ValidTextureOverload::kDimensionsStorageWO3d:
|
case ValidTextureOverload::kDimensionsStorageWO3d:
|
||||||
return R"(uint3(texture.get_width(), texture.get_height(), texture.get_depth()))";
|
return R"(uint3(Texture.get_width(), Texture.get_height(), Texture.get_depth()))";
|
||||||
case ValidTextureOverload::kDimensions2dLevel:
|
case ValidTextureOverload::kDimensions2dLevel:
|
||||||
case ValidTextureOverload::kDimensionsCubeLevel:
|
case ValidTextureOverload::kDimensionsCubeLevel:
|
||||||
case ValidTextureOverload::kDimensionsCubeArrayLevel:
|
case ValidTextureOverload::kDimensionsCubeArrayLevel:
|
||||||
|
@ -49,51 +49,51 @@ std::string expected_texture_overload(ast::builtin::test::ValidTextureOverload o
|
||||||
case ValidTextureOverload::kDimensionsDepth2dArrayLevel:
|
case ValidTextureOverload::kDimensionsDepth2dArrayLevel:
|
||||||
case ValidTextureOverload::kDimensionsDepthCubeLevel:
|
case ValidTextureOverload::kDimensionsDepthCubeLevel:
|
||||||
case ValidTextureOverload::kDimensionsDepthCubeArrayLevel:
|
case ValidTextureOverload::kDimensionsDepthCubeArrayLevel:
|
||||||
return R"(uint2(texture.get_width(1), texture.get_height(1)))";
|
return R"(uint2(Texture.get_width(1), Texture.get_height(1)))";
|
||||||
case ValidTextureOverload::kDimensions3dLevel:
|
case ValidTextureOverload::kDimensions3dLevel:
|
||||||
return R"(uint3(texture.get_width(1), texture.get_height(1), texture.get_depth(1)))";
|
return R"(uint3(Texture.get_width(1), Texture.get_height(1), Texture.get_depth(1)))";
|
||||||
case ValidTextureOverload::kGather2dF32:
|
case ValidTextureOverload::kGather2dF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f), int2(0), component::x))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f), int2(0), component::x))";
|
||||||
case ValidTextureOverload::kGather2dOffsetF32:
|
case ValidTextureOverload::kGather2dOffsetF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f), int2(3, 4), component::x))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f), int2(3, 4), component::x))";
|
||||||
case ValidTextureOverload::kGather2dArrayF32:
|
case ValidTextureOverload::kGather2dArrayF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f), 3, int2(0), component::x))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f), 3, int2(0), component::x))";
|
||||||
case ValidTextureOverload::kGather2dArrayOffsetF32:
|
case ValidTextureOverload::kGather2dArrayOffsetF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f), 3u, int2(4, 5), component::x))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f), 3u, int2(4, 5), component::x))";
|
||||||
case ValidTextureOverload::kGatherCubeF32:
|
case ValidTextureOverload::kGatherCubeF32:
|
||||||
return R"(texture.gather(sampler, float3(1.0f, 2.0f, 3.0f), component::x))";
|
return R"(Texture.gather(Sampler, float3(1.0f, 2.0f, 3.0f), component::x))";
|
||||||
case ValidTextureOverload::kGatherCubeArrayF32:
|
case ValidTextureOverload::kGatherCubeArrayF32:
|
||||||
return R"(texture.gather(sampler, float3(1.0f, 2.0f, 3.0f), 4u, component::x))";
|
return R"(Texture.gather(Sampler, float3(1.0f, 2.0f, 3.0f), 4u, component::x))";
|
||||||
case ValidTextureOverload::kGatherDepth2dF32:
|
case ValidTextureOverload::kGatherDepth2dF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f)))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f)))";
|
||||||
case ValidTextureOverload::kGatherDepth2dOffsetF32:
|
case ValidTextureOverload::kGatherDepth2dOffsetF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f), int2(3, 4)))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f), int2(3, 4)))";
|
||||||
case ValidTextureOverload::kGatherDepth2dArrayF32:
|
case ValidTextureOverload::kGatherDepth2dArrayF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f), 3u))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f), 3u))";
|
||||||
case ValidTextureOverload::kGatherDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kGatherDepth2dArrayOffsetF32:
|
||||||
return R"(texture.gather(sampler, float2(1.0f, 2.0f), 3, int2(4, 5)))";
|
return R"(Texture.gather(Sampler, float2(1.0f, 2.0f), 3, int2(4, 5)))";
|
||||||
case ValidTextureOverload::kGatherDepthCubeF32:
|
case ValidTextureOverload::kGatherDepthCubeF32:
|
||||||
return R"(texture.gather(sampler, float3(1.0f, 2.0f, 3.0f)))";
|
return R"(Texture.gather(Sampler, float3(1.0f, 2.0f, 3.0f)))";
|
||||||
case ValidTextureOverload::kGatherDepthCubeArrayF32:
|
case ValidTextureOverload::kGatherDepthCubeArrayF32:
|
||||||
return R"(texture.gather(sampler, float3(1.0f, 2.0f, 3.0f), 4u))";
|
return R"(Texture.gather(Sampler, float3(1.0f, 2.0f, 3.0f), 4u))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dF32:
|
case ValidTextureOverload::kGatherCompareDepth2dF32:
|
||||||
return R"(texture.gather_compare(sampler, float2(1.0f, 2.0f), 3.0f))";
|
return R"(Texture.gather_compare(Sampler, float2(1.0f, 2.0f), 3.0f))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dOffsetF32:
|
case ValidTextureOverload::kGatherCompareDepth2dOffsetF32:
|
||||||
return R"(texture.gather_compare(sampler, float2(1.0f, 2.0f), 3.0f, int2(4, 5)))";
|
return R"(Texture.gather_compare(Sampler, float2(1.0f, 2.0f), 3.0f, int2(4, 5)))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dArrayF32:
|
case ValidTextureOverload::kGatherCompareDepth2dArrayF32:
|
||||||
return R"(texture.gather_compare(sampler, float2(1.0f, 2.0f), 3, 4.0f))";
|
return R"(Texture.gather_compare(Sampler, float2(1.0f, 2.0f), 3, 4.0f))";
|
||||||
case ValidTextureOverload::kGatherCompareDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kGatherCompareDepth2dArrayOffsetF32:
|
||||||
return R"(texture.gather_compare(sampler, float2(1.0f, 2.0f), 3, 4.0f, int2(5, 6)))";
|
return R"(Texture.gather_compare(Sampler, float2(1.0f, 2.0f), 3, 4.0f, int2(5, 6)))";
|
||||||
case ValidTextureOverload::kGatherCompareDepthCubeF32:
|
case ValidTextureOverload::kGatherCompareDepthCubeF32:
|
||||||
return R"(texture.gather_compare(sampler, float3(1.0f, 2.0f, 3.0f), 4.0f))";
|
return R"(Texture.gather_compare(Sampler, float3(1.0f, 2.0f, 3.0f), 4.0f))";
|
||||||
case ValidTextureOverload::kGatherCompareDepthCubeArrayF32:
|
case ValidTextureOverload::kGatherCompareDepthCubeArrayF32:
|
||||||
return R"(texture.gather_compare(sampler, float3(1.0f, 2.0f, 3.0f), 4u, 5.0f))";
|
return R"(Texture.gather_compare(Sampler, float3(1.0f, 2.0f, 3.0f), 4u, 5.0f))";
|
||||||
case ValidTextureOverload::kNumLayers2dArray:
|
case ValidTextureOverload::kNumLayers2dArray:
|
||||||
case ValidTextureOverload::kNumLayersCubeArray:
|
case ValidTextureOverload::kNumLayersCubeArray:
|
||||||
case ValidTextureOverload::kNumLayersDepth2dArray:
|
case ValidTextureOverload::kNumLayersDepth2dArray:
|
||||||
case ValidTextureOverload::kNumLayersDepthCubeArray:
|
case ValidTextureOverload::kNumLayersDepthCubeArray:
|
||||||
case ValidTextureOverload::kNumLayersStorageWO2dArray:
|
case ValidTextureOverload::kNumLayersStorageWO2dArray:
|
||||||
return R"(texture.get_array_size())";
|
return R"(Texture.get_array_size())";
|
||||||
case ValidTextureOverload::kNumLevels2d:
|
case ValidTextureOverload::kNumLevels2d:
|
||||||
case ValidTextureOverload::kNumLevels2dArray:
|
case ValidTextureOverload::kNumLevels2dArray:
|
||||||
case ValidTextureOverload::kNumLevels3d:
|
case ValidTextureOverload::kNumLevels3d:
|
||||||
|
@ -103,166 +103,166 @@ std::string expected_texture_overload(ast::builtin::test::ValidTextureOverload o
|
||||||
case ValidTextureOverload::kNumLevelsDepth2dArray:
|
case ValidTextureOverload::kNumLevelsDepth2dArray:
|
||||||
case ValidTextureOverload::kNumLevelsDepthCube:
|
case ValidTextureOverload::kNumLevelsDepthCube:
|
||||||
case ValidTextureOverload::kNumLevelsDepthCubeArray:
|
case ValidTextureOverload::kNumLevelsDepthCubeArray:
|
||||||
return R"(texture.get_num_mip_levels())";
|
return R"(Texture.get_num_mip_levels())";
|
||||||
case ValidTextureOverload::kNumSamplesDepthMultisampled2d:
|
case ValidTextureOverload::kNumSamplesDepthMultisampled2d:
|
||||||
case ValidTextureOverload::kNumSamplesMultisampled2d:
|
case ValidTextureOverload::kNumSamplesMultisampled2d:
|
||||||
return R"(texture.get_num_samples())";
|
return R"(Texture.get_num_samples())";
|
||||||
case ValidTextureOverload::kSample1dF32:
|
case ValidTextureOverload::kSample1dF32:
|
||||||
return R"(texture.sample(sampler, 1.0f))";
|
return R"(Texture.sample(Sampler, 1.0f))";
|
||||||
case ValidTextureOverload::kSample2dF32:
|
case ValidTextureOverload::kSample2dF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f)))";
|
||||||
case ValidTextureOverload::kSample2dOffsetF32:
|
case ValidTextureOverload::kSample2dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), int2(3, 4)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), int2(3, 4)))";
|
||||||
case ValidTextureOverload::kSample2dArrayF32:
|
case ValidTextureOverload::kSample2dArrayF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3))";
|
||||||
case ValidTextureOverload::kSample2dArrayOffsetF32:
|
case ValidTextureOverload::kSample2dArrayOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3u, int2(4, 5)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3u, int2(4, 5)))";
|
||||||
case ValidTextureOverload::kSample3dF32:
|
case ValidTextureOverload::kSample3dF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f)))";
|
||||||
case ValidTextureOverload::kSample3dOffsetF32:
|
case ValidTextureOverload::kSample3dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), int3(4, 5, 6)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), int3(4, 5, 6)))";
|
||||||
case ValidTextureOverload::kSampleCubeF32:
|
case ValidTextureOverload::kSampleCubeF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f)))";
|
||||||
case ValidTextureOverload::kSampleCubeArrayF32:
|
case ValidTextureOverload::kSampleCubeArrayF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), 4))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), 4))";
|
||||||
case ValidTextureOverload::kSampleDepth2dF32:
|
case ValidTextureOverload::kSampleDepth2dF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f)))";
|
||||||
case ValidTextureOverload::kSampleDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleDepth2dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), int2(3, 4)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), int2(3, 4)))";
|
||||||
case ValidTextureOverload::kSampleDepth2dArrayF32:
|
case ValidTextureOverload::kSampleDepth2dArrayF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3))";
|
||||||
case ValidTextureOverload::kSampleDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleDepth2dArrayOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3, int2(4, 5)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3, int2(4, 5)))";
|
||||||
case ValidTextureOverload::kSampleDepthCubeF32:
|
case ValidTextureOverload::kSampleDepthCubeF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f)))";
|
||||||
case ValidTextureOverload::kSampleDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleDepthCubeArrayF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), 4u))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), 4u))";
|
||||||
case ValidTextureOverload::kSampleBias2dF32:
|
case ValidTextureOverload::kSampleBias2dF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), bias(3.0f)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), bias(3.0f)))";
|
||||||
case ValidTextureOverload::kSampleBias2dOffsetF32:
|
case ValidTextureOverload::kSampleBias2dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), bias(3.0f), int2(4, 5)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), bias(3.0f), int2(4, 5)))";
|
||||||
case ValidTextureOverload::kSampleBias2dArrayF32:
|
case ValidTextureOverload::kSampleBias2dArrayF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 4u, bias(3.0f)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 4u, bias(3.0f)))";
|
||||||
case ValidTextureOverload::kSampleBias2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleBias2dArrayOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3, bias(4.0f), int2(5, 6)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3, bias(4.0f), int2(5, 6)))";
|
||||||
case ValidTextureOverload::kSampleBias3dF32:
|
case ValidTextureOverload::kSampleBias3dF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), bias(4.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), bias(4.0f)))";
|
||||||
case ValidTextureOverload::kSampleBias3dOffsetF32:
|
case ValidTextureOverload::kSampleBias3dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), bias(4.0f), int3(5, 6, 7)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), bias(4.0f), int3(5, 6, 7)))";
|
||||||
case ValidTextureOverload::kSampleBiasCubeF32:
|
case ValidTextureOverload::kSampleBiasCubeF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), bias(4.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), bias(4.0f)))";
|
||||||
case ValidTextureOverload::kSampleBiasCubeArrayF32:
|
case ValidTextureOverload::kSampleBiasCubeArrayF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), 3, bias(4.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), 3, bias(4.0f)))";
|
||||||
case ValidTextureOverload::kSampleLevel2dF32:
|
case ValidTextureOverload::kSampleLevel2dF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), level(3.0f)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), level(3.0f)))";
|
||||||
case ValidTextureOverload::kSampleLevel2dOffsetF32:
|
case ValidTextureOverload::kSampleLevel2dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), level(3.0f), int2(4, 5)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), level(3.0f), int2(4, 5)))";
|
||||||
case ValidTextureOverload::kSampleLevel2dArrayF32:
|
case ValidTextureOverload::kSampleLevel2dArrayF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3, level(4.0f)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3, level(4.0f)))";
|
||||||
case ValidTextureOverload::kSampleLevel2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleLevel2dArrayOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3, level(4.0f), int2(5, 6)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3, level(4.0f), int2(5, 6)))";
|
||||||
case ValidTextureOverload::kSampleLevel3dF32:
|
case ValidTextureOverload::kSampleLevel3dF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), level(4.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), level(4.0f)))";
|
||||||
case ValidTextureOverload::kSampleLevel3dOffsetF32:
|
case ValidTextureOverload::kSampleLevel3dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), level(4.0f), int3(5, 6, 7)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), level(4.0f), int3(5, 6, 7)))";
|
||||||
case ValidTextureOverload::kSampleLevelCubeF32:
|
case ValidTextureOverload::kSampleLevelCubeF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), level(4.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), level(4.0f)))";
|
||||||
case ValidTextureOverload::kSampleLevelCubeArrayF32:
|
case ValidTextureOverload::kSampleLevelCubeArrayF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), 4, level(5.0f)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), 4, level(5.0f)))";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dF32:
|
case ValidTextureOverload::kSampleLevelDepth2dF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), level(3u)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), level(3u)))";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleLevelDepth2dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), level(3), int2(4, 5)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), level(3), int2(4, 5)))";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dArrayF32:
|
case ValidTextureOverload::kSampleLevelDepth2dArrayF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3u, level(4u)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3u, level(4u)))";
|
||||||
case ValidTextureOverload::kSampleLevelDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleLevelDepth2dArrayOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3u, level(4u), int2(5, 6)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3u, level(4u), int2(5, 6)))";
|
||||||
case ValidTextureOverload::kSampleLevelDepthCubeF32:
|
case ValidTextureOverload::kSampleLevelDepthCubeF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), level(4)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), level(4)))";
|
||||||
case ValidTextureOverload::kSampleLevelDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleLevelDepthCubeArrayF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), 4, level(5)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), 4, level(5)))";
|
||||||
case ValidTextureOverload::kSampleGrad2dF32:
|
case ValidTextureOverload::kSampleGrad2dF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), gradient2d(float2(3.0f, 4.0f), float2(5.0f, 6.0f))))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), gradient2d(float2(3.0f, 4.0f), float2(5.0f, 6.0f))))";
|
||||||
case ValidTextureOverload::kSampleGrad2dOffsetF32:
|
case ValidTextureOverload::kSampleGrad2dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), gradient2d(float2(3.0f, 4.0f), float2(5.0f, 6.0f)), int2(7)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), gradient2d(float2(3.0f, 4.0f), float2(5.0f, 6.0f)), int2(7)))";
|
||||||
case ValidTextureOverload::kSampleGrad2dArrayF32:
|
case ValidTextureOverload::kSampleGrad2dArrayF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3, gradient2d(float2(4.0f, 5.0f), float2(6.0f, 7.0f))))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3, gradient2d(float2(4.0f, 5.0f), float2(6.0f, 7.0f))))";
|
||||||
case ValidTextureOverload::kSampleGrad2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleGrad2dArrayOffsetF32:
|
||||||
return R"(texture.sample(sampler, float2(1.0f, 2.0f), 3u, gradient2d(float2(4.0f, 5.0f), float2(6.0f, 7.0f)), int2(6, 7)))";
|
return R"(Texture.sample(Sampler, float2(1.0f, 2.0f), 3u, gradient2d(float2(4.0f, 5.0f), float2(6.0f, 7.0f)), int2(6, 7)))";
|
||||||
case ValidTextureOverload::kSampleGrad3dF32:
|
case ValidTextureOverload::kSampleGrad3dF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), gradient3d(float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), gradient3d(float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))))";
|
||||||
case ValidTextureOverload::kSampleGrad3dOffsetF32:
|
case ValidTextureOverload::kSampleGrad3dOffsetF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), gradient3d(float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)), int3(0, 1, 2)))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), gradient3d(float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f)), int3(0, 1, 2)))";
|
||||||
case ValidTextureOverload::kSampleGradCubeF32:
|
case ValidTextureOverload::kSampleGradCubeF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), gradientcube(float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), gradientcube(float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))))";
|
||||||
case ValidTextureOverload::kSampleGradCubeArrayF32:
|
case ValidTextureOverload::kSampleGradCubeArrayF32:
|
||||||
return R"(texture.sample(sampler, float3(1.0f, 2.0f, 3.0f), 4u, gradientcube(float3(5.0f, 6.0f, 7.0f), float3(8.0f, 9.0f, 10.0f))))";
|
return R"(Texture.sample(Sampler, float3(1.0f, 2.0f, 3.0f), 4u, gradientcube(float3(5.0f, 6.0f, 7.0f), float3(8.0f, 9.0f, 10.0f))))";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dF32:
|
case ValidTextureOverload::kSampleCompareDepth2dF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 3.0f))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 3.0f))";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleCompareDepth2dOffsetF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 3.0f, int2(4, 5)))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 3.0f, int2(4, 5)))";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dArrayF32:
|
case ValidTextureOverload::kSampleCompareDepth2dArrayF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 4, 3.0f))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 4, 3.0f))";
|
||||||
case ValidTextureOverload::kSampleCompareDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleCompareDepth2dArrayOffsetF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 4u, 3.0f, int2(5, 6)))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 4u, 3.0f, int2(5, 6)))";
|
||||||
case ValidTextureOverload::kSampleCompareDepthCubeF32:
|
case ValidTextureOverload::kSampleCompareDepthCubeF32:
|
||||||
return R"(texture.sample_compare(sampler, float3(1.0f, 2.0f, 3.0f), 4.0f))";
|
return R"(Texture.sample_compare(Sampler, float3(1.0f, 2.0f, 3.0f), 4.0f))";
|
||||||
case ValidTextureOverload::kSampleCompareDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleCompareDepthCubeArrayF32:
|
||||||
return R"(texture.sample_compare(sampler, float3(1.0f, 2.0f, 3.0f), 4, 5.0f))";
|
return R"(Texture.sample_compare(Sampler, float3(1.0f, 2.0f, 3.0f), 4, 5.0f))";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 3.0f, level(0)))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 3.0f, level(0)))";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dOffsetF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dOffsetF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 3.0f, level(0), int2(4, 5)))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 3.0f, level(0), int2(4, 5)))";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 3, 4.0f, level(0)))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 3, 4.0f, level(0)))";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayOffsetF32:
|
case ValidTextureOverload::kSampleCompareLevelDepth2dArrayOffsetF32:
|
||||||
return R"(texture.sample_compare(sampler, float2(1.0f, 2.0f), 3, 4.0f, level(0), int2(5, 6)))";
|
return R"(Texture.sample_compare(Sampler, float2(1.0f, 2.0f), 3, 4.0f, level(0), int2(5, 6)))";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepthCubeF32:
|
case ValidTextureOverload::kSampleCompareLevelDepthCubeF32:
|
||||||
return R"(texture.sample_compare(sampler, float3(1.0f, 2.0f, 3.0f), 4.0f, level(0)))";
|
return R"(Texture.sample_compare(Sampler, float3(1.0f, 2.0f, 3.0f), 4.0f, level(0)))";
|
||||||
case ValidTextureOverload::kSampleCompareLevelDepthCubeArrayF32:
|
case ValidTextureOverload::kSampleCompareLevelDepthCubeArrayF32:
|
||||||
return R"(texture.sample_compare(sampler, float3(1.0f, 2.0f, 3.0f), 4, 5.0f, level(0)))";
|
return R"(Texture.sample_compare(Sampler, float3(1.0f, 2.0f, 3.0f), 4, 5.0f, level(0)))";
|
||||||
case ValidTextureOverload::kLoad1dLevelF32:
|
case ValidTextureOverload::kLoad1dLevelF32:
|
||||||
return R"(texture.read(uint(1u), 0))";
|
return R"(Texture.read(uint(1u), 0))";
|
||||||
case ValidTextureOverload::kLoad1dLevelU32:
|
case ValidTextureOverload::kLoad1dLevelU32:
|
||||||
return R"(texture.read(uint(1), 0))";
|
return R"(Texture.read(uint(1), 0))";
|
||||||
case ValidTextureOverload::kLoad1dLevelI32:
|
case ValidTextureOverload::kLoad1dLevelI32:
|
||||||
return R"(texture.read(uint(1), 0))";
|
return R"(Texture.read(uint(1), 0))";
|
||||||
case ValidTextureOverload::kLoad2dLevelF32:
|
case ValidTextureOverload::kLoad2dLevelF32:
|
||||||
return R"(texture.read(uint2(uint2(1u, 2u)), 3u))";
|
return R"(Texture.read(uint2(uint2(1u, 2u)), 3u))";
|
||||||
case ValidTextureOverload::kLoad2dLevelU32:
|
case ValidTextureOverload::kLoad2dLevelU32:
|
||||||
return R"(texture.read(uint2(int2(1, 2)), 3))";
|
return R"(Texture.read(uint2(int2(1, 2)), 3))";
|
||||||
case ValidTextureOverload::kLoad2dArrayLevelF32:
|
case ValidTextureOverload::kLoad2dArrayLevelF32:
|
||||||
return R"(texture.read(uint2(int2(1, 2)), 3, 4))";
|
return R"(Texture.read(uint2(int2(1, 2)), 3, 4))";
|
||||||
case ValidTextureOverload::kLoad2dArrayLevelU32:
|
case ValidTextureOverload::kLoad2dArrayLevelU32:
|
||||||
return R"(texture.read(uint2(int2(1, 2)), 3, 4))";
|
return R"(Texture.read(uint2(int2(1, 2)), 3, 4))";
|
||||||
case ValidTextureOverload::kLoad2dArrayLevelI32:
|
case ValidTextureOverload::kLoad2dArrayLevelI32:
|
||||||
return R"(texture.read(uint2(uint2(1u, 2u)), 3u, 4u))";
|
return R"(Texture.read(uint2(uint2(1u, 2u)), 3u, 4u))";
|
||||||
case ValidTextureOverload::kLoad3dLevelF32:
|
case ValidTextureOverload::kLoad3dLevelF32:
|
||||||
return R"(texture.read(uint3(int3(1, 2, 3)), 4))";
|
return R"(Texture.read(uint3(int3(1, 2, 3)), 4))";
|
||||||
case ValidTextureOverload::kLoad3dLevelU32:
|
case ValidTextureOverload::kLoad3dLevelU32:
|
||||||
return R"(texture.read(uint3(int3(1, 2, 3)), 4))";
|
return R"(Texture.read(uint3(int3(1, 2, 3)), 4))";
|
||||||
case ValidTextureOverload::kLoad3dLevelI32:
|
case ValidTextureOverload::kLoad3dLevelI32:
|
||||||
return R"(texture.read(uint3(uint3(1u, 2u, 3u)), 4u))";
|
return R"(Texture.read(uint3(uint3(1u, 2u, 3u)), 4u))";
|
||||||
case ValidTextureOverload::kLoadMultisampled2dF32:
|
case ValidTextureOverload::kLoadMultisampled2dF32:
|
||||||
case ValidTextureOverload::kLoadMultisampled2dU32:
|
case ValidTextureOverload::kLoadMultisampled2dU32:
|
||||||
return R"(texture.read(uint2(int2(1, 2)), 3))";
|
return R"(Texture.read(uint2(int2(1, 2)), 3))";
|
||||||
case ValidTextureOverload::kLoad2dLevelI32:
|
case ValidTextureOverload::kLoad2dLevelI32:
|
||||||
case ValidTextureOverload::kLoadMultisampled2dI32:
|
case ValidTextureOverload::kLoadMultisampled2dI32:
|
||||||
return R"(texture.read(uint2(uint2(1u, 2u)), 3u))";
|
return R"(Texture.read(uint2(uint2(1u, 2u)), 3u))";
|
||||||
case ValidTextureOverload::kLoadDepth2dLevelF32:
|
case ValidTextureOverload::kLoadDepth2dLevelF32:
|
||||||
return R"(texture.read(uint2(int2(1, 2)), 3))";
|
return R"(Texture.read(uint2(int2(1, 2)), 3))";
|
||||||
case ValidTextureOverload::kLoadDepth2dArrayLevelF32:
|
case ValidTextureOverload::kLoadDepth2dArrayLevelF32:
|
||||||
return R"(texture.read(uint2(uint2(1u, 2u)), 3u, 4u))";
|
return R"(Texture.read(uint2(uint2(1u, 2u)), 3u, 4u))";
|
||||||
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
||||||
return R"(texture.read(uint2(uint2(1u, 2u)), 3u))";
|
return R"(Texture.read(uint2(uint2(1u, 2u)), 3u))";
|
||||||
case ValidTextureOverload::kStoreWO1dRgba32float:
|
case ValidTextureOverload::kStoreWO1dRgba32float:
|
||||||
return R"(texture.write(float4(2.0f, 3.0f, 4.0f, 5.0f), uint(1)))";
|
return R"(Texture.write(float4(2.0f, 3.0f, 4.0f, 5.0f), uint(1)))";
|
||||||
case ValidTextureOverload::kStoreWO2dRgba32float:
|
case ValidTextureOverload::kStoreWO2dRgba32float:
|
||||||
return R"(texture.write(float4(3.0f, 4.0f, 5.0f, 6.0f), uint2(int2(1, 2))))";
|
return R"(Texture.write(float4(3.0f, 4.0f, 5.0f, 6.0f), uint2(int2(1, 2))))";
|
||||||
case ValidTextureOverload::kStoreWO2dArrayRgba32float:
|
case ValidTextureOverload::kStoreWO2dArrayRgba32float:
|
||||||
return R"(texture.write(float4(4.0f, 5.0f, 6.0f, 7.0f), uint2(uint2(1u, 2u)), 3u))";
|
return R"(Texture.write(float4(4.0f, 5.0f, 6.0f, 7.0f), uint2(uint2(1u, 2u)), 3u))";
|
||||||
case ValidTextureOverload::kStoreWO3dRgba32float:
|
case ValidTextureOverload::kStoreWO3dRgba32float:
|
||||||
return R"(texture.write(float4(4.0f, 5.0f, 6.0f, 7.0f), uint3(uint3(1u, 2u, 3u))))";
|
return R"(Texture.write(float4(4.0f, 5.0f, 6.0f, 7.0f), uint3(uint3(1u, 2u, 3u))))";
|
||||||
}
|
}
|
||||||
return "<unmatched texture overload>";
|
return "<unmatched texture overload>";
|
||||||
} // NOLINT - Ignore the length of this function
|
} // NOLINT - Ignore the length of this function
|
||||||
|
|
|
@ -452,14 +452,6 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) {
|
||||||
out << ">";
|
out << ">";
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[&](const ast::Sampler* sampler) {
|
|
||||||
out << "sampler";
|
|
||||||
|
|
||||||
if (sampler->IsComparison()) {
|
|
||||||
out << "_comparison";
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
[&](const ast::ExternalTexture*) {
|
[&](const ast::ExternalTexture*) {
|
||||||
out << "texture_external";
|
out << "texture_external";
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue