------------------------------------------------------------------------------
| 1666 | |
| 1667 | //------------------------------------------------------------------------------ |
| 1668 | bool vtkOpenGLRenderWindow::ResolveFlipRenderFramebuffer() |
| 1669 | { |
| 1670 | bool copiedColor = false; |
| 1671 | |
| 1672 | // Some linux drivers have issues reading a multisampled texture |
| 1673 | bool useTexture = false; |
| 1674 | if (this->MultiSamples > 1 && this->RenderFramebuffer->GetColorAttachmentAsTextureObject(0)) |
| 1675 | { |
| 1676 | useTexture = true; |
| 1677 | // can set VTK_FORCE_MSAA=0/1 to override driver exclusion |
| 1678 | const char* useMSAAEnv = std::getenv("VTK_FORCE_MSAA"); |
| 1679 | if (useMSAAEnv) |
| 1680 | { |
| 1681 | auto str = std::string_view(useMSAAEnv); |
| 1682 | if (!str.empty()) |
| 1683 | { |
| 1684 | int useTextureInt = 0; |
| 1685 | VTK_FROM_CHARS_IF_ERROR_BREAK(useMSAAEnv, useTextureInt); |
| 1686 | useTexture = useTextureInt == 1; |
| 1687 | } |
| 1688 | } |
| 1689 | else |
| 1690 | { |
| 1691 | const std::string& vendorString = this->GetState()->GetVendor(); |
| 1692 | const std::string& versionString = this->GetState()->GetVersion(); |
| 1693 | const std::string& rendererString = this->GetState()->GetRenderer(); |
| 1694 | size_t numExceptions = |
| 1695 | sizeof(vtkOpenGLRenderWindowMSAATextureBug) / sizeof(vtkOpenGLRenderWindowDriverInfo); |
| 1696 | for (size_t i = 0; i < numExceptions; i++) |
| 1697 | { |
| 1698 | if (vendorString.find(vtkOpenGLRenderWindowMSAATextureBug[i].Vendor) == 0 && |
| 1699 | versionString.find(vtkOpenGLRenderWindowMSAATextureBug[i].Version) == 0 && |
| 1700 | rendererString.find(vtkOpenGLRenderWindowMSAATextureBug[i].Renderer) == 0) |
| 1701 | { |
| 1702 | useTexture = false; |
| 1703 | break; |
| 1704 | } |
| 1705 | } |
| 1706 | } |
| 1707 | } |
| 1708 | |
| 1709 | // if we have a MSAA buffer we have to resolve it using a shader as opposed to |
| 1710 | // a normal blit due to linear/gamma colorspace issues |
| 1711 | if (useTexture) |
| 1712 | { |
| 1713 | if (!this->ResolveQuad) |
| 1714 | { |
| 1715 | this->ResolveQuad = |
| 1716 | new vtkOpenGLQuadHelper(this, nullptr, ResolveShader, "", this->FramebufferFlipY); |
| 1717 | if (!this->ResolveQuad->Program || !this->ResolveQuad->Program->GetCompiled()) |
| 1718 | { |
| 1719 | vtkErrorMacro("Couldn't build the shader program for resolving msaa."); |
| 1720 | } |
| 1721 | } |
| 1722 | else |
| 1723 | { |
| 1724 | this->GetShaderCache()->ReadyShaderProgram(this->ResolveQuad->Program); |
| 1725 | } |
no test coverage detected