summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 16:13:58 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 16:13:58 +0000
commit6b8cf1ad4ff0c7c145154d78e557eef666247a50 (patch)
tree56b75e13699c5faf75ba687624dc2dc2ac12abf0 /gpu/command_buffer/client
parentab50f5225ec04327d77e9bf3fe0fbc66473c77ab (diff)
downloadchromium_src-6b8cf1ad4ff0c7c145154d78e557eef666247a50.zip
chromium_src-6b8cf1ad4ff0c7c145154d78e557eef666247a50.tar.gz
chromium_src-6b8cf1ad4ff0c7c145154d78e557eef666247a50.tar.bz2
Various fixes for the OpenGL ES 2.0 conformance tests.
Was failing 268 of 1198 Now failing 266 of 1198 ugh! all those changes only fixed 2 tests :-( TEST=some unit test and conformance tests. BUG=none Review URL: http://codereview.chromium.org/1942004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client')
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc35
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc38
2 files changed, 54 insertions, 19 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 6b2efad..8e7867c 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -809,12 +809,10 @@ void GLES2Implementation::ShaderSource(
// Compute the total size.
uint32 total_size = 1;
for (GLsizei ii = 0; ii < count; ++ii) {
- // I shouldn't have to check for this. The spec doesn't allow this
- if (!source[ii]) {
- SetGLError(GL_INVALID_VALUE, "glShaderSource: null passed for string.");
- return;
+ if (source[ii]) {
+ total_size +=
+ (length && length[ii] >= 0) ? length[ii] : strlen(source[ii]);
}
- total_size += (length && length[ii] >= 0) ? length[ii] : strlen(source[ii]);
}
// Concatenate all the strings in to a bucket on the service.
@@ -823,19 +821,20 @@ void GLES2Implementation::ShaderSource(
uint32 offset = 0;
for (GLsizei ii = 0; ii <= count; ++ii) {
const char* src = ii < count ? source[ii] : "";
-
- uint32 size = ii < count ? (length ? length[ii] : strlen(src)) : 1;
- while (size) {
- uint32 part_size = std::min(size, max_size);
- void* buffer = transfer_buffer_.Alloc(part_size);
- memcpy(buffer, src, part_size);
- helper_->SetBucketData(kResultBucketId, offset, part_size,
- transfer_buffer_id_,
- transfer_buffer_.GetOffset(buffer));
- transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
- offset += part_size;
- src += part_size;
- size -= part_size;
+ if (src) {
+ uint32 size = ii < count ? (length ? length[ii] : strlen(src)) : 1;
+ while (size) {
+ uint32 part_size = std::min(size, max_size);
+ void* buffer = transfer_buffer_.Alloc(part_size);
+ memcpy(buffer, src, part_size);
+ helper_->SetBucketData(kResultBucketId, offset, part_size,
+ transfer_buffer_id_,
+ transfer_buffer_.GetOffset(buffer));
+ transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
+ offset += part_size;
+ src += part_size;
+ size -= part_size;
+ }
}
}
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index e43bf84..b73b889 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -626,6 +626,8 @@ TEST_F(GLES2ImplementationTest, GetVertexAttrib) {
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
+#endif // defined(GLES2_SUPPORT_CLIENT_SIDE_BUFFERS)
+
TEST_F(GLES2ImplementationTest, ReservedIds) {
// Only the get error command should be issued.
struct Cmds {
@@ -650,8 +652,42 @@ TEST_F(GLES2ImplementationTest, ReservedIds) {
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
-#endif // defined(GLES2_SUPPORT_CLIENT_SIDE_BUFFERS)
+TEST_F(GLES2ImplementationTest, ReadPixels2Reads) {
+ struct Cmds {
+ ReadPixels read1;
+ cmd::SetToken set_token1;
+ ReadPixels read2;
+ cmd::SetToken set_token2;
+ };
+ const GLint kBytesPerPixel = 4;
+ const GLint kWidth =
+ (kTransferBufferSize - GLES2Implementation::kStartingOffset) /
+ kBytesPerPixel;
+ const GLint kHeight = 2;
+ const GLenum kFormat = GL_RGBA;
+ const GLenum kType = GL_UNSIGNED_BYTE;
+
+ int32 token = 1;
+ uint32 offset = GLES2Implementation::kStartingOffset;
+ Cmds expected;
+ expected.read1.Init(0, 0, kWidth, kHeight / 2, kFormat, kType,
+ kTransferBufferId, offset,
+ kTransferBufferId, 0);
+ expected.set_token1.Init(token++);
+ expected.read2.Init(0, kHeight / 2, kWidth, kHeight / 2, kFormat, kType,
+ kTransferBufferId, offset,
+ kTransferBufferId, 0);
+ expected.set_token2.Init(token++);
+ scoped_array<int8> buffer(new int8[kWidth * kHeight * kBytesPerPixel]);
+ EXPECT_CALL(*command_buffer_, OnFlush(_))
+ .WillOnce(SetMemory(uint32(1)))
+ .WillOnce(SetMemory(uint32(1)))
+ .RetiresOnSaturation();
+
+ gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get());
+ EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
+}
} // namespace gles2
} // namespace gpu