type::StorageTexture: Remove set_type()

The subtype of a storage texture is statically determinisic from the ImageFormat, and does not need to be late-set by the TypeDeterminer.

Add StorageTexture::SubtypeFor() helper for returning the subtype for a given ImageFormat, and add the subtype as another immutable constructor parameter.

Bug: tint:390
Change-Id: Ibe732293e3142064b60f4e666a7eb39ae8db50e7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40064
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2021-02-03 20:28:26 +00:00
committed by Commit Bot service account
parent b17aea159c
commit 48b384168c
14 changed files with 168 additions and 143 deletions

View File

@@ -177,9 +177,8 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
nullptr, decos);
case ast::intrinsic::test::TextureKind::kStorage: {
auto* st =
b->create<type::StorageTexture>(texture_dimension, image_format);
st->set_type(datatype);
auto* st = b->create<type::StorageTexture>(texture_dimension,
image_format, datatype);
auto* ac = b->create<type::AccessControl>(access_control, st);
return b->Global("texture", ast::StorageClass::kUniformConstant, ac,