具有多重采样的 OpenGL 多渲染目标 FBO - 要求

OpenGL multiple render target FBO with multisampling - requirements

创建多采样 FBO 时,是否所有附加的目标纹理都需要是多采样纹理?

认为是这样。

§ 9.2.3.1 Multisample Queries

The values of SAMPLE_BUFFERS and SAMPLES control whether and how multisampling is performed (...).

If a framebuffer object is not framebuffer complete (...), then the values of SAMPLE_BUFFERS and SAMPLES are undefined.

Otherwise, the value of SAMPLES is equal to the value of RENDERBUFFER_SAMPLES or TEXTURE_SAMPLES (depending on the type of the attached images), which must all have the same value.

(强调我的)

规范的

Section 9.4.2 Whole Framebuffer Completeness

The framebuffer object bound to target is said to be framebuffer complete if all the following conditions are true:
[...]

• The value of RENDERBUFFER_SAMPLES is the same for all attached renderbuffers; the value of TEXTURE_SAMPLES is the same for all attached textures; and, if the attached images are a mix of renderbuffers and textures, the value of RENDERBUFFER_SAMPLES matches the value of TEXTURE_SAMPLES.

所以是的,所有附加的纹理和渲染缓冲区的样本数必须相同。