rename member variables

This commit is contained in:
Jeremy Nelson
2025-06-05 12:07:07 -07:00
committed by Jeremy Nelson
parent 5ae7760752
commit 2a04cee97f
3 changed files with 22 additions and 18 deletions

View File

@@ -809,13 +809,15 @@ void WebGPUDriver::beginRenderPass(Handle<HwRenderTarget> rth, RenderPassParams
if (colorInfos[i].handle) {
auto* hwTexture = handleCast<WGPUTexture>(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<HwRenderTarget> 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<WGPUTexture>(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<HwRenderTarget> 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<HwDescriptorSet> dsh,
auto sampler = makeSampler(params);
// TODO making assumptions that size and offset mean the same thing here.
wgpu::BindGroupEntry tEntry{ .binding = static_cast<uint32_t>(binding * 2),
.textureView = texture->getTextureView() };
.textureView = texture->getDefaultTextureView() };
bindGroup->addEntry(tEntry.binding, std::move(tEntry));
wgpu::BindGroupEntry sEntry{ .binding = static_cast<uint32_t>(binding * 2 + 1),

View File

@@ -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;

View File

@@ -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,