diff --git a/filament/backend/src/webgpu/WebGPUDriver.cpp b/filament/backend/src/webgpu/WebGPUDriver.cpp index 48c3be60c4..22606eb506 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.cpp +++ b/filament/backend/src/webgpu/WebGPUDriver.cpp @@ -809,13 +809,15 @@ void WebGPUDriver::beginRenderPass(Handle rth, RenderPassParams if (colorInfos[i].handle) { auto* hwTexture = handleCast(colorInfos[i].handle); if (hwTexture) { - FILAMENT_CHECK_POSTCONDITION(colorInfos[i].layer < renderTarget->getLayerCount()) - << "Color attachment " << i << " requests layer " - << colorInfos[i].layer << " but render target has only " - << renderTarget->getLayerCount() << "."; + FILAMENT_CHECK_POSTCONDITION( + colorInfos[i].layer < renderTarget->getLayerCount()) + << "Color attachment " << i << " requests layer " << colorInfos[i].layer + << " but render target has only " << renderTarget->getLayerCount() + << "."; const uint8_t mipLevel = colorInfos[i].level; const uint32_t arrayLayer = colorInfos[i].layer; - customColorViews[customColorViewCount++] = hwTexture->getOrMakeTextureView(mipLevel, arrayLayer); + customColorViews[customColorViewCount++] = + hwTexture->getOrMakeTextureView(mipLevel, arrayLayer); } } } @@ -823,13 +825,13 @@ void WebGPUDriver::beginRenderPass(Handle rth, RenderPassParams const auto& depthInfo = renderTarget->getDepthAttachmentInfo(); if (depthInfo.handle) { FILAMENT_CHECK_POSTCONDITION(depthInfo.layer < renderTarget->getLayerCount()) - << "Depth attachment requests layer " << depthInfo.layer - << "but render target has only " << renderTarget->getLayerCount() << "."; + << "Depth attachment requests layer " << depthInfo.layer + << "but render target has only " << renderTarget->getLayerCount() << "."; auto* hwTexture = handleCast(depthInfo.handle); if (hwTexture) { const uint8_t depthMipLevel = depthInfo.level; const uint32_t depthArrayLayer = depthInfo.layer; - customDepthView = hwTexture->getOrMakeTextureView(depthMipLevel,depthArrayLayer); + customDepthView = hwTexture->getOrMakeTextureView(depthMipLevel, depthArrayLayer); customDepthFormat = hwTexture->getFormat(); } } @@ -845,7 +847,8 @@ void WebGPUDriver::beginRenderPass(Handle rth, RenderPassParams << " layers."; const uint8_t stencilMipLevel = stencilInfo.level; const uint32_t stencilArrayLayer = stencilInfo.layer; - customStencilView = hwTexture->getOrMakeTextureView(stencilMipLevel,stencilArrayLayer ); + customStencilView = + hwTexture->getOrMakeTextureView(stencilMipLevel, stencilArrayLayer); customStencilFormat = hwTexture->getFormat(); } } @@ -1165,7 +1168,7 @@ void WebGPUDriver::updateDescriptorSetTexture(Handle dsh, auto sampler = makeSampler(params); // TODO making assumptions that size and offset mean the same thing here. wgpu::BindGroupEntry tEntry{ .binding = static_cast(binding * 2), - .textureView = texture->getTextureView() }; + .textureView = texture->getDefaultTextureView() }; bindGroup->addEntry(tEntry.binding, std::move(tEntry)); wgpu::BindGroupEntry sEntry{ .binding = static_cast(binding * 2 + 1), diff --git a/filament/backend/src/webgpu/WebGPUHandles.cpp b/filament/backend/src/webgpu/WebGPUHandles.cpp index 8fb164b403..401cab219b 100644 --- a/filament/backend/src/webgpu/WebGPUHandles.cpp +++ b/filament/backend/src/webgpu/WebGPUHandles.cpp @@ -638,18 +638,18 @@ WGPUTexture::WGPUTexture(SamplerType samplerType, uint8_t levels, TextureFormat FILAMENT_CHECK_POSTCONDITION(mTexture) << "Failed to create texture for " << textureDescriptor.label; - mTextureView = makeTextureView(0, levels, 0, mArrayLayerCount, samplerType); + mDefaultTextureView = makeTextureView(0, levels, 0, mArrayLayerCount, samplerType); } -WGPUTexture::WGPUTexture(WGPUTexture* src, uint8_t baseLevel, uint8_t levelCount) noexcept : - mTexture(src->mTexture), +WGPUTexture::WGPUTexture(WGPUTexture* src, uint8_t baseLevel, uint8_t levelCount) noexcept + : mTexture(src->mTexture), mAspect(src->mAspect), mArrayLayerCount(src->mArrayLayerCount), mBlockWidth(src->mBlockWidth), mBlockHeight(src->mBlockHeight), mSamplerType(src->mSamplerType), - mTextureView(makeTextureView(baseLevel, levelCount, 0, src->mArrayLayerCount, mSamplerType)) - {} + mDefaultTextureView( + makeTextureView(baseLevel, levelCount, 0, src->mArrayLayerCount, mSamplerType)) {} wgpu::TextureUsage WGPUTexture::fToWGPUTextureUsage(TextureUsage const& fUsage) { wgpu::TextureUsage retUsage = wgpu::TextureUsage::None; diff --git a/filament/backend/src/webgpu/WebGPUHandles.h b/filament/backend/src/webgpu/WebGPUHandles.h index c2363724db..53f0482c82 100644 --- a/filament/backend/src/webgpu/WebGPUHandles.h +++ b/filament/backend/src/webgpu/WebGPUHandles.h @@ -183,7 +183,7 @@ public: [[nodiscard]] const wgpu::Texture& getTexture() const { return mTexture; } - [[nodiscard]] wgpu::TextureView getTextureView() const {return mTextureView;} + [[nodiscard]] wgpu::TextureView getDefaultTextureView() const {return mDefaultTextureView;} [[nodiscard]] wgpu::TextureView getOrMakeTextureView(uint8_t mipLevel, uint32_t arrayLayer) const; [[nodiscard]] wgpu::TextureFormat getFormat() const { return mFormat; } @@ -207,10 +207,11 @@ private: size_t mBlockWidth; size_t mBlockHeight; SamplerType mSamplerType; - wgpu::TextureView mTextureView = nullptr; + wgpu::TextureView mDefaultTextureView = nullptr; - [[nodiscard]] wgpu::TextureUsage fToWGPUTextureUsage(filament::backend::TextureUsage const& fUsage); + [[nodiscard]] wgpu::TextureUsage fToWGPUTextureUsage( + filament::backend::TextureUsage const& fUsage); [[nodiscard]] wgpu::TextureView makeTextureView(const uint8_t& baseLevel, const uint8_t& levelCount, const uint32_t& baseArrayLayer,