weixin_39902472
weixin_39902472
2021-01-11 06:47

Cube example renders differently with OpenGL vs Metal on MacOS

When rendering with Metal:

gfx_cube_example_metal

When rendering with OpenGL:

gfx_cube_example_opengl

my_specs

该提问来源于开源项目:gfx-rs/gfx

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39599317 weixin_39599317 4月前

    Thanks for filing the issue! I wonder if we are confused here about ARGB2101010 format. Seems rather unusual for a back buffer. Do you have HDR-enabled screen?

    点赞 评论 复制链接分享
  • weixin_39588911 weixin_39588911 4月前

    Same problem here on my mac with NVIDIA GeForce GT 650M. Pixel depth is 32-Bit Color (ARGB8888).

    点赞 评论 复制链接分享
  • weixin_39731623 weixin_39731623 4月前

    It looks like there are two issues (possibly with a single cause):

    1. The single texel "texture" is being interpreted as BGRA event though gfx::format::Rgba8 is specified. The cube shows up as blue if you swap the blue and red in the cube's main.rs.
    2. There's something funny going on with the gamma. Tweaking the format mapping in the metal backend by sending (Rgba8) to BGRAUnorm_sRGB at map.rs:241 (instead of BGRAUnorm) makes the background the right color, but the cube is still too dark.

    My guess is this has something to do with the backend silently converting Rgba8 to Bgra8 for render targets, which we do to isolate the user from the fact that CAMetalLayers (i.e. the window) only supports BGRAUnorm, BGRAUnorm_sRGB and RGBA16Float. However Vulkan already requires the same juggling so we should probably stop doing the remapping.

    点赞 评论 复制链接分享
  • weixin_39863616 weixin_39863616 4月前

    I think this was fixed by #1259 and can be closed.

    点赞 评论 复制链接分享

相关推荐