summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-27 07:43:43 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-27 07:43:43 +0000
commit4f0c32d419b2a9783e1458192f5c0d3d79813764 (patch)
tree937023c99cbd754e9e9a6e0b5300f16ffca9aebf /gpu/command_buffer/service
parent8c809a36b0ba392460822306392ee0b1be2e84c8 (diff)
downloadchromium_src-4f0c32d419b2a9783e1458192f5c0d3d79813764.zip
chromium_src-4f0c32d419b2a9783e1458192f5c0d3d79813764.tar.gz
chromium_src-4f0c32d419b2a9783e1458192f5c0d3d79813764.tar.bz2
Revert http://codereview.chromium.org/660238
TEST=none BUG=none TBR=gman@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service')
-rw-r--r--gpu/command_buffer/service/common_decoder.cc8
-rw-r--r--gpu/command_buffer/service/common_decoder.h5
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc84
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h97
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc27
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h74
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h125
7 files changed, 275 insertions, 145 deletions
diff --git a/gpu/command_buffer/service/common_decoder.cc b/gpu/command_buffer/service/common_decoder.cc
index 06d368d..4452e39 100644
--- a/gpu/command_buffer/service/common_decoder.cc
+++ b/gpu/command_buffer/service/common_decoder.cc
@@ -8,7 +8,7 @@
namespace gpu {
-void* CommonDecoder::Bucket::GetData(size_t offset, size_t size) const {
+const void* CommonDecoder::Bucket::GetData(size_t offset, size_t size) const {
if (OffsetSizeValid(offset, size)) {
return data_.get() + offset;
}
@@ -33,10 +33,8 @@ bool CommonDecoder::Bucket::SetData(
}
void CommonDecoder::Bucket::SetFromString(const std::string& str) {
- // Strings are passed NULL terminated to distinguish between empty string
- // and no string.
- SetSize(str.size() + 1);
- SetData(str.c_str(), 0, str.size() + 1);
+ SetSize(str.size());
+ SetData(str.c_str(), 0, str.size());
}
void* CommonDecoder::GetAddressAndCheckSize(unsigned int shm_id,
diff --git a/gpu/command_buffer/service/common_decoder.h b/gpu/command_buffer/service/common_decoder.h
index 9ea0d6f..2300e5a 100644
--- a/gpu/command_buffer/service/common_decoder.h
+++ b/gpu/command_buffer/service/common_decoder.h
@@ -57,7 +57,7 @@ class CommonDecoder : public AsyncAPIInterface {
// Gets a pointer to a section the bucket. Returns NULL if offset or size is
// out of range.
- void* GetData(size_t offset, size_t size) const;
+ const void* GetData(size_t offset, size_t size) const;
template <typename T>
T GetDataAs(size_t offset, size_t size) const {
@@ -71,8 +71,7 @@ class CommonDecoder : public AsyncAPIInterface {
// Returns false if offset or size is out of range.
bool SetData(const void* src, size_t offset, size_t size);
- // Sets the bucket data from a string. Strings are passed NULL terminated to
- // distinguish between empty string and no string.
+ // Sets the bucket data from a string.
void SetFromString(const std::string& str);
private:
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 52f59ce..2b04de6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -103,6 +103,53 @@ const CommandInfo g_command_info[] = {
#undef GLES2_CMD_OP
};
+namespace GLErrorBit {
+enum GLErrorBit {
+ kNoError = 0,
+ kInvalidEnum = (1 << 0),
+ kInvalidValue = (1 << 1),
+ kInvalidOperation = (1 << 2),
+ kOutOfMemory = (1 << 3),
+ kInvalidFrameBufferOperation = (1 << 4),
+};
+}
+
+uint32 GLErrorToErrorBit(GLenum error) {
+ switch (error) {
+ case GL_INVALID_ENUM:
+ return GLErrorBit::kInvalidEnum;
+ case GL_INVALID_VALUE:
+ return GLErrorBit::kInvalidValue;
+ case GL_INVALID_OPERATION:
+ return GLErrorBit::kInvalidOperation;
+ case GL_OUT_OF_MEMORY:
+ return GLErrorBit::kOutOfMemory;
+ case GL_INVALID_FRAMEBUFFER_OPERATION:
+ return GLErrorBit::kInvalidFrameBufferOperation;
+ default:
+ DCHECK(false);
+ return GLErrorBit::kNoError;
+ }
+}
+
+GLenum GLErrorBitToGLError(uint32 error_bit) {
+ switch (error_bit) {
+ case GLErrorBit::kInvalidEnum:
+ return GL_INVALID_ENUM;
+ case GLErrorBit::kInvalidValue:
+ return GL_INVALID_VALUE;
+ case GLErrorBit::kInvalidOperation:
+ return GL_INVALID_OPERATION;
+ case GLErrorBit::kOutOfMemory:
+ return GL_OUT_OF_MEMORY;
+ case GLErrorBit::kInvalidFrameBufferOperation:
+ return GL_INVALID_FRAMEBUFFER_OPERATION;
+ default:
+ DCHECK(false);
+ return GL_NO_ERROR;
+ }
+}
+
// } // anonymous namespace.
GLES2Decoder::GLES2Decoder(ContextGroup* group)
@@ -441,9 +488,6 @@ class GLES2DecoderImpl : public GLES2Decoder {
// Wrapper for glGenerateMipmap
void DoGenerateMipmap(GLenum target);
- // Wrapper for glGetShaderiv
- void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params);
-
// Wrapper for glGetShaderSource.
void DoGetShaderSource(
GLuint shader, GLsizei bufsize, GLsizei* length, char* dst);
@@ -1758,7 +1802,7 @@ GLenum GLES2DecoderImpl::GetGLError() {
if (error == GL_NO_ERROR && error_bits_ != 0) {
for (uint32 mask = 1; mask != 0; mask = mask << 1) {
if ((error_bits_ & mask) != 0) {
- error = GLES2Util::GLErrorBitToGLError(mask);
+ error = GLErrorBitToGLError(mask);
break;
}
}
@@ -1766,13 +1810,13 @@ GLenum GLES2DecoderImpl::GetGLError() {
if (error != GL_NO_ERROR) {
// There was an error, clear the corresponding wrapped error.
- error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error);
+ error_bits_ &= ~GLErrorToErrorBit(error);
}
return error;
}
void GLES2DecoderImpl::SetGLError(GLenum error) {
- error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
+ error_bits_ |= GLErrorToErrorBit(error);
}
void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() {
@@ -2004,20 +2048,6 @@ void GLES2DecoderImpl::DoCompileShader(GLuint shader) {
glCompileShader(shader);
};
-void GLES2DecoderImpl::DoGetShaderiv(
- GLuint shader, GLenum pname, GLint* params) {
- ShaderManager::ShaderInfo* info = GetShaderInfo(shader);
- if (!info) {
- SetGLError(GL_INVALID_OPERATION);
- return;
- }
- if (pname == GL_SHADER_SOURCE_LENGTH) {
- *params = info->source().size();
- } else {
- glGetShaderiv(shader, pname, params);
- }
-}
-
void GLES2DecoderImpl::DoGetShaderSource(
GLuint shader, GLsizei bufsize, GLsizei* length, char* dst) {
ShaderManager::ShaderInfo* info = GetShaderInfo(shader);
@@ -2247,18 +2277,6 @@ error::Error GLES2DecoderImpl::HandleGetUniformLocationImmediate(
return error::kNoError;
}
-error::Error GLES2DecoderImpl::HandleGetString(
- uint32 immediate_data_size, const gles2::GetString& c) {
- GLenum name = static_cast<GLenum>(c.name);
- if (!ValidateGLenumStringType(name)) {
- SetGLError(GL_INVALID_ENUM);
- return error::kNoError;
- }
- Bucket* bucket = CreateBucket(c.bucket_id);
- bucket->SetFromString(reinterpret_cast<const char*>(glGetString(name)));
- return error::kNoError;
-}
-
error::Error GLES2DecoderImpl::HandleBufferData(
uint32 immediate_data_size, const gles2::BufferData& c) {
GLenum target = static_cast<GLenum>(c.target);
@@ -2419,6 +2437,8 @@ error::Error GLES2DecoderImpl::HandleCompressedTexImage2DImmediate(
target, level, internal_format, width, height, border, image_size, data);
}
+// TODO(gman): handle CopyTexImage2D because we need to track what was created.
+
error::Error GLES2DecoderImpl::DoTexImage2D(
GLenum target,
GLint level,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index c2620ac..d22a900 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -1087,13 +1087,27 @@ error::Error GLES2DecoderImpl::HandleGetProgramInfoLog(
SetGLError(GL_INVALID_VALUE);
return error::kNoError;
}
- uint32 bucket_id = static_cast<uint32>(c.bucket_id);
- GLint len = 0;
- glGetProgramiv(program, GL_INFO_LOG_LENGTH, &len);
- Bucket* bucket = CreateBucket(bucket_id);
- bucket->SetSize(len + 1);
- glGetProgramInfoLog(
- program, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));
+ GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
+ uint32 size_shm_id = c.length_shm_id;
+ uint32 size_shm_offset = c.length_shm_offset;
+ GLsizei* length = NULL;
+ if (size_shm_id != 0 || size_shm_offset != 0) {
+ length = GetSharedMemoryAs<GLsizei*>(
+ size_shm_id, size_shm_offset, sizeof(*length));
+ if (!length) {
+ return error::kOutOfBounds;
+ }
+ }
+ char* infolog = GetSharedMemoryAs<char*>(
+ c.infolog_shm_id, c.infolog_shm_offset, bufsize);
+ if (bufsize < 0) {
+ SetGLError(GL_INVALID_VALUE);
+ return error::kNoError;
+ }
+ if (infolog == NULL) {
+ return error::kOutOfBounds;
+ }
+ glGetProgramInfoLog(program, bufsize, length, infolog);
return error::kNoError;
}
@@ -1141,7 +1155,7 @@ error::Error GLES2DecoderImpl::HandleGetShaderiv(
if (params == NULL) {
return error::kOutOfBounds;
}
- DoGetShaderiv(shader, pname, params);
+ glGetShaderiv(shader, pname, params);
return error::kNoError;
}
@@ -1152,13 +1166,27 @@ error::Error GLES2DecoderImpl::HandleGetShaderInfoLog(
SetGLError(GL_INVALID_VALUE);
return error::kNoError;
}
- uint32 bucket_id = static_cast<uint32>(c.bucket_id);
- GLint len = 0;
- glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
- Bucket* bucket = CreateBucket(bucket_id);
- bucket->SetSize(len + 1);
- glGetShaderInfoLog(
- shader, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));
+ GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
+ uint32 size_shm_id = c.length_shm_id;
+ uint32 size_shm_offset = c.length_shm_offset;
+ GLsizei* length = NULL;
+ if (size_shm_id != 0 || size_shm_offset != 0) {
+ length = GetSharedMemoryAs<GLsizei*>(
+ size_shm_id, size_shm_offset, sizeof(*length));
+ if (!length) {
+ return error::kOutOfBounds;
+ }
+ }
+ char* infolog = GetSharedMemoryAs<char*>(
+ c.infolog_shm_id, c.infolog_shm_offset, bufsize);
+ if (bufsize < 0) {
+ SetGLError(GL_INVALID_VALUE);
+ return error::kNoError;
+ }
+ if (infolog == NULL) {
+ return error::kOutOfBounds;
+ }
+ glGetShaderInfoLog(shader, bufsize, length, infolog);
return error::kNoError;
}
@@ -1169,13 +1197,38 @@ error::Error GLES2DecoderImpl::HandleGetShaderSource(
SetGLError(GL_INVALID_VALUE);
return error::kNoError;
}
- uint32 bucket_id = static_cast<uint32>(c.bucket_id);
- GLint len = 0;
- DoGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &len);
- Bucket* bucket = CreateBucket(bucket_id);
- bucket->SetSize(len + 1);
- DoGetShaderSource(
- shader, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));
+ GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
+ uint32 size_shm_id = c.length_shm_id;
+ uint32 size_shm_offset = c.length_shm_offset;
+ GLsizei* length = NULL;
+ if (size_shm_id != 0 || size_shm_offset != 0) {
+ length = GetSharedMemoryAs<GLsizei*>(
+ size_shm_id, size_shm_offset, sizeof(*length));
+ if (!length) {
+ return error::kOutOfBounds;
+ }
+ }
+ char* source = GetSharedMemoryAs<char*>(
+ c.source_shm_id, c.source_shm_offset, bufsize);
+ if (bufsize < 0) {
+ SetGLError(GL_INVALID_VALUE);
+ return error::kNoError;
+ }
+ if (source == NULL) {
+ return error::kOutOfBounds;
+ }
+ DoGetShaderSource(shader, bufsize, length, source);
+ return error::kNoError;
+}
+
+error::Error GLES2DecoderImpl::HandleGetString(
+ uint32 immediate_data_size, const gles2::GetString& c) {
+ GLenum name = static_cast<GLenum>(c.name);
+ if (!ValidateGLenumStringType(name)) {
+ SetGLError(GL_INVALID_ENUM);
+ return error::kNoError;
+ }
+ glGetString(name);
return error::kNoError;
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index 5f96cd5..09ddc14 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -853,7 +853,6 @@ TEST_F(GLES2DecoderTest, CompileShaderInvalidArgs) {
}
TEST_F(GLES2DecoderTest, ShaderSourceAndGetShaderSourceValidArgs) {
- const uint32 kBucketId = 123;
const char kSource[] = "hello";
const uint32 kSourceSize = sizeof(kSource) - 1;
memcpy(shared_memory_address_, kSource, kSourceSize);
@@ -862,14 +861,15 @@ TEST_F(GLES2DecoderTest, ShaderSourceAndGetShaderSourceValidArgs) {
kSharedMemoryId, kSharedMemoryOffset, kSourceSize);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
memset(shared_memory_address_, 0, kSourceSize);
+ // TODO(gman): GetShaderSource has to change format so result is always set.
GetShaderSource get_cmd;
- get_cmd.Init(client_shader_id_, kBucketId);
+ get_cmd.Init(client_shader_id_, kSourceSize + 1,
+ kSharedMemoryId, kSharedMemoryOffset,
+ kSharedMemoryId, kSharedMemoryOffset + sizeof(kSourceSize));
EXPECT_EQ(error::kNoError, ExecuteCmd(get_cmd));
- CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
- ASSERT_TRUE(bucket != NULL);
- EXPECT_EQ(kSourceSize + 1, bucket->size());
- EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kSource,
- bucket->size()));
+ EXPECT_EQ(kSourceSize, *GetSharedMemoryAs<uint32*>());
+ EXPECT_EQ(0, memcmp(GetSharedMemoryAsWithOffset<void*>(sizeof(kSourceSize)),
+ kSource, kSourceSize));
}
TEST_F(GLES2DecoderTest, ShaderSourceInvalidArgs) {
@@ -897,7 +897,6 @@ TEST_F(GLES2DecoderTest, ShaderSourceInvalidArgs) {
}
TEST_F(GLES2DecoderTest, ShaderSourceImmediateAndGetShaderSourceValidArgs) {
- const uint32 kBucketId = 123;
const char kSource[] = "hello";
const uint32 kSourceSize = sizeof(kSource) - 1;
ShaderSourceImmediate& cmd = *GetImmediateAs<ShaderSourceImmediate>();
@@ -907,13 +906,13 @@ TEST_F(GLES2DecoderTest, ShaderSourceImmediateAndGetShaderSourceValidArgs) {
memset(shared_memory_address_, 0, kSourceSize);
// TODO(gman): GetShaderSource has to change format so result is always set.
GetShaderSource get_cmd;
- get_cmd.Init(client_shader_id_, kBucketId);
+ get_cmd.Init(client_shader_id_, kSourceSize + 1,
+ kSharedMemoryId, kSharedMemoryOffset,
+ kSharedMemoryId, kSharedMemoryOffset + sizeof(kSourceSize));
EXPECT_EQ(error::kNoError, ExecuteCmd(get_cmd));
- CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
- ASSERT_TRUE(bucket != NULL);
- EXPECT_EQ(kSourceSize + 1, bucket->size());
- EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kSource,
- bucket->size()));
+ EXPECT_EQ(kSourceSize, *GetSharedMemoryAs<uint32*>());
+ EXPECT_EQ(0, memcmp(GetSharedMemoryAsWithOffset<void*>(sizeof(kSourceSize)),
+ kSource, kSourceSize));
}
TEST_F(GLES2DecoderTest, ShaderSourceImmediateInvalidArgs) {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h
index f8dc38b..5b422bf 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h
@@ -10,6 +10,7 @@
TEST_F(GLES2DecoderTest1, ActiveTextureValidArgs) {
+ EXPECT_CALL(*gl_, ActiveTexture(1));
SpecializedSetup<ActiveTexture, 0>();
ActiveTexture cmd;
cmd.Init(1);
@@ -1112,38 +1113,8 @@ TEST_F(GLES2DecoderTest1, GetProgramivInvalidArgs2_1) {
kInvalidSharedMemoryOffset);
EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
}
+// TODO(gman): GetProgramInfoLog
-TEST_F(GLES2DecoderTest1, GetProgramInfoLogValidArgs) {
- const char* kInfo = "hello";
- const uint32 kBucketId = 123;
- SpecializedSetup<GetProgramInfoLog, 0>();
- EXPECT_CALL(
- *gl_, GetProgramiv(
- kServiceProgramId, GL_INFO_LOG_LENGTH, _)) .WillOnce(
- SetArgumentPointee<2>(strlen(kInfo)));
- EXPECT_CALL(
- *gl_, GetProgramInfoLog(kServiceProgramId, strlen(kInfo) + 1, _, _))
- .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)),
- SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1)));
- GetProgramInfoLog cmd;
- cmd.Init(client_program_id_, kBucketId);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
- ASSERT_TRUE(bucket != NULL);
- EXPECT_EQ(strlen(kInfo) + 1, bucket->size());
- EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo,
- bucket->size()));
-}
-
-TEST_F(GLES2DecoderTest1, GetProgramInfoLogInvalidArgs) {
- const uint32 kBucketId = 123;
- EXPECT_CALL(*gl_, GetProgramInfoLog(_, _, _, _))
- .Times(0);
- GetProgramInfoLog cmd;
- cmd.Init(kInvalidClientId, kBucketId);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
-}
TEST_F(GLES2DecoderTest1, GetRenderbufferParameterivValidArgs) {
EXPECT_CALL(
@@ -1206,44 +1177,21 @@ TEST_F(GLES2DecoderTest1, GetShaderivInvalidArgs2_1) {
kInvalidSharedMemoryOffset);
EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
}
+// TODO(gman): GetShaderInfoLog
-TEST_F(GLES2DecoderTest1, GetShaderInfoLogValidArgs) {
- const char* kInfo = "hello";
- const uint32 kBucketId = 123;
- SpecializedSetup<GetShaderInfoLog, 0>();
- EXPECT_CALL(
- *gl_, GetShaderiv(
- kServiceShaderId, GL_INFO_LOG_LENGTH, _)) .WillOnce(
- SetArgumentPointee<2>(strlen(kInfo)));
- EXPECT_CALL(
- *gl_, GetShaderInfoLog(kServiceShaderId, strlen(kInfo) + 1, _, _))
- .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)),
- SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1)));
- GetShaderInfoLog cmd;
- cmd.Init(client_shader_id_, kBucketId);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
- ASSERT_TRUE(bucket != NULL);
- EXPECT_EQ(strlen(kInfo) + 1, bucket->size());
- EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo,
- bucket->size()));
-}
-
-TEST_F(GLES2DecoderTest1, GetShaderInfoLogInvalidArgs) {
- const uint32 kBucketId = 123;
- EXPECT_CALL(*gl_, GetShaderInfoLog(_, _, _, _))
- .Times(0);
- GetShaderInfoLog cmd;
- cmd.Init(kInvalidClientId, kBucketId);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
-}
// TODO(gman): GetShaderPrecisionFormat
// TODO(gman): GetShaderSource
-// TODO(gman): GetString
+TEST_F(GLES2DecoderTest1, GetStringValidArgs) {
+ EXPECT_CALL(*gl_, GetString(GL_VENDOR));
+ SpecializedSetup<GetString, 0>();
+ GetString cmd;
+ cmd.Init(GL_VENDOR);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+}
+
TEST_F(GLES2DecoderTest1, GetTexParameterfvValidArgs) {
EXPECT_CALL(
*gl_, GetTexParameterfv(
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h
index ef5c231..c0b52fa 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h
@@ -667,6 +667,17 @@ TEST_F(GLES2DecoderTest2, Uniform1fvImmediateValidArgs) {
EXPECT_EQ(error::kNoError,
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+
+TEST_F(GLES2DecoderTest2, Uniform1fvImmediateInvalidArgs1_0) {
+ Uniform1fvImmediate& cmd = *GetImmediateAs<Uniform1fvImmediate>();
+ EXPECT_CALL(*gl_, Uniform1fv(_, _, _)).Times(0);
+ SpecializedSetup<Uniform1fvImmediate, 0>();
+ GLfloat temp[1 * 2] = { 0, };
+ cmd.Init(1, -1, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
// TODO(gman): Uniform1i
// TODO(gman): Uniform1iv
// TODO(gman): Uniform1ivImmediate
@@ -727,6 +738,17 @@ TEST_F(GLES2DecoderTest2, Uniform2fvImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, Uniform2fvImmediateInvalidArgs1_0) {
+ Uniform2fvImmediate& cmd = *GetImmediateAs<Uniform2fvImmediate>();
+ EXPECT_CALL(*gl_, Uniform2fv(_, _, _)).Times(0);
+ SpecializedSetup<Uniform2fvImmediate, 0>();
+ GLfloat temp[2 * 2] = { 0, };
+ cmd.Init(1, -1, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, Uniform2iValidArgs) {
EXPECT_CALL(*gl_, Uniform2i(1, 2, 3));
SpecializedSetup<Uniform2i, 0>();
@@ -783,6 +805,17 @@ TEST_F(GLES2DecoderTest2, Uniform2ivImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, Uniform2ivImmediateInvalidArgs1_0) {
+ Uniform2ivImmediate& cmd = *GetImmediateAs<Uniform2ivImmediate>();
+ EXPECT_CALL(*gl_, Uniform2iv(_, _, _)).Times(0);
+ SpecializedSetup<Uniform2ivImmediate, 0>();
+ GLint temp[2 * 2] = { 0, };
+ cmd.Init(1, -1, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, Uniform3fValidArgs) {
EXPECT_CALL(*gl_, Uniform3f(1, 2, 3, 4));
SpecializedSetup<Uniform3f, 0>();
@@ -839,6 +872,17 @@ TEST_F(GLES2DecoderTest2, Uniform3fvImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, Uniform3fvImmediateInvalidArgs1_0) {
+ Uniform3fvImmediate& cmd = *GetImmediateAs<Uniform3fvImmediate>();
+ EXPECT_CALL(*gl_, Uniform3fv(_, _, _)).Times(0);
+ SpecializedSetup<Uniform3fvImmediate, 0>();
+ GLfloat temp[3 * 2] = { 0, };
+ cmd.Init(1, -1, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, Uniform3iValidArgs) {
EXPECT_CALL(*gl_, Uniform3i(1, 2, 3, 4));
SpecializedSetup<Uniform3i, 0>();
@@ -895,6 +939,17 @@ TEST_F(GLES2DecoderTest2, Uniform3ivImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, Uniform3ivImmediateInvalidArgs1_0) {
+ Uniform3ivImmediate& cmd = *GetImmediateAs<Uniform3ivImmediate>();
+ EXPECT_CALL(*gl_, Uniform3iv(_, _, _)).Times(0);
+ SpecializedSetup<Uniform3ivImmediate, 0>();
+ GLint temp[3 * 2] = { 0, };
+ cmd.Init(1, -1, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, Uniform4fValidArgs) {
EXPECT_CALL(*gl_, Uniform4f(1, 2, 3, 4, 5));
SpecializedSetup<Uniform4f, 0>();
@@ -951,6 +1006,17 @@ TEST_F(GLES2DecoderTest2, Uniform4fvImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, Uniform4fvImmediateInvalidArgs1_0) {
+ Uniform4fvImmediate& cmd = *GetImmediateAs<Uniform4fvImmediate>();
+ EXPECT_CALL(*gl_, Uniform4fv(_, _, _)).Times(0);
+ SpecializedSetup<Uniform4fvImmediate, 0>();
+ GLfloat temp[4 * 2] = { 0, };
+ cmd.Init(1, -1, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, Uniform4iValidArgs) {
EXPECT_CALL(*gl_, Uniform4i(1, 2, 3, 4, 5));
SpecializedSetup<Uniform4i, 0>();
@@ -1007,6 +1073,17 @@ TEST_F(GLES2DecoderTest2, Uniform4ivImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, Uniform4ivImmediateInvalidArgs1_0) {
+ Uniform4ivImmediate& cmd = *GetImmediateAs<Uniform4ivImmediate>();
+ EXPECT_CALL(*gl_, Uniform4iv(_, _, _)).Times(0);
+ SpecializedSetup<Uniform4ivImmediate, 0>();
+ GLint temp[4 * 2] = { 0, };
+ cmd.Init(1, -1, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, UniformMatrix2fvValidArgs) {
EXPECT_CALL(
*gl_, UniformMatrix2fv(
@@ -1033,7 +1110,7 @@ TEST_F(GLES2DecoderTest2, UniformMatrix2fvInvalidArgs2_0) {
UniformMatrix2fv cmd;
cmd.Init(1, 2, true, shared_memory_id_, shared_memory_offset_);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
}
TEST_F(GLES2DecoderTest2, UniformMatrix2fvInvalidArgs3_0) {
@@ -1066,6 +1143,18 @@ TEST_F(GLES2DecoderTest2, UniformMatrix2fvImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, UniformMatrix2fvImmediateInvalidArgs1_0) {
+ UniformMatrix2fvImmediate& cmd =
+ *GetImmediateAs<UniformMatrix2fvImmediate>();
+ EXPECT_CALL(*gl_, UniformMatrix2fv(_, _, _, _)).Times(0);
+ SpecializedSetup<UniformMatrix2fvImmediate, 0>();
+ GLfloat temp[4 * 2] = { 0, };
+ cmd.Init(1, -1, false, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, UniformMatrix2fvImmediateInvalidArgs2_0) {
UniformMatrix2fvImmediate& cmd =
*GetImmediateAs<UniformMatrix2fvImmediate>();
@@ -1075,7 +1164,7 @@ TEST_F(GLES2DecoderTest2, UniformMatrix2fvImmediateInvalidArgs2_0) {
cmd.Init(1, 2, true, &temp[0]);
EXPECT_EQ(error::kNoError,
ExecuteImmediateCmd(cmd, sizeof(temp)));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
}
TEST_F(GLES2DecoderTest2, UniformMatrix3fvValidArgs) {
@@ -1104,7 +1193,7 @@ TEST_F(GLES2DecoderTest2, UniformMatrix3fvInvalidArgs2_0) {
UniformMatrix3fv cmd;
cmd.Init(1, 2, true, shared_memory_id_, shared_memory_offset_);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
}
TEST_F(GLES2DecoderTest2, UniformMatrix3fvInvalidArgs3_0) {
@@ -1137,6 +1226,18 @@ TEST_F(GLES2DecoderTest2, UniformMatrix3fvImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, UniformMatrix3fvImmediateInvalidArgs1_0) {
+ UniformMatrix3fvImmediate& cmd =
+ *GetImmediateAs<UniformMatrix3fvImmediate>();
+ EXPECT_CALL(*gl_, UniformMatrix3fv(_, _, _, _)).Times(0);
+ SpecializedSetup<UniformMatrix3fvImmediate, 0>();
+ GLfloat temp[9 * 2] = { 0, };
+ cmd.Init(1, -1, false, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, UniformMatrix3fvImmediateInvalidArgs2_0) {
UniformMatrix3fvImmediate& cmd =
*GetImmediateAs<UniformMatrix3fvImmediate>();
@@ -1146,7 +1247,7 @@ TEST_F(GLES2DecoderTest2, UniformMatrix3fvImmediateInvalidArgs2_0) {
cmd.Init(1, 2, true, &temp[0]);
EXPECT_EQ(error::kNoError,
ExecuteImmediateCmd(cmd, sizeof(temp)));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
}
TEST_F(GLES2DecoderTest2, UniformMatrix4fvValidArgs) {
@@ -1175,7 +1276,7 @@ TEST_F(GLES2DecoderTest2, UniformMatrix4fvInvalidArgs2_0) {
UniformMatrix4fv cmd;
cmd.Init(1, 2, true, shared_memory_id_, shared_memory_offset_);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
}
TEST_F(GLES2DecoderTest2, UniformMatrix4fvInvalidArgs3_0) {
@@ -1208,6 +1309,18 @@ TEST_F(GLES2DecoderTest2, UniformMatrix4fvImmediateValidArgs) {
ExecuteImmediateCmd(cmd, sizeof(temp)));
}
+TEST_F(GLES2DecoderTest2, UniformMatrix4fvImmediateInvalidArgs1_0) {
+ UniformMatrix4fvImmediate& cmd =
+ *GetImmediateAs<UniformMatrix4fvImmediate>();
+ EXPECT_CALL(*gl_, UniformMatrix4fv(_, _, _, _)).Times(0);
+ SpecializedSetup<UniformMatrix4fvImmediate, 0>();
+ GLfloat temp[16 * 2] = { 0, };
+ cmd.Init(1, -1, false, &temp[0]);
+ EXPECT_EQ(error::kNoError,
+ ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest2, UniformMatrix4fvImmediateInvalidArgs2_0) {
UniformMatrix4fvImmediate& cmd =
*GetImmediateAs<UniformMatrix4fvImmediate>();
@@ -1217,7 +1330,7 @@ TEST_F(GLES2DecoderTest2, UniformMatrix4fvImmediateInvalidArgs2_0) {
cmd.Init(1, 2, true, &temp[0]);
EXPECT_EQ(error::kNoError,
ExecuteImmediateCmd(cmd, sizeof(temp)));
- EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
}
// TODO(gman): UseProgram