Skip to content

Commit 1e3854c

Browse files
authored
Merge pull request #244 from defold/astc_unorm
Use ASTC Unorm formats instead of Srgb
2 parents f5ecea5 + 0c6e7ec commit 1e3854c

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

defold-rive/src/private/renderer_context_webgpu.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,23 +195,21 @@ namespace dmRive
195195

196196
static wgpu::TextureFormat GetASTCFormat(uint8_t blockW, uint8_t blockH)
197197
{
198-
// ASTC block sizes mapped to WebGPU sRGB formats (correct for color textures).
199-
// NOTE: Linear data (e.g. normal maps) would need Unorm variants instead,
200-
// but ASTC files don't contain color space info. For now we assume sRGB.
201-
if (blockW == 4 && blockH == 4) return wgpu::TextureFormat::ASTC4x4UnormSrgb;
202-
if (blockW == 5 && blockH == 4) return wgpu::TextureFormat::ASTC5x4UnormSrgb;
203-
if (blockW == 5 && blockH == 5) return wgpu::TextureFormat::ASTC5x5UnormSrgb;
204-
if (blockW == 6 && blockH == 5) return wgpu::TextureFormat::ASTC6x5UnormSrgb;
205-
if (blockW == 6 && blockH == 6) return wgpu::TextureFormat::ASTC6x6UnormSrgb;
206-
if (blockW == 8 && blockH == 5) return wgpu::TextureFormat::ASTC8x5UnormSrgb;
207-
if (blockW == 8 && blockH == 6) return wgpu::TextureFormat::ASTC8x6UnormSrgb;
208-
if (blockW == 8 && blockH == 8) return wgpu::TextureFormat::ASTC8x8UnormSrgb;
209-
if (blockW == 10 && blockH == 5) return wgpu::TextureFormat::ASTC10x5UnormSrgb;
210-
if (blockW == 10 && blockH == 6) return wgpu::TextureFormat::ASTC10x6UnormSrgb;
211-
if (blockW == 10 && blockH == 8) return wgpu::TextureFormat::ASTC10x8UnormSrgb;
212-
if (blockW == 10 && blockH == 10) return wgpu::TextureFormat::ASTC10x10UnormSrgb;
213-
if (blockW == 12 && blockH == 10) return wgpu::TextureFormat::ASTC12x10UnormSrgb;
214-
if (blockW == 12 && blockH == 12) return wgpu::TextureFormat::ASTC12x12UnormSrgb;
198+
// ASTC block sizes mapped to WebGPU Unorm formats.
199+
if (blockW == 4 && blockH == 4) return wgpu::TextureFormat::ASTC4x4Unorm;
200+
if (blockW == 5 && blockH == 4) return wgpu::TextureFormat::ASTC5x4Unorm;
201+
if (blockW == 5 && blockH == 5) return wgpu::TextureFormat::ASTC5x5Unorm;
202+
if (blockW == 6 && blockH == 5) return wgpu::TextureFormat::ASTC6x5Unorm;
203+
if (blockW == 6 && blockH == 6) return wgpu::TextureFormat::ASTC6x6Unorm;
204+
if (blockW == 8 && blockH == 5) return wgpu::TextureFormat::ASTC8x5Unorm;
205+
if (blockW == 8 && blockH == 6) return wgpu::TextureFormat::ASTC8x6Unorm;
206+
if (blockW == 8 && blockH == 8) return wgpu::TextureFormat::ASTC8x8Unorm;
207+
if (blockW == 10 && blockH == 5) return wgpu::TextureFormat::ASTC10x5Unorm;
208+
if (blockW == 10 && blockH == 6) return wgpu::TextureFormat::ASTC10x6Unorm;
209+
if (blockW == 10 && blockH == 8) return wgpu::TextureFormat::ASTC10x8Unorm;
210+
if (blockW == 10 && blockH == 10) return wgpu::TextureFormat::ASTC10x10Unorm;
211+
if (blockW == 12 && blockH == 10) return wgpu::TextureFormat::ASTC12x10Unorm;
212+
if (blockW == 12 && blockH == 12) return wgpu::TextureFormat::ASTC12x12Unorm;
215213
return wgpu::TextureFormat::Undefined;
216214
}
217215

0 commit comments

Comments
 (0)