writer/hlsl: Add some comments to pack_level_in_coords

This behavior was confusing in an earlier code review.

Change-Id: I1a8551d890f98d40e25f02d69bff88cf0c2356ac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56542
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2021-06-30 11:04:46 +00:00 committed by Tint LUCI CQ
parent 51b9da45c8
commit 863e285013
1 changed files with 6 additions and 0 deletions

View File

@ -1663,7 +1663,12 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
if (!EmitExpression(out, texture)) if (!EmitExpression(out, texture))
return false; return false;
// If pack_level_in_coords is true, then the mip level will be appended as the
// last value of the coordinates argument. If the WGSL intrinsic overload does
// not have a level parameter and pack_level_in_coords is true, then a zero
// mip level will be inserted.
bool pack_level_in_coords = false; bool pack_level_in_coords = false;
uint32_t hlsl_ret_width = 4u; uint32_t hlsl_ret_width = 4u;
switch (intrinsic->Type()) { switch (intrinsic->Type()) {
@ -1689,6 +1694,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
break; break;
case sem::IntrinsicType::kTextureLoad: case sem::IntrinsicType::kTextureLoad:
out << ".Load("; out << ".Load(";
// Multisampled textures do not support mip-levels.
if (!texture_type->Is<sem::MultisampledTexture>()) { if (!texture_type->Is<sem::MultisampledTexture>()) {
pack_level_in_coords = true; pack_level_in_coords = true;
} }