mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Move ast/texel_format to type/texel_format.
This CL moves the texel_format code from ast to type to remove the dependency on ast from type. Change-Id: Ie075b2315360dc782284a7b4b55a817a9de31d78 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117606 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
61c16eb448
commit
57c0bbc2a5
@@ -231,7 +231,7 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonConstructible_Handle) {
|
||||
// a = b;
|
||||
|
||||
auto make_type = [&] {
|
||||
return ty.storage_texture(type::TextureDimension::k1d, ast::TexelFormat::kRgba8Unorm,
|
||||
return ty.storage_texture(type::TextureDimension::k1d, type::TexelFormat::kRgba8Unorm,
|
||||
type::Access::kWrite);
|
||||
};
|
||||
|
||||
|
||||
@@ -2105,7 +2105,7 @@ inline std::ostream& operator<<(std::ostream& out, Texture data) {
|
||||
struct TextureTestParams {
|
||||
type::TextureDimension dim;
|
||||
Texture type = Texture::kF32;
|
||||
ast::TexelFormat format = ast::TexelFormat::kR32Float;
|
||||
type::TexelFormat format = type::TexelFormat::kR32Float;
|
||||
};
|
||||
inline std::ostream& operator<<(std::ostream& out, TextureTestParams data) {
|
||||
out << data.dim << "_" << data.type;
|
||||
|
||||
@@ -1296,7 +1296,7 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) {
|
||||
GlobalVar(Sym(), ty.depth_multisampled_texture(type::TextureDimension::k2d));
|
||||
GlobalVar(Sym(), ty.external_texture());
|
||||
GlobalVar(Sym(), ty.multisampled_texture(type::TextureDimension::k2d, T));
|
||||
GlobalVar(Sym(), ty.storage_texture(type::TextureDimension::k2d, ast::TexelFormat::kR32Float,
|
||||
GlobalVar(Sym(), ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
|
||||
type::Access::kRead)); //
|
||||
GlobalVar(Sym(), ty.sampler(ast::SamplerKind::kSampler));
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ class TemplateNumberMatcher : public NumberMatcher {
|
||||
// TODO(bclayton): See if we can move more of this hand-rolled code to the
|
||||
// template
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
using TexelFormat = ast::TexelFormat;
|
||||
using TexelFormat = type::TexelFormat;
|
||||
using Access = type::Access;
|
||||
using AddressSpace = type::AddressSpace;
|
||||
using ParameterUsage = sem::ParameterUsage;
|
||||
|
||||
@@ -414,9 +414,9 @@ TEST_F(IntrinsicTableTest, MatchWOStorageTexture) {
|
||||
auto* i32 = create<type::I32>();
|
||||
auto* vec2_i32 = create<type::Vector>(i32, 2u);
|
||||
auto* vec4_f32 = create<type::Vector>(f32, 4u);
|
||||
auto* subtype = type::StorageTexture::SubtypeFor(ast::TexelFormat::kR32Float, Types());
|
||||
auto* subtype = type::StorageTexture::SubtypeFor(type::TexelFormat::kR32Float, Types());
|
||||
auto* tex = create<type::StorageTexture>(
|
||||
type::TextureDimension::k2d, ast::TexelFormat::kR32Float, type::Access::kWrite, subtype);
|
||||
type::TextureDimension::k2d, type::TexelFormat::kR32Float, type::Access::kWrite, subtype);
|
||||
|
||||
auto result = table->Lookup(BuiltinType::kTextureStore, utils::Vector{tex, vec2_i32, vec4_f32},
|
||||
sem::EvaluationStage::kConstant, Source{});
|
||||
|
||||
@@ -190,7 +190,7 @@ TEST_P(SideEffectsBuiltinTest, Test) {
|
||||
GlobalVar("t2d_multi", ty.multisampled_texture(type::TextureDimension::k2d, ty.f32()),
|
||||
Group(0_a), Binding(AInt(next_binding++)));
|
||||
GlobalVar("tstorage2d",
|
||||
ty.storage_texture(type::TextureDimension::k2d, ast::TexelFormat::kR32Float,
|
||||
ty.storage_texture(type::TextureDimension::k2d, type::TexelFormat::kR32Float,
|
||||
type::Access::kWrite),
|
||||
Group(0_a), Binding(AInt(next_binding++)));
|
||||
GlobalVar("s2d", ty.sampler(ast::SamplerKind::kSampler), Group(0_a),
|
||||
|
||||
@@ -1113,7 +1113,7 @@ TEST_P(StorageTextureDimensionTest, All) {
|
||||
// var a : texture_storage_*<ru32int, write>;
|
||||
auto& params = GetParam();
|
||||
|
||||
auto* st = ty.storage_texture(Source{{12, 34}}, params.dim, ast::TexelFormat::kR32Uint,
|
||||
auto* st = ty.storage_texture(Source{{12, 34}}, params.dim, type::TexelFormat::kR32Uint,
|
||||
type::Access::kWrite);
|
||||
|
||||
GlobalVar("a", st, Group(0_a), Binding(0_a));
|
||||
@@ -1131,27 +1131,27 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest,
|
||||
testing::ValuesIn(Dimension_cases));
|
||||
|
||||
struct FormatParams {
|
||||
ast::TexelFormat format;
|
||||
type::TexelFormat format;
|
||||
bool is_valid;
|
||||
};
|
||||
|
||||
static constexpr FormatParams format_cases[] = {FormatParams{ast::TexelFormat::kBgra8Unorm, true},
|
||||
FormatParams{ast::TexelFormat::kR32Float, true},
|
||||
FormatParams{ast::TexelFormat::kR32Sint, true},
|
||||
FormatParams{ast::TexelFormat::kR32Uint, true},
|
||||
FormatParams{ast::TexelFormat::kRg32Float, true},
|
||||
FormatParams{ast::TexelFormat::kRg32Sint, true},
|
||||
FormatParams{ast::TexelFormat::kRg32Uint, true},
|
||||
FormatParams{ast::TexelFormat::kRgba16Float, true},
|
||||
FormatParams{ast::TexelFormat::kRgba16Sint, true},
|
||||
FormatParams{ast::TexelFormat::kRgba16Uint, true},
|
||||
FormatParams{ast::TexelFormat::kRgba32Float, true},
|
||||
FormatParams{ast::TexelFormat::kRgba32Sint, true},
|
||||
FormatParams{ast::TexelFormat::kRgba32Uint, true},
|
||||
FormatParams{ast::TexelFormat::kRgba8Sint, true},
|
||||
FormatParams{ast::TexelFormat::kRgba8Snorm, true},
|
||||
FormatParams{ast::TexelFormat::kRgba8Uint, true},
|
||||
FormatParams{ast::TexelFormat::kRgba8Unorm, true}};
|
||||
static constexpr FormatParams format_cases[] = {FormatParams{type::TexelFormat::kBgra8Unorm, true},
|
||||
FormatParams{type::TexelFormat::kR32Float, true},
|
||||
FormatParams{type::TexelFormat::kR32Sint, true},
|
||||
FormatParams{type::TexelFormat::kR32Uint, true},
|
||||
FormatParams{type::TexelFormat::kRg32Float, true},
|
||||
FormatParams{type::TexelFormat::kRg32Sint, true},
|
||||
FormatParams{type::TexelFormat::kRg32Uint, true},
|
||||
FormatParams{type::TexelFormat::kRgba16Float, true},
|
||||
FormatParams{type::TexelFormat::kRgba16Sint, true},
|
||||
FormatParams{type::TexelFormat::kRgba16Uint, true},
|
||||
FormatParams{type::TexelFormat::kRgba32Float, true},
|
||||
FormatParams{type::TexelFormat::kRgba32Sint, true},
|
||||
FormatParams{type::TexelFormat::kRgba32Uint, true},
|
||||
FormatParams{type::TexelFormat::kRgba8Sint, true},
|
||||
FormatParams{type::TexelFormat::kRgba8Snorm, true},
|
||||
FormatParams{type::TexelFormat::kRgba8Uint, true},
|
||||
FormatParams{type::TexelFormat::kRgba8Unorm, true}};
|
||||
|
||||
using StorageTextureFormatTest = ResolverTestWithParam<FormatParams>;
|
||||
TEST_P(StorageTextureFormatTest, All) {
|
||||
@@ -1201,7 +1201,7 @@ TEST_F(StorageTextureAccessTest, MissingAccess_Fail) {
|
||||
// var a : texture_storage_1d<ru32int>;
|
||||
|
||||
auto* st = ty.storage_texture(Source{{12, 34}}, type::TextureDimension::k1d,
|
||||
ast::TexelFormat::kR32Uint, type::Access::kUndefined);
|
||||
type::TexelFormat::kR32Uint, type::Access::kUndefined);
|
||||
|
||||
GlobalVar("a", st, Group(0_a), Binding(0_a));
|
||||
|
||||
@@ -1214,7 +1214,7 @@ TEST_F(StorageTextureAccessTest, RWAccess_Fail) {
|
||||
// var a : texture_storage_1d<ru32int, read_write>;
|
||||
|
||||
auto* st = ty.storage_texture(Source{{12, 34}}, type::TextureDimension::k1d,
|
||||
ast::TexelFormat::kR32Uint, type::Access::kReadWrite);
|
||||
type::TexelFormat::kR32Uint, type::Access::kReadWrite);
|
||||
|
||||
GlobalVar("a", st, Group(0_a), Binding(0_a));
|
||||
|
||||
@@ -1228,7 +1228,7 @@ TEST_F(StorageTextureAccessTest, ReadOnlyAccess_Fail) {
|
||||
// var a : texture_storage_1d<ru32int, read>;
|
||||
|
||||
auto* st = ty.storage_texture(Source{{12, 34}}, type::TextureDimension::k1d,
|
||||
ast::TexelFormat::kR32Uint, type::Access::kRead);
|
||||
type::TexelFormat::kR32Uint, type::Access::kRead);
|
||||
|
||||
GlobalVar("a", st, Group(0_a), Binding(0_a));
|
||||
|
||||
@@ -1241,7 +1241,7 @@ TEST_F(StorageTextureAccessTest, WriteOnlyAccess_Pass) {
|
||||
// @group(0) @binding(0)
|
||||
// var a : texture_storage_1d<ru32int, write>;
|
||||
|
||||
auto* st = ty.storage_texture(type::TextureDimension::k1d, ast::TexelFormat::kR32Uint,
|
||||
auto* st = ty.storage_texture(type::TextureDimension::k1d, type::TexelFormat::kR32Uint,
|
||||
type::Access::kWrite);
|
||||
|
||||
GlobalVar("a", st, Group(0_a), Binding(0_a));
|
||||
|
||||
@@ -97,25 +97,25 @@ bool IsValidStorageTextureDimension(type::TextureDimension dim) {
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValidStorageTextureTexelFormat(ast::TexelFormat format) {
|
||||
bool IsValidStorageTextureTexelFormat(type::TexelFormat format) {
|
||||
switch (format) {
|
||||
case ast::TexelFormat::kBgra8Unorm:
|
||||
case ast::TexelFormat::kR32Uint:
|
||||
case ast::TexelFormat::kR32Sint:
|
||||
case ast::TexelFormat::kR32Float:
|
||||
case ast::TexelFormat::kRg32Uint:
|
||||
case ast::TexelFormat::kRg32Sint:
|
||||
case ast::TexelFormat::kRg32Float:
|
||||
case ast::TexelFormat::kRgba8Unorm:
|
||||
case ast::TexelFormat::kRgba8Snorm:
|
||||
case ast::TexelFormat::kRgba8Uint:
|
||||
case ast::TexelFormat::kRgba8Sint:
|
||||
case ast::TexelFormat::kRgba16Uint:
|
||||
case ast::TexelFormat::kRgba16Sint:
|
||||
case ast::TexelFormat::kRgba16Float:
|
||||
case ast::TexelFormat::kRgba32Uint:
|
||||
case ast::TexelFormat::kRgba32Sint:
|
||||
case ast::TexelFormat::kRgba32Float:
|
||||
case type::TexelFormat::kBgra8Unorm:
|
||||
case type::TexelFormat::kR32Uint:
|
||||
case type::TexelFormat::kR32Sint:
|
||||
case type::TexelFormat::kR32Float:
|
||||
case type::TexelFormat::kRg32Uint:
|
||||
case type::TexelFormat::kRg32Sint:
|
||||
case type::TexelFormat::kRg32Float:
|
||||
case type::TexelFormat::kRgba8Unorm:
|
||||
case type::TexelFormat::kRgba8Snorm:
|
||||
case type::TexelFormat::kRgba8Uint:
|
||||
case type::TexelFormat::kRgba8Sint:
|
||||
case type::TexelFormat::kRgba16Uint:
|
||||
case type::TexelFormat::kRgba16Sint:
|
||||
case type::TexelFormat::kRgba16Float:
|
||||
case type::TexelFormat::kRgba32Uint:
|
||||
case type::TexelFormat::kRgba32Sint:
|
||||
case type::TexelFormat::kRgba32Float:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user