Commit af0ad216 by bsalomon@google.com

Disable GL_OES_standard_derivatives when ps_2_x or later is not available.

BUG=392 Review URL: https://codereview.appspot.com/7027051 git-svn-id: https://angleproject.googlecode.com/svn/trunk@1641 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 9930f904
#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 1639 #define BUILD_REVISION 1641
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -317,7 +317,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface) ...@@ -317,7 +317,7 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
mSupportsLuminanceAlphaTextures = mDisplay->getLuminanceAlphaTextureSupport(); mSupportsLuminanceAlphaTextures = mDisplay->getLuminanceAlphaTextureSupport();
mSupportsDepthTextures = mDisplay->getDepthTextureSupport(); mSupportsDepthTextures = mDisplay->getDepthTextureSupport();
mSupportsTextureFilterAnisotropy = mMaxTextureAnisotropy >= 2.0f; mSupportsTextureFilterAnisotropy = mMaxTextureAnisotropy >= 2.0f;
mSupportsDerivativeInstructions = (mDeviceCaps.PS20Caps.Caps & D3DPS20CAPS_GRADIENTINSTRUCTIONS) != 0;
mSupports32bitIndices = mDeviceCaps.MaxVertexIndex >= (1 << 16); mSupports32bitIndices = mDeviceCaps.MaxVertexIndex >= (1 << 16);
mNumCompressedTextureFormats = 0; mNumCompressedTextureFormats = 0;
...@@ -3621,6 +3621,11 @@ bool Context::supportsTextureFilterAnisotropy() const ...@@ -3621,6 +3621,11 @@ bool Context::supportsTextureFilterAnisotropy() const
return mSupportsTextureFilterAnisotropy; return mSupportsTextureFilterAnisotropy;
} }
bool Context::supportsDerivativeInstructions() const
{
return mSupportsDerivativeInstructions;
}
float Context::getTextureMaxAnisotropy() const float Context::getTextureMaxAnisotropy() const
{ {
return mMaxTextureAnisotropy; return mMaxTextureAnisotropy;
...@@ -3883,7 +3888,10 @@ void Context::initExtensionString() ...@@ -3883,7 +3888,10 @@ void Context::initExtensionString()
mExtensionString += "GL_OES_packed_depth_stencil "; mExtensionString += "GL_OES_packed_depth_stencil ";
mExtensionString += "GL_OES_get_program_binary "; mExtensionString += "GL_OES_get_program_binary ";
mExtensionString += "GL_OES_rgb8_rgba8 "; mExtensionString += "GL_OES_rgb8_rgba8 ";
mExtensionString += "GL_OES_standard_derivatives "; if (supportsDerivativeInstructions())
{
mExtensionString += "GL_OES_standard_derivatives ";
}
if (supportsFloat16Textures()) if (supportsFloat16Textures())
{ {
......
...@@ -509,6 +509,7 @@ class Context ...@@ -509,6 +509,7 @@ class Context
bool supportsNonPower2Texture() const; bool supportsNonPower2Texture() const;
bool supportsInstancing() const; bool supportsInstancing() const;
bool supportsTextureFilterAnisotropy() const; bool supportsTextureFilterAnisotropy() const;
bool supportsDerivativeInstructions() const;
bool getCurrentReadFormatType(GLenum *format, GLenum *type); bool getCurrentReadFormatType(GLenum *format, GLenum *type);
...@@ -645,6 +646,7 @@ class Context ...@@ -645,6 +646,7 @@ class Context
bool mSupportsDepthTextures; bool mSupportsDepthTextures;
bool mSupports32bitIndices; bool mSupports32bitIndices;
bool mSupportsTextureFilterAnisotropy; bool mSupportsTextureFilterAnisotropy;
bool mSupportsDerivativeInstructions;
int mNumCompressedTextureFormats; int mNumCompressedTextureFormats;
// state caching flags // state caching flags
......
...@@ -235,7 +235,7 @@ void Shader::initializeCompiler() ...@@ -235,7 +235,7 @@ void Shader::initializeCompiler()
resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
resources.MaxFragmentUniformVectors = context->getMaximumFragmentUniformVectors(); resources.MaxFragmentUniformVectors = context->getMaximumFragmentUniformVectors();
resources.MaxDrawBuffers = MAX_DRAW_BUFFERS; resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
resources.OES_standard_derivatives = 1; resources.OES_standard_derivatives = context->supportsDerivativeInstructions() ? 1 : 0;
// resources.OES_EGL_image_external = getDisplay()->isD3d9ExDevice() ? 1 : 0; // TODO: commented out until the extension is actually supported. // resources.OES_EGL_image_external = getDisplay()->isD3d9ExDevice() ? 1 : 0; // TODO: commented out until the extension is actually supported.
mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_HLSL_OUTPUT, &resources); mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, SH_HLSL_OUTPUT, &resources);
......
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