Fix particles on WebGPU to respect format support flags properly

This commit is contained in:
Wojtek Figat
2026-03-02 23:06:01 +01:00
parent 3b2015e816
commit 23ebb0e754
10 changed files with 171 additions and 72 deletions

View File

@@ -400,6 +400,7 @@ bool GPUTexture::Init(const GPUTextureDescription& desc)
LOG(Warning, "Cannot create texture. Depth Stencil texture cannot have mip maps. Description: {0}", desc.ToString());
return true;
}
auto formatFeatures = device->GetFormatFeatures(desc.Format);
switch (desc.Dimensions)
{
case TextureDimensions::Texture:
@@ -409,6 +410,11 @@ bool GPUTexture::Init(const GPUTextureDescription& desc)
LOG(Warning, "Cannot create texture. Texture cannot have per slice views. Description: {0}", desc.ToString());
return true;
}
if (EnumHasNoneFlags(formatFeatures.Support, FormatSupport::Texture2D))
{
LOG(Warning, "Cannot create texture. Not supported format. Description: {0}", desc.ToString());
return true;
}
if (desc.Width <= 0 || desc.Height <= 0 || desc.ArraySize <= 0
|| desc.Width > device->Limits.MaximumTexture2DSize
|| desc.Height > device->Limits.MaximumTexture2DSize
@@ -449,6 +455,11 @@ bool GPUTexture::Init(const GPUTextureDescription& desc)
LOG(Warning, "Cannot create texture. Volume texture cannot have per slice map views if is not a render target. Description: {0}", desc.ToString());
return true;
}
if (EnumHasNoneFlags(formatFeatures.Support, FormatSupport::Texture3D))
{
LOG(Warning, "Cannot create texture. Not supported format. Description: {0}", desc.ToString());
return true;
}
if (desc.Width <= 0 || desc.Height <= 0 || desc.Depth <= 0
|| desc.Width > device->Limits.MaximumTexture3DSize
|| desc.Height > device->Limits.MaximumTexture3DSize
@@ -469,6 +480,11 @@ bool GPUTexture::Init(const GPUTextureDescription& desc)
LOG(Warning, "Cannot create texture. Cube texture cannot have per slice views. Description: {0}", desc.ToString());
return true;
}
if (EnumHasNoneFlags(formatFeatures.Support, FormatSupport::TextureCube))
{
LOG(Warning, "Cannot create texture. Not supported format. Description: {0}", desc.ToString());
return true;
}
if (desc.Width <= 0 || desc.ArraySize <= 0
|| desc.Width > device->Limits.MaximumTextureCubeSize
|| desc.Height > device->Limits.MaximumTextureCubeSize