cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_cmd_helper.h
blob7361a9b3e0dabea3bf9d4c8f0c9b959f9591b620
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H_
8 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/gpu_export.h"
12 namespace gpu {
13 namespace gles2 {
15 // A class that helps write GL command buffers.
16 class GPU_EXPORT GLES2CmdHelper : public CommandBufferHelper {
17 public:
18 explicit GLES2CmdHelper(CommandBuffer* command_buffer);
19 virtual ~GLES2CmdHelper();
21 // Include the auto-generated part of this class. We split this because it
22 // means we can easily edit the non-auto generated parts right here in this
23 // file instead of having to edit some template or the code generator.
24 #include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h"
26 // Helpers that could not be auto-generated.
27 // TODO(gman): Auto generate these.
29 void GetAttribLocation(
30 GLuint program, uint32 name_shm_id, uint32 name_shm_offset,
31 uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) {
32 gles2::cmds::GetAttribLocation* c =
33 GetCmdSpace<gles2::cmds::GetAttribLocation>();
34 if (c) {
35 c->Init(
36 program, name_shm_id, name_shm_offset, location_shm_id,
37 location_shm_offset, data_size);
41 void GetAttribLocationImmediate(
42 GLuint program, const char* name,
43 uint32 location_shm_id, uint32 location_shm_offset) {
44 const uint32 size = gles2::cmds::GetAttribLocationImmediate::ComputeSize(
45 name);
46 gles2::cmds::GetAttribLocationImmediate* c =
47 GetImmediateCmdSpaceTotalSize<gles2::cmds::GetAttribLocationImmediate>(
48 size);
49 if (c) {
50 c->Init(program, name, location_shm_id, location_shm_offset);
54 void GetAttribLocationBucket(
55 GLuint program, uint32 name_bucket_id,
56 uint32 location_shm_id, uint32 location_shm_offset) {
57 gles2::cmds::GetAttribLocationBucket* c =
58 GetCmdSpace<gles2::cmds::GetAttribLocationBucket>();
59 if (c) {
60 c->Init(program, name_bucket_id, location_shm_id, location_shm_offset);
64 void GetUniformLocation(
65 GLuint program, uint32 name_shm_id, uint32 name_shm_offset,
66 uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) {
67 gles2::cmds::GetUniformLocation* c =
68 GetCmdSpace<gles2::cmds::GetUniformLocation>();
69 if (c) {
70 c->Init(
71 program, name_shm_id, name_shm_offset, location_shm_id,
72 location_shm_offset, data_size);
76 void GetUniformLocationImmediate(
77 GLuint program, const char* name,
78 uint32 location_shm_id, uint32 location_shm_offset) {
79 const uint32 size = gles2::cmds::GetUniformLocationImmediate::ComputeSize(
80 name);
81 gles2::cmds::GetUniformLocationImmediate* c =
82 GetImmediateCmdSpaceTotalSize<gles2::cmds::GetUniformLocationImmediate>(
83 size);
84 if (c) {
85 c->Init(program, name, location_shm_id, location_shm_offset);
89 void GetUniformLocationBucket(
90 GLuint program, uint32 name_bucket_id,
91 uint32 location_shm_id, uint32 location_shm_offset) {
92 gles2::cmds::GetUniformLocationBucket* c =
93 GetCmdSpace<gles2::cmds::GetUniformLocationBucket>();
94 if (c) {
95 c->Init(program, name_bucket_id, location_shm_id, location_shm_offset);
99 GLuint InsertSyncPointCHROMIUM() {
100 CommandBufferHelper::Flush();
101 return command_buffer()->InsertSyncPoint();
104 private:
105 DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper);
108 } // namespace gles2
109 } // namespace gpu
111 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H_