多重采样 FBO 深度/模板和 OpenGL 规格

发布于 2024-12-26 03:20:08 字数 416 浏览 0 评论 0原文

OpenGL 4.2 规范(第 3.3.1 节)明确指出:

因为每个样本都包含颜色、深度和模板信息,所以颜色(包括 纹理操作)、深度和模板函数的执行效果与 单样本模式。 一个额外的缓冲区,称为多重采样缓冲区,被添加到帧缓冲区中。 像素样本值,包括颜色、深度和模板值,存储在此 缓冲。样本包含每个片段颜色的单独颜色值。 什么时候 帧缓冲区包括多重采样缓冲区,但不包括深度或模板 buffers ,即使多重采样缓冲区不存储深度或模板值。 然而,颜色缓冲区确实与多样本缓冲区共存。

但是,如果我需要深度/模板测试,我必须设置一个 height_stencil 多重采样渲染缓冲区。

这是否违反规格或者我遗漏了什么?

the OpenGL 4.2 specs (section 3.3.1) clearly states that:

Because each sample includes color, depth, and stencil information, the color (including
texture operation), depth, and stencil functions perform equivalently to the
single-sample mode.
An additional buffer, called the multisample buffer, is added to the framebuffer.
Pixel sample values, including color, depth, and stencil values, are stored in this
buffer. Samples contain separate color values for each fragment color.
When
the framebuffer includes a multisample buffer, it does not include depth or stencil
buffers
, even if the multisample buffer does not store depth or stencil values.
Color buffers do coexist with the multisample buffer, however.

However, if I need depth/stencil test I have to setup a depth_stencil multisampled renderbuffer.

Does this go against the specs or am I missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愛上了 2025-01-02 03:20:08

好吧,让我们看看。第 4.4.4 节规定:

如果一个帧缓冲区对象的所有附加内容都被认为是帧缓冲区完整的
图像以及利用帧缓冲区进行渲染和读取所需的所有帧缓冲区参数均被一致定义并满足下面定义的要求。帧缓冲区完整性的规则取决于附加图像的属性以及某些与实现相关的限制。

在“下面”提到的许多规则中:

RENDERBUFFER_SAMPLES 的值对于所有附加的渲染缓冲区都是相同的;对于所有附加的纹理,TEXTURE_SAMPLES 的值是相同的;并且,如果附加图像是渲染缓冲区和纹理的混合,则 RENDERBUFFER_SAMPLES 的值与 TEXTURE_-SAMPLES 的值匹配。

因此,如果您的深度/模板缓冲区未进行多重采样,而您的颜色缓冲区进行了多重采样,那么您的 FBO 将不完整。并且您无法渲染到不完整的帧缓冲区对象。

所以,是的,您不仅需要确保它们是多重采样的,而且还必须使用相同数量的样本。

Well, let's see. Section 4.4.4 states:

A framebuffer object is said to be framebuffer complete if all of its attached
images, and all framebuffer parameters required to utilize the framebuffer for rendering and reading, are consistently defined and meet the requirements defined below. The rules of framebuffer completeness are dependent on the properties of the attached images, and on certain implementation-dependent restrictions.

Among the many rules mentioned "below":

The value of RENDERBUFFER_SAMPLES is the same for all attached render-buffers; the value of TEXTURE_SAMPLES is the same for all attached tex-tures; and, if the attached images are a mix of renderbuffers and textures, the value of RENDERBUFFER_SAMPLES matches the value of TEXTURE_-SAMPLES.

So if your depth/stencil buffer is not multisampled while your color buffer is multisampled, then your FBO will not be complete. And you cannot render to an incomplete framebuffer object.

So yes, you need to not only make sure that they are multisampled, they must use the same number of samples.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文