Commit 195c7460 authored by hybrid's avatar hybrid

Add driver attribute element for AntiAliasing level. This allows to check...

Add driver attribute element for AntiAliasing level. This allows to check whether the driver has AA enabled, and which level.
Fix AA setup for OpenGL under windows, where the extension was missing and no error came up due to unsupported feature request. Now, the driver recognizes the missing support and properly sets AA to 0.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3491 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 884ede4e
......@@ -308,6 +308,7 @@ namespace video
MaxTextureLODBias (float) Maximum value for LOD bias. Is usually at around 16, but can be lower on some systems.
Version (int) Version of the driver. Should be Major*100+Minor
ShaderLanguageVersion (int) Version of the high level shader language. Should be Major*100+Minor.
AntiAlias (int) Number of Samples the driver uses for each pixel. 0 and 1 means anti aliasing is off, typical values are 2,4,8,16,32
*/
virtual const io::IAttributes& getDriverAttributes() const=0;
......
......@@ -400,6 +400,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
DriverAttributes->setAttribute("MaxTextureLODBias", 16.f);
DriverAttributes->setAttribute("Version", 800);
DriverAttributes->setAttribute("ShaderLanguageVersion", (s32)Caps.VertexShaderVersion*100);
DriverAttributes->setAttribute("AntiAlias", antiAlias);
// set the renderstates
setRenderStates3DMode();
......
......@@ -455,6 +455,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
DriverAttributes->setAttribute("MaxTextureLODBias", 16);
DriverAttributes->setAttribute("Version", 901);
DriverAttributes->setAttribute("ShaderLanguageVersion", (s32)Caps.VertexShaderVersion*100);
DriverAttributes->setAttribute("AntiAlias", AntiAliasing);
// set the renderstates
setRenderStates3DMode();
......
......@@ -103,6 +103,7 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre
// DriverAttributes->addFloat("MaxTextureLODBias", 0.f);
DriverAttributes->addInt("Version", 1);
// DriverAttributes->addInt("ShaderLanguageVersion", 0);
// DriverAttributes->addInt("AntiAlias", 0);
setFog();
......
......@@ -235,8 +235,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
return false;
}
#ifdef _DEBUG
core::stringc wglExtensions;
io::path wglExtensions;
#ifdef WGL_ARB_extensions_string
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
if (irrGetExtensionsString)
......@@ -246,12 +245,16 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
if (irrGetExtensionsString)
wglExtensions = irrGetExtensionsString(HDc);
#endif
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1) );
#ifdef _DEBUG
os::Printer::log("WGL_extensions", wglExtensions);
#endif
#ifdef WGL_ARB_pixel_format
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
if (wglChoosePixelFormat_ARB)
if (pixel_format_supported && multi_sample_supported && wglChoosePixelFormat_ARB)
{
// This value determines the number of samples used for antialiasing
// My experience is that 8 does not show a big
......@@ -662,6 +665,7 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize,
DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias);
DriverAttributes->setAttribute("Version", Version);
DriverAttributes->setAttribute("ShaderLanguageVersion", ShaderLanguageVersion);
DriverAttributes->setAttribute("AntiAlias", AntiAlias);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
......
......@@ -16,6 +16,10 @@ static bool testLineRendering(video::E_DRIVER_TYPE type)
return true; // in case the driver type does not exist
video::IVideoDriver* driver = device->getVideoDriver();
// if no AntiAliasing supported, skip this test
if (driver->getDriverAttributes().getAttributeAsInt("AntiAlias")<2)
return true;
scene::ISceneManager* smgr = device->getSceneManager();
scene::IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment