summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gpu/BUILD.gn1
-rw-r--r--gpu/GLES2/gl2chromium_autogen.h2
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py18
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h14
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h22
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc66
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h2
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest_autogen.h38
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h8
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h14
-rw-r--r--gpu/command_buffer/client/vertex_array_object_manager.cc4
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt2
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_autogen.h110
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_test_autogen.h30
-rw-r--r--gpu/command_buffer/common/gles2_cmd_ids_autogen.h342
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.cc6
-rw-r--r--gpu/command_buffer/service/context_state.cc131
-rw-r--r--gpu/command_buffer/service/context_state.h55
-rw-r--r--gpu/command_buffer/service/context_state_unittest.cc86
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc102
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h68
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc32
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h69
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc6
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h33
-rw-r--r--gpu/command_buffer/service/vertex_attrib_manager.cc1
-rw-r--r--gpu/command_buffer/service/vertex_attrib_manager.h17
-rw-r--r--gpu/gpu.gyp1
-rw-r--r--mojo/gpu/mojo_gles2_impl_autogen.cc10
-rw-r--r--mojo/gpu/mojo_gles2_impl_autogen.h2
33 files changed, 1029 insertions, 271 deletions
diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn
index 8cb4ec4..4df2569 100644
--- a/gpu/BUILD.gn
+++ b/gpu/BUILD.gn
@@ -163,6 +163,7 @@ test("gpu_unittests") {
"command_buffer/service/command_buffer_service_unittest.cc",
"command_buffer/service/common_decoder_unittest.cc",
"command_buffer/service/context_group_unittest.cc",
+ "command_buffer/service/context_state_unittest.cc",
"command_buffer/service/feature_info_unittest.cc",
"command_buffer/service/framebuffer_manager_unittest.cc",
"command_buffer/service/gl_context_mock.cc",
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h
index 01f0e9a..9dbe95d 100644
--- a/gpu/GLES2/gl2chromium_autogen.h
+++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -129,6 +129,8 @@
#define glGetUniformLocation GLES2_GET_FUN(GetUniformLocation)
#define glGetVertexAttribfv GLES2_GET_FUN(GetVertexAttribfv)
#define glGetVertexAttribiv GLES2_GET_FUN(GetVertexAttribiv)
+#define glGetVertexAttribIiv GLES2_GET_FUN(GetVertexAttribIiv)
+#define glGetVertexAttribIuiv GLES2_GET_FUN(GetVertexAttribIuiv)
#define glGetVertexAttribPointerv GLES2_GET_FUN(GetVertexAttribPointerv)
#define glHint GLES2_GET_FUN(Hint)
#define glInvalidateFramebuffer GLES2_GET_FUN(InvalidateFramebuffer)
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index b1c8ee1..67f77f8 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -2918,6 +2918,24 @@ _FUNCTION_INFO = {
'expectation': False,
'client_test': False,
},
+ 'GetVertexAttribIiv': {
+ 'type': 'GETn',
+ 'result': ['SizedResult<GLint>'],
+ 'impl_decl': False,
+ 'decoder_func': 'DoGetVertexAttribIiv',
+ 'expectation': False,
+ 'client_test': False,
+ 'unsafe': True,
+ },
+ 'GetVertexAttribIuiv': {
+ 'type': 'GETn',
+ 'result': ['SizedResult<GLuint>'],
+ 'impl_decl': False,
+ 'decoder_func': 'DoGetVertexAttribIuiv',
+ 'expectation': False,
+ 'client_test': False,
+ 'unsafe': True,
+ },
'GetVertexAttribPointerv': {
'type': 'Custom',
'data_transfer_methods': ['shm'],
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 32aad9d..58881b7 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -546,6 +546,12 @@ void GLES2GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) {
void GLES2GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) {
gles2::GetGLContext()->GetVertexAttribiv(index, pname, params);
}
+void GLES2GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) {
+ gles2::GetGLContext()->GetVertexAttribIiv(index, pname, params);
+}
+void GLES2GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) {
+ gles2::GetGLContext()->GetVertexAttribIuiv(index, pname, params);
+}
void GLES2GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) {
gles2::GetGLContext()->GetVertexAttribPointerv(index, pname, pointer);
}
@@ -1852,6 +1858,14 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(glGetVertexAttribiv),
},
{
+ "glGetVertexAttribIiv",
+ reinterpret_cast<GLES2FunctionPointer>(glGetVertexAttribIiv),
+ },
+ {
+ "glGetVertexAttribIuiv",
+ reinterpret_cast<GLES2FunctionPointer>(glGetVertexAttribIuiv),
+ },
+ {
"glGetVertexAttribPointerv",
reinterpret_cast<GLES2FunctionPointer>(glGetVertexAttribPointerv),
},
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index cd01ff5..838cec6 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -1176,6 +1176,28 @@ void GetVertexAttribiv(GLuint index,
}
}
+void GetVertexAttribIiv(GLuint index,
+ GLenum pname,
+ uint32_t params_shm_id,
+ uint32_t params_shm_offset) {
+ gles2::cmds::GetVertexAttribIiv* c =
+ GetCmdSpace<gles2::cmds::GetVertexAttribIiv>();
+ if (c) {
+ c->Init(index, pname, params_shm_id, params_shm_offset);
+ }
+}
+
+void GetVertexAttribIuiv(GLuint index,
+ GLenum pname,
+ uint32_t params_shm_id,
+ uint32_t params_shm_offset) {
+ gles2::cmds::GetVertexAttribIuiv* c =
+ GetCmdSpace<gles2::cmds::GetVertexAttribIuiv>();
+ if (c) {
+ c->Init(index, pname, params_shm_id, params_shm_offset);
+ }
+}
+
void GetVertexAttribPointerv(GLuint index,
GLenum pname,
uint32_t pointer_shm_id,
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 1c8045d..b4c2858 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -3875,7 +3875,7 @@ void GLES2Implementation::GetVertexAttribfv(
<< static_cast<const void*>(params) << ")");
uint32 value = 0;
if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
- *params = static_cast<float>(value);
+ *params = static_cast<GLfloat>(value);
return;
}
TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv");
@@ -3906,7 +3906,7 @@ void GLES2Implementation::GetVertexAttribiv(
<< static_cast<const void*>(params) << ")");
uint32 value = 0;
if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
- *params = value;
+ *params = static_cast<GLint>(value);
return;
}
TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv");
@@ -3928,6 +3928,68 @@ void GLES2Implementation::GetVertexAttribiv(
CheckGLError();
}
+void GLES2Implementation::GetVertexAttribIiv(
+ GLuint index, GLenum pname, GLint* params) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribIiv("
+ << index << ", "
+ << GLES2Util::GetStringVertexAttribute(pname) << ", "
+ << static_cast<const void*>(params) << ")");
+ uint32 value = 0;
+ if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
+ *params = static_cast<GLint>(value);
+ return;
+ }
+ TRACE_EVENT0("gpu", "GLES2::GetVertexAttribIiv");
+ typedef cmds::GetVertexAttribiv::Result Result;
+ Result* result = GetResultAs<Result*>();
+ if (!result) {
+ return;
+ }
+ result->SetNumResults(0);
+ helper_->GetVertexAttribIiv(
+ index, pname, GetResultShmId(), GetResultShmOffset());
+ WaitForCmd();
+ result->CopyResult(params);
+ GPU_CLIENT_LOG_CODE_BLOCK({
+ for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
+ }
+ });
+ CheckGLError();
+}
+
+void GLES2Implementation::GetVertexAttribIuiv(
+ GLuint index, GLenum pname, GLuint* params) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribIuiv("
+ << index << ", "
+ << GLES2Util::GetStringVertexAttribute(pname) << ", "
+ << static_cast<const void*>(params) << ")");
+ uint32 value = 0;
+ if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
+ *params = static_cast<GLuint>(value);
+ return;
+ }
+ TRACE_EVENT0("gpu", "GLES2::GetVertexAttribIuiv");
+ typedef cmds::GetVertexAttribiv::Result Result;
+ Result* result = GetResultAs<Result*>();
+ if (!result) {
+ return;
+ }
+ result->SetNumResults(0);
+ helper_->GetVertexAttribIuiv(
+ index, pname, GetResultShmId(), GetResultShmOffset());
+ WaitForCmd();
+ result->CopyResult(params);
+ GPU_CLIENT_LOG_CODE_BLOCK({
+ for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
+ }
+ });
+ CheckGLError();
+}
+
void GLES2Implementation::Swap() {
SwapBuffers();
}
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index 31dc7e4..9c1a2fa 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -198,6 +198,8 @@ class GLES2_IMPL_EXPORT GLES2Implementation
void EnableVertexAttribArray(GLuint index) override;
void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override;
void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override;
+ void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override;
+ void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override;
// ContextSupport implementation.
void Swap() override;
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
index 138479c..ae9b5e1 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h
@@ -1122,6 +1122,44 @@ TEST_F(GLES2ImplementationTest, GetVertexAttribiv) {
EXPECT_EQ(static_cast<ResultType>(1), result);
}
+TEST_F(GLES2ImplementationTest, GetVertexAttribIiv) {
+ struct Cmds {
+ cmds::GetVertexAttribIiv cmd;
+ };
+ typedef cmds::GetVertexAttribIiv::Result::Type ResultType;
+ ResultType result = 0;
+ Cmds expected;
+ ExpectedMemoryInfo result1 =
+ GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType));
+ expected.cmd.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id,
+ result1.offset);
+ EXPECT_CALL(*command_buffer(), OnFlush())
+ .WillOnce(SetMemory(result1.ptr, SizedResultHelper<ResultType>(1)))
+ .RetiresOnSaturation();
+ gl_->GetVertexAttribIiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
+ EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
+ EXPECT_EQ(static_cast<ResultType>(1), result);
+}
+
+TEST_F(GLES2ImplementationTest, GetVertexAttribIuiv) {
+ struct Cmds {
+ cmds::GetVertexAttribIuiv cmd;
+ };
+ typedef cmds::GetVertexAttribIuiv::Result::Type ResultType;
+ ResultType result = 0;
+ Cmds expected;
+ ExpectedMemoryInfo result1 =
+ GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType));
+ expected.cmd.Init(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id,
+ result1.offset);
+ EXPECT_CALL(*command_buffer(), OnFlush())
+ .WillOnce(SetMemory(result1.ptr, SizedResultHelper<ResultType>(1)))
+ .RetiresOnSaturation();
+ gl_->GetVertexAttribIuiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
+ EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
+ EXPECT_EQ(static_cast<ResultType>(1), result);
+}
+
TEST_F(GLES2ImplementationTest, Hint) {
struct Cmds {
cmds::Hint cmd;
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 6fd74a5..a8bde29 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -309,6 +309,10 @@ virtual void GetUniformIndices(GLuint program,
virtual GLint GetUniformLocation(GLuint program, const char* name) = 0;
virtual void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) = 0;
virtual void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) = 0;
+virtual void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) = 0;
+virtual void GetVertexAttribIuiv(GLuint index,
+ GLenum pname,
+ GLuint* params) = 0;
virtual void GetVertexAttribPointerv(GLuint index,
GLenum pname,
void** pointer) = 0;
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 3430fbe..fd5151b 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -302,6 +302,8 @@ void GetUniformIndices(GLuint program,
GLint GetUniformLocation(GLuint program, const char* name) override;
void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override;
void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override;
+void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override;
+void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override;
void GetVertexAttribPointerv(GLuint index,
GLenum pname,
void** pointer) override;
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index 5f70ef6..464f1ed 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -485,6 +485,14 @@ void GLES2InterfaceStub::GetVertexAttribiv(GLuint /* index */,
GLenum /* pname */,
GLint* /* params */) {
}
+void GLES2InterfaceStub::GetVertexAttribIiv(GLuint /* index */,
+ GLenum /* pname */,
+ GLint* /* params */) {
+}
+void GLES2InterfaceStub::GetVertexAttribIuiv(GLuint /* index */,
+ GLenum /* pname */,
+ GLuint* /* params */) {
+}
void GLES2InterfaceStub::GetVertexAttribPointerv(GLuint /* index */,
GLenum /* pname */,
void** /* pointer */) {
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 51d2907..8ad90c5 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -302,6 +302,8 @@ void GetUniformIndices(GLuint program,
GLint GetUniformLocation(GLuint program, const char* name) override;
void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override;
void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override;
+void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override;
+void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override;
void GetVertexAttribPointerv(GLuint index,
GLenum pname,
void** pointer) override;
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index 1169368..5d4641f 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -822,6 +822,20 @@ void GLES2TraceImplementation::GetVertexAttribiv(GLuint index,
gl_->GetVertexAttribiv(index, pname, params);
}
+void GLES2TraceImplementation::GetVertexAttribIiv(GLuint index,
+ GLenum pname,
+ GLint* params) {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetVertexAttribIiv");
+ gl_->GetVertexAttribIiv(index, pname, params);
+}
+
+void GLES2TraceImplementation::GetVertexAttribIuiv(GLuint index,
+ GLenum pname,
+ GLuint* params) {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetVertexAttribIuiv");
+ gl_->GetVertexAttribIuiv(index, pname, params);
+}
+
void GLES2TraceImplementation::GetVertexAttribPointerv(GLuint index,
GLenum pname,
void** pointer) {
diff --git a/gpu/command_buffer/client/vertex_array_object_manager.cc b/gpu/command_buffer/client/vertex_array_object_manager.cc
index a1098e9..8b0385d 100644
--- a/gpu/command_buffer/client/vertex_array_object_manager.cc
+++ b/gpu/command_buffer/client/vertex_array_object_manager.cc
@@ -282,9 +282,11 @@ bool VertexArrayObject::GetVertexAttrib(
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
*param = attrib->normalized();
break;
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ // TODO(zmo): cache this on the client side.
+ return false;
default:
return false; // pass through to service side.
- break;
}
return true;
}
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index 463596a..a7ec6ce 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -119,6 +119,8 @@ GL_APICALL void GL_APIENTRY glGetUniformIndices (GLidProgram program, GL
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLidProgram program, const char* name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenumVertexAttribute pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenumVertexAttribute pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenumVertexAttribute pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenumVertexAttribute pname, GLuint* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenumVertexPointer pname, void** pointer);
GL_APICALL void GL_APIENTRY glHint (GLenumHintTarget target, GLenumHintMode mode);
GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenumInvalidateFrameBufferTarget target, GLsizeiNotNegative count, const GLenum* attachments);
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
index 9775d68..c25d9d2 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -5848,6 +5848,116 @@ static_assert(offsetof(GetVertexAttribiv, params_shm_id) == 12,
static_assert(offsetof(GetVertexAttribiv, params_shm_offset) == 16,
"offset of GetVertexAttribiv params_shm_offset should be 16");
+struct GetVertexAttribIiv {
+ typedef GetVertexAttribIiv ValueType;
+ static const CommandId kCmdId = kGetVertexAttribIiv;
+ static const cmd::ArgFlags kArgFlags = cmd::kFixed;
+ static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
+
+ typedef SizedResult<GLint> Result;
+
+ static uint32_t ComputeSize() {
+ return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT
+ }
+
+ void SetHeader() { header.SetCmd<ValueType>(); }
+
+ void Init(GLuint _index,
+ GLenum _pname,
+ uint32_t _params_shm_id,
+ uint32_t _params_shm_offset) {
+ SetHeader();
+ index = _index;
+ pname = _pname;
+ params_shm_id = _params_shm_id;
+ params_shm_offset = _params_shm_offset;
+ }
+
+ void* Set(void* cmd,
+ GLuint _index,
+ GLenum _pname,
+ uint32_t _params_shm_id,
+ uint32_t _params_shm_offset) {
+ static_cast<ValueType*>(cmd)
+ ->Init(_index, _pname, _params_shm_id, _params_shm_offset);
+ return NextCmdAddress<ValueType>(cmd);
+ }
+
+ gpu::CommandHeader header;
+ uint32_t index;
+ uint32_t pname;
+ uint32_t params_shm_id;
+ uint32_t params_shm_offset;
+};
+
+static_assert(sizeof(GetVertexAttribIiv) == 20,
+ "size of GetVertexAttribIiv should be 20");
+static_assert(offsetof(GetVertexAttribIiv, header) == 0,
+ "offset of GetVertexAttribIiv header should be 0");
+static_assert(offsetof(GetVertexAttribIiv, index) == 4,
+ "offset of GetVertexAttribIiv index should be 4");
+static_assert(offsetof(GetVertexAttribIiv, pname) == 8,
+ "offset of GetVertexAttribIiv pname should be 8");
+static_assert(offsetof(GetVertexAttribIiv, params_shm_id) == 12,
+ "offset of GetVertexAttribIiv params_shm_id should be 12");
+static_assert(offsetof(GetVertexAttribIiv, params_shm_offset) == 16,
+ "offset of GetVertexAttribIiv params_shm_offset should be 16");
+
+struct GetVertexAttribIuiv {
+ typedef GetVertexAttribIuiv ValueType;
+ static const CommandId kCmdId = kGetVertexAttribIuiv;
+ static const cmd::ArgFlags kArgFlags = cmd::kFixed;
+ static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
+
+ typedef SizedResult<GLuint> Result;
+
+ static uint32_t ComputeSize() {
+ return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT
+ }
+
+ void SetHeader() { header.SetCmd<ValueType>(); }
+
+ void Init(GLuint _index,
+ GLenum _pname,
+ uint32_t _params_shm_id,
+ uint32_t _params_shm_offset) {
+ SetHeader();
+ index = _index;
+ pname = _pname;
+ params_shm_id = _params_shm_id;
+ params_shm_offset = _params_shm_offset;
+ }
+
+ void* Set(void* cmd,
+ GLuint _index,
+ GLenum _pname,
+ uint32_t _params_shm_id,
+ uint32_t _params_shm_offset) {
+ static_cast<ValueType*>(cmd)
+ ->Init(_index, _pname, _params_shm_id, _params_shm_offset);
+ return NextCmdAddress<ValueType>(cmd);
+ }
+
+ gpu::CommandHeader header;
+ uint32_t index;
+ uint32_t pname;
+ uint32_t params_shm_id;
+ uint32_t params_shm_offset;
+};
+
+static_assert(sizeof(GetVertexAttribIuiv) == 20,
+ "size of GetVertexAttribIuiv should be 20");
+static_assert(offsetof(GetVertexAttribIuiv, header) == 0,
+ "offset of GetVertexAttribIuiv header should be 0");
+static_assert(offsetof(GetVertexAttribIuiv, index) == 4,
+ "offset of GetVertexAttribIuiv index should be 4");
+static_assert(offsetof(GetVertexAttribIuiv, pname) == 8,
+ "offset of GetVertexAttribIuiv pname should be 8");
+static_assert(offsetof(GetVertexAttribIuiv, params_shm_id) == 12,
+ "offset of GetVertexAttribIuiv params_shm_id should be 12");
+static_assert(offsetof(GetVertexAttribIuiv, params_shm_offset) == 16,
+ "offset of GetVertexAttribIuiv params_shm_offset should be 16");
+
struct GetVertexAttribPointerv {
typedef GetVertexAttribPointerv ValueType;
static const CommandId kCmdId = kGetVertexAttribPointerv;
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
index 620d2a1..ad56c24 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -1778,6 +1778,36 @@ TEST_F(GLES2FormatTest, GetVertexAttribiv) {
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
+TEST_F(GLES2FormatTest, GetVertexAttribIiv) {
+ cmds::GetVertexAttribIiv& cmd = *GetBufferAs<cmds::GetVertexAttribIiv>();
+ void* next_cmd =
+ cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
+ static_cast<uint32_t>(13), static_cast<uint32_t>(14));
+ EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIiv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
+ EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
+ EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
+ EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
+ EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
+ CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
+}
+
+TEST_F(GLES2FormatTest, GetVertexAttribIuiv) {
+ cmds::GetVertexAttribIuiv& cmd = *GetBufferAs<cmds::GetVertexAttribIuiv>();
+ void* next_cmd =
+ cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
+ static_cast<uint32_t>(13), static_cast<uint32_t>(14));
+ EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIuiv::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
+ EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
+ EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
+ EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
+ EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
+ CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
+}
+
TEST_F(GLES2FormatTest, GetVertexAttribPointerv) {
cmds::GetVertexAttribPointerv& cmd =
*GetBufferAs<cmds::GetVertexAttribPointerv>();
diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
index dcc1a14..ba8f073 100644
--- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
@@ -130,176 +130,178 @@
OP(GetUniformLocation) /* 371 */ \
OP(GetVertexAttribfv) /* 372 */ \
OP(GetVertexAttribiv) /* 373 */ \
- OP(GetVertexAttribPointerv) /* 374 */ \
- OP(Hint) /* 375 */ \
- OP(InvalidateFramebufferImmediate) /* 376 */ \
- OP(InvalidateSubFramebufferImmediate) /* 377 */ \
- OP(IsBuffer) /* 378 */ \
- OP(IsEnabled) /* 379 */ \
- OP(IsFramebuffer) /* 380 */ \
- OP(IsProgram) /* 381 */ \
- OP(IsRenderbuffer) /* 382 */ \
- OP(IsSampler) /* 383 */ \
- OP(IsShader) /* 384 */ \
- OP(IsSync) /* 385 */ \
- OP(IsTexture) /* 386 */ \
- OP(IsTransformFeedback) /* 387 */ \
- OP(LineWidth) /* 388 */ \
- OP(LinkProgram) /* 389 */ \
- OP(PauseTransformFeedback) /* 390 */ \
- OP(PixelStorei) /* 391 */ \
- OP(PolygonOffset) /* 392 */ \
- OP(ReadBuffer) /* 393 */ \
- OP(ReadPixels) /* 394 */ \
- OP(ReleaseShaderCompiler) /* 395 */ \
- OP(RenderbufferStorage) /* 396 */ \
- OP(ResumeTransformFeedback) /* 397 */ \
- OP(SampleCoverage) /* 398 */ \
- OP(SamplerParameterf) /* 399 */ \
- OP(SamplerParameterfvImmediate) /* 400 */ \
- OP(SamplerParameteri) /* 401 */ \
- OP(SamplerParameterivImmediate) /* 402 */ \
- OP(Scissor) /* 403 */ \
- OP(ShaderBinary) /* 404 */ \
- OP(ShaderSourceBucket) /* 405 */ \
- OP(StencilFunc) /* 406 */ \
- OP(StencilFuncSeparate) /* 407 */ \
- OP(StencilMask) /* 408 */ \
- OP(StencilMaskSeparate) /* 409 */ \
- OP(StencilOp) /* 410 */ \
- OP(StencilOpSeparate) /* 411 */ \
- OP(TexImage2D) /* 412 */ \
- OP(TexImage3D) /* 413 */ \
- OP(TexParameterf) /* 414 */ \
- OP(TexParameterfvImmediate) /* 415 */ \
- OP(TexParameteri) /* 416 */ \
- OP(TexParameterivImmediate) /* 417 */ \
- OP(TexStorage3D) /* 418 */ \
- OP(TexSubImage2D) /* 419 */ \
- OP(TexSubImage3D) /* 420 */ \
- OP(TransformFeedbackVaryingsBucket) /* 421 */ \
- OP(Uniform1f) /* 422 */ \
- OP(Uniform1fvImmediate) /* 423 */ \
- OP(Uniform1i) /* 424 */ \
- OP(Uniform1ivImmediate) /* 425 */ \
- OP(Uniform1ui) /* 426 */ \
- OP(Uniform1uivImmediate) /* 427 */ \
- OP(Uniform2f) /* 428 */ \
- OP(Uniform2fvImmediate) /* 429 */ \
- OP(Uniform2i) /* 430 */ \
- OP(Uniform2ivImmediate) /* 431 */ \
- OP(Uniform2ui) /* 432 */ \
- OP(Uniform2uivImmediate) /* 433 */ \
- OP(Uniform3f) /* 434 */ \
- OP(Uniform3fvImmediate) /* 435 */ \
- OP(Uniform3i) /* 436 */ \
- OP(Uniform3ivImmediate) /* 437 */ \
- OP(Uniform3ui) /* 438 */ \
- OP(Uniform3uivImmediate) /* 439 */ \
- OP(Uniform4f) /* 440 */ \
- OP(Uniform4fvImmediate) /* 441 */ \
- OP(Uniform4i) /* 442 */ \
- OP(Uniform4ivImmediate) /* 443 */ \
- OP(Uniform4ui) /* 444 */ \
- OP(Uniform4uivImmediate) /* 445 */ \
- OP(UniformBlockBinding) /* 446 */ \
- OP(UniformMatrix2fvImmediate) /* 447 */ \
- OP(UniformMatrix2x3fvImmediate) /* 448 */ \
- OP(UniformMatrix2x4fvImmediate) /* 449 */ \
- OP(UniformMatrix3fvImmediate) /* 450 */ \
- OP(UniformMatrix3x2fvImmediate) /* 451 */ \
- OP(UniformMatrix3x4fvImmediate) /* 452 */ \
- OP(UniformMatrix4fvImmediate) /* 453 */ \
- OP(UniformMatrix4x2fvImmediate) /* 454 */ \
- OP(UniformMatrix4x3fvImmediate) /* 455 */ \
- OP(UseProgram) /* 456 */ \
- OP(ValidateProgram) /* 457 */ \
- OP(VertexAttrib1f) /* 458 */ \
- OP(VertexAttrib1fvImmediate) /* 459 */ \
- OP(VertexAttrib2f) /* 460 */ \
- OP(VertexAttrib2fvImmediate) /* 461 */ \
- OP(VertexAttrib3f) /* 462 */ \
- OP(VertexAttrib3fvImmediate) /* 463 */ \
- OP(VertexAttrib4f) /* 464 */ \
- OP(VertexAttrib4fvImmediate) /* 465 */ \
- OP(VertexAttribI4i) /* 466 */ \
- OP(VertexAttribI4ivImmediate) /* 467 */ \
- OP(VertexAttribI4ui) /* 468 */ \
- OP(VertexAttribI4uivImmediate) /* 469 */ \
- OP(VertexAttribIPointer) /* 470 */ \
- OP(VertexAttribPointer) /* 471 */ \
- OP(Viewport) /* 472 */ \
- OP(WaitSync) /* 473 */ \
- OP(BlitFramebufferCHROMIUM) /* 474 */ \
- OP(RenderbufferStorageMultisampleCHROMIUM) /* 475 */ \
- OP(RenderbufferStorageMultisampleEXT) /* 476 */ \
- OP(FramebufferTexture2DMultisampleEXT) /* 477 */ \
- OP(TexStorage2DEXT) /* 478 */ \
- OP(GenQueriesEXTImmediate) /* 479 */ \
- OP(DeleteQueriesEXTImmediate) /* 480 */ \
- OP(BeginQueryEXT) /* 481 */ \
- OP(BeginTransformFeedback) /* 482 */ \
- OP(EndQueryEXT) /* 483 */ \
- OP(EndTransformFeedback) /* 484 */ \
- OP(InsertEventMarkerEXT) /* 485 */ \
- OP(PushGroupMarkerEXT) /* 486 */ \
- OP(PopGroupMarkerEXT) /* 487 */ \
- OP(GenVertexArraysOESImmediate) /* 488 */ \
- OP(DeleteVertexArraysOESImmediate) /* 489 */ \
- OP(IsVertexArrayOES) /* 490 */ \
- OP(BindVertexArrayOES) /* 491 */ \
- OP(SwapBuffers) /* 492 */ \
- OP(GetMaxValueInBufferCHROMIUM) /* 493 */ \
- OP(EnableFeatureCHROMIUM) /* 494 */ \
- OP(MapBufferRange) /* 495 */ \
- OP(UnmapBuffer) /* 496 */ \
- OP(ResizeCHROMIUM) /* 497 */ \
- OP(GetRequestableExtensionsCHROMIUM) /* 498 */ \
- OP(RequestExtensionCHROMIUM) /* 499 */ \
- OP(GetProgramInfoCHROMIUM) /* 500 */ \
- OP(GetUniformBlocksCHROMIUM) /* 501 */ \
- OP(GetTransformFeedbackVaryingsCHROMIUM) /* 502 */ \
- OP(GetUniformsES3CHROMIUM) /* 503 */ \
- OP(GetTranslatedShaderSourceANGLE) /* 504 */ \
- OP(PostSubBufferCHROMIUM) /* 505 */ \
- OP(TexImageIOSurface2DCHROMIUM) /* 506 */ \
- OP(CopyTextureCHROMIUM) /* 507 */ \
- OP(CopySubTextureCHROMIUM) /* 508 */ \
- OP(DrawArraysInstancedANGLE) /* 509 */ \
- OP(DrawElementsInstancedANGLE) /* 510 */ \
- OP(VertexAttribDivisorANGLE) /* 511 */ \
- OP(GenMailboxCHROMIUM) /* 512 */ \
- OP(ProduceTextureCHROMIUMImmediate) /* 513 */ \
- OP(ProduceTextureDirectCHROMIUMImmediate) /* 514 */ \
- OP(ConsumeTextureCHROMIUMImmediate) /* 515 */ \
- OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 516 */ \
- OP(BindUniformLocationCHROMIUMBucket) /* 517 */ \
- OP(GenValuebuffersCHROMIUMImmediate) /* 518 */ \
- OP(DeleteValuebuffersCHROMIUMImmediate) /* 519 */ \
- OP(IsValuebufferCHROMIUM) /* 520 */ \
- OP(BindValuebufferCHROMIUM) /* 521 */ \
- OP(SubscribeValueCHROMIUM) /* 522 */ \
- OP(PopulateSubscribedValuesCHROMIUM) /* 523 */ \
- OP(UniformValuebufferCHROMIUM) /* 524 */ \
- OP(BindTexImage2DCHROMIUM) /* 525 */ \
- OP(ReleaseTexImage2DCHROMIUM) /* 526 */ \
- OP(TraceBeginCHROMIUM) /* 527 */ \
- OP(TraceEndCHROMIUM) /* 528 */ \
- OP(AsyncTexSubImage2DCHROMIUM) /* 529 */ \
- OP(AsyncTexImage2DCHROMIUM) /* 530 */ \
- OP(WaitAsyncTexImage2DCHROMIUM) /* 531 */ \
- OP(WaitAllAsyncTexImage2DCHROMIUM) /* 532 */ \
- OP(DiscardFramebufferEXTImmediate) /* 533 */ \
- OP(LoseContextCHROMIUM) /* 534 */ \
- OP(InsertSyncPointCHROMIUM) /* 535 */ \
- OP(WaitSyncPointCHROMIUM) /* 536 */ \
- OP(DrawBuffersEXTImmediate) /* 537 */ \
- OP(DiscardBackbufferCHROMIUM) /* 538 */ \
- OP(ScheduleOverlayPlaneCHROMIUM) /* 539 */ \
- OP(SwapInterval) /* 540 */ \
- OP(MatrixLoadfCHROMIUMImmediate) /* 541 */ \
- OP(MatrixLoadIdentityCHROMIUM) /* 542 */ \
- OP(BlendBarrierKHR) /* 543 */
+ OP(GetVertexAttribIiv) /* 374 */ \
+ OP(GetVertexAttribIuiv) /* 375 */ \
+ OP(GetVertexAttribPointerv) /* 376 */ \
+ OP(Hint) /* 377 */ \
+ OP(InvalidateFramebufferImmediate) /* 378 */ \
+ OP(InvalidateSubFramebufferImmediate) /* 379 */ \
+ OP(IsBuffer) /* 380 */ \
+ OP(IsEnabled) /* 381 */ \
+ OP(IsFramebuffer) /* 382 */ \
+ OP(IsProgram) /* 383 */ \
+ OP(IsRenderbuffer) /* 384 */ \
+ OP(IsSampler) /* 385 */ \
+ OP(IsShader) /* 386 */ \
+ OP(IsSync) /* 387 */ \
+ OP(IsTexture) /* 388 */ \
+ OP(IsTransformFeedback) /* 389 */ \
+ OP(LineWidth) /* 390 */ \
+ OP(LinkProgram) /* 391 */ \
+ OP(PauseTransformFeedback) /* 392 */ \
+ OP(PixelStorei) /* 393 */ \
+ OP(PolygonOffset) /* 394 */ \
+ OP(ReadBuffer) /* 395 */ \
+ OP(ReadPixels) /* 396 */ \
+ OP(ReleaseShaderCompiler) /* 397 */ \
+ OP(RenderbufferStorage) /* 398 */ \
+ OP(ResumeTransformFeedback) /* 399 */ \
+ OP(SampleCoverage) /* 400 */ \
+ OP(SamplerParameterf) /* 401 */ \
+ OP(SamplerParameterfvImmediate) /* 402 */ \
+ OP(SamplerParameteri) /* 403 */ \
+ OP(SamplerParameterivImmediate) /* 404 */ \
+ OP(Scissor) /* 405 */ \
+ OP(ShaderBinary) /* 406 */ \
+ OP(ShaderSourceBucket) /* 407 */ \
+ OP(StencilFunc) /* 408 */ \
+ OP(StencilFuncSeparate) /* 409 */ \
+ OP(StencilMask) /* 410 */ \
+ OP(StencilMaskSeparate) /* 411 */ \
+ OP(StencilOp) /* 412 */ \
+ OP(StencilOpSeparate) /* 413 */ \
+ OP(TexImage2D) /* 414 */ \
+ OP(TexImage3D) /* 415 */ \
+ OP(TexParameterf) /* 416 */ \
+ OP(TexParameterfvImmediate) /* 417 */ \
+ OP(TexParameteri) /* 418 */ \
+ OP(TexParameterivImmediate) /* 419 */ \
+ OP(TexStorage3D) /* 420 */ \
+ OP(TexSubImage2D) /* 421 */ \
+ OP(TexSubImage3D) /* 422 */ \
+ OP(TransformFeedbackVaryingsBucket) /* 423 */ \
+ OP(Uniform1f) /* 424 */ \
+ OP(Uniform1fvImmediate) /* 425 */ \
+ OP(Uniform1i) /* 426 */ \
+ OP(Uniform1ivImmediate) /* 427 */ \
+ OP(Uniform1ui) /* 428 */ \
+ OP(Uniform1uivImmediate) /* 429 */ \
+ OP(Uniform2f) /* 430 */ \
+ OP(Uniform2fvImmediate) /* 431 */ \
+ OP(Uniform2i) /* 432 */ \
+ OP(Uniform2ivImmediate) /* 433 */ \
+ OP(Uniform2ui) /* 434 */ \
+ OP(Uniform2uivImmediate) /* 435 */ \
+ OP(Uniform3f) /* 436 */ \
+ OP(Uniform3fvImmediate) /* 437 */ \
+ OP(Uniform3i) /* 438 */ \
+ OP(Uniform3ivImmediate) /* 439 */ \
+ OP(Uniform3ui) /* 440 */ \
+ OP(Uniform3uivImmediate) /* 441 */ \
+ OP(Uniform4f) /* 442 */ \
+ OP(Uniform4fvImmediate) /* 443 */ \
+ OP(Uniform4i) /* 444 */ \
+ OP(Uniform4ivImmediate) /* 445 */ \
+ OP(Uniform4ui) /* 446 */ \
+ OP(Uniform4uivImmediate) /* 447 */ \
+ OP(UniformBlockBinding) /* 448 */ \
+ OP(UniformMatrix2fvImmediate) /* 449 */ \
+ OP(UniformMatrix2x3fvImmediate) /* 450 */ \
+ OP(UniformMatrix2x4fvImmediate) /* 451 */ \
+ OP(UniformMatrix3fvImmediate) /* 452 */ \
+ OP(UniformMatrix3x2fvImmediate) /* 453 */ \
+ OP(UniformMatrix3x4fvImmediate) /* 454 */ \
+ OP(UniformMatrix4fvImmediate) /* 455 */ \
+ OP(UniformMatrix4x2fvImmediate) /* 456 */ \
+ OP(UniformMatrix4x3fvImmediate) /* 457 */ \
+ OP(UseProgram) /* 458 */ \
+ OP(ValidateProgram) /* 459 */ \
+ OP(VertexAttrib1f) /* 460 */ \
+ OP(VertexAttrib1fvImmediate) /* 461 */ \
+ OP(VertexAttrib2f) /* 462 */ \
+ OP(VertexAttrib2fvImmediate) /* 463 */ \
+ OP(VertexAttrib3f) /* 464 */ \
+ OP(VertexAttrib3fvImmediate) /* 465 */ \
+ OP(VertexAttrib4f) /* 466 */ \
+ OP(VertexAttrib4fvImmediate) /* 467 */ \
+ OP(VertexAttribI4i) /* 468 */ \
+ OP(VertexAttribI4ivImmediate) /* 469 */ \
+ OP(VertexAttribI4ui) /* 470 */ \
+ OP(VertexAttribI4uivImmediate) /* 471 */ \
+ OP(VertexAttribIPointer) /* 472 */ \
+ OP(VertexAttribPointer) /* 473 */ \
+ OP(Viewport) /* 474 */ \
+ OP(WaitSync) /* 475 */ \
+ OP(BlitFramebufferCHROMIUM) /* 476 */ \
+ OP(RenderbufferStorageMultisampleCHROMIUM) /* 477 */ \
+ OP(RenderbufferStorageMultisampleEXT) /* 478 */ \
+ OP(FramebufferTexture2DMultisampleEXT) /* 479 */ \
+ OP(TexStorage2DEXT) /* 480 */ \
+ OP(GenQueriesEXTImmediate) /* 481 */ \
+ OP(DeleteQueriesEXTImmediate) /* 482 */ \
+ OP(BeginQueryEXT) /* 483 */ \
+ OP(BeginTransformFeedback) /* 484 */ \
+ OP(EndQueryEXT) /* 485 */ \
+ OP(EndTransformFeedback) /* 486 */ \
+ OP(InsertEventMarkerEXT) /* 487 */ \
+ OP(PushGroupMarkerEXT) /* 488 */ \
+ OP(PopGroupMarkerEXT) /* 489 */ \
+ OP(GenVertexArraysOESImmediate) /* 490 */ \
+ OP(DeleteVertexArraysOESImmediate) /* 491 */ \
+ OP(IsVertexArrayOES) /* 492 */ \
+ OP(BindVertexArrayOES) /* 493 */ \
+ OP(SwapBuffers) /* 494 */ \
+ OP(GetMaxValueInBufferCHROMIUM) /* 495 */ \
+ OP(EnableFeatureCHROMIUM) /* 496 */ \
+ OP(MapBufferRange) /* 497 */ \
+ OP(UnmapBuffer) /* 498 */ \
+ OP(ResizeCHROMIUM) /* 499 */ \
+ OP(GetRequestableExtensionsCHROMIUM) /* 500 */ \
+ OP(RequestExtensionCHROMIUM) /* 501 */ \
+ OP(GetProgramInfoCHROMIUM) /* 502 */ \
+ OP(GetUniformBlocksCHROMIUM) /* 503 */ \
+ OP(GetTransformFeedbackVaryingsCHROMIUM) /* 504 */ \
+ OP(GetUniformsES3CHROMIUM) /* 505 */ \
+ OP(GetTranslatedShaderSourceANGLE) /* 506 */ \
+ OP(PostSubBufferCHROMIUM) /* 507 */ \
+ OP(TexImageIOSurface2DCHROMIUM) /* 508 */ \
+ OP(CopyTextureCHROMIUM) /* 509 */ \
+ OP(CopySubTextureCHROMIUM) /* 510 */ \
+ OP(DrawArraysInstancedANGLE) /* 511 */ \
+ OP(DrawElementsInstancedANGLE) /* 512 */ \
+ OP(VertexAttribDivisorANGLE) /* 513 */ \
+ OP(GenMailboxCHROMIUM) /* 514 */ \
+ OP(ProduceTextureCHROMIUMImmediate) /* 515 */ \
+ OP(ProduceTextureDirectCHROMIUMImmediate) /* 516 */ \
+ OP(ConsumeTextureCHROMIUMImmediate) /* 517 */ \
+ OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 518 */ \
+ OP(BindUniformLocationCHROMIUMBucket) /* 519 */ \
+ OP(GenValuebuffersCHROMIUMImmediate) /* 520 */ \
+ OP(DeleteValuebuffersCHROMIUMImmediate) /* 521 */ \
+ OP(IsValuebufferCHROMIUM) /* 522 */ \
+ OP(BindValuebufferCHROMIUM) /* 523 */ \
+ OP(SubscribeValueCHROMIUM) /* 524 */ \
+ OP(PopulateSubscribedValuesCHROMIUM) /* 525 */ \
+ OP(UniformValuebufferCHROMIUM) /* 526 */ \
+ OP(BindTexImage2DCHROMIUM) /* 527 */ \
+ OP(ReleaseTexImage2DCHROMIUM) /* 528 */ \
+ OP(TraceBeginCHROMIUM) /* 529 */ \
+ OP(TraceEndCHROMIUM) /* 530 */ \
+ OP(AsyncTexSubImage2DCHROMIUM) /* 531 */ \
+ OP(AsyncTexImage2DCHROMIUM) /* 532 */ \
+ OP(WaitAsyncTexImage2DCHROMIUM) /* 533 */ \
+ OP(WaitAllAsyncTexImage2DCHROMIUM) /* 534 */ \
+ OP(DiscardFramebufferEXTImmediate) /* 535 */ \
+ OP(LoseContextCHROMIUM) /* 536 */ \
+ OP(InsertSyncPointCHROMIUM) /* 537 */ \
+ OP(WaitSyncPointCHROMIUM) /* 538 */ \
+ OP(DrawBuffersEXTImmediate) /* 539 */ \
+ OP(DiscardBackbufferCHROMIUM) /* 540 */ \
+ OP(ScheduleOverlayPlaneCHROMIUM) /* 541 */ \
+ OP(SwapInterval) /* 542 */ \
+ OP(MatrixLoadfCHROMIUMImmediate) /* 543 */ \
+ OP(MatrixLoadIdentityCHROMIUM) /* 544 */ \
+ OP(BlendBarrierKHR) /* 545 */
enum CommandId {
kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this.
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index 257758fe..d58156f 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -329,7 +329,7 @@ int GLES2Util::GLGetNumValuesReturned(int id) const {
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
return 1;
- // -- glGetVertexAttribfv, glGetVertexAttribiv
+ // -- glGetVertexAttrib
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
return 1;
case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
@@ -344,6 +344,10 @@ int GLES2Util::GLGetNumValuesReturned(int id) const {
return 1;
case GL_CURRENT_VERTEX_ATTRIB:
return 4;
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ return 1;
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+ return 1;
// -- glGetSynciv
case GL_OBJECT_TYPE:
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc
index 5c5da82..13c56b4 100644
--- a/gpu/command_buffer/service/context_state.cc
+++ b/gpu/command_buffer/service/context_state.cc
@@ -81,6 +81,113 @@ TextureUnit::TextureUnit()
TextureUnit::~TextureUnit() {
}
+bool Vec4::Equal(const Vec4& other) const {
+ if (type_ != other.type_)
+ return false;
+ switch (type_) {
+ case kFloat:
+ for (size_t ii = 0; ii < 4; ++ii) {
+ if (v_[ii].float_value != other.v_[ii].float_value)
+ return false;
+ }
+ break;
+ case kInt:
+ for (size_t ii = 0; ii < 4; ++ii) {
+ if (v_[ii].int_value != other.v_[ii].int_value)
+ return false;
+ }
+ break;
+ case kUInt:
+ for (size_t ii = 0; ii < 4; ++ii) {
+ if (v_[ii].uint_value != other.v_[ii].uint_value)
+ return false;
+ }
+ break;
+ }
+ return true;
+}
+
+template <>
+void Vec4::GetValues<GLfloat>(GLfloat* values) const {
+ DCHECK(values);
+ switch (type_) {
+ case kFloat:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = v_[ii].float_value;
+ break;
+ case kInt:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = static_cast<GLfloat>(v_[ii].int_value);
+ break;
+ case kUInt:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = static_cast<GLfloat>(v_[ii].uint_value);
+ break;
+ }
+}
+
+template <>
+void Vec4::GetValues<GLint>(GLint* values) const {
+ DCHECK(values);
+ switch (type_) {
+ case kFloat:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = static_cast<GLint>(v_[ii].float_value);
+ break;
+ case kInt:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = v_[ii].int_value;
+ break;
+ case kUInt:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = static_cast<GLint>(v_[ii].uint_value);
+ break;
+ }
+}
+
+template<>
+void Vec4::GetValues<GLuint>(GLuint* values) const {
+ DCHECK(values);
+ switch (type_) {
+ case kFloat:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = static_cast<GLuint>(v_[ii].float_value);
+ break;
+ case kInt:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = static_cast<GLuint>(v_[ii].int_value);
+ break;
+ case kUInt:
+ for (size_t ii = 0; ii < 4; ++ii)
+ values[ii] = v_[ii].uint_value;
+ break;
+ }
+}
+
+template <>
+void Vec4::SetValues<GLfloat>(const GLfloat* values) {
+ DCHECK(values);
+ for (size_t ii = 0; ii < 4; ++ii)
+ v_[ii].float_value = values[ii];
+ type_ = kFloat;
+}
+
+template <>
+void Vec4::SetValues<GLint>(const GLint* values) {
+ DCHECK(values);
+ for (size_t ii = 0; ii < 4; ++ii)
+ v_[ii].int_value = values[ii];
+ type_ = kInt;
+}
+
+template <>
+void Vec4::SetValues<GLuint>(const GLuint* values) {
+ DCHECK(values);
+ for (size_t ii = 0; ii < 4; ++ii)
+ v_[ii].uint_value = values[ii];
+ type_ = kUInt;
+}
+
ContextState::ContextState(FeatureInfo* feature_info,
ErrorStateClient* error_state_client,
Logger* logger)
@@ -185,7 +292,29 @@ void ContextState::RestoreActiveTextureUnitBinding(unsigned int target) const {
void ContextState::RestoreVertexAttribValues() const {
for (size_t attrib = 0; attrib < vertex_attrib_manager->num_attribs();
++attrib) {
- glVertexAttrib4fv(attrib, attrib_values[attrib].v);
+ switch (attrib_values[attrib].type()) {
+ case Vec4::kFloat:
+ {
+ GLfloat v[4];
+ attrib_values[attrib].GetValues(v);
+ glVertexAttrib4fv(attrib, v);
+ }
+ break;
+ case Vec4::kInt:
+ {
+ GLint v[4];
+ attrib_values[attrib].GetValues(v);
+ glVertexAttribI4iv(attrib, v);
+ }
+ break;
+ case Vec4::kUInt:
+ {
+ GLuint v[4];
+ attrib_values[attrib].GetValues(v);
+ glVertexAttribI4uiv(attrib, v);
+ }
+ break;
+ }
}
}
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h
index 32bef4c..166a906 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -101,16 +101,59 @@ struct GPU_EXPORT TextureUnit {
}
};
-struct Vec4 {
+class GPU_EXPORT Vec4 {
+ public:
+ enum DataType {
+ kFloat,
+ kInt,
+ kUInt,
+ };
+
Vec4() {
- v[0] = 0.0f;
- v[1] = 0.0f;
- v[2] = 0.0f;
- v[3] = 1.0f;
+ v_[0].float_value = 0.0f;
+ v_[1].float_value = 0.0f;
+ v_[2].float_value = 0.0f;
+ v_[3].float_value = 1.0f;
+ type_ = kFloat;
+ }
+
+ template <typename T>
+ void GetValues(T* values) const;
+
+ template <typename T>
+ void SetValues(const T* values);
+
+ DataType type() const {
+ return type_;
}
- float v[4];
+
+ bool Equal(const Vec4& other) const;
+
+ private:
+ union ValueUnion {
+ GLfloat float_value;
+ GLint int_value;
+ GLuint uint_value;
+ };
+
+ ValueUnion v_[4];
+ DataType type_;
};
+template <>
+GPU_EXPORT void Vec4::GetValues<GLfloat>(GLfloat* values) const;
+template <>
+GPU_EXPORT void Vec4::GetValues<GLint>(GLint* values) const;
+template <>
+GPU_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const;
+
+template <>
+GPU_EXPORT void Vec4::SetValues<GLfloat>(const GLfloat* values);
+template <>
+GPU_EXPORT void Vec4::SetValues<GLint>(const GLint* values);
+template <>
+GPU_EXPORT void Vec4::SetValues<GLuint>(const GLuint* values);
+
struct GPU_EXPORT ContextState {
ContextState(FeatureInfo* feature_info,
ErrorStateClient* error_state_client,
diff --git a/gpu/command_buffer/service/context_state_unittest.cc b/gpu/command_buffer/service/context_state_unittest.cc
new file mode 100644
index 0000000..5a835de
--- /dev/null
+++ b/gpu/command_buffer/service/context_state_unittest.cc
@@ -0,0 +1,86 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/command_buffer/service/context_state.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace gpu {
+namespace gles2 {
+
+TEST(ContextStateVec4Test, DefaultValues) {
+ Vec4 v;
+ EXPECT_EQ(Vec4::kFloat, v.type());
+ GLfloat f[4];
+ v.GetValues(f);
+ EXPECT_EQ(0.f, f[0]);
+ EXPECT_EQ(0.f, f[1]);
+ EXPECT_EQ(0.f, f[2]);
+ EXPECT_EQ(1.f, f[3]);
+}
+
+TEST(ContextStateVec4Test, SetGetFloatValues) {
+ Vec4 v;
+
+ const GLfloat kFloatValues[4] = { 2.f, 3.f, 4.f, 5.f };
+ v.SetValues(kFloatValues);
+ EXPECT_EQ(Vec4::kFloat, v.type());
+ GLfloat fv[4];
+ v.GetValues(fv);
+ for (size_t ii = 0; ii < 4; ++ii) {
+ EXPECT_EQ(kFloatValues[ii], fv[ii]);
+ }
+}
+
+TEST(ContextStateVec4Test, SetGetIntValues) {
+ Vec4 v;
+
+ const GLint kIntValues[4] = { 2, 3, -4, 5 };
+ v.SetValues(kIntValues);
+ EXPECT_EQ(Vec4::kInt, v.type());
+ GLint iv[4];
+ v.GetValues(iv);
+ for (size_t ii = 0; ii < 4; ++ii) {
+ EXPECT_EQ(kIntValues[ii], iv[ii]);
+ }
+}
+
+TEST(ContextStateVec4Test, SetGetUIntValues) {
+ Vec4 v;
+
+ const GLuint kUIntValues[4] = { 2, 3, 4, 5 };
+ v.SetValues(kUIntValues);
+ EXPECT_EQ(Vec4::kUInt, v.type());
+ GLuint uiv[4];
+ v.GetValues(uiv);
+ for (size_t ii = 0; ii < 4; ++ii) {
+ EXPECT_EQ(kUIntValues[ii], uiv[ii]);
+ }
+}
+
+TEST(ContextStateVec4Test, Equal) {
+ Vec4 v1, v2;
+
+ const GLint kIntValues[4] = { 2, 3, 4, 5 };
+ const GLuint kUIntValues[4] = { 2, 3, 4, 5 };
+
+ v1.SetValues(kIntValues);
+ v2.SetValues(kUIntValues);
+ EXPECT_FALSE(v1.Equal(v2));
+ EXPECT_FALSE(v2.Equal(v1));
+
+ v2.SetValues(kIntValues);
+ EXPECT_TRUE(v1.Equal(v2));
+ EXPECT_TRUE(v2.Equal(v1));
+
+ const GLint kIntValues2[4] = { 2, 3, 4, 6 };
+ v2.SetValues(kIntValues2);
+ EXPECT_FALSE(v1.Equal(v2));
+ EXPECT_FALSE(v2.Equal(v1));
+}
+
+} // 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 884566d..6cef78f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -173,6 +173,14 @@ static gfx::OverlayTransform GetGFXOverlayTransform(GLenum plane_transform) {
}
}
+struct Vec4f {
+ explicit Vec4f(const Vec4& data) {
+ data.GetValues(v);
+ }
+
+ GLfloat v[4];
+};
+
} // namespace
class GLES2DecoderImpl;
@@ -1472,8 +1480,12 @@ class GLES2DecoderImpl : public GLES2Decoder,
void InitTextureMaxAnisotropyIfNeeded(GLenum target, GLenum pname);
// Wrappers for glGetVertexAttrib.
- void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
- void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
+ template <typename T>
+ void DoGetVertexAttribImpl(GLuint index, GLenum pname, T* params);
+ void DoGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
+ void DoGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
+ void DoGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params);
+ void DoGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params);
// Wrappers for glIsXXX functions.
bool DoIsEnabled(GLenum cap);
@@ -2466,11 +2478,6 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
validation_fbo_(0) {
DCHECK(group);
- attrib_0_value_.v[0] = 0.0f;
- attrib_0_value_.v[1] = 0.0f;
- attrib_0_value_.v[2] = 0.0f;
- attrib_0_value_.v[3] = 1.0f;
-
// The shader translator is used for WebGL even when running on EGL
// because additional restrictions are needed (like only enabling
// GL_OES_standard_derivatives on demand). It is used for the unit
@@ -6852,7 +6859,7 @@ bool GLES2DecoderImpl::SimulateAttrib0(
uint32 size_needed = 0;
if (num_vertices == 0 ||
- !SafeMultiplyUint32(num_vertices, sizeof(Vec4), &size_needed) ||
+ !SafeMultiplyUint32(num_vertices, sizeof(Vec4f), &size_needed) ||
size_needed > 0x7FFFFFFFU) {
LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0");
return false;
@@ -6878,12 +6885,12 @@ bool GLES2DecoderImpl::SimulateAttrib0(
const Vec4& value = state_.attrib_values[0];
if (new_buffer ||
(attrib_0_used &&
- (!attrib_0_buffer_matches_value_ ||
- (value.v[0] != attrib_0_value_.v[0] ||
- value.v[1] != attrib_0_value_.v[1] ||
- value.v[2] != attrib_0_value_.v[2] ||
- value.v[3] != attrib_0_value_.v[3])))) {
- std::vector<Vec4> temp(num_vertices, value);
+ (!attrib_0_buffer_matches_value_ || !value.Equal(attrib_0_value_)))){
+ // TODO(zmo): This is not 100% correct because we might lose data when
+ // casting to float type, but it is a corner case and once we migrate to
+ // core profiles on desktop GL, it is no longer relevant.
+ Vec4f fvalue(value);
+ std::vector<Vec4f> temp(num_vertices, fvalue);
glBufferSubData(GL_ARRAY_BUFFER, 0, size_needed, &temp[0].v[0]);
attrib_0_buffer_matches_value_ = true;
attrib_0_value_ = value;
@@ -7596,7 +7603,8 @@ void GLES2DecoderImpl::DoValidateProgram(GLuint program_client_id) {
void GLES2DecoderImpl::GetVertexAttribHelper(
const VertexAttrib* attrib, GLenum pname, GLint* params) {
switch (pname) {
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: {
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ {
Buffer* buffer = attrib->buffer();
if (buffer && !buffer->IsDeleted()) {
GLuint client_id;
@@ -7620,9 +7628,12 @@ void GLES2DecoderImpl::GetVertexAttribHelper(
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
*params = attrib->normalized();
break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
*params = attrib->divisor();
break;
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ *params = attrib->integer();
+ break;
default:
NOTREACHED();
break;
@@ -7662,53 +7673,46 @@ void GLES2DecoderImpl::InitTextureMaxAnisotropyIfNeeded(
texture->InitTextureMaxAnisotropyIfNeeded(target);
}
-void GLES2DecoderImpl::DoGetVertexAttribfv(
- GLuint index, GLenum pname, GLfloat* params) {
+template <typename T>
+void GLES2DecoderImpl::DoGetVertexAttribImpl(
+ GLuint index, GLenum pname, T* params) {
VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index);
if (!attrib) {
LOCAL_SET_GL_ERROR(
- GL_INVALID_VALUE, "glGetVertexAttribfv", "index out of range");
+ GL_INVALID_VALUE, "glGetVertexAttrib", "index out of range");
return;
}
switch (pname) {
- case GL_CURRENT_VERTEX_ATTRIB: {
- const Vec4& value = state_.attrib_values[index];
- params[0] = value.v[0];
- params[1] = value.v[1];
- params[2] = value.v[2];
- params[3] = value.v[3];
+ case GL_CURRENT_VERTEX_ATTRIB:
+ state_.attrib_values[index].GetValues(params);
break;
- }
default: {
GLint value = 0;
GetVertexAttribHelper(attrib, pname, &value);
- *params = static_cast<GLfloat>(value);
+ *params = static_cast<T>(value);
break;
}
}
}
+void GLES2DecoderImpl::DoGetVertexAttribfv(
+ GLuint index, GLenum pname, GLfloat* params) {
+ DoGetVertexAttribImpl<GLfloat>(index, pname, params);
+}
+
void GLES2DecoderImpl::DoGetVertexAttribiv(
GLuint index, GLenum pname, GLint* params) {
- VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index);
- if (!attrib) {
- LOCAL_SET_GL_ERROR(
- GL_INVALID_VALUE, "glGetVertexAttribiv", "index out of range");
- return;
- }
- switch (pname) {
- case GL_CURRENT_VERTEX_ATTRIB: {
- const Vec4& value = state_.attrib_values[index];
- params[0] = static_cast<GLint>(value.v[0]);
- params[1] = static_cast<GLint>(value.v[1]);
- params[2] = static_cast<GLint>(value.v[2]);
- params[3] = static_cast<GLint>(value.v[3]);
- break;
- }
- default:
- GetVertexAttribHelper(attrib, pname, params);
- break;
- }
+ DoGetVertexAttribImpl<GLint>(index, pname, params);
+}
+
+void GLES2DecoderImpl::DoGetVertexAttribIiv(
+ GLuint index, GLenum pname, GLint* params) {
+ DoGetVertexAttribImpl<GLint>(index, pname, params);
+}
+
+void GLES2DecoderImpl::DoGetVertexAttribIuiv(
+ GLuint index, GLenum pname, GLuint* params) {
+ DoGetVertexAttribImpl<GLuint>(index, pname, params);
}
bool GLES2DecoderImpl::SetVertexAttribValue(
@@ -7717,11 +7721,7 @@ bool GLES2DecoderImpl::SetVertexAttribValue(
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "index out of range");
return false;
}
- Vec4& v = state_.attrib_values[index];
- v.v[0] = value[0];
- v.v[1] = value[1];
- v.v[2] = value[2];
- v.v[3] = value[3];
+ state_.attrib_values[index].SetValues(value);
return true;
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index 27a7f41..c68b8a5 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -2070,6 +2070,74 @@ error::Error GLES2DecoderImpl::HandleGetVertexAttribiv(
return error::kNoError;
}
+error::Error GLES2DecoderImpl::HandleGetVertexAttribIiv(
+ uint32_t immediate_data_size,
+ const void* cmd_data) {
+ if (!unsafe_es3_apis_enabled())
+ return error::kUnknownCommand;
+ const gles2::cmds::GetVertexAttribIiv& c =
+ *static_cast<const gles2::cmds::GetVertexAttribIiv*>(cmd_data);
+ (void)c;
+ GLuint index = static_cast<GLuint>(c.index);
+ GLenum pname = static_cast<GLenum>(c.pname);
+ typedef cmds::GetVertexAttribIiv::Result Result;
+ GLsizei num_values = 0;
+ GetNumValuesReturnedForGLGet(pname, &num_values);
+ Result* result = GetSharedMemoryAs<Result*>(
+ c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values));
+ GLint* params = result ? result->GetData() : NULL;
+ if (params == NULL) {
+ return error::kOutOfBounds;
+ }
+ LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetVertexAttribIiv");
+ // Check that the client initialized the result.
+ if (result->size != 0) {
+ return error::kInvalidArguments;
+ }
+ DoGetVertexAttribIiv(index, pname, params);
+ GLenum error = glGetError();
+ if (error == GL_NO_ERROR) {
+ result->SetNumResults(num_values);
+ } else {
+ LOCAL_SET_GL_ERROR(error, "GetVertexAttribIiv", "");
+ }
+ return error::kNoError;
+}
+
+error::Error GLES2DecoderImpl::HandleGetVertexAttribIuiv(
+ uint32_t immediate_data_size,
+ const void* cmd_data) {
+ if (!unsafe_es3_apis_enabled())
+ return error::kUnknownCommand;
+ const gles2::cmds::GetVertexAttribIuiv& c =
+ *static_cast<const gles2::cmds::GetVertexAttribIuiv*>(cmd_data);
+ (void)c;
+ GLuint index = static_cast<GLuint>(c.index);
+ GLenum pname = static_cast<GLenum>(c.pname);
+ typedef cmds::GetVertexAttribIuiv::Result Result;
+ GLsizei num_values = 0;
+ GetNumValuesReturnedForGLGet(pname, &num_values);
+ Result* result = GetSharedMemoryAs<Result*>(
+ c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values));
+ GLuint* params = result ? result->GetData() : NULL;
+ if (params == NULL) {
+ return error::kOutOfBounds;
+ }
+ LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetVertexAttribIuiv");
+ // Check that the client initialized the result.
+ if (result->size != 0) {
+ return error::kInvalidArguments;
+ }
+ DoGetVertexAttribIuiv(index, pname, params);
+ GLenum error = glGetError();
+ if (error == GL_NO_ERROR) {
+ result->SetNumResults(num_values);
+ } else {
+ LOCAL_SET_GL_ERROR(error, "GetVertexAttribIuiv", "");
+ }
+ return error::kNoError;
+}
+
error::Error GLES2DecoderImpl::HandleHint(uint32_t immediate_data_size,
const void* cmd_data) {
const gles2::cmds::Hint& c = *static_cast<const gles2::cmds::Hint*>(cmd_data);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
index 5c242be..2b471b97 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc
@@ -456,12 +456,6 @@ void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix2fvImmediate, 0>(
};
template <>
-void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix3fvImmediate, 0>(
- bool /* valid */) {
- SetupShaderForUniform(GL_FLOAT_MAT3);
-};
-
-template <>
void GLES2DecoderTestBase::SpecializedSetup<cmds::TexParameterf, 0>(
bool /* valid */) {
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
@@ -511,6 +505,32 @@ void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribfv, 0>(
}
};
+template <>
+void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribIiv, 0>(
+ bool valid) {
+ DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
+ DoVertexAttribPointer(1, 1, GL_FLOAT, 0, 0);
+ if (valid) {
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ }
+};
+
+template <>
+void GLES2DecoderTestBase::SpecializedSetup<cmds::GetVertexAttribIuiv, 0>(
+ bool valid) {
+ DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId);
+ DoVertexAttribPointer(1, 1, GL_FLOAT, 0, 0);
+ if (valid) {
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ }
+};
+
#include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h"
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 f79567a..d21613b 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
@@ -443,6 +443,42 @@ TEST_P(GLES2DecoderTest2, GetVertexAttribivInvalidArgs2_1) {
EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
EXPECT_EQ(0u, result->size);
}
+
+TEST_P(GLES2DecoderTest2, GetVertexAttribIivValidArgs) {
+ SpecializedSetup<cmds::GetVertexAttribIiv, 0>(true);
+ typedef cmds::GetVertexAttribIiv::Result Result;
+ Result* result = static_cast<Result*>(shared_memory_address_);
+ result->size = 0;
+ cmds::GetVertexAttribIiv cmd;
+ cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
+ shared_memory_offset_);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
+ GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
+ result->GetNumResults());
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
+
+TEST_P(GLES2DecoderTest2, GetVertexAttribIuivValidArgs) {
+ SpecializedSetup<cmds::GetVertexAttribIuiv, 0>(true);
+ typedef cmds::GetVertexAttribIuiv::Result Result;
+ Result* result = static_cast<Result*>(shared_memory_address_);
+ result->size = 0;
+ cmds::GetVertexAttribIuiv cmd;
+ cmd.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, shared_memory_id_,
+ shared_memory_offset_);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
+ GL_VERTEX_ATTRIB_ARRAY_NORMALIZED),
+ result->GetNumResults());
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
// TODO(gman): GetVertexAttribPointerv
TEST_P(GLES2DecoderTest2, HintValidArgs) {
@@ -1613,37 +1649,4 @@ TEST_P(GLES2DecoderTest2, UniformMatrix2x4fvImmediateValidArgs) {
decoder_->set_unsafe_es3_apis_enabled(false);
EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
}
-
-TEST_P(GLES2DecoderTest2, UniformMatrix3fvImmediateValidArgs) {
- cmds::UniformMatrix3fvImmediate& cmd =
- *GetImmediateAs<cmds::UniformMatrix3fvImmediate>();
- EXPECT_CALL(*gl_,
- UniformMatrix3fv(1, 2, false, reinterpret_cast<GLfloat*>(
- ImmediateDataAddress(&cmd))));
- SpecializedSetup<cmds::UniformMatrix3fvImmediate, 0>(true);
- GLfloat temp[9 * 2] = {
- 0,
- };
- cmd.Init(1, 2, &temp[0]);
- EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-}
-
-TEST_P(GLES2DecoderTest2, UniformMatrix3x2fvImmediateValidArgs) {
- cmds::UniformMatrix3x2fvImmediate& cmd =
- *GetImmediateAs<cmds::UniformMatrix3x2fvImmediate>();
- EXPECT_CALL(*gl_,
- UniformMatrix3x2fv(1, 2, false, reinterpret_cast<GLfloat*>(
- ImmediateDataAddress(&cmd))));
- SpecializedSetup<cmds::UniformMatrix3x2fvImmediate, 0>(true);
- GLfloat temp[6 * 2] = {
- 0,
- };
- cmd.Init(1, 2, &temp[0]);
- decoder_->set_unsafe_es3_apis_enabled(true);
- EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
- decoder_->set_unsafe_es3_apis_enabled(false);
- EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
-}
#endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_2_AUTOGEN_H_
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc
index 1413c31..b705f60 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3.cc
@@ -37,6 +37,12 @@ class GLES2DecoderTest3 : public GLES2DecoderTestBase {
INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderTest3, ::testing::Bool());
template <>
+void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix3fvImmediate, 0>(
+ bool /* valid */) {
+ SetupShaderForUniform(GL_FLOAT_MAT3);
+};
+
+template <>
void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix4fvImmediate, 0>(
bool /* valid */) {
SetupShaderForUniform(GL_FLOAT_MAT4);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h
index 3927010..e09d540 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h
@@ -12,6 +12,39 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_3_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_3_AUTOGEN_H_
+TEST_P(GLES2DecoderTest3, UniformMatrix3fvImmediateValidArgs) {
+ cmds::UniformMatrix3fvImmediate& cmd =
+ *GetImmediateAs<cmds::UniformMatrix3fvImmediate>();
+ EXPECT_CALL(*gl_,
+ UniformMatrix3fv(1, 2, false, reinterpret_cast<GLfloat*>(
+ ImmediateDataAddress(&cmd))));
+ SpecializedSetup<cmds::UniformMatrix3fvImmediate, 0>(true);
+ GLfloat temp[9 * 2] = {
+ 0,
+ };
+ cmd.Init(1, 2, &temp[0]);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+}
+
+TEST_P(GLES2DecoderTest3, UniformMatrix3x2fvImmediateValidArgs) {
+ cmds::UniformMatrix3x2fvImmediate& cmd =
+ *GetImmediateAs<cmds::UniformMatrix3x2fvImmediate>();
+ EXPECT_CALL(*gl_,
+ UniformMatrix3x2fv(1, 2, false, reinterpret_cast<GLfloat*>(
+ ImmediateDataAddress(&cmd))));
+ SpecializedSetup<cmds::UniformMatrix3x2fvImmediate, 0>(true);
+ GLfloat temp[6 * 2] = {
+ 0,
+ };
+ cmd.Init(1, 2, &temp[0]);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
+}
+
TEST_P(GLES2DecoderTest3, UniformMatrix3x4fvImmediateValidArgs) {
cmds::UniformMatrix3x4fvImmediate& cmd =
*GetImmediateAs<cmds::UniformMatrix3x4fvImmediate>();
diff --git a/gpu/command_buffer/service/vertex_attrib_manager.cc b/gpu/command_buffer/service/vertex_attrib_manager.cc
index 8725c4f..b7ead54 100644
--- a/gpu/command_buffer/service/vertex_attrib_manager.cc
+++ b/gpu/command_buffer/service/vertex_attrib_manager.cc
@@ -35,6 +35,7 @@ VertexAttrib::VertexAttrib()
gl_stride_(0),
real_stride_(16),
divisor_(0),
+ integer_(GL_FALSE),
is_client_side_array_(false),
list_(NULL) {
}
diff --git a/gpu/command_buffer/service/vertex_attrib_manager.h b/gpu/command_buffer/service/vertex_attrib_manager.h
index 73fa480..b5425e0 100644
--- a/gpu/command_buffer/service/vertex_attrib_manager.h
+++ b/gpu/command_buffer/service/vertex_attrib_manager.h
@@ -65,6 +65,10 @@ class GPU_EXPORT VertexAttrib {
return divisor_;
}
+ GLboolean integer() const {
+ return integer_;
+ }
+
bool enabled() const {
return enabled_;
}
@@ -118,6 +122,10 @@ class GPU_EXPORT VertexAttrib {
divisor_ = divisor;
}
+ void SetInteger(GLboolean integer) {
+ integer_ = integer;
+ }
+
void Unbind(Buffer* buffer);
// The index of this attrib.
@@ -147,6 +155,8 @@ class GPU_EXPORT VertexAttrib {
GLsizei divisor_;
+ GLboolean integer_;
+
// Will be true if this was assigned to a client side array.
bool is_client_side_array_;
@@ -218,6 +228,13 @@ class GPU_EXPORT VertexAttribManager :
}
}
+ void SetInteger(GLuint index, GLboolean integer) {
+ VertexAttrib* attrib = GetVertexAttrib(index);
+ if (attrib) {
+ attrib->SetInteger(integer);
+ }
+ }
+
void SetElementArrayBuffer(Buffer* buffer);
Buffer* element_array_buffer() const { return element_array_buffer_.get(); }
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 6e1874d..ac30315 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -203,6 +203,7 @@
'command_buffer/service/command_buffer_service_unittest.cc',
'command_buffer/service/common_decoder_unittest.cc',
'command_buffer/service/context_group_unittest.cc',
+ 'command_buffer/service/context_state_unittest.cc',
'command_buffer/service/feature_info_unittest.cc',
'command_buffer/service/framebuffer_manager_unittest.cc',
'command_buffer/service/gl_context_mock.cc',
diff --git a/mojo/gpu/mojo_gles2_impl_autogen.cc b/mojo/gpu/mojo_gles2_impl_autogen.cc
index a65388f..2a6169b 100644
--- a/mojo/gpu/mojo_gles2_impl_autogen.cc
+++ b/mojo/gpu/mojo_gles2_impl_autogen.cc
@@ -646,6 +646,16 @@ void MojoGLES2Impl::GetVertexAttribiv(GLuint index,
MojoGLES2MakeCurrent(context_);
glGetVertexAttribiv(index, pname, params);
}
+void MojoGLES2Impl::GetVertexAttribIiv(GLuint index,
+ GLenum pname,
+ GLint* params) {
+ NOTREACHED() << "Unimplemented GetVertexAttribIiv.";
+}
+void MojoGLES2Impl::GetVertexAttribIuiv(GLuint index,
+ GLenum pname,
+ GLuint* params) {
+ NOTREACHED() << "Unimplemented GetVertexAttribIuiv.";
+}
void MojoGLES2Impl::GetVertexAttribPointerv(GLuint index,
GLenum pname,
void** pointer) {
diff --git a/mojo/gpu/mojo_gles2_impl_autogen.h b/mojo/gpu/mojo_gles2_impl_autogen.h
index 5997da5..d6be8929 100644
--- a/mojo/gpu/mojo_gles2_impl_autogen.h
+++ b/mojo/gpu/mojo_gles2_impl_autogen.h
@@ -316,6 +316,8 @@ class MojoGLES2Impl : public gpu::gles2::GLES2Interface {
GLint GetUniformLocation(GLuint program, const char* name) override;
void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override;
void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override;
+ void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override;
+ void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override;
void GetVertexAttribPointerv(GLuint index,
GLenum pname,
void** pointer) override;