Commit d303ef9a by alokp@chromium.org

ANGLE supports GL_OES_standard_derivatives now.

BUG=25 Review URL: http://codereview.appspot.com/2122048 git-svn-id: https://angleproject.googlecode.com/svn/trunk@416 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 8815d7f2
......@@ -84,6 +84,7 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext)
mState.scissorTest = false;
mState.dither = true;
mState.generateMipmapHint = GL_DONT_CARE;
mState.fragmentShaderDerivativeHint = GL_DONT_CARE;
mState.lineWidth = 1.0f;
......@@ -664,6 +665,14 @@ void Context::setGenerateMipmapHint(GLenum hint)
mState.generateMipmapHint = hint;
}
void Context::setFragmentShaderDerivativeHint(GLenum hint)
{
mState.fragmentShaderDerivativeHint = hint;
// TODO: Propagate the hint to shader translator so we can write
// ddx, ddx_coarse, or ddx_fine depending on the hint.
// Ignore for now. It is valid for implementations to ignore hint.
}
void Context::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
{
mState.viewportX = x;
......@@ -1212,6 +1221,7 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
case GL_PACK_ALIGNMENT: *params = mState.packAlignment; break;
case GL_UNPACK_ALIGNMENT: *params = mState.unpackAlignment; break;
case GL_GENERATE_MIPMAP_HINT: *params = mState.generateMipmapHint; break;
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mState.fragmentShaderDerivativeHint; break;
case GL_ACTIVE_TEXTURE: *params = (mState.activeSampler + GL_TEXTURE0); break;
case GL_STENCIL_FUNC: *params = mState.stencilFunc; break;
case GL_STENCIL_REF: *params = mState.stencilRef; break;
......@@ -1445,6 +1455,7 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
case GL_PACK_ALIGNMENT:
case GL_UNPACK_ALIGNMENT:
case GL_GENERATE_MIPMAP_HINT:
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
case GL_RED_BITS:
case GL_GREEN_BITS:
case GL_BLUE_BITS:
......@@ -3115,6 +3126,7 @@ void Context::initExtensionString()
mExtensionString += "GL_EXT_read_format_bgra ";
mExtensionString += "GL_ANGLE_framebuffer_blit ";
mExtensionString += "GL_OES_rgb8_rgba8 ";
mExtensionString += "GL_OES_standard_derivatives ";
if (supportsEventQueries())
{
......
......@@ -12,6 +12,7 @@
#define GL_APICALL
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define EGLAPI
#include <EGL/egl.h>
#include <d3d9.h>
......@@ -158,6 +159,7 @@ struct State
GLfloat lineWidth;
GLenum generateMipmapHint;
GLenum fragmentShaderDerivativeHint;
GLint viewportX;
GLint viewportY;
......@@ -265,6 +267,7 @@ class Context
void setLineWidth(GLfloat width);
void setGenerateMipmapHint(GLenum hint);
void setFragmentShaderDerivativeHint(GLenum hint);
void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
......
......@@ -44,6 +44,7 @@ Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mReso
resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
resources.MaxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS;
resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
resources.OES_standard_derivatives = 1;
mFragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecGLES2, &resources);
mVertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecGLES2, &resources);
......
......@@ -3542,28 +3542,27 @@ void __stdcall glHint(GLenum target, GLenum mode)
try
{
switch (target)
switch (mode)
{
case GL_GENERATE_MIPMAP_HINT:
switch (mode)
{
case GL_FASTEST:
case GL_NICEST:
case GL_DONT_CARE:
break;
default:
return error(GL_INVALID_ENUM);
}
case GL_FASTEST:
case GL_NICEST:
case GL_DONT_CARE:
break;
default:
return error(GL_INVALID_ENUM);
return error(GL_INVALID_ENUM);
}
gl::Context *context = gl::getContext();
if (context)
switch (target)
{
if (target == GL_GENERATE_MIPMAP_HINT)
context->setGenerateMipmapHint(mode);
case GL_GENERATE_MIPMAP_HINT:
if (context) context->setGenerateMipmapHint(mode);
break;
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
if (context) context->setFragmentShaderDerivativeHint(mode);
break;
default:
return error(GL_INVALID_ENUM);
}
}
catch(std::bad_alloc&)
......
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