Disable GL_OES_standard_derivatives when ps_2_x or later is not available.

BUG=392 Review URL: https://codereview.appspot.com/7027051 Author: bsalomon@google.com (manual merge from master by daniel@transgaming.com) git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1704 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent b3077d08
...@@ -259,7 +259,7 @@ void Context::makeCurrent(egl::Surface *surface) ...@@ -259,7 +259,7 @@ void Context::makeCurrent(egl::Surface *surface)
mSupportsLuminanceAlphaTextures = mRenderer->getLuminanceAlphaTextureSupport(); mSupportsLuminanceAlphaTextures = mRenderer->getLuminanceAlphaTextureSupport();
mSupportsDepthTextures = mRenderer->getDepthTextureSupport(); mSupportsDepthTextures = mRenderer->getDepthTextureSupport();
mSupportsTextureFilterAnisotropy = mRenderer->getTextureFilterAnisotropySupport(); mSupportsTextureFilterAnisotropy = mRenderer->getTextureFilterAnisotropySupport();
mSupportsDerivativeInstructions = mRenderer->getDerivativeInstructionSupport();
mSupports32bitIndices = mRenderer->get32BitIndexSupport(); mSupports32bitIndices = mRenderer->get32BitIndexSupport();
mNumCompressedTextureFormats = 0; mNumCompressedTextureFormats = 0;
...@@ -2266,6 +2266,11 @@ bool Context::supportsTextureFilterAnisotropy() const ...@@ -2266,6 +2266,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;
...@@ -2504,7 +2509,10 @@ void Context::initExtensionString() ...@@ -2504,7 +2509,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())
{ {
......
...@@ -409,6 +409,7 @@ class Context ...@@ -409,6 +409,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);
...@@ -515,6 +516,7 @@ class Context ...@@ -515,6 +516,7 @@ class Context
bool mSupportsDepthTextures; bool mSupportsDepthTextures;
bool mSupports32bitIndices; bool mSupports32bitIndices;
bool mSupportsTextureFilterAnisotropy; bool mSupportsTextureFilterAnisotropy;
bool mSupportsDerivativeInstructions;
int mNumCompressedTextureFormats; int mNumCompressedTextureFormats;
ResourceManager *mResourceManager; ResourceManager *mResourceManager;
......
...@@ -240,7 +240,7 @@ void Shader::initializeCompiler() ...@@ -240,7 +240,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()->getRenderer()->getShareHandleSupport() ? 1 : 0; // TODO: commented out until the extension is actually supported. // resources.OES_EGL_image_external = getDisplay()->getRenderer()->getShareHandleSupport() ? 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);
......
...@@ -150,6 +150,7 @@ class Renderer ...@@ -150,6 +150,7 @@ class Renderer
virtual bool getTextureFilterAnisotropySupport() const = 0; virtual bool getTextureFilterAnisotropySupport() const = 0;
virtual float getTextureMaxAnisotropy() const = 0; virtual float getTextureMaxAnisotropy() const = 0;
virtual bool getShareHandleSupport() const = 0; virtual bool getShareHandleSupport() const = 0;
virtual bool getDerivativeInstructionSupport() const = 0;
virtual int getMajorShaderModel() const = 0; virtual int getMajorShaderModel() const = 0;
virtual float getMaxPointSize() const = 0; virtual float getMaxPointSize() const = 0;
......
...@@ -1414,6 +1414,13 @@ bool Renderer11::getShareHandleSupport() const ...@@ -1414,6 +1414,13 @@ bool Renderer11::getShareHandleSupport() const
return false && !gl::perfActive(); return false && !gl::perfActive();
} }
bool Renderer11::getDerivativeInstructionSupport() const
{
// TODO
// UNIMPLEMENTED();
return false;
}
int Renderer11::getMajorShaderModel() const int Renderer11::getMajorShaderModel() const
{ {
switch (mFeatureLevel) switch (mFeatureLevel)
......
...@@ -105,6 +105,7 @@ class Renderer11 : public Renderer ...@@ -105,6 +105,7 @@ class Renderer11 : public Renderer
virtual bool getTextureFilterAnisotropySupport() const; virtual bool getTextureFilterAnisotropySupport() const;
virtual float getTextureMaxAnisotropy() const; virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getDerivativeInstructionSupport() const;
virtual int getMajorShaderModel() const; virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const; virtual float getMaxPointSize() const;
......
...@@ -2211,6 +2211,11 @@ bool Renderer9::getShareHandleSupport() const ...@@ -2211,6 +2211,11 @@ bool Renderer9::getShareHandleSupport() const
return (mD3d9Ex != NULL) && !gl::perfActive(); return (mD3d9Ex != NULL) && !gl::perfActive();
} }
bool Renderer9::getDerivativeInstructionSupport() const
{
return (mDeviceCaps.PS20Caps.Caps & D3DPS20CAPS_GRADIENTINSTRUCTIONS) != 0;
}
int Renderer9::getMajorShaderModel() const int Renderer9::getMajorShaderModel() const
{ {
return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion); return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion);
......
...@@ -130,6 +130,7 @@ class Renderer9 : public Renderer ...@@ -130,6 +130,7 @@ class Renderer9 : public Renderer
virtual bool getTextureFilterAnisotropySupport() const; virtual bool getTextureFilterAnisotropySupport() const;
virtual float getTextureMaxAnisotropy() const; virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getDerivativeInstructionSupport() const;
virtual int getMajorShaderModel() const; virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const; virtual float getMaxPointSize() const;
......
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