From 526aff4a53dbd73aebe45f2cc662493ccc41dd3c Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 23 Oct 2023 11:03:07 +0200 Subject: [PATCH] sokol_gfx.h wgpu: fix pixel format confusion (fixes #920) - SG_PIXELFORMAT_RGBA and SG_PIXELFORMAT_SRGBA8 were mixed up - SRGBA8 and RGB9E5 were not added to the pixel format capabilities table --- sokol_gfx.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 26c6e4603..dcee64fb5 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12784,8 +12784,8 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) { case SG_PIXELFORMAT_RG16UI: return WGPUTextureFormat_RG16Uint; case SG_PIXELFORMAT_RG16SI: return WGPUTextureFormat_RG16Sint; case SG_PIXELFORMAT_RG16F: return WGPUTextureFormat_RG16Float; - case SG_PIXELFORMAT_RGBA8: return WGPUTextureFormat_RGBA8UnormSrgb; - case SG_PIXELFORMAT_SRGB8A8: return WGPUTextureFormat_RGBA8Unorm; + case SG_PIXELFORMAT_RGBA8: return WGPUTextureFormat_RGBA8Unorm; + case SG_PIXELFORMAT_SRGB8A8: return WGPUTextureFormat_RGBA8UnormSrgb; case SG_PIXELFORMAT_RGBA8SN: return WGPUTextureFormat_RGBA8Snorm; case SG_PIXELFORMAT_RGBA8UI: return WGPUTextureFormat_RGBA8Uint; case SG_PIXELFORMAT_RGBA8SI: return WGPUTextureFormat_RGBA8Sint; @@ -12981,6 +12981,7 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RGBA8]); + _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_SRGB8A8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_BGRA8]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_R16F]); _sg_pixelformat_all(&_sg.formats[SG_PIXELFORMAT_RG16F]); @@ -13023,6 +13024,8 @@ _SOKOL_PRIVATE void _sg_wgpu_init_caps(void) { _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH]); _sg_pixelformat_srmd(&_sg.formats[SG_PIXELFORMAT_DEPTH_STENCIL]); + _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_RGB9E5]); + if (wgpuDeviceHasFeature(_sg.wgpu.dev, WGPUFeatureName_TextureCompressionBC)) { _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC1_RGBA]); _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC2_RGBA]);