From 6af38fa47fa1f02547fe0e5ae3570f673defea22 Mon Sep 17 00:00:00 2001 From: Jeremy Nelson Date: Wed, 4 Jun 2025 14:35:25 -0700 Subject: [PATCH] renaming param to samplerType --- filament/backend/src/webgpu/WebGPUDriver.cpp | 2 +- filament/backend/src/webgpu/WebGPUHandles.cpp | 13 +++++-------- filament/backend/src/webgpu/WebGPUHandles.h | 8 +------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/filament/backend/src/webgpu/WebGPUDriver.cpp b/filament/backend/src/webgpu/WebGPUDriver.cpp index a85ff7b70e..2bc4fe6b40 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.cpp +++ b/filament/backend/src/webgpu/WebGPUDriver.cpp @@ -845,7 +845,7 @@ void WebGPUDriver::beginRenderPass(Handle rth, RenderPassParams << " layers."; uint8_t stencilMipLevel = stencilInfo.level; uint32_t stencilArrayLayer = stencilInfo.layer; - customStencilView = hwTexture->getTextureView(stencilMipLevel,stencilArrayLayer); + customStencilView = hwTexture->getTextureView(stencilMipLevel, stencilArrayLayer); customStencilFormat = hwTexture->getFormat(); } } diff --git a/filament/backend/src/webgpu/WebGPUHandles.cpp b/filament/backend/src/webgpu/WebGPUHandles.cpp index 19966a7afd..53a97a935d 100644 --- a/filament/backend/src/webgpu/WebGPUHandles.cpp +++ b/filament/backend/src/webgpu/WebGPUHandles.cpp @@ -579,7 +579,7 @@ size_t WebGPUDescriptorSet::countEntitiesWithDynamicOffsets() const { return mEntriesWithDynamicOffsetsCount; } -WGPUTexture::WGPUTexture(SamplerType target, uint8_t levels, TextureFormat format, +WGPUTexture::WGPUTexture(SamplerType samplerType, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t width, uint32_t height, uint32_t depth, TextureUsage usage, wgpu::Device const& device) noexcept { assert_invariant( @@ -593,12 +593,12 @@ WGPUTexture::WGPUTexture(SamplerType target, uint8_t levels, TextureFormat forma mFormat = fToWGPUTextureFormat(format); mUsage = fToWGPUTextureUsage(usage); mAspect = fToWGPUTextureViewAspect(usage, format); - mSamplerType = target; + mSamplerType = samplerType; mBlockWidth = filament::backend::getBlockWidth(format); mBlockHeight = filament::backend::getBlockHeight(format); wgpu::TextureDescriptor textureDescriptor{ - .label = getUserTextureLabel(target), + .label = getUserTextureLabel(samplerType), .usage = mUsage, .dimension = target == SamplerType::SAMPLER_3D ? wgpu::TextureDimension::e3D : wgpu::TextureDimension::e2D, @@ -612,7 +612,7 @@ WGPUTexture::WGPUTexture(SamplerType target, uint8_t levels, TextureFormat forma .viewFormats = nullptr, }; - switch (target) { + switch (samplerType) { case SamplerType::SAMPLER_2D: mArrayLayerCount = 1; break; @@ -638,7 +638,7 @@ WGPUTexture::WGPUTexture(SamplerType target, uint8_t levels, TextureFormat forma FILAMENT_CHECK_POSTCONDITION(mTexture) << "Failed to create texture for " << textureDescriptor.label; - mTextureView = makeTextureView(0, levels, 0, mArrayLayerCount, target); + mTextureView = makeTextureView(0, levels, 0, mArrayLayerCount, samplerType); } WGPUTexture::WGPUTexture(WGPUTexture* src, uint8_t baseLevel, uint8_t levelCount) noexcept { @@ -652,8 +652,6 @@ WGPUTexture::WGPUTexture(WGPUTexture* src, uint8_t baseLevel, uint8_t levelCount mTextureView = makeTextureView(baseLevel, levelCount, 0, src->mArrayLayerCount, mSamplerType); } - - wgpu::TextureUsage WGPUTexture::fToWGPUTextureUsage(TextureUsage const& fUsage) { wgpu::TextureUsage retUsage = wgpu::TextureUsage::None; @@ -983,7 +981,6 @@ wgpu::TextureView WGPUTexture::getTextureView(uint8_t mipLevel, uint32_t arrayLa return makeTextureView(mipLevel, 1, arrayLayer, 1, mSamplerType); } - wgpu::TextureView WGPUTexture::makeTextureView(const uint8_t& baseLevel, const uint8_t& levelCount, const uint32_t& baseArrayLayer, const uint32_t& arrayLayerCount, SamplerType samplerType) const { diff --git a/filament/backend/src/webgpu/WebGPUHandles.h b/filament/backend/src/webgpu/WebGPUHandles.h index 2232d4a7b7..d059525870 100644 --- a/filament/backend/src/webgpu/WebGPUHandles.h +++ b/filament/backend/src/webgpu/WebGPUHandles.h @@ -198,7 +198,6 @@ public: filament::backend::TextureUsage const& fUsage, filament::backend::TextureFormat const& fFormat); - private: // CreateTextureR has info for a texture and sampler. Texture Views are needed for binding, // along with a sampler Current plan: Inherit the sampler and Texture to always exist (It is a @@ -213,13 +212,11 @@ private: size_t mBlockHeight; SamplerType mSamplerType; - wgpu::TextureUsage fToWGPUTextureUsage(filament::backend::TextureUsage const& fUsage); wgpu::TextureView makeTextureView(const uint8_t& baseLevel, const uint8_t& levelCount, const uint32_t& baseArrayLayer, const uint32_t& arrayLayerCount, SamplerType samplerType) const; - }; struct WGPURenderPrimitive : public HwRenderPrimitive { @@ -258,7 +255,6 @@ public: wgpu::TextureFormat customDepthFormat, wgpu::TextureFormat customStencilFormat); - bool isDefaultRenderTarget() const { return defaultRenderTarget; } uint8_t getSamples() const { return mSamples; } uint8_t getLayerCount() const { return mLayerCount; } @@ -271,9 +267,7 @@ public: // Static helpers for load/store operations static wgpu::LoadOp getLoadOperation(const RenderPassParams& params, TargetBufferFlags buffer); static wgpu::StoreOp getStoreOperation(const RenderPassParams& params, TargetBufferFlags buffer); - - - + private: bool defaultRenderTarget = false; uint8_t mSamples = 1;