diff --git a/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp b/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp index 5e6f92121a0..2708ecca1cc 100644 --- a/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp +++ b/native/cocos/renderer/gfx-wgpu/WGPUDescriptorSetLayout.cpp @@ -71,6 +71,14 @@ ccstd::hash_t hash(const ccstd::vector &entries) { return hash; } +bool checkInUse(uint8_t binding, const ccstd::set &bindingInUse, bool samplerBinding) { + bool res = bindingInUse.find(binding) != bindingInUse.end(); + if (!res && samplerBinding) { + res |= bindingInUse.find(binding - CC_WGPU_MAX_ATTACHMENTS) != bindingInUse.end(); + } + return res; +} + } // namespace using namespace emscripten; @@ -202,7 +210,7 @@ void CCWGPUDescriptorSetLayout::prepare(ccstd::set &bindingInUse, bool ccstd::vector bindGroupLayoutEntries{}; bindGroupLayoutEntries.reserve(_gpuLayoutEntryObj->bindGroupLayoutEntries.size()); for (const auto &[bd, layoutEntry] : _gpuLayoutEntryObj->bindGroupLayoutEntries) { - if (bindingInUse.find(static_cast(bd)) != bindingInUse.end()) { + if(checkInUse(static_cast(bd), bindingInUse, layoutEntry.sampler.type != WGPUSamplerBindingType_Undefined)) { bindGroupLayoutEntries.emplace_back(layoutEntry); } }