summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 19:45:24 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 19:45:24 +0000
commit5094b0f1606da9535aa79bc53bd23808c1fcaed0 (patch)
tree6b4553611a7fa95c82e0bb7f4288976c010d8f93 /gpu
parentfddfcac49093d05e6ed34622320f280bb23fe994 (diff)
downloadchromium_src-5094b0f1606da9535aa79bc53bd23808c1fcaed0.zip
chromium_src-5094b0f1606da9535aa79bc53bd23808c1fcaed0.tar.gz
chromium_src-5094b0f1606da9535aa79bc53bd23808c1fcaed0.tar.bz2
* Check for GL_ANGLE_framebuffer_mutlisample
* Return correct values for GL_MAX_VIEWPORT_DIMS * connect blitFramebufferEXT to blitFramebufferANGLE TEST=unit tests BUG=55471,55560,56733 Review URL: http://codereview.chromium.org/4500001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/context_group.cc9
-rw-r--r--gpu/command_buffer/service/feature_info.cc3
-rw-r--r--gpu/command_buffer/service/framebuffer_manager_unittest.cc3
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc22
-rw-r--r--gpu/command_buffer/service/renderbuffer_manager.cc4
-rw-r--r--gpu/command_buffer/service/renderbuffer_manager.h8
-rw-r--r--gpu/command_buffer/service/renderbuffer_manager_unittest.cc11
-rw-r--r--gpu/command_buffer/service/test_helper.cc4
-rw-r--r--gpu/command_buffer/service/test_helper.h1
9 files changed, 53 insertions, 12 deletions
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc
index 07583c0..b542d51 100644
--- a/gpu/command_buffer/service/context_group.cc
+++ b/gpu/command_buffer/service/context_group.cc
@@ -49,9 +49,12 @@ bool ContextGroup::Initialize(const char* allowed_features) {
return false;
}
+ GLint max_renderbuffer_size = 0;
+ glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &max_renderbuffer_size);
+
buffer_manager_.reset(new BufferManager());
framebuffer_manager_.reset(new FramebufferManager());
- renderbuffer_manager_.reset(new RenderbufferManager());
+ renderbuffer_manager_.reset(new RenderbufferManager(max_renderbuffer_size));
shader_manager_.reset(new ShaderManager());
program_manager_.reset(new ProgramManager());
@@ -72,8 +75,8 @@ bool ContextGroup::Initialize(const char* allowed_features) {
return false;
}
- GLint max_texture_size;
- GLint max_cube_map_texture_size;
+ GLint max_texture_size = 0;
+ GLint max_cube_map_texture_size = 0;
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(max_texture_size,
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc
index 00fed83..94a6b29 100644
--- a/gpu/command_buffer/service/feature_info.cc
+++ b/gpu/command_buffer/service/feature_info.cc
@@ -261,7 +261,8 @@ void FeatureInfo::AddFeatures(const char* desired_features) {
// Check for multisample support
if (ext.Desire("GL_CHROMIUM_framebuffer_multisample") &&
- ext.Have("GL_EXT_framebuffer_multisample")) {
+ (ext.Have("GL_EXT_framebuffer_multisample") ||
+ ext.Have("GL_ANGLE_framebuffer_multisample"))) {
feature_flags_.chromium_framebuffer_multisample = true;
validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT);
validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT);
diff --git a/gpu/command_buffer/service/framebuffer_manager_unittest.cc b/gpu/command_buffer/service/framebuffer_manager_unittest.cc
index ead31b1..04dba8b 100644
--- a/gpu/command_buffer/service/framebuffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/framebuffer_manager_unittest.cc
@@ -124,12 +124,13 @@ TEST_F(FramebufferInfoTest, AttachRenderbuffer) {
const GLuint kRenderbufferService1Id = 333;
const GLuint kRenderbufferClient2Id = 34;
const GLuint kRenderbufferService2Id = 334;
+ const GLint kMaxRenderbufferSize = 128;
EXPECT_FALSE(info_->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0));
EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT));
EXPECT_FALSE(info_->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT));
EXPECT_FALSE(info_->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT));
- RenderbufferManager rb_manager;
+ RenderbufferManager rb_manager(kMaxRenderbufferSize);
rb_manager.CreateRenderbufferInfo(
kRenderbufferClient1Id, kRenderbufferService1Id);
RenderbufferManager::RenderbufferInfo* rb_info1 =
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 559c2ef..1723c27e 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2770,13 +2770,13 @@ bool GLES2DecoderImpl::GetHelper(
case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
*num_written = 1;
if (params) {
- *params = GL_RGBA; // TODO(gman): get correct format.
+ *params = GL_RGBA; // We don't support other formats.
}
return true;
case GL_IMPLEMENTATION_COLOR_READ_TYPE:
*num_written = 1;
if (params) {
- *params = GL_UNSIGNED_BYTE; // TODO(gman): get correct type.
+ *params = GL_UNSIGNED_BYTE; // We don't support other types.
}
return true;
case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
@@ -2797,6 +2797,15 @@ bool GLES2DecoderImpl::GetHelper(
*params = group_->max_vertex_uniform_vectors();
}
return true;
+ case GL_MAX_VIEWPORT_DIMS:
+ if (offscreen_target_frame_buffer_.get()) {
+ *num_written = 2;
+ if (params) {
+ params[0] = renderbuffer_manager()->max_renderbuffer_size();
+ params[1] = renderbuffer_manager()->max_renderbuffer_size();
+ }
+ return true;
+ }
}
}
switch (pname) {
@@ -3454,8 +3463,13 @@ void GLES2DecoderImpl::DoBlitFramebufferEXT(
SetGLError(GL_INVALID_OPERATION,
"glBlitFramebufferEXT: function not available");
}
- glBlitFramebufferEXT(
- srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+ if (IsAngle()) {
+ glBlitFramebufferANGLE(
+ srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+ } else {
+ glBlitFramebufferEXT(
+ srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+ }
}
void GLES2DecoderImpl::DoRenderbufferStorageMultisample(
diff --git a/gpu/command_buffer/service/renderbuffer_manager.cc b/gpu/command_buffer/service/renderbuffer_manager.cc
index 954c00c..86b0861 100644
--- a/gpu/command_buffer/service/renderbuffer_manager.cc
+++ b/gpu/command_buffer/service/renderbuffer_manager.cc
@@ -10,7 +10,9 @@
namespace gpu {
namespace gles2 {
-RenderbufferManager::RenderbufferManager() {}
+RenderbufferManager::RenderbufferManager(GLint max_renderbuffer_size)
+ : max_renderbuffer_size_(max_renderbuffer_size) {
+}
RenderbufferManager::~RenderbufferManager() {
DCHECK(renderbuffer_infos_.empty());
diff --git a/gpu/command_buffer/service/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h
index d3fbaa8..c6992c3a 100644
--- a/gpu/command_buffer/service/renderbuffer_manager.h
+++ b/gpu/command_buffer/service/renderbuffer_manager.h
@@ -74,9 +74,13 @@ class RenderbufferManager {
GLenum internal_format_;
};
- RenderbufferManager();
+ explicit RenderbufferManager(GLint max_renderbuffer_size);
~RenderbufferManager();
+ GLint max_renderbuffer_size() const {
+ return max_renderbuffer_size_;
+ }
+
// Must call before destruction.
void Destroy(bool have_context);
@@ -93,6 +97,8 @@ class RenderbufferManager {
bool GetClientId(GLuint service_id, GLuint* client_id) const;
private:
+ GLint max_renderbuffer_size_;
+
// Info for each renderbuffer in the system.
// TODO(gman): Choose a faster container.
typedef std::map<GLuint, RenderbufferInfo::Ref> RenderbufferInfoMap;
diff --git a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
index 563b0fb..da1849c 100644
--- a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
@@ -12,7 +12,10 @@ namespace gles2 {
class RenderbufferManagerTest : public testing::Test {
public:
- RenderbufferManagerTest() {
+ static const GLint kMaxSize = 128;
+
+ RenderbufferManagerTest()
+ : manager_(kMaxSize) {
}
~RenderbufferManagerTest() {
manager_.Destroy(false);
@@ -34,10 +37,16 @@ class RenderbufferManagerTest : public testing::Test {
RenderbufferManager manager_;
};
+// GCC requires these declarations, but MSVC requires they not be present
+#ifndef COMPILER_MSVC
+const GLint RenderbufferManagerTest::kMaxSize;
+#endif
+
TEST_F(RenderbufferManagerTest, Basic) {
const GLuint kClient1Id = 1;
const GLuint kService1Id = 11;
const GLuint kClient2Id = 2;
+ EXPECT_EQ(kMaxSize, manager_.max_renderbuffer_size());
// Check we can create renderbuffer.
manager_.CreateRenderbufferInfo(kClient1Id, kService1Id);
// Check renderbuffer got created.
diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc
index af511b3..9deac87 100644
--- a/gpu/command_buffer/service/test_helper.cc
+++ b/gpu/command_buffer/service/test_helper.cc
@@ -30,6 +30,7 @@ const GLuint TestHelper::kServiceBlackTextureCubemapId;
const GLuint TestHelper::kServiceDefaultTexture2dId;
const GLuint TestHelper::kServiceDefaultTextureCubemapId;
+const GLint TestHelper::kMaxRenderbufferSize;
const GLint TestHelper::kMaxTextureSize;
const GLint TestHelper::kMaxCubeMapTextureSize;
const GLint TestHelper::kNumVertexAttribs;
@@ -96,6 +97,9 @@ void TestHelper::SetupContextGroupInitExpectations(
SetupFeatureInfoInitExpectations(gl, extensions);
+ EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _))
+ .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize))
+ .RetiresOnSaturation();
EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_ATTRIBS, _))
.WillOnce(SetArgumentPointee<1>(kNumVertexAttribs))
.RetiresOnSaturation();
diff --git a/gpu/command_buffer/service/test_helper.h b/gpu/command_buffer/service/test_helper.h
index d301a6d..6c56224 100644
--- a/gpu/command_buffer/service/test_helper.h
+++ b/gpu/command_buffer/service/test_helper.h
@@ -18,6 +18,7 @@ class TestHelper {
static const GLuint kServiceDefaultTexture2dId = 703;
static const GLuint kServiceDefaultTextureCubemapId = 704;
+ static const GLint kMaxRenderbufferSize = 1024;
static const GLint kMaxTextureSize = 2048;
static const GLint kMaxCubeMapTextureSize = 256;
static const GLint kNumVertexAttribs = 16;