diff options
| author | Andre Weissflog <floooh@gmail.com> | 2024-10-09 18:37:55 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2024-10-14 17:31:38 +0200 |
| commit | b804bfa1303b1e0b65a21c6aa4d1d637bc340930 (patch) | |
| tree | 015dce06fef474d3523c151ee67df9e3efbe812e | |
| parent | e4ac395c8f52e940ecac289b83f9a86ed8320ede (diff) | |
sokol_gfx.h wgpu: fix a C vs C++ incompatibility in the Emscripten vs Dawn webgpu.h differences
| -rw-r--r-- | sokol_gfx.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sokol_gfx.h b/sokol_gfx.h index a52b27ba..371ca4c4 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -13406,7 +13406,8 @@ _SOKOL_PRIVATE WGPUOptionalBool _sg_wgpu_optional_bool(bool b) { #endif _SOKOL_PRIVATE WGPUBufferUsage _sg_wgpu_buffer_usage(sg_buffer_type t, sg_usage u) { - WGPUBufferUsage res = 0; + // FIXME: change to WGPUBufferUsage once Emscripten and Dawn webgpu.h agree + int res = 0; if (SG_BUFFERTYPE_VERTEXBUFFER == t) { res = WGPUBufferUsage_Vertex; } else if (SG_BUFFERTYPE_STORAGEBUFFER == t) { @@ -13417,7 +13418,7 @@ _SOKOL_PRIVATE WGPUBufferUsage _sg_wgpu_buffer_usage(sg_buffer_type t, sg_usage if (SG_USAGE_IMMUTABLE != u) { res |= WGPUBufferUsage_CopyDst; } - return res; + return (WGPUBufferUsage)res; } _SOKOL_PRIVATE WGPULoadOp _sg_wgpu_load_op(WGPUTextureView view, sg_load_action a) { @@ -13749,7 +13750,8 @@ _SOKOL_PRIVATE WGPUBlendFactor _sg_wgpu_blendfactor(sg_blend_factor f) { } _SOKOL_PRIVATE WGPUColorWriteMask _sg_wgpu_colorwritemask(uint8_t m) { - WGPUColorWriteMask res = 0; + // FIXME: change to WGPUColorWriteMask once Emscripten and Dawn webgpu.h agree + int res = 0; if (0 != (m & SG_COLORMASK_R)) { res |= WGPUColorWriteMask_Red; } @@ -13762,7 +13764,7 @@ _SOKOL_PRIVATE WGPUColorWriteMask _sg_wgpu_colorwritemask(uint8_t m) { if (0 != (m & SG_COLORMASK_A)) { res |= WGPUColorWriteMask_Alpha; } - return res; + return (WGPUColorWriteMask)res; } _SOKOL_PRIVATE WGPUShaderStage _sg_wgpu_shader_stage(sg_shader_stage stage) { |