writer/spirv: Fix storage class and add decorations for texture test cases

These are required for correct SPIR-V emission.

Bug: tint:444
Change-Id: I6d25dcc6e06af7f9ca9f250758b7901171923773
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/37444
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton 2021-01-12 20:14:18 +00:00 committed by Commit Bot service account
parent 50c5fa1100
commit d1aef67011
2 changed files with 594 additions and 581 deletions

View File

@ -153,26 +153,34 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
ast::Builder* b) const {
auto* datatype = resultVectorComponentType(b);
VariableDecorationList decos = {
b->create<ast::SetDecoration>(0),
b->create<ast::BindingDecoration>(0),
};
switch (texture_kind) {
case ast::intrinsic::test::TextureKind::kRegular:
return b->Var(
"texture", ast::StorageClass::kNone,
b->create<ast::type::SampledTexture>(texture_dimension, datatype));
"texture", ast::StorageClass::kUniformConstant,
b->create<ast::type::SampledTexture>(texture_dimension, datatype),
nullptr, decos);
case ast::intrinsic::test::TextureKind::kDepth:
return b->Var("texture", ast::StorageClass::kNone,
b->create<ast::type::DepthTexture>(texture_dimension));
return b->Var("texture", ast::StorageClass::kUniformConstant,
b->create<ast::type::DepthTexture>(texture_dimension),
nullptr, decos);
case ast::intrinsic::test::TextureKind::kMultisampled:
return b->Var("texture", ast::StorageClass::kNone,
return b->Var("texture", ast::StorageClass::kUniformConstant,
b->create<ast::type::MultisampledTexture>(texture_dimension,
datatype));
datatype),
nullptr, decos);
case ast::intrinsic::test::TextureKind::kStorage: {
auto* st = b->create<ast::type::StorageTexture>(
texture_dimension, access_control, image_format);
st->set_type(datatype);
return b->Var("texture", ast::StorageClass::kNone, st);
return b->Var("texture", ast::StorageClass::kUniformConstant, st, nullptr,
decos);
}
}
@ -182,8 +190,13 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
ast::Variable* TextureOverloadCase::buildSamplerVariable(
ast::Builder* b) const {
return b->Var("sampler", ast::StorageClass::kNone,
b->create<ast::type::Sampler>(sampler_kind));
VariableDecorationList decos = {
b->create<ast::SetDecoration>(0),
b->create<ast::BindingDecoration>(1),
};
return b->Var("sampler", ast::StorageClass::kUniformConstant,
b->create<ast::type::Sampler>(sampler_kind), nullptr, decos);
}
std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {

File diff suppressed because it is too large Load Diff