Hi everyone,
I’ve encountered a strange issue when enabling multisampling and using a depth texture with the FilterManager
in Panda3D. Below is a detailed description of the problem and a minimal reproducible example.
Problem Description
When I set Multisamples
greater than 0
in FrameBufferProperties
:
fbprobs = FrameBufferProperties()
fbprobs.setMultisamples(2)
and then use a depth texture:
colortex = Texture()
depthtex = Texture()
manager = FilterManager(base.win, base.cam)
quad = manager.renderSceneInto(colortex=colortex, depthtex=depthtex, fbprops=fbprobs)
I receive the following errors repeatedly:
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
2025-01-08 00:40:33.918 Python[61495:5469081] +[IMKClient subclass]: chose IMKClient_Modern
2025-01-08 00:40:33.918 Python[61495:5469081] +[IMKInputSession subclass]: chose IMKInputSession_Modern
:display:gsg:glgsg(error): GL error 0x502 : invalid operation
:display:gsg:glgsg(error): An OpenGL error has occurred. Set gl-check-errors #t in your PRC file to display more information.
When enabling gl-check-errors
in the PRC file, I get:
:display:gsg:glgsg(error): at 2074 of panda/src/glstuff/glGraphicsBuffer_src.cxx : invalid operation
...
:display(error): Deactivating CocoaGraphicsStateGuardian.
This issue does not occur in the following scenarios:
- When I omit the depth texture:
quad = manager.renderSceneInto(colortex=colortex, fbprops=fbprobs)
- When I set
Multisamples
to0
:
fbprobs.setMultisamples(0)
quad = manager.renderSceneInto(colortex=colortex, depthtex=depthtex, fbprops=fbprobs)
Additional Information
I’m using Panda3D version 1.10.15. Here is my system configuration:
• Python version: 3.12.6
• Machine: arm64
• Graphics Driver Vendor: Apple
• Graphics Renderer: Apple M1
• Graphics Driver Version: 4.1 Metal - 89.3
• Supports Basic Shaders: False
The specific line in panda/src/glstuff/glGraphicsBuffer_src.cxx
(line 2074 for 1.10.15) triggering the error is:
report_my_gl_errors();
Minimal Reproducible Example
Here is a small script to reproduce the issue:
from direct.filter.FilterManager import FilterManager
from direct.showbase.ShowBase import ShowBase
from panda3d.core import (
AntialiasAttrib,
FrameBufferProperties,
Texture,
loadPrcFileData,
)
# Uncomment this to enable detailed OpenGL error reporting
# loadPrcFileData("", "gl-check-errors #t")
base = ShowBase()
base.render.setAntialias(AntialiasAttrib.MAuto)
fbprobs = FrameBufferProperties()
fbprobs.setMultisamples(2)
colortex = Texture()
depthtex = Texture()
manager = FilterManager(base.win, base.cam)
quad = manager.renderSceneInto(colortex=colortex, depthtex=depthtex, fbprops=fbprobs)
model = base.loader.loadModel("box")
model.setY(2)
model.reparentTo(base.render)
base.run()
Questions
-
Is this a known issue with multisampling and depth textures on Apple M1 devices or with Panda3D 1.10.15?
-
Could this be a driver-related limitation or something misconfigured in the FilterManager setup?
-
Are there any workarounds to enable both multisampling and depth textures without causing this error?
Any help or pointers would be greatly appreciated!
Thanks in advance,
Miklesz