Hello,
I ran into an issue with glDrawBuffers and MRT when disabling certain buffers.
Consider this (simplified) fragment shader
#version 150 core
out vec4 Color0;
out vec4 Color1;
out vec4 Color2;
void main(void)
{
Color0 = vec4(0.0, 0.0, 0.0, 0.3);
Color1 = vec4(0.0, 0.0, 0.0, 0.5);
Color2 = vec4(0.0, 0.0, 0.0, 0.8);
}
During shader linking the color outputs are mapped to draw buffer indices like this:
glBindFragDataLocation(Handle, 0, "Color0");
glBindFragDataLocation(Handle, 1, "Color1");
glBindFragDataLocation(Handle, 2, "Color2");
The FBO has 3 color attachments:
GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 and GL_COLOR_ATTACHMENT2.
Before rendering with the fragment shader above, glDrawBuffers is called like this:
GLenum buffers[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };
glDrawBuffers(3, buffers);
=> The output is as expected, each of the 3 buffers receives the proper alpha value (also the RGB terms would be the proper ones as I tested, so it is not about only the alpha part here).
Now the problem:
When I call glDrawBuffers like this (because I don't want to render to 2nd color buffer):
GLenum buffers[3] = { GL_COLOR_ATTACHMENT0, GL_NONE, GL_COLOR_ATTACHMENT2 };
glDrawBuffers(3, buffers)
=> Then nothing is rendered to the 3rd color buffer (i.e. GL_COLOR_ATTACHMENT2)! It seems everything after GL_NONE is skipped/discarded as well.
How is that possible? Where is my mistake? Or could it be a driver bug?
Help is really appreciated!
I have Windows 10 64bit and a Radeon HD 5850 with latest driver (at least no update was found). Here are the details:
Treiber-Paketversion 15.201.1151.1008-151104a-296217E Anbieter Advanced Micro Devices, Inc. 2D-Treiberversion 8.01.01.1500 2D-Treiberpfad /REGISTRY/MACHINE/SYSTEM/ControlSet001/Control/Class/{4d36e968-e325-11ce-bfc1-08002be10318}/0000 Direct3D-Version 9.14.10.01128 OpenGL-Version 6.14.10.13399 Mantle-Treiberversion 9.1.10.0083 Mantle-API-Version Nicht verfügbar AMD Catalyst Control Center-Version 2015.1104.1643.30033 |
Grafikkarten-Hersteller Powered by AMD Grafik-Chipsatz AMD Radeon HD 5800 Series Geräte-ID 6899 Anbieter-ID 1002 Subsystem-ID E140 Subsystem-Anbieter-ID 174B Revisions-ID 00 Grafikbus-Unterstützung PCI Express 2.0 Maximale Buseinstellungen PCI Express 2.0x16 BIOS-Version 012.019.000.002 BIOS-Teilenummer 113-C00140-00X BIOS-Datum 2010/03/09 Speichergröße 1024 MB Speichertyp GDDR5 Kern-Taktfrequenz in MHz 725 MHz Speichertaktfrequenz in MHz 1000 MHz Gesamtspeicherbandbreite in GB/s 128,0 GB/s |