summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/common
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 21:42:02 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-31 21:42:02 +0000
commit9d756882750dabd1abbe70b30292531abb86a34b (patch)
treecd6f3ba4d5481a39953e87570abf9a1402630772 /gpu/command_buffer/common
parent8ca0b64248afd305ff938b080afdcb880a98e61b (diff)
downloadchromium_src-9d756882750dabd1abbe70b30292531abb86a34b.zip
chromium_src-9d756882750dabd1abbe70b30292531abb86a34b.tar.gz
chromium_src-9d756882750dabd1abbe70b30292531abb86a34b.tar.bz2
Support for glSetSurfaceCHROMIUM.
This command allows a previously created GPU surface to be made current for a command buffer. There are no surfaces registered at this point so this command is currently a no-op. Review URL: http://codereview.chromium.org/7077001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/common')
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_autogen.h34
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_test_autogen.h13
-rw-r--r--gpu/command_buffer/common/gles2_cmd_ids_autogen.h1
3 files changed, 48 insertions, 0 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
index 0536887..67bbc36 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -8979,6 +8979,40 @@ COMPILE_ASSERT(offsetof(WaitLatchCHROMIUM, header) == 0,
COMPILE_ASSERT(offsetof(WaitLatchCHROMIUM, latch_id) == 4,
OffsetOf_WaitLatchCHROMIUM_latch_id_not_4);
+struct SetSurfaceCHROMIUM {
+ typedef SetSurfaceCHROMIUM ValueType;
+ static const CommandId kCmdId = kSetSurfaceCHROMIUM;
+ static const cmd::ArgFlags kArgFlags = cmd::kFixed;
+
+ static uint32 ComputeSize() {
+ return static_cast<uint32>(sizeof(ValueType)); // NOLINT
+ }
+
+ void SetHeader() {
+ header.SetCmd<ValueType>();
+ }
+
+ void Init(GLint _surface_id) {
+ SetHeader();
+ surface_id = _surface_id;
+ }
+
+ void* Set(void* cmd, GLint _surface_id) {
+ static_cast<ValueType*>(cmd)->Init(_surface_id);
+ return NextCmdAddress<ValueType>(cmd);
+ }
+
+ gpu::CommandHeader header;
+ int32 surface_id;
+};
+
+COMPILE_ASSERT(sizeof(SetSurfaceCHROMIUM) == 8,
+ Sizeof_SetSurfaceCHROMIUM_is_not_8);
+COMPILE_ASSERT(offsetof(SetSurfaceCHROMIUM, header) == 0,
+ OffsetOf_SetSurfaceCHROMIUM_header_not_0);
+COMPILE_ASSERT(offsetof(SetSurfaceCHROMIUM, surface_id) == 4,
+ OffsetOf_SetSurfaceCHROMIUM_surface_id_not_4);
+
#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_AUTOGEN_H_
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 77660e2..0f18f94 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -3534,5 +3534,18 @@ TEST(GLES2FormatTest, WaitLatchCHROMIUM) {
EXPECT_EQ(static_cast<GLuint>(11), cmd.latch_id);
}
+TEST(GLES2FormatTest, SetSurfaceCHROMIUM) {
+ SetSurfaceCHROMIUM cmd = { { 0 } };
+ void* next_cmd = cmd.Set(
+ &cmd,
+ static_cast<GLint>(11));
+ EXPECT_EQ(static_cast<uint32>(SetSurfaceCHROMIUM::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
+ EXPECT_EQ(static_cast<char*>(next_cmd),
+ reinterpret_cast<char*>(&cmd) + sizeof(cmd));
+ EXPECT_EQ(static_cast<GLint>(11), cmd.surface_id);
+}
+
#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
index 7566beb..5a3dc2d 100644
--- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
@@ -205,6 +205,7 @@
OP(RequestExtensionCHROMIUM) /* 450 */ \
OP(SetLatchCHROMIUM) /* 451 */ \
OP(WaitLatchCHROMIUM) /* 452 */ \
+ OP(SetSurfaceCHROMIUM) /* 453 */ \
enum CommandId {
kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this.