From 863e285013495b492ad033ebad2b83af55c56a56 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Wed, 30 Jun 2021 11:04:46 +0000 Subject: [PATCH] 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 Reviewed-by: Corentin Wallez Commit-Queue: Ben Clayton Kokoro: Kokoro --- src/writer/hlsl/generator_impl.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc index a03f4a6115..560f014025 100644 --- a/src/writer/hlsl/generator_impl.cc +++ b/src/writer/hlsl/generator_impl.cc @@ -1663,7 +1663,12 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, if (!EmitExpression(out, texture)) 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; + uint32_t hlsl_ret_width = 4u; switch (intrinsic->Type()) { @@ -1689,6 +1694,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out, break; case sem::IntrinsicType::kTextureLoad: out << ".Load("; + // Multisampled textures do not support mip-levels. if (!texture_type->Is()) { pack_level_in_coords = true; }