mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 21:17:45 +00:00
Resolver: Add ast -> sem type resolving
Not currently called (nothing currently attaches ast::Type nodes to the AST), but implements some of the boilerplate that'll be shortly required. This change also removes a bunch of duplicated enumerators from the sem namespace for their counterpart in the ast namespace. Bug: tint:724 Change-Id: I0372a9f4eca2f9357ff161e7ec1b67eae1c4c8f6 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48603 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
a922e65d72
commit
fec63b7aa6
@@ -22,14 +22,16 @@ namespace tint {
|
||||
namespace sem {
|
||||
namespace {
|
||||
|
||||
bool IsValidDepthDimension(TextureDimension dim) {
|
||||
return dim == TextureDimension::k2d || dim == TextureDimension::k2dArray ||
|
||||
dim == TextureDimension::kCube || dim == TextureDimension::kCubeArray;
|
||||
bool IsValidDepthDimension(ast::TextureDimension dim) {
|
||||
return dim == ast::TextureDimension::k2d ||
|
||||
dim == ast::TextureDimension::k2dArray ||
|
||||
dim == ast::TextureDimension::kCube ||
|
||||
dim == ast::TextureDimension::kCubeArray;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
DepthTexture::DepthTexture(TextureDimension dim) : Base(dim) {
|
||||
DepthTexture::DepthTexture(ast::TextureDimension dim) : Base(dim) {
|
||||
TINT_ASSERT(IsValidDepthDimension(dim));
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class DepthTexture : public Castable<DepthTexture, Texture> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param dim the dimensionality of the texture
|
||||
explicit DepthTexture(TextureDimension dim);
|
||||
explicit DepthTexture(ast::TextureDimension dim);
|
||||
/// Move constructor
|
||||
DepthTexture(DepthTexture&&);
|
||||
~DepthTexture() override;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace {
|
||||
using DepthTextureTest = TestHelper;
|
||||
|
||||
TEST_F(DepthTextureTest, Is) {
|
||||
DepthTexture d(TextureDimension::kCube);
|
||||
DepthTexture d(ast::TextureDimension::kCube);
|
||||
Type* ty = &d;
|
||||
EXPECT_FALSE(ty->Is<AccessControl>());
|
||||
EXPECT_FALSE(ty->Is<Alias>());
|
||||
@@ -46,7 +46,7 @@ TEST_F(DepthTextureTest, Is) {
|
||||
}
|
||||
|
||||
TEST_F(DepthTextureTest, IsTexture) {
|
||||
DepthTexture d(TextureDimension::kCube);
|
||||
DepthTexture d(ast::TextureDimension::kCube);
|
||||
Texture* ty = &d;
|
||||
EXPECT_TRUE(ty->Is<DepthTexture>());
|
||||
EXPECT_FALSE(ty->Is<ExternalTexture>());
|
||||
@@ -55,17 +55,17 @@ TEST_F(DepthTextureTest, IsTexture) {
|
||||
}
|
||||
|
||||
TEST_F(DepthTextureTest, Dim) {
|
||||
DepthTexture d(TextureDimension::kCube);
|
||||
EXPECT_EQ(d.dim(), TextureDimension::kCube);
|
||||
DepthTexture d(ast::TextureDimension::kCube);
|
||||
EXPECT_EQ(d.dim(), ast::TextureDimension::kCube);
|
||||
}
|
||||
|
||||
TEST_F(DepthTextureTest, TypeName) {
|
||||
DepthTexture d(TextureDimension::kCube);
|
||||
DepthTexture d(ast::TextureDimension::kCube);
|
||||
EXPECT_EQ(d.type_name(), "__depth_texture_cube");
|
||||
}
|
||||
|
||||
TEST_F(DepthTextureTest, FriendlyName) {
|
||||
DepthTexture d(TextureDimension::kCube);
|
||||
DepthTexture d(ast::TextureDimension::kCube);
|
||||
EXPECT_EQ(d.FriendlyName(Symbols()), "texture_depth_cube");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::ExternalTexture);
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
ExternalTexture::ExternalTexture() : Base(TextureDimension::k2d) {}
|
||||
ExternalTexture::ExternalTexture() : Base(ast::TextureDimension::k2d) {}
|
||||
|
||||
ExternalTexture::ExternalTexture(ExternalTexture&&) = default;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ TEST_F(ExternalTextureTest, IsTexture) {
|
||||
TEST_F(ExternalTextureTest, Dim) {
|
||||
F32 f32;
|
||||
ExternalTexture s;
|
||||
EXPECT_EQ(s.dim(), TextureDimension::k2d);
|
||||
EXPECT_EQ(s.dim(), ast::TextureDimension::k2d);
|
||||
}
|
||||
|
||||
TEST_F(ExternalTextureTest, TypeName) {
|
||||
|
||||
@@ -117,12 +117,12 @@ Function::ReferencedBuiltinVariables() const {
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::ReferencedSamplerVariables() const {
|
||||
return ReferencedSamplerVariablesImpl(sem::SamplerKind::kSampler);
|
||||
return ReferencedSamplerVariablesImpl(ast::SamplerKind::kSampler);
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::ReferencedComparisonSamplerVariables()
|
||||
const {
|
||||
return ReferencedSamplerVariablesImpl(sem::SamplerKind::kComparisonSampler);
|
||||
return ReferencedSamplerVariablesImpl(ast::SamplerKind::kComparisonSampler);
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::ReferencedSampledTextureVariables() const {
|
||||
@@ -180,7 +180,7 @@ bool Function::HasAncestorEntryPoint(Symbol symbol) const {
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::ReferencedSamplerVariablesImpl(
|
||||
sem::SamplerKind kind) const {
|
||||
ast::SamplerKind kind) const {
|
||||
VariableBindings ret;
|
||||
|
||||
for (auto* var : ReferencedModuleVariables()) {
|
||||
|
||||
@@ -142,7 +142,7 @@ class Function : public Castable<Function, CallTarget> {
|
||||
bool HasAncestorEntryPoint(Symbol sym) const;
|
||||
|
||||
private:
|
||||
VariableBindings ReferencedSamplerVariablesImpl(sem::SamplerKind kind) const;
|
||||
VariableBindings ReferencedSamplerVariablesImpl(ast::SamplerKind kind) const;
|
||||
VariableBindings ReferencedSampledTextureVariablesImpl(
|
||||
bool multisampled) const;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::MultisampledTexture);
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
MultisampledTexture::MultisampledTexture(TextureDimension dim, Type* type)
|
||||
MultisampledTexture::MultisampledTexture(ast::TextureDimension dim, Type* type)
|
||||
: Base(dim), type_(type) {
|
||||
TINT_ASSERT(type_);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class MultisampledTexture : public Castable<MultisampledTexture, Texture> {
|
||||
/// Constructor
|
||||
/// @param dim the dimensionality of the texture
|
||||
/// @param type the data type of the multisampled texture
|
||||
MultisampledTexture(TextureDimension dim, Type* type);
|
||||
MultisampledTexture(ast::TextureDimension dim, Type* type);
|
||||
/// Move constructor
|
||||
MultisampledTexture(MultisampledTexture&&);
|
||||
~MultisampledTexture() override;
|
||||
|
||||
@@ -29,7 +29,7 @@ using MultisampledTextureTest = TestHelper;
|
||||
|
||||
TEST_F(MultisampledTextureTest, Is) {
|
||||
F32 f32;
|
||||
MultisampledTexture s(TextureDimension::kCube, &f32);
|
||||
MultisampledTexture s(ast::TextureDimension::kCube, &f32);
|
||||
Type* ty = &s;
|
||||
EXPECT_FALSE(ty->Is<AccessControl>());
|
||||
EXPECT_FALSE(ty->Is<Alias>());
|
||||
@@ -48,7 +48,7 @@ TEST_F(MultisampledTextureTest, Is) {
|
||||
|
||||
TEST_F(MultisampledTextureTest, IsTexture) {
|
||||
F32 f32;
|
||||
MultisampledTexture s(TextureDimension::kCube, &f32);
|
||||
MultisampledTexture s(ast::TextureDimension::kCube, &f32);
|
||||
Texture* ty = &s;
|
||||
EXPECT_FALSE(ty->Is<DepthTexture>());
|
||||
EXPECT_FALSE(ty->Is<ExternalTexture>());
|
||||
@@ -59,24 +59,24 @@ TEST_F(MultisampledTextureTest, IsTexture) {
|
||||
|
||||
TEST_F(MultisampledTextureTest, Dim) {
|
||||
F32 f32;
|
||||
MultisampledTexture s(TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.dim(), TextureDimension::k3d);
|
||||
MultisampledTexture s(ast::TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.dim(), ast::TextureDimension::k3d);
|
||||
}
|
||||
|
||||
TEST_F(MultisampledTextureTest, Type) {
|
||||
F32 f32;
|
||||
MultisampledTexture s(TextureDimension::k3d, &f32);
|
||||
MultisampledTexture s(ast::TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.type(), &f32);
|
||||
}
|
||||
|
||||
TEST_F(MultisampledTextureTest, TypeName) {
|
||||
F32 f32;
|
||||
MultisampledTexture s(TextureDimension::k3d, &f32);
|
||||
MultisampledTexture s(ast::TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.type_name(), "__multisampled_texture_3d__f32");
|
||||
}
|
||||
|
||||
TEST_F(MultisampledTextureTest, FriendlyName) {
|
||||
MultisampledTexture s(TextureDimension::k3d, ty.f32());
|
||||
MultisampledTexture s(ast::TextureDimension::k3d, ty.f32());
|
||||
EXPECT_EQ(s.FriendlyName(Symbols()), "texture_multisampled_3d<f32>");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class Pointer : public Castable<Pointer, Type> {
|
||||
/// Construtor
|
||||
/// @param subtype the pointee type
|
||||
/// @param storage_class the storage class of the pointer
|
||||
explicit Pointer(Type* subtype, ast::StorageClass storage_class);
|
||||
Pointer(Type* subtype, ast::StorageClass storage_class);
|
||||
/// Move constructor
|
||||
Pointer(Pointer&&);
|
||||
~Pointer() override;
|
||||
|
||||
@@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::SampledTexture);
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
SampledTexture::SampledTexture(TextureDimension dim, Type* type)
|
||||
SampledTexture::SampledTexture(ast::TextureDimension dim, Type* type)
|
||||
: Base(dim), type_(type) {
|
||||
TINT_ASSERT(type_);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class SampledTexture : public Castable<SampledTexture, Texture> {
|
||||
/// Constructor
|
||||
/// @param dim the dimensionality of the texture
|
||||
/// @param type the data type of the sampled texture
|
||||
SampledTexture(TextureDimension dim, Type* type);
|
||||
SampledTexture(ast::TextureDimension dim, Type* type);
|
||||
/// Move constructor
|
||||
SampledTexture(SampledTexture&&);
|
||||
~SampledTexture() override;
|
||||
|
||||
@@ -28,7 +28,7 @@ using SampledTextureTest = TestHelper;
|
||||
|
||||
TEST_F(SampledTextureTest, Is) {
|
||||
F32 f32;
|
||||
SampledTexture s(TextureDimension::kCube, &f32);
|
||||
SampledTexture s(ast::TextureDimension::kCube, &f32);
|
||||
Type* ty = &s;
|
||||
EXPECT_FALSE(ty->Is<AccessControl>());
|
||||
EXPECT_FALSE(ty->Is<Alias>());
|
||||
@@ -47,7 +47,7 @@ TEST_F(SampledTextureTest, Is) {
|
||||
|
||||
TEST_F(SampledTextureTest, IsTexture) {
|
||||
F32 f32;
|
||||
SampledTexture s(TextureDimension::kCube, &f32);
|
||||
SampledTexture s(ast::TextureDimension::kCube, &f32);
|
||||
Texture* ty = &s;
|
||||
EXPECT_FALSE(ty->Is<DepthTexture>());
|
||||
EXPECT_FALSE(ty->Is<ExternalTexture>());
|
||||
@@ -57,24 +57,24 @@ TEST_F(SampledTextureTest, IsTexture) {
|
||||
|
||||
TEST_F(SampledTextureTest, Dim) {
|
||||
F32 f32;
|
||||
SampledTexture s(TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.dim(), TextureDimension::k3d);
|
||||
SampledTexture s(ast::TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.dim(), ast::TextureDimension::k3d);
|
||||
}
|
||||
|
||||
TEST_F(SampledTextureTest, Type) {
|
||||
F32 f32;
|
||||
SampledTexture s(TextureDimension::k3d, &f32);
|
||||
SampledTexture s(ast::TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.type(), &f32);
|
||||
}
|
||||
|
||||
TEST_F(SampledTextureTest, TypeName) {
|
||||
F32 f32;
|
||||
SampledTexture s(TextureDimension::k3d, &f32);
|
||||
SampledTexture s(ast::TextureDimension::k3d, &f32);
|
||||
EXPECT_EQ(s.type_name(), "__sampled_texture_3d__f32");
|
||||
}
|
||||
|
||||
TEST_F(SampledTextureTest, FriendlyName) {
|
||||
SampledTexture s(TextureDimension::k3d, ty.f32());
|
||||
SampledTexture s(ast::TextureDimension::k3d, ty.f32());
|
||||
EXPECT_EQ(s.FriendlyName(Symbols()), "texture_3d<f32>");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,19 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Sampler);
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, SamplerKind kind) {
|
||||
switch (kind) {
|
||||
case SamplerKind::kSampler:
|
||||
out << "sampler";
|
||||
break;
|
||||
case SamplerKind::kComparisonSampler:
|
||||
out << "comparison_sampler";
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Sampler::Sampler(SamplerKind kind) : kind_(kind) {}
|
||||
Sampler::Sampler(ast::SamplerKind kind) : kind_(kind) {}
|
||||
|
||||
Sampler::Sampler(Sampler&&) = default;
|
||||
|
||||
@@ -41,11 +29,11 @@ Sampler::~Sampler() = default;
|
||||
|
||||
std::string Sampler::type_name() const {
|
||||
return std::string("__sampler_") +
|
||||
(kind_ == SamplerKind::kSampler ? "sampler" : "comparison");
|
||||
(kind_ == ast::SamplerKind::kSampler ? "sampler" : "comparison");
|
||||
}
|
||||
|
||||
std::string Sampler::FriendlyName(const SymbolTable&) const {
|
||||
return kind_ == SamplerKind::kSampler ? "sampler" : "sampler_comparison";
|
||||
return kind_ == ast::SamplerKind::kSampler ? "sampler" : "sampler_comparison";
|
||||
}
|
||||
|
||||
Sampler* Sampler::Clone(CloneContext* ctx) const {
|
||||
|
||||
@@ -17,35 +17,29 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "src/ast/sampler.h"
|
||||
#include "src/sem/type.h"
|
||||
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
/// The different kinds of samplers
|
||||
enum class SamplerKind {
|
||||
/// A regular sampler
|
||||
kSampler,
|
||||
/// A comparison sampler
|
||||
kComparisonSampler
|
||||
};
|
||||
std::ostream& operator<<(std::ostream& out, SamplerKind kind);
|
||||
|
||||
/// A sampler type.
|
||||
class Sampler : public Castable<Sampler, Type> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param kind the kind of sampler
|
||||
explicit Sampler(SamplerKind kind);
|
||||
explicit Sampler(ast::SamplerKind kind);
|
||||
/// Move constructor
|
||||
Sampler(Sampler&&);
|
||||
~Sampler() override;
|
||||
|
||||
/// @returns the sampler type
|
||||
SamplerKind kind() const { return kind_; }
|
||||
ast::SamplerKind kind() const { return kind_; }
|
||||
|
||||
/// @returns true if this is a comparison sampler
|
||||
bool IsComparison() const { return kind_ == SamplerKind::kComparisonSampler; }
|
||||
bool IsComparison() const {
|
||||
return kind_ == ast::SamplerKind::kComparisonSampler;
|
||||
}
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override;
|
||||
@@ -61,7 +55,7 @@ class Sampler : public Castable<Sampler, Type> {
|
||||
Sampler* Clone(CloneContext* ctx) const override;
|
||||
|
||||
private:
|
||||
SamplerKind const kind_;
|
||||
ast::SamplerKind const kind_;
|
||||
};
|
||||
|
||||
} // namespace sem
|
||||
|
||||
@@ -23,18 +23,18 @@ namespace {
|
||||
using SamplerTest = TestHelper;
|
||||
|
||||
TEST_F(SamplerTest, Creation) {
|
||||
Sampler s{SamplerKind::kSampler};
|
||||
EXPECT_EQ(s.kind(), SamplerKind::kSampler);
|
||||
Sampler s{ast::SamplerKind::kSampler};
|
||||
EXPECT_EQ(s.kind(), ast::SamplerKind::kSampler);
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, Creation_ComparisonSampler) {
|
||||
Sampler s{SamplerKind::kComparisonSampler};
|
||||
EXPECT_EQ(s.kind(), SamplerKind::kComparisonSampler);
|
||||
Sampler s{ast::SamplerKind::kComparisonSampler};
|
||||
EXPECT_EQ(s.kind(), ast::SamplerKind::kComparisonSampler);
|
||||
EXPECT_TRUE(s.IsComparison());
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, Is) {
|
||||
Sampler s{SamplerKind::kSampler};
|
||||
Sampler s{ast::SamplerKind::kSampler};
|
||||
Type* ty = &s;
|
||||
EXPECT_FALSE(ty->Is<AccessControl>());
|
||||
EXPECT_FALSE(ty->Is<Alias>());
|
||||
@@ -52,22 +52,22 @@ TEST_F(SamplerTest, Is) {
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, TypeName_Sampler) {
|
||||
Sampler s{SamplerKind::kSampler};
|
||||
Sampler s{ast::SamplerKind::kSampler};
|
||||
EXPECT_EQ(s.type_name(), "__sampler_sampler");
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, TypeName_Comparison) {
|
||||
Sampler s{SamplerKind::kComparisonSampler};
|
||||
Sampler s{ast::SamplerKind::kComparisonSampler};
|
||||
EXPECT_EQ(s.type_name(), "__sampler_comparison");
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, FriendlyNameSampler) {
|
||||
Sampler s{SamplerKind::kSampler};
|
||||
Sampler s{ast::SamplerKind::kSampler};
|
||||
EXPECT_EQ(s.FriendlyName(Symbols()), "sampler");
|
||||
}
|
||||
|
||||
TEST_F(SamplerTest, FriendlyNameComparisonSampler) {
|
||||
Sampler s{SamplerKind::kComparisonSampler};
|
||||
Sampler s{ast::SamplerKind::kComparisonSampler};
|
||||
EXPECT_EQ(s.FriendlyName(Symbols()), "sampler_comparison");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,124 +21,8 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::StorageTexture);
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
// Note, these names match the names in the WGSL spec. This behaviour is used
|
||||
// in the WGSL writer to emit the texture format names.
|
||||
std::ostream& operator<<(std::ostream& out, ImageFormat format) {
|
||||
switch (format) {
|
||||
case ImageFormat::kNone:
|
||||
out << "none";
|
||||
break;
|
||||
case ImageFormat::kR8Unorm:
|
||||
out << "r8unorm";
|
||||
break;
|
||||
case ImageFormat::kR8Snorm:
|
||||
out << "r8snorm";
|
||||
break;
|
||||
case ImageFormat::kR8Uint:
|
||||
out << "r8uint";
|
||||
break;
|
||||
case ImageFormat::kR8Sint:
|
||||
out << "r8sint";
|
||||
break;
|
||||
case ImageFormat::kR16Uint:
|
||||
out << "r16uint";
|
||||
break;
|
||||
case ImageFormat::kR16Sint:
|
||||
out << "r16sint";
|
||||
break;
|
||||
case ImageFormat::kR16Float:
|
||||
out << "r16float";
|
||||
break;
|
||||
case ImageFormat::kRg8Unorm:
|
||||
out << "rg8unorm";
|
||||
break;
|
||||
case ImageFormat::kRg8Snorm:
|
||||
out << "rg8snorm";
|
||||
break;
|
||||
case ImageFormat::kRg8Uint:
|
||||
out << "rg8uint";
|
||||
break;
|
||||
case ImageFormat::kRg8Sint:
|
||||
out << "rg8sint";
|
||||
break;
|
||||
case ImageFormat::kR32Uint:
|
||||
out << "r32uint";
|
||||
break;
|
||||
case ImageFormat::kR32Sint:
|
||||
out << "r32sint";
|
||||
break;
|
||||
case ImageFormat::kR32Float:
|
||||
out << "r32float";
|
||||
break;
|
||||
case ImageFormat::kRg16Uint:
|
||||
out << "rg16uint";
|
||||
break;
|
||||
case ImageFormat::kRg16Sint:
|
||||
out << "rg16sint";
|
||||
break;
|
||||
case ImageFormat::kRg16Float:
|
||||
out << "rg16float";
|
||||
break;
|
||||
case ImageFormat::kRgba8Unorm:
|
||||
out << "rgba8unorm";
|
||||
break;
|
||||
case ImageFormat::kRgba8UnormSrgb:
|
||||
out << "rgba8unorm_srgb";
|
||||
break;
|
||||
case ImageFormat::kRgba8Snorm:
|
||||
out << "rgba8snorm";
|
||||
break;
|
||||
case ImageFormat::kRgba8Uint:
|
||||
out << "rgba8uint";
|
||||
break;
|
||||
case ImageFormat::kRgba8Sint:
|
||||
out << "rgba8sint";
|
||||
break;
|
||||
case ImageFormat::kBgra8Unorm:
|
||||
out << "bgra8unorm";
|
||||
break;
|
||||
case ImageFormat::kBgra8UnormSrgb:
|
||||
out << "bgra8unorm_srgb";
|
||||
break;
|
||||
case ImageFormat::kRgb10A2Unorm:
|
||||
out << "rgb10a2unorm";
|
||||
break;
|
||||
case ImageFormat::kRg11B10Float:
|
||||
out << "rg11b10float";
|
||||
break;
|
||||
case ImageFormat::kRg32Uint:
|
||||
out << "rg32uint";
|
||||
break;
|
||||
case ImageFormat::kRg32Sint:
|
||||
out << "rg32sint";
|
||||
break;
|
||||
case ImageFormat::kRg32Float:
|
||||
out << "rg32float";
|
||||
break;
|
||||
case ImageFormat::kRgba16Uint:
|
||||
out << "rgba16uint";
|
||||
break;
|
||||
case ImageFormat::kRgba16Sint:
|
||||
out << "rgba16sint";
|
||||
break;
|
||||
case ImageFormat::kRgba16Float:
|
||||
out << "rgba16float";
|
||||
break;
|
||||
case ImageFormat::kRgba32Uint:
|
||||
out << "rgba32uint";
|
||||
break;
|
||||
case ImageFormat::kRgba32Sint:
|
||||
out << "rgba32sint";
|
||||
break;
|
||||
case ImageFormat::kRgba32Float:
|
||||
out << "rgba32float";
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
StorageTexture::StorageTexture(TextureDimension dim,
|
||||
ImageFormat format,
|
||||
StorageTexture::StorageTexture(ast::TextureDimension dim,
|
||||
ast::ImageFormat format,
|
||||
sem::Type* subtype)
|
||||
: Base(dim), image_format_(format), subtype_(subtype) {}
|
||||
|
||||
@@ -164,54 +48,54 @@ StorageTexture* StorageTexture::Clone(CloneContext* ctx) const {
|
||||
return ctx->dst->create<StorageTexture>(dim(), image_format_, ty);
|
||||
}
|
||||
|
||||
sem::Type* StorageTexture::SubtypeFor(sem::ImageFormat format,
|
||||
sem::Type* StorageTexture::SubtypeFor(ast::ImageFormat format,
|
||||
sem::Manager& type_mgr) {
|
||||
switch (format) {
|
||||
case sem::ImageFormat::kR8Uint:
|
||||
case sem::ImageFormat::kR16Uint:
|
||||
case sem::ImageFormat::kRg8Uint:
|
||||
case sem::ImageFormat::kR32Uint:
|
||||
case sem::ImageFormat::kRg16Uint:
|
||||
case sem::ImageFormat::kRgba8Uint:
|
||||
case sem::ImageFormat::kRg32Uint:
|
||||
case sem::ImageFormat::kRgba16Uint:
|
||||
case sem::ImageFormat::kRgba32Uint: {
|
||||
case ast::ImageFormat::kR8Uint:
|
||||
case ast::ImageFormat::kR16Uint:
|
||||
case ast::ImageFormat::kRg8Uint:
|
||||
case ast::ImageFormat::kR32Uint:
|
||||
case ast::ImageFormat::kRg16Uint:
|
||||
case ast::ImageFormat::kRgba8Uint:
|
||||
case ast::ImageFormat::kRg32Uint:
|
||||
case ast::ImageFormat::kRgba16Uint:
|
||||
case ast::ImageFormat::kRgba32Uint: {
|
||||
return type_mgr.Get<sem::U32>();
|
||||
}
|
||||
|
||||
case sem::ImageFormat::kR8Sint:
|
||||
case sem::ImageFormat::kR16Sint:
|
||||
case sem::ImageFormat::kRg8Sint:
|
||||
case sem::ImageFormat::kR32Sint:
|
||||
case sem::ImageFormat::kRg16Sint:
|
||||
case sem::ImageFormat::kRgba8Sint:
|
||||
case sem::ImageFormat::kRg32Sint:
|
||||
case sem::ImageFormat::kRgba16Sint:
|
||||
case sem::ImageFormat::kRgba32Sint: {
|
||||
case ast::ImageFormat::kR8Sint:
|
||||
case ast::ImageFormat::kR16Sint:
|
||||
case ast::ImageFormat::kRg8Sint:
|
||||
case ast::ImageFormat::kR32Sint:
|
||||
case ast::ImageFormat::kRg16Sint:
|
||||
case ast::ImageFormat::kRgba8Sint:
|
||||
case ast::ImageFormat::kRg32Sint:
|
||||
case ast::ImageFormat::kRgba16Sint:
|
||||
case ast::ImageFormat::kRgba32Sint: {
|
||||
return type_mgr.Get<sem::I32>();
|
||||
}
|
||||
|
||||
case sem::ImageFormat::kR8Unorm:
|
||||
case sem::ImageFormat::kRg8Unorm:
|
||||
case sem::ImageFormat::kRgba8Unorm:
|
||||
case sem::ImageFormat::kRgba8UnormSrgb:
|
||||
case sem::ImageFormat::kBgra8Unorm:
|
||||
case sem::ImageFormat::kBgra8UnormSrgb:
|
||||
case sem::ImageFormat::kRgb10A2Unorm:
|
||||
case sem::ImageFormat::kR8Snorm:
|
||||
case sem::ImageFormat::kRg8Snorm:
|
||||
case sem::ImageFormat::kRgba8Snorm:
|
||||
case sem::ImageFormat::kR16Float:
|
||||
case sem::ImageFormat::kR32Float:
|
||||
case sem::ImageFormat::kRg16Float:
|
||||
case sem::ImageFormat::kRg11B10Float:
|
||||
case sem::ImageFormat::kRg32Float:
|
||||
case sem::ImageFormat::kRgba16Float:
|
||||
case sem::ImageFormat::kRgba32Float: {
|
||||
case ast::ImageFormat::kR8Unorm:
|
||||
case ast::ImageFormat::kRg8Unorm:
|
||||
case ast::ImageFormat::kRgba8Unorm:
|
||||
case ast::ImageFormat::kRgba8UnormSrgb:
|
||||
case ast::ImageFormat::kBgra8Unorm:
|
||||
case ast::ImageFormat::kBgra8UnormSrgb:
|
||||
case ast::ImageFormat::kRgb10A2Unorm:
|
||||
case ast::ImageFormat::kR8Snorm:
|
||||
case ast::ImageFormat::kRg8Snorm:
|
||||
case ast::ImageFormat::kRgba8Snorm:
|
||||
case ast::ImageFormat::kR16Float:
|
||||
case ast::ImageFormat::kR32Float:
|
||||
case ast::ImageFormat::kRg16Float:
|
||||
case ast::ImageFormat::kRg11B10Float:
|
||||
case ast::ImageFormat::kRg32Float:
|
||||
case ast::ImageFormat::kRgba16Float:
|
||||
case ast::ImageFormat::kRgba32Float: {
|
||||
return type_mgr.Get<sem::F32>();
|
||||
}
|
||||
|
||||
case sem::ImageFormat::kNone:
|
||||
case ast::ImageFormat::kNone:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "src/ast/storage_texture.h"
|
||||
#include "src/sem/texture_type.h"
|
||||
|
||||
namespace tint {
|
||||
@@ -24,47 +25,6 @@ namespace sem {
|
||||
|
||||
class Manager;
|
||||
|
||||
/// The image format in the storage texture
|
||||
enum class ImageFormat {
|
||||
kNone = -1,
|
||||
kR8Unorm,
|
||||
kR8Snorm,
|
||||
kR8Uint,
|
||||
kR8Sint,
|
||||
kR16Uint,
|
||||
kR16Sint,
|
||||
kR16Float,
|
||||
kRg8Unorm,
|
||||
kRg8Snorm,
|
||||
kRg8Uint,
|
||||
kRg8Sint,
|
||||
kR32Uint,
|
||||
kR32Sint,
|
||||
kR32Float,
|
||||
kRg16Uint,
|
||||
kRg16Sint,
|
||||
kRg16Float,
|
||||
kRgba8Unorm,
|
||||
kRgba8UnormSrgb,
|
||||
kRgba8Snorm,
|
||||
kRgba8Uint,
|
||||
kRgba8Sint,
|
||||
kBgra8Unorm,
|
||||
kBgra8UnormSrgb,
|
||||
kRgb10A2Unorm,
|
||||
kRg11B10Float,
|
||||
kRg32Uint,
|
||||
kRg32Sint,
|
||||
kRg32Float,
|
||||
kRgba16Uint,
|
||||
kRgba16Sint,
|
||||
kRgba16Float,
|
||||
kRgba32Uint,
|
||||
kRgba32Sint,
|
||||
kRgba32Float,
|
||||
};
|
||||
std::ostream& operator<<(std::ostream& out, ImageFormat dim);
|
||||
|
||||
/// A storage texture type.
|
||||
class StorageTexture : public Castable<StorageTexture, Texture> {
|
||||
public:
|
||||
@@ -72,7 +32,9 @@ class StorageTexture : public Castable<StorageTexture, Texture> {
|
||||
/// @param dim the dimensionality of the texture
|
||||
/// @param format the image format of the texture
|
||||
/// @param subtype the storage subtype. Use SubtypeFor() to calculate this.
|
||||
StorageTexture(TextureDimension dim, ImageFormat format, sem::Type* subtype);
|
||||
StorageTexture(ast::TextureDimension dim,
|
||||
ast::ImageFormat format,
|
||||
sem::Type* subtype);
|
||||
|
||||
/// Move constructor
|
||||
StorageTexture(StorageTexture&&);
|
||||
@@ -82,7 +44,7 @@ class StorageTexture : public Castable<StorageTexture, Texture> {
|
||||
Type* type() const { return subtype_; }
|
||||
|
||||
/// @returns the image format
|
||||
ImageFormat image_format() const { return image_format_; }
|
||||
ast::ImageFormat image_format() const { return image_format_; }
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override;
|
||||
@@ -100,10 +62,10 @@ class StorageTexture : public Castable<StorageTexture, Texture> {
|
||||
/// @param format the storage texture image format
|
||||
/// @param type_mgr the sem::Manager used to build the returned type
|
||||
/// @returns the storage texture subtype for the given ImageFormat
|
||||
static sem::Type* SubtypeFor(sem::ImageFormat format, sem::Manager& type_mgr);
|
||||
static sem::Type* SubtypeFor(ast::ImageFormat format, sem::Manager& type_mgr);
|
||||
|
||||
private:
|
||||
ImageFormat const image_format_;
|
||||
ast::ImageFormat const image_format_;
|
||||
Type* const subtype_;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ using StorageTextureTest = TestHelper;
|
||||
|
||||
TEST_F(StorageTextureTest, Is) {
|
||||
auto* subtype =
|
||||
StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Float, subtype);
|
||||
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Float, subtype);
|
||||
Type* ty = s;
|
||||
EXPECT_FALSE(ty->Is<AccessControl>());
|
||||
EXPECT_FALSE(ty->Is<Alias>());
|
||||
@@ -49,9 +49,9 @@ TEST_F(StorageTextureTest, Is) {
|
||||
|
||||
TEST_F(StorageTextureTest, IsTexture) {
|
||||
auto* subtype =
|
||||
StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Float, subtype);
|
||||
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Float, subtype);
|
||||
Texture* ty = s;
|
||||
EXPECT_FALSE(ty->Is<DepthTexture>());
|
||||
EXPECT_FALSE(ty->Is<ExternalTexture>());
|
||||
@@ -61,42 +61,42 @@ TEST_F(StorageTextureTest, IsTexture) {
|
||||
|
||||
TEST_F(StorageTextureTest, Dim) {
|
||||
auto* subtype =
|
||||
StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Float, subtype);
|
||||
EXPECT_EQ(s->dim(), TextureDimension::k2dArray);
|
||||
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Float, subtype);
|
||||
EXPECT_EQ(s->dim(), ast::TextureDimension::k2dArray);
|
||||
}
|
||||
|
||||
TEST_F(StorageTextureTest, Format) {
|
||||
auto* subtype =
|
||||
StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Float, subtype);
|
||||
EXPECT_EQ(s->image_format(), ImageFormat::kRgba32Float);
|
||||
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Float, subtype);
|
||||
EXPECT_EQ(s->image_format(), ast::ImageFormat::kRgba32Float);
|
||||
}
|
||||
|
||||
TEST_F(StorageTextureTest, TypeName) {
|
||||
auto* subtype =
|
||||
StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Float, subtype);
|
||||
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Float, subtype);
|
||||
EXPECT_EQ(s->type_name(), "__storage_texture_2d_array_rgba32float");
|
||||
}
|
||||
|
||||
TEST_F(StorageTextureTest, FriendlyName) {
|
||||
auto* subtype =
|
||||
StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Float, subtype);
|
||||
StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
|
||||
auto* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Float, subtype);
|
||||
EXPECT_EQ(s->FriendlyName(Symbols()),
|
||||
"texture_storage_2d_array<rgba32float>");
|
||||
}
|
||||
|
||||
TEST_F(StorageTextureTest, F32) {
|
||||
auto* subtype =
|
||||
sem::StorageTexture::SubtypeFor(ImageFormat::kRgba32Float, Types());
|
||||
Type* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Float, subtype);
|
||||
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Float, Types());
|
||||
Type* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Float, subtype);
|
||||
|
||||
auto program = Build();
|
||||
|
||||
@@ -108,9 +108,9 @@ TEST_F(StorageTextureTest, F32) {
|
||||
|
||||
TEST_F(StorageTextureTest, U32) {
|
||||
auto* subtype =
|
||||
sem::StorageTexture::SubtypeFor(ImageFormat::kRg32Uint, Types());
|
||||
Type* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRg32Uint, subtype);
|
||||
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kRg32Uint, Types());
|
||||
Type* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRg32Uint, subtype);
|
||||
|
||||
auto program = Build();
|
||||
|
||||
@@ -122,9 +122,9 @@ TEST_F(StorageTextureTest, U32) {
|
||||
|
||||
TEST_F(StorageTextureTest, I32) {
|
||||
auto* subtype =
|
||||
sem::StorageTexture::SubtypeFor(ImageFormat::kRgba32Sint, Types());
|
||||
Type* s = create<StorageTexture>(TextureDimension::k2dArray,
|
||||
ImageFormat::kRgba32Sint, subtype);
|
||||
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kRgba32Sint, Types());
|
||||
Type* s = create<StorageTexture>(ast::TextureDimension::k2dArray,
|
||||
ast::ImageFormat::kRgba32Sint, subtype);
|
||||
|
||||
auto program = Build();
|
||||
|
||||
|
||||
@@ -19,66 +19,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Texture);
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, TextureDimension dim) {
|
||||
switch (dim) {
|
||||
case TextureDimension::kNone:
|
||||
out << "None";
|
||||
break;
|
||||
case TextureDimension::k1d:
|
||||
out << "1d";
|
||||
break;
|
||||
case TextureDimension::k2d:
|
||||
out << "2d";
|
||||
break;
|
||||
case TextureDimension::k2dArray:
|
||||
out << "2d_array";
|
||||
break;
|
||||
case TextureDimension::k3d:
|
||||
out << "3d";
|
||||
break;
|
||||
case TextureDimension::kCube:
|
||||
out << "cube";
|
||||
break;
|
||||
case TextureDimension::kCubeArray:
|
||||
out << "cube_array";
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool IsTextureArray(TextureDimension dim) {
|
||||
switch (dim) {
|
||||
case TextureDimension::k2dArray:
|
||||
case TextureDimension::kCubeArray:
|
||||
return true;
|
||||
case TextureDimension::k2d:
|
||||
case TextureDimension::kNone:
|
||||
case TextureDimension::k1d:
|
||||
case TextureDimension::k3d:
|
||||
case TextureDimension::kCube:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int NumCoordinateAxes(TextureDimension dim) {
|
||||
switch (dim) {
|
||||
case TextureDimension::kNone:
|
||||
return 0;
|
||||
case TextureDimension::k1d:
|
||||
return 1;
|
||||
case TextureDimension::k2d:
|
||||
case TextureDimension::k2dArray:
|
||||
return 2;
|
||||
case TextureDimension::k3d:
|
||||
case TextureDimension::kCube:
|
||||
case TextureDimension::kCubeArray:
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Texture::Texture(TextureDimension dim) : dim_(dim) {}
|
||||
Texture::Texture(ast::TextureDimension dim) : dim_(dim) {}
|
||||
|
||||
Texture::Texture(Texture&&) = default;
|
||||
|
||||
|
||||
@@ -15,58 +15,27 @@
|
||||
#ifndef SRC_SEM_TEXTURE_TYPE_H_
|
||||
#define SRC_SEM_TEXTURE_TYPE_H_
|
||||
|
||||
#include "src/ast/texture.h"
|
||||
#include "src/sem/type.h"
|
||||
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
/// The dimensionality of the texture
|
||||
enum class TextureDimension {
|
||||
/// Invalid texture
|
||||
kNone = -1,
|
||||
/// 1 dimensional texture
|
||||
k1d,
|
||||
/// 2 dimensional texture
|
||||
k2d,
|
||||
/// 2 dimensional array texture
|
||||
k2dArray,
|
||||
/// 3 dimensional texture
|
||||
k3d,
|
||||
/// cube texture
|
||||
kCube,
|
||||
/// cube array texture
|
||||
kCubeArray,
|
||||
};
|
||||
std::ostream& operator<<(std::ostream& out, TextureDimension dim);
|
||||
|
||||
/// @param dim the TextureDimension to query
|
||||
/// @return true if the given TextureDimension is an array texture
|
||||
bool IsTextureArray(TextureDimension dim);
|
||||
|
||||
/// Returns the number of axes in the coordinate for a dimensionality.
|
||||
/// None -> 0
|
||||
/// 1D -> 1
|
||||
/// 2D, 2DArray -> 2
|
||||
/// 3D, Cube, CubeArray -> 3
|
||||
/// @param dim the TextureDimension to query
|
||||
/// @return number of dimensions in a coordinate for the dimensionality
|
||||
int NumCoordinateAxes(TextureDimension dim);
|
||||
|
||||
/// A texture type.
|
||||
class Texture : public Castable<Texture, Type> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param dim the dimensionality of the texture
|
||||
explicit Texture(TextureDimension dim);
|
||||
explicit Texture(ast::TextureDimension dim);
|
||||
/// Move constructor
|
||||
Texture(Texture&&);
|
||||
~Texture() override;
|
||||
|
||||
/// @returns the texture dimension
|
||||
TextureDimension dim() const { return dim_; }
|
||||
ast::TextureDimension dim() const { return dim_; }
|
||||
|
||||
private:
|
||||
TextureDimension const dim_;
|
||||
ast::TextureDimension const dim_;
|
||||
};
|
||||
|
||||
} // namespace sem
|
||||
|
||||
@@ -23,23 +23,23 @@ namespace {
|
||||
using TextureTypeTest = TestHelper;
|
||||
|
||||
TEST_F(TextureTypeTest, IsTextureArray) {
|
||||
EXPECT_EQ(false, IsTextureArray(TextureDimension::kNone));
|
||||
EXPECT_EQ(false, IsTextureArray(TextureDimension::k1d));
|
||||
EXPECT_EQ(false, IsTextureArray(TextureDimension::k2d));
|
||||
EXPECT_EQ(true, IsTextureArray(TextureDimension::k2dArray));
|
||||
EXPECT_EQ(false, IsTextureArray(TextureDimension::k3d));
|
||||
EXPECT_EQ(false, IsTextureArray(TextureDimension::kCube));
|
||||
EXPECT_EQ(true, IsTextureArray(TextureDimension::kCubeArray));
|
||||
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::kNone));
|
||||
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::k1d));
|
||||
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::k2d));
|
||||
EXPECT_EQ(true, IsTextureArray(ast::TextureDimension::k2dArray));
|
||||
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::k3d));
|
||||
EXPECT_EQ(false, IsTextureArray(ast::TextureDimension::kCube));
|
||||
EXPECT_EQ(true, IsTextureArray(ast::TextureDimension::kCubeArray));
|
||||
}
|
||||
|
||||
TEST_F(TextureTypeTest, NumCoordinateAxes) {
|
||||
EXPECT_EQ(0, NumCoordinateAxes(TextureDimension::kNone));
|
||||
EXPECT_EQ(1, NumCoordinateAxes(TextureDimension::k1d));
|
||||
EXPECT_EQ(2, NumCoordinateAxes(TextureDimension::k2d));
|
||||
EXPECT_EQ(2, NumCoordinateAxes(TextureDimension::k2dArray));
|
||||
EXPECT_EQ(3, NumCoordinateAxes(TextureDimension::k3d));
|
||||
EXPECT_EQ(3, NumCoordinateAxes(TextureDimension::kCube));
|
||||
EXPECT_EQ(3, NumCoordinateAxes(TextureDimension::kCubeArray));
|
||||
EXPECT_EQ(0, NumCoordinateAxes(ast::TextureDimension::kNone));
|
||||
EXPECT_EQ(1, NumCoordinateAxes(ast::TextureDimension::k1d));
|
||||
EXPECT_EQ(2, NumCoordinateAxes(ast::TextureDimension::k2d));
|
||||
EXPECT_EQ(2, NumCoordinateAxes(ast::TextureDimension::k2dArray));
|
||||
EXPECT_EQ(3, NumCoordinateAxes(ast::TextureDimension::k3d));
|
||||
EXPECT_EQ(3, NumCoordinateAxes(ast::TextureDimension::kCube));
|
||||
EXPECT_EQ(3, NumCoordinateAxes(ast::TextureDimension::kCubeArray));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user