diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 17:48:25 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 17:48:25 +0000 |
commit | 7b92c41ccc32a7b8a9a439a9a2a45d635a8d9caf (patch) | |
tree | df2b14c8461bf0c5d04c310c579bd53a0809403e /gpu/command_buffer/service/context_group.cc | |
parent | 618ce22287d17d60d8912b5419c4ff8e7bf17d27 (diff) | |
download | chromium_src-7b92c41ccc32a7b8a9a439a9a2a45d635a8d9caf.zip chromium_src-7b92c41ccc32a7b8a9a439a9a2a45d635a8d9caf.tar.gz chromium_src-7b92c41ccc32a7b8a9a439a9a2a45d635a8d9caf.tar.bz2 |
Add support for
GL_OES_texture_float,
GL_OES_texture_float_linear,
GL_OES_texture_half_float,
GL_OES_texture_half_float_linear
TEST=unit tests
BUG=none
Review URL: http://codereview.chromium.org/3005017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/context_group.cc')
-rw-r--r-- | gpu/command_buffer/service/context_group.cc | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index 74ad556..7e3f0a5 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -10,6 +10,7 @@ #include "gpu/command_buffer/service/renderbuffer_manager.h" #include "gpu/command_buffer/service/shader_manager.h" #include "gpu/command_buffer/service/texture_manager.h" +#include "gpu/GLES2/gles2_command_buffer.h" namespace gpu { namespace gles2 { @@ -79,12 +80,53 @@ bool ContextGroup::Initialize() { npot_ok = true; } + // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, + // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear + bool enable_texture_float = false; + bool enable_texture_float_linear = false; + bool enable_texture_half_float = false; + bool enable_texture_half_float_linear = false; + if (strstr(extensions, "GL_ARB_texture_float")) { + enable_texture_float = true; + enable_texture_float_linear = true; + enable_texture_half_float = true; + enable_texture_half_float_linear = true; + } else { + if (strstr(extensions, "GL_OES_texture_float")) { + enable_texture_float = true; + if (strstr(extensions, "GL_OES_texture_float_linear")) { + enable_texture_float_linear = true; + } + } + if (strstr(extensions, "GL_OES_texture_half_float")) { + enable_texture_half_float = true; + if (strstr(extensions, "GL_OES_texture_half_float_linear")) { + enable_texture_half_float_linear = true; + } + } + } + + if (enable_texture_float) { + validators_.pixel_type.AddValue(GL_FLOAT); + AddExtensionString("GL_OES_texture_float"); + if (enable_texture_float_linear) { + AddExtensionString("GL_OES_texture_float_linear"); + } + } + + if (enable_texture_half_float) { + validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); + AddExtensionString("GL_OES_texture_half_float"); + if (enable_texture_half_float_linear) { + AddExtensionString("GL_OES_texture_half_float_linear"); + } + } + // TODO(gman): Add support for these extensions. // GL_OES_depth24 // GL_OES_depth32 // GL_OES_packed_depth_stencil // GL_OES_element_index_uint - // GL_EXT_texture_format_BGRA8888 buffer_manager_.reset(new BufferManager()); framebuffer_manager_.reset(new FramebufferManager()); @@ -106,6 +148,8 @@ bool ContextGroup::Initialize() { glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &max_cube_map_texture_size); texture_manager_.reset(new TextureManager(npot_ok, + enable_texture_float_linear, + enable_texture_half_float_linear, max_texture_size, max_cube_map_texture_size)); @@ -168,7 +212,7 @@ void ContextGroup::Destroy(bool have_context) { } void ContextGroup::AddExtensionString(const std::string& str) { - extensions_ += (extensions_.empty() ? " " : "") + str; + extensions_ += (extensions_.empty() ? "" : " ") + str; } IdAllocator* ContextGroup::GetIdAllocator(unsigned namespace_id) { |