spirv-reader: WGSL does not support OpImageQueryLod

Bug: tint:109
Change-Id: Ife61dca63c605a456407140d5c4fdb6b4bfa97a0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/39681
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
This commit is contained in:
David Neto 2021-02-01 21:47:04 +00:00 committed by Commit Bot service account
parent db67a287b8
commit 4d098a7b75
2 changed files with 18 additions and 6 deletions

View File

@ -539,6 +539,7 @@ bool IsImageQuery(SpvOp opcode) {
case SpvOpImageQuerySizeLod:
case SpvOpImageQueryLevels:
case SpvOpImageQuerySamples:
case SpvOpImageQueryLod:
return true;
default:
break;
@ -2945,14 +2946,14 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) {
return false;
}
if (IsSampledImageAccess(inst.opcode()) || IsRawImageAccess(inst.opcode())) {
return EmitImageAccess(inst);
}
if (IsImageQuery(inst.opcode())) {
return EmitImageQuery(inst);
}
if (IsSampledImageAccess(inst.opcode()) || IsRawImageAccess(inst.opcode())) {
return EmitImageAccess(inst);
}
switch (inst.opcode()) {
case SpvOpNop:
return true;
@ -4174,8 +4175,6 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) {
case SpvOpImageGather:
case SpvOpImageDrefGather:
return Fail() << " image gather is not yet supported";
case SpvOpImageQueryLod:
return Fail() << " image query Lod is not yet supported";
case SpvOpImageFetch:
// Read a single texel from a sampled image.
builtin_name = "textureLoad";
@ -4398,6 +4397,10 @@ bool FunctionEmitter::EmitImageQuery(const spvtools::opt::Instruction& inst) {
create<ast::TypeConstructorExpression>(Source{}, result_type, exprs)};
return EmitConstDefOrWriteToHoistedVar(inst, expr);
}
case SpvOpImageQueryLod:
return Fail() << "WGSL does not support querying the level of detail of "
"an image: "
<< inst.PrettyPrint();
case SpvOpImageQuerySizeLod: // TODO(dneto)
case SpvOpImageQueryLevels: // TODO(dneto)
case SpvOpImageQuerySamples: // TODO(dneto)

View File

@ -4832,6 +4832,15 @@ TEST_F(SpvParserTest, CombinedImageSampler_IsError) {
HasSubstr("WGSL does not support combined image-samplers: "));
}
INSTANTIATE_TEST_SUITE_P(
ImageQueryLod_IsError,
SpvParserTest_ImageCoordsTest,
::testing::ValuesIn(std::vector<ImageCoordsCase>{
{"%float 2D 0 0 0 1 Unknown",
"%result = OpImageQueryLod %v2int %sampled_image %vf12",
"WGSL does not support querying the level of detail of an image: ",
{}}}));
} // namespace
} // namespace spirv
} // namespace reader