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:
parent
50c5fa1100
commit
d1aef67011
|
@ -153,26 +153,34 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
|
||||||
ast::Builder* b) const {
|
ast::Builder* b) const {
|
||||||
auto* datatype = resultVectorComponentType(b);
|
auto* datatype = resultVectorComponentType(b);
|
||||||
|
|
||||||
|
VariableDecorationList decos = {
|
||||||
|
b->create<ast::SetDecoration>(0),
|
||||||
|
b->create<ast::BindingDecoration>(0),
|
||||||
|
};
|
||||||
switch (texture_kind) {
|
switch (texture_kind) {
|
||||||
case ast::intrinsic::test::TextureKind::kRegular:
|
case ast::intrinsic::test::TextureKind::kRegular:
|
||||||
return b->Var(
|
return b->Var(
|
||||||
"texture", ast::StorageClass::kNone,
|
"texture", ast::StorageClass::kUniformConstant,
|
||||||
b->create<ast::type::SampledTexture>(texture_dimension, datatype));
|
b->create<ast::type::SampledTexture>(texture_dimension, datatype),
|
||||||
|
nullptr, decos);
|
||||||
|
|
||||||
case ast::intrinsic::test::TextureKind::kDepth:
|
case ast::intrinsic::test::TextureKind::kDepth:
|
||||||
return b->Var("texture", ast::StorageClass::kNone,
|
return b->Var("texture", ast::StorageClass::kUniformConstant,
|
||||||
b->create<ast::type::DepthTexture>(texture_dimension));
|
b->create<ast::type::DepthTexture>(texture_dimension),
|
||||||
|
nullptr, decos);
|
||||||
|
|
||||||
case ast::intrinsic::test::TextureKind::kMultisampled:
|
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,
|
b->create<ast::type::MultisampledTexture>(texture_dimension,
|
||||||
datatype));
|
datatype),
|
||||||
|
nullptr, decos);
|
||||||
|
|
||||||
case ast::intrinsic::test::TextureKind::kStorage: {
|
case ast::intrinsic::test::TextureKind::kStorage: {
|
||||||
auto* st = b->create<ast::type::StorageTexture>(
|
auto* st = b->create<ast::type::StorageTexture>(
|
||||||
texture_dimension, access_control, image_format);
|
texture_dimension, access_control, image_format);
|
||||||
st->set_type(datatype);
|
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::Variable* TextureOverloadCase::buildSamplerVariable(
|
||||||
ast::Builder* b) const {
|
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() {
|
std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue