panda3d / panda3d

Powerful, mature open-source cross-platform game engine for Python and C++, developed by Disney and CMU
https://www.panda3d.org/
Other
4.52k stars 784 forks source link

MacOS: glgsg error when enabling msaa on floating point color buffer #756

Closed el-dee closed 5 years ago

el-dee commented 5 years ago

On MacOS, when activating MSAA on a frame buffer with floating point color the glgsg throws errors then abort because the configuration is not supported by the driver but not detected by Panda. This happens both with the legacy profile and the core profile.

Here is a minimal test program :

#!/usr/bin/env python

import panda3d.core as p3d
from direct.showbase.ShowBase import ShowBase
from direct.filter.FilterManager import FilterManager

p3d.load_prc_file_data("", "gl-check-errors #t\n")
#p3d.load_prc_file_data("", "gl-version 3 2\n")

base = ShowBase()

manager = FilterManager(base.win, base.cam)
fbprops = p3d.FrameBufferProperties()
fbprops.float_color = True
fbprops.set_multisamples(4)
scene_tex = p3d.Texture()
tonemap_quad = manager.render_scene_into(colortex=scene_tex, fbprops=fbprops)

base.run()

See forum thread : https://discourse.panda3d.org/t/gltf-viewer-glgsg-error-on-mac-when-using-msaa/25236

rdb commented 5 years ago

I'm getting some strong déjà vu: https://discourse.panda3d.org/t/multisampling-srgb-and-intermediate-buffers/24304 https://github.com/panda3d/panda3d/commit/886d44d15d191c2b0bf1dea4ed15bce517fbc47d

What's different here, I guess, is that the buffer is 16-bit float, but the multisample buffer is being created as 32-bit float, so we need to add an extra case.

el-dee commented 5 years ago

You have a better memory than me :) And indeed, when setting explicitly the component size to 32 it works fine.

rdb commented 5 years ago

I think 6dcaab2d3ad6ee6f12b34622a13dddf28772e840 should fix it, would you mind testing it to be sure?

el-dee commented 5 years ago

Will an installer be available on buildbot ? (I tried building from source but the resulting sdk crashes at startup when instancing CocoaGraphicsPipe(). Actually it's the first time I compile Panda on Mojave...)

rdb commented 5 years ago

Give this a try: https://buildbot.panda3d.org/downloads/6dcaab2d3ad6ee6f12b34622a13dddf28772e840/

el-dee commented 5 years ago

Thanks, it works fine with your build :)

I will look why I can't have a valid build with Mojave...

duburcqa commented 3 months ago

For the record, to this day it is still crashing with the following image format:

import panda3d.core as p3d
from direct.showbase.ShowBase import ShowBase
from direct.filter.FilterManager import FilterManager

p3d.load_prc_file_data("", "gl-check-errors #t\n")

base = ShowBase()
manager = FilterManager(base.win, base.cam)
fbprops = p3d.FrameBufferProperties()
fbprops.set_rgba_bits(8, 8, 8, 0). # 8, 8, 8, 8 is working fine
fbprops.set_multisamples(4)
scene_tex = p3d.Texture()
tonemap_quad = manager.render_scene_into(colortex=scene_tex, fbprops=fbprops)
base.run()