Skip to content

Commit

Permalink
sokol_gfx.h wgpu: fix pixel format confusion (fixes #920)
Browse files Browse the repository at this point in the history
- SG_PIXELFORMAT_RGBA and SG_PIXELFORMAT_SRGBA8 were mixed up
- SRGBA8 and RGB9E5 were not added to the pixel format
  capabilities table
  • Loading branch information
floooh committed Oct 23, 2023
1 parent 08ae58e commit 526aff4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sokol_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit 526aff4

Please sign in to comment.