diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 22:00:46 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 22:00:46 +0000 |
commit | 9fcd39385ae39a68d3509238bd9ef83af1868fc7 (patch) | |
tree | f87d5e740dbe0b14341ff7a097dedeeaea250dc2 /gpu | |
parent | 9597ff6926070a4c3bf3649589568352cf870456 (diff) | |
download | chromium_src-9fcd39385ae39a68d3509238bd9ef83af1868fc7.zip chromium_src-9fcd39385ae39a68d3509238bd9ef83af1868fc7.tar.gz chromium_src-9fcd39385ae39a68d3509238bd9ef83af1868fc7.tar.bz2 |
Enables GL_OES_standard_derivatives
Note: With this CL standard derivaties will unfortunately be accessable by
WebGL. Another CL will be coming ASAP that fixes this.
TEST=unit tests
BUG=none
Review URL: http://codereview.chromium.org/3446008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/context_group.cc | 10 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group.h | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group_unittest.cc | 8 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 5 |
4 files changed, 23 insertions, 4 deletions
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index b4737ed..a09f041 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -95,6 +95,10 @@ bool ContextGroup::Initialize() { // Check if we should support GL_OES_packed_depth_stencil and/or // GL_GOOGLE_depth_texture. + // NOTE: GL_OES_depth_texture requires support for depth + // cubemaps. GL_ARB_depth_texture requires other features that + // GL_OES_packed_depth_stencil does not provide. Therefore we made up + // GL_GOOGLE_depth_texture. bool enable_depth_texture = false; if (strstr(extensions, "GL_ARB_depth_texture") || strstr(extensions, "GL_OES_depth_texture")) { @@ -212,6 +216,12 @@ bool ContextGroup::Initialize() { validators_.render_buffer_format.AddValue(GL_DEPTH_COMPONENT24); } + if (strstr(extensions, "GL_OES_standard_derivatives") || + gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { + AddExtensionString("GL_OES_standard_derivatives"); + extension_flags_.oes_standard_derivatives = true; + } + // TODO(gman): Add support for these extensions. // GL_OES_depth32 // GL_OES_element_index_uint diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h index 77b1c7a..e48cacd 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -32,10 +32,12 @@ class ContextGroup { public: struct ExtensionFlags { ExtensionFlags() - : ext_framebuffer_multisample(false) { + : ext_framebuffer_multisample(false), + oes_standard_derivatives(false) { } bool ext_framebuffer_multisample; + bool oes_standard_derivatives; }; ContextGroup(); diff --git a/gpu/command_buffer/service/context_group_unittest.cc b/gpu/command_buffer/service/context_group_unittest.cc index 49efb3a..4384ea6 100644 --- a/gpu/command_buffer/service/context_group_unittest.cc +++ b/gpu/command_buffer/service/context_group_unittest.cc @@ -68,6 +68,7 @@ TEST_F(ContextGroupTest, Basic) { EXPECT_TRUE(group_.program_manager() == NULL); EXPECT_TRUE(group_.shader_manager() == NULL); EXPECT_FALSE(group_.extension_flags().ext_framebuffer_multisample); + EXPECT_FALSE(group_.extension_flags().oes_standard_derivatives); } TEST_F(ContextGroupTest, InitializeNoExtensions) { @@ -376,6 +377,13 @@ TEST_F(ContextGroupTest, InitializeOES_depth24) { GL_DEPTH_COMPONENT24)); } +TEST_F(ContextGroupTest, InitializeOES_standard_derivatives) { + SetupInitExpectations("GL_OES_standard_derivatives"); + group_.Initialize(); + EXPECT_THAT(group_.extensions(), HasSubstr("GL_OES_standard_derivatives")); + EXPECT_TRUE(group_.extension_flags().oes_standard_derivatives); +} + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index b94d92a..139e1af 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -1654,9 +1654,8 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, resources.MaxFragmentUniformVectors = group_->max_fragment_uniform_vectors(); resources.MaxDrawBuffers = 1; - // TODO(alokp): Figure out if OES_standard_derivatives extension is - // available. - resources.OES_standard_derivatives = 0; + resources.OES_standard_derivatives = + group_->extension_flags().oes_standard_derivatives ? 1 : 0; vertex_translator_.reset(new ShaderTranslator); if (!vertex_translator_->Init(EShLangVertex, &resources)) { DLOG(ERROR) << "Could not initialize vertex shader translator."; |