summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gpu/GLES2/gles2_command_buffer.h3
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.cc3
-rw-r--r--gpu/command_buffer/service/context_group.cc48
-rw-r--r--gpu/command_buffer/service/context_group_unittest.cc61
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc16
-rw-r--r--gpu/command_buffer/service/texture_manager.cc35
-rw-r--r--gpu/command_buffer/service/texture_manager.h19
-rw-r--r--gpu/command_buffer/service/texture_manager_unittest.cc72
8 files changed, 242 insertions, 15 deletions
diff --git a/gpu/GLES2/gles2_command_buffer.h b/gpu/GLES2/gles2_command_buffer.h
index bf26a58..3f6b39d 100644
--- a/gpu/GLES2/gles2_command_buffer.h
+++ b/gpu/GLES2/gles2_command_buffer.h
@@ -25,6 +25,9 @@
#ifndef GL_BGRA_EXT
#define GL_BGRA_EXT 0x80E1
#endif
+#ifndef GL_HALF_FLOAT_OES
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
#endif // GPU_GLES2_GLES2_COMMAND_BUFFER_H_
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index b51c8c5..6f28bc5 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -328,6 +328,9 @@ int ElementsPerGroup(int format, int type) {
// Return the number of bytes per element, based on the element type.
int BytesPerElement(int type) {
switch (type) {
+ case GL_FLOAT:
+ return 4;
+ case GL_HALF_FLOAT_OES:
case GL_UNSIGNED_SHORT:
case GL_SHORT:
case GL_UNSIGNED_SHORT_5_6_5:
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) {
diff --git a/gpu/command_buffer/service/context_group_unittest.cc b/gpu/command_buffer/service/context_group_unittest.cc
index e053127..d619e9a 100644
--- a/gpu/command_buffer/service/context_group_unittest.cc
+++ b/gpu/command_buffer/service/context_group_unittest.cc
@@ -6,6 +6,7 @@
#include "app/gfx/gl/gl_mock.h"
#include "base/scoped_ptr.h"
#include "gpu/command_buffer/service/texture_manager.h"
+#include "gpu/GLES2/gles2_command_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
using ::gfx::MockGLInterface;
@@ -223,6 +224,66 @@ TEST_F(ContextGroupTest, InitializeEXT_texture_format_BGRA8888Apple) {
GL_BGRA_EXT));
}
+TEST_F(ContextGroupTest, InitializeOES_texture_floatGLES2) {
+ SetupInitExpectations("GL_OES_texture_float");
+ group_.Initialize();
+ EXPECT_FALSE(group_.texture_manager()->enable_float_linear());
+ EXPECT_FALSE(group_.texture_manager()->enable_half_float_linear());
+ EXPECT_THAT(group_.extensions(), HasSubstr("GL_OES_texture_float"));
+ EXPECT_THAT(group_.extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
+ EXPECT_THAT(group_.extensions(),
+ Not(HasSubstr("GL_OES_texture_float_linear")));
+ EXPECT_THAT(group_.extensions(),
+ Not(HasSubstr("GL_OES_texture_half_float_linear")));
+ EXPECT_TRUE(group_.validators()->pixel_type.IsValid(GL_FLOAT));
+ EXPECT_FALSE(group_.validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
+}
+
+TEST_F(ContextGroupTest, InitializeOES_texture_float_linearGLES2) {
+ SetupInitExpectations("GL_OES_texture_float GL_OES_texture_float_linear");
+ group_.Initialize();
+ EXPECT_TRUE(group_.texture_manager()->enable_float_linear());
+ EXPECT_FALSE(group_.texture_manager()->enable_half_float_linear());
+ EXPECT_THAT(group_.extensions(), HasSubstr("GL_OES_texture_float"));
+ EXPECT_THAT(group_.extensions(), Not(HasSubstr("GL_OES_texture_half_float")));
+ EXPECT_THAT(group_.extensions(), HasSubstr("GL_OES_texture_float_linear"));
+ EXPECT_THAT(group_.extensions(),
+ Not(HasSubstr("GL_OES_texture_half_float_linear")));
+ EXPECT_TRUE(group_.validators()->pixel_type.IsValid(GL_FLOAT));
+ EXPECT_FALSE(group_.validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
+}
+
+TEST_F(ContextGroupTest, InitializeOES_texture_half_floatGLES2) {
+ SetupInitExpectations("GL_OES_texture_half_float");
+ group_.Initialize();
+ EXPECT_FALSE(group_.texture_manager()->enable_float_linear());
+ EXPECT_FALSE(group_.texture_manager()->enable_half_float_linear());
+ EXPECT_THAT(group_.extensions(), Not(HasSubstr("GL_OES_texture_float")));
+ EXPECT_THAT(group_.extensions(), HasSubstr("GL_OES_texture_half_float"));
+ EXPECT_THAT(group_.extensions(),
+ Not(HasSubstr("GL_OES_texture_float_linear")));
+ EXPECT_THAT(group_.extensions(),
+ Not(HasSubstr("GL_OES_texture_half_float_linear")));
+ EXPECT_FALSE(group_.validators()->pixel_type.IsValid(GL_FLOAT));
+ EXPECT_TRUE(group_.validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
+}
+
+TEST_F(ContextGroupTest, InitializeOES_texture_half_float_linearGLES2) {
+ SetupInitExpectations(
+ "GL_OES_texture_half_float GL_OES_texture_half_float_linear");
+ group_.Initialize();
+ EXPECT_FALSE(group_.texture_manager()->enable_float_linear());
+ EXPECT_TRUE(group_.texture_manager()->enable_half_float_linear());
+ EXPECT_THAT(group_.extensions(), Not(HasSubstr("GL_OES_texture_float")));
+ EXPECT_THAT(group_.extensions(), HasSubstr("GL_OES_texture_half_float"));
+ EXPECT_THAT(group_.extensions(),
+ Not(HasSubstr("GL_OES_texture_float_linear")));
+ EXPECT_THAT(group_.extensions(),
+ HasSubstr("GL_OES_texture_half_float_linear"));
+ EXPECT_FALSE(group_.validators()->pixel_type.IsValid(GL_FLOAT));
+ EXPECT_TRUE(group_.validators()->pixel_type.IsValid(GL_HALF_FLOAT_OES));
+}
+
} // 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 e1df544..8d2b22f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4304,6 +4304,10 @@ error::Error GLES2DecoderImpl::DoTexImage2D(
SetGLError(GL_INVALID_ENUM, "glTexImage2D: type GL_INVALID_ENUM");
return error::kNoError;
}
+ if (format != internal_format) {
+ SetGLError(GL_INVALID_OPERATION, "glTexImage2D: format != internalFormat");
+ return error::kNoError;
+ }
if (!texture_manager()->ValidForTarget(target, level, width, height, 1) ||
border != 0) {
SetGLError(GL_INVALID_VALUE, "glTexImage2D: dimensions out of range");
@@ -4326,6 +4330,18 @@ error::Error GLES2DecoderImpl::DoTexImage2D(
#if !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2)
if (format == GL_BGRA_EXT && internal_format == GL_BGRA_EXT) {
internal_format = GL_RGBA;
+ } else if (type == GL_FLOAT) {
+ if (format == GL_RGBA) {
+ internal_format = GL_RGBA32F_ARB;
+ } else if (format == GL_RGB) {
+ internal_format = GL_RGB32F_ARB;
+ }
+ } else if (type == GL_HALF_FLOAT_OES) {
+ if (format == GL_RGBA) {
+ internal_format = GL_RGBA16F_ARB;
+ } else if (format == GL_RGB) {
+ internal_format = GL_RGB16F_ARB;
+ }
}
#endif
glTexImage2D(
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index e822aa6..18a0ae8 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -7,6 +7,7 @@
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
+#include "gpu/GLES2/gles2_command_buffer.h"
namespace gpu {
namespace gles2 {
@@ -114,7 +115,8 @@ bool TextureManager::TextureInfo::MarkMipmapsGenerated(
width = std::max(1, width >> 1);
height = std::max(1, height >> 1);
depth = std::max(1, depth >> 1);
- SetLevelInfo(target_ == GL_TEXTURE_2D ? GL_TEXTURE_2D :
+ SetLevelInfo(manager,
+ target_ == GL_TEXTURE_2D ? GL_TEXTURE_2D :
FaceIndexToGLTarget(ii),
level,
info1.internal_format,
@@ -152,6 +154,7 @@ bool TextureManager::TextureInfo::CanGenerateMipmaps(
}
void TextureManager::TextureInfo::SetLevelInfo(
+ const TextureManager* manager,
GLenum target,
GLint level,
GLint internal_format,
@@ -180,7 +183,7 @@ void TextureManager::TextureInfo::SetLevelInfo(
info.format = format;
info.type = type;
max_level_set_ = std::max(max_level_set_, level);
- Update();
+ Update(manager);
}
bool TextureManager::TextureInfo::GetLevelSize(
@@ -196,7 +199,8 @@ bool TextureManager::TextureInfo::GetLevelSize(
return false;
}
-void TextureManager::TextureInfo::SetParameter(GLenum pname, GLint param) {
+void TextureManager::TextureInfo::SetParameter(
+ const TextureManager* manager, GLenum pname, GLint param) {
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
min_filter_ = param;
@@ -214,9 +218,10 @@ void TextureManager::TextureInfo::SetParameter(GLenum pname, GLint param) {
NOTREACHED();
break;
}
+ Update(manager);
}
-void TextureManager::TextureInfo::Update() {
+void TextureManager::TextureInfo::Update(const TextureManager* manager) {
// Update npot status.
npot_ = false;
for (size_t ii = 0; ii < level_infos_.size(); ++ii) {
@@ -238,6 +243,16 @@ void TextureManager::TextureInfo::Update() {
max_level_set_ >= 0;
cube_complete_ = (level_infos_.size() == 6) &&
(first_face.width == first_face.height);
+ if (first_face.type == GL_FLOAT && !manager->enable_float_linear() &&
+ (min_filter_ != GL_NEAREST_MIPMAP_NEAREST ||
+ mag_filter_ != GL_NEAREST)) {
+ texture_complete_ = false;
+ } else if (first_face.type == GL_HALF_FLOAT_OES &&
+ !manager->enable_half_float_linear() &&
+ (min_filter_ != GL_NEAREST_MIPMAP_NEAREST ||
+ mag_filter_ != GL_NEAREST)) {
+ texture_complete_ = false;
+ }
for (size_t ii = 0;
ii < level_infos_.size() && (cube_complete_ || texture_complete_);
++ii) {
@@ -277,9 +292,13 @@ void TextureManager::TextureInfo::Update() {
TextureManager::TextureManager(
bool npot_ok,
+ bool enable_float_linear,
+ bool enable_half_float_linear,
GLint max_texture_size,
GLint max_cube_map_texture_size)
: npot_ok_(npot_ok),
+ enable_float_linear_(enable_float_linear),
+ enable_half_float_linear_(enable_half_float_linear),
max_texture_size_(max_texture_size),
max_cube_map_texture_size_(max_cube_map_texture_size),
max_levels_(ComputeMipMapCount(max_texture_size,
@@ -292,12 +311,12 @@ TextureManager::TextureManager(
default_texture_2d_ = TextureInfo::Ref(new TextureInfo(0));
SetInfoTarget(default_texture_2d_, GL_TEXTURE_2D);
default_texture_2d_->SetLevelInfo(
- GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE);
+ this, GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE);
default_texture_cube_map_ = TextureInfo::Ref(new TextureInfo(0));
SetInfoTarget(default_texture_cube_map_, GL_TEXTURE_CUBE_MAP);
for (int ii = 0; ii < GLES2Util::kNumFaces; ++ii) {
default_texture_cube_map_->SetLevelInfo(
- GLES2Util::IndexToGLFaceTarget(ii),
+ this, GLES2Util::IndexToGLFaceTarget(ii),
0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE);
}
}
@@ -339,7 +358,7 @@ void TextureManager::SetLevelInfo(
--num_unrenderable_textures_;
}
info->SetLevelInfo(
- target, level, internal_format, width, height, depth,
+ this, target, level, internal_format, width, height, depth,
border, format, type);
if (!info->CanRender(this)) {
++num_unrenderable_textures_;
@@ -353,7 +372,7 @@ void TextureManager::SetParameter(
if (!info->CanRender(this)) {
--num_unrenderable_textures_;
}
- info->SetParameter(pname, param);
+ info->SetParameter(this, pname, param);
if (!info->CanRender(this)) {
++num_unrenderable_textures_;
}
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index a984489..4fbfb68 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -117,6 +117,7 @@ class TextureManager {
// Set the info for a particular level.
void SetLevelInfo(
+ const TextureManager* manager,
GLenum target,
GLint level,
GLint internal_format,
@@ -129,7 +130,7 @@ class TextureManager {
// Sets a texture parameter.
// TODO(gman): Expand to SetParameteri,f,iv,fv
- void SetParameter(GLenum pname, GLint param);
+ void SetParameter(const TextureManager* manager, GLenum pname, GLint param);
// Makes each of the mip levels as though they were generated.
bool MarkMipmapsGenerated(const TextureManager* manager);
@@ -158,7 +159,7 @@ class TextureManager {
}
// Update info about this texture.
- void Update();
+ void Update(const TextureManager* manager);
// Info about each face and level of texture.
std::vector<std::vector<LevelInfo> > level_infos_;
@@ -194,6 +195,8 @@ class TextureManager {
};
TextureManager(bool npot_ok,
+ bool enable_float_linear,
+ bool enable_half_float_linear,
GLsizei max_texture_size,
GLsizei max_cube_map_texture_size);
~TextureManager();
@@ -206,6 +209,16 @@ class TextureManager {
return npot_ok_;
}
+ // Whether float textures can have linear filtering.
+ bool enable_float_linear() const {
+ return enable_float_linear_;
+ }
+
+ // Whether half float textures can have linear filtering.
+ bool enable_half_float_linear() const {
+ return enable_half_float_linear_;
+ }
+
// Returns the maximum number of levels.
GLint MaxLevelsForTarget(GLenum target) const {
return (target == GL_TEXTURE_2D) ? max_levels_ : max_cube_map_levels_;
@@ -280,6 +293,8 @@ class TextureManager {
TextureInfoMap texture_infos_;
bool npot_ok_;
+ bool enable_float_linear_;
+ bool enable_half_float_linear_;
GLsizei max_texture_size_;
GLsizei max_cube_map_texture_size_;
GLint max_levels_;
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index b97245c..72aac0a 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -5,6 +5,7 @@
#include "gpu/command_buffer/service/texture_manager.h"
#include "base/scoped_ptr.h"
#include "app/gfx/gl/gl_mock.h"
+#include "gpu/GLES2/gles2_command_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
using ::testing::Pointee;
@@ -20,7 +21,7 @@ class TextureManagerTest : public testing::Test {
static const GLint kMaxCubeMapLevels = 4;
TextureManagerTest()
- : manager_(false, kMaxTextureSize, kMaxCubeMapTextureSize) {
+ : manager_(false, false, false, kMaxTextureSize, kMaxCubeMapTextureSize) {
}
~TextureManagerTest() {
@@ -156,7 +157,7 @@ class TextureInfoTest : public testing::Test {
static const GLuint kService1Id = 11;
TextureInfoTest()
- : manager_(false, kMaxTextureSize, kMaxCubeMapTextureSize) {
+ : manager_(false, false, false, kMaxTextureSize, kMaxCubeMapTextureSize) {
}
~TextureInfoTest() {
manager_.Destroy(false);
@@ -265,7 +266,8 @@ TEST_F(TextureInfoTest, NPOT2D) {
}
TEST_F(TextureInfoTest, NPOT2DNPOTOK) {
- TextureManager manager(true, kMaxTextureSize, kMaxCubeMapTextureSize);
+ TextureManager manager(
+ true, false, false, kMaxTextureSize, kMaxCubeMapTextureSize);
manager.CreateTextureInfo(kClient1Id, kService1Id);
TextureManager::TextureInfo* info = manager_.GetTextureInfo(kClient1Id);
ASSERT_TRUE(info_ != NULL);
@@ -390,6 +392,70 @@ TEST_F(TextureInfoTest, GetLevelSize) {
EXPECT_FALSE(info_->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height));
}
+TEST_F(TextureInfoTest, FloatNotLinear) {
+ TextureManager manager(
+ false, false, false, kMaxTextureSize, kMaxCubeMapTextureSize);
+ manager.CreateTextureInfo(kClient1Id, kService1Id);
+ TextureManager::TextureInfo* info = manager_.GetTextureInfo(kClient1Id);
+ ASSERT_TRUE(info_ != NULL);
+ manager.SetInfoTarget(info, GL_TEXTURE_2D);
+ EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), info->target());
+ manager.SetLevelInfo(info,
+ GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_FLOAT);
+ EXPECT_FALSE(info->texture_complete());
+ manager.SetParameter(info, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ EXPECT_FALSE(info->texture_complete());
+ manager.SetParameter(info, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
+ EXPECT_TRUE(info->texture_complete());
+ manager.Destroy(false);
+}
+
+TEST_F(TextureInfoTest, FloatLinear) {
+ TextureManager manager(
+ false, true, false, kMaxTextureSize, kMaxCubeMapTextureSize);
+ manager.CreateTextureInfo(kClient1Id, kService1Id);
+ TextureManager::TextureInfo* info = manager_.GetTextureInfo(kClient1Id);
+ ASSERT_TRUE(info_ != NULL);
+ manager.SetInfoTarget(info, GL_TEXTURE_2D);
+ EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), info->target());
+ manager.SetLevelInfo(info,
+ GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_FLOAT);
+ EXPECT_TRUE(info->texture_complete());
+ manager.Destroy(false);
+}
+
+TEST_F(TextureInfoTest, HalfFloatNotLinear) {
+ TextureManager manager(
+ false, false, false, kMaxTextureSize, kMaxCubeMapTextureSize);
+ manager.CreateTextureInfo(kClient1Id, kService1Id);
+ TextureManager::TextureInfo* info = manager_.GetTextureInfo(kClient1Id);
+ ASSERT_TRUE(info_ != NULL);
+ manager.SetInfoTarget(info, GL_TEXTURE_2D);
+ EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), info->target());
+ manager.SetLevelInfo(info,
+ GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_HALF_FLOAT_OES);
+ EXPECT_FALSE(info->texture_complete());
+ manager.SetParameter(info, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ EXPECT_FALSE(info->texture_complete());
+ manager.SetParameter(info, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
+ EXPECT_TRUE(info->texture_complete());
+ manager.Destroy(false);
+}
+
+TEST_F(TextureInfoTest, HalfFloatLinear) {
+ TextureManager manager(
+ false, false, true, kMaxTextureSize, kMaxCubeMapTextureSize);
+ manager.CreateTextureInfo(kClient1Id, kService1Id);
+ TextureManager::TextureInfo* info = manager_.GetTextureInfo(kClient1Id);
+ ASSERT_TRUE(info_ != NULL);
+ manager.SetInfoTarget(info, GL_TEXTURE_2D);
+ EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), info->target());
+ manager.SetLevelInfo(info,
+ GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_HALF_FLOAT_OES);
+ EXPECT_TRUE(info->texture_complete());
+ manager.Destroy(false);
+}
+
} // namespace gles2
} // namespace gpu