Commit 0806cb27 by jbauman@chromium.org

Disable npot texture support on AMD cards on XP.

We had been seeing some BSODs due to this. BUG= Review URL: https://codereview.appspot.com/6485058 git-svn-id: https://angleproject.googlecode.com/svn/trunk@1264 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 5a1bfa2e
#define MAJOR_VERSION 1 #define MAJOR_VERSION 1
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 1263 #define BUILD_REVISION 1264
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -196,6 +196,12 @@ bool Display::initialize() ...@@ -196,6 +196,12 @@ bool Display::initialize()
mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier); mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier);
// ATI cards on XP have problems with non-power-of-two textures.
mSupportsNonPower2Textures = !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &&
!(getComparableOSVersion() < versionWindowsVista && mAdapterIdentifier.VendorId == VENDOR_ID_AMD);
const D3DFORMAT renderTargetFormats[] = const D3DFORMAT renderTargetFormats[] =
{ {
D3DFMT_A1R5G5B5, D3DFMT_A1R5G5B5,
...@@ -1254,9 +1260,7 @@ bool Display::getVertexTextureSupport() const ...@@ -1254,9 +1260,7 @@ bool Display::getVertexTextureSupport() const
bool Display::getNonPower2TextureSupport() const bool Display::getNonPower2TextureSupport() const
{ {
return !(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) && return mSupportsNonPower2Textures;
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
!(mDeviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL);
} }
bool Display::getOcclusionQuerySupport() const bool Display::getOcclusionQuerySupport() const
......
...@@ -26,6 +26,19 @@ ...@@ -26,6 +26,19 @@
#include "libEGL/ShaderCache.h" #include "libEGL/ShaderCache.h"
#include "libEGL/Surface.h" #include "libEGL/Surface.h"
const int versionWindowsVista = MAKEWORD(0x00, 0x06);
const int versionWindows7 = MAKEWORD(0x01, 0x06);
// Return the version of the operating system in a format suitable for ordering
// comparison.
inline int getComparableOSVersion()
{
DWORD version = GetVersion();
int majorVersion = LOBYTE(LOWORD(version));
int minorVersion = HIBYTE(LOWORD(version));
return MAKEWORD(minorVersion, majorVersion);
}
namespace egl namespace egl
{ {
class Display class Display
...@@ -131,6 +144,7 @@ class Display ...@@ -131,6 +144,7 @@ class Display
EGLint mMaxSwapInterval; EGLint mMaxSwapInterval;
EGLint mMinSwapInterval; EGLint mMinSwapInterval;
bool mSoftwareDevice; bool mSoftwareDevice;
bool mSupportsNonPower2Textures;
typedef std::set<Surface*> SurfaceSet; typedef std::set<Surface*> SurfaceSet;
SurfaceSet mSurfaceSet; SurfaceSet mSurfaceSet;
......
...@@ -23,22 +23,6 @@ ...@@ -23,22 +23,6 @@
namespace egl namespace egl
{ {
namespace
{
const int versionWindowsVista = MAKEWORD(0x00, 0x06);
const int versionWindows7 = MAKEWORD(0x01, 0x06);
// Return the version of the operating system in a format suitable for ordering
// comparison.
int getComparableOSVersion()
{
DWORD version = GetVersion();
int majorVersion = LOBYTE(LOWORD(version));
int minorVersion = HIBYTE(LOWORD(version));
return MAKEWORD(minorVersion, majorVersion);
}
}
Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported) Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported) : mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{ {
......
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