OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H |
6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H | 6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H |
7 | 7 |
8 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 8 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 | 10 |
11 namespace command_buffer { | 11 namespace command_buffer { |
12 namespace gles2 { | 12 namespace gles2 { |
13 | 13 |
14 // A class that helps write GL command buffers. | 14 // A class that helps write GL command buffers. |
15 class GLES2CmdHelper : public CommandBufferHelper { | 15 class GLES2CmdHelper : public CommandBufferHelper { |
16 public: | 16 public: |
17 explicit GLES2CmdHelper(command_buffer::CommandBuffer* command_buffer) | 17 explicit GLES2CmdHelper(command_buffer::CommandBuffer* command_buffer) |
18 : CommandBufferHelper(command_buffer) { | 18 : CommandBufferHelper(command_buffer) { |
19 } | 19 } |
20 virtual ~GLES2CmdHelper() { | 20 virtual ~GLES2CmdHelper() { |
21 } | 21 } |
22 | 22 |
23 // Include the auto-generated part of this class. We split this because it | 23 // Include the auto-generated part of this class. We split this because it |
24 // means we can easily edit the non-auto generated parts right here in this | 24 // means we can easily edit the non-auto generated parts right here in this |
25 // file instead of having to edit some template or the code generator. | 25 // file instead of having to edit some template or the code generator. |
26 #include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h" | 26 #include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h" |
27 | 27 |
| 28 // Helpers that could not be auto-generated. |
| 29 // TODO(gman): Auto generate these. |
| 30 |
| 31 void GetAttribLocation( |
| 32 GLuint program, uint32 name_shm_id, uint32 name_shm_offset, |
| 33 uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { |
| 34 gles2::GetAttribLocation& c = GetCmdSpace<gles2::GetAttribLocation>(); |
| 35 c.Init( |
| 36 program, name_shm_id, name_shm_offset, location_shm_id, |
| 37 location_shm_offset, data_size); |
| 38 } |
| 39 |
| 40 void GetAttribLocationImmediate( |
| 41 GLuint program, const char* name, |
| 42 uint32 location_shm_id, uint32 location_shm_offset) { |
| 43 const uint32 size = gles2::GetAttribLocationImmediate::ComputeSize(name); |
| 44 gles2::GetAttribLocationImmediate& c = |
| 45 GetImmediateCmdSpaceTotalSize<gles2::GetAttribLocationImmediate>(size); |
| 46 c.Init(program, name, location_shm_id, location_shm_offset); |
| 47 } |
| 48 |
| 49 void GetUniformLocation( |
| 50 GLuint program, uint32 name_shm_id, uint32 name_shm_offset, |
| 51 uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { |
| 52 gles2::GetUniformLocation& c = GetCmdSpace<gles2::GetUniformLocation>(); |
| 53 c.Init( |
| 54 program, name_shm_id, name_shm_offset, location_shm_id, |
| 55 location_shm_offset, data_size); |
| 56 } |
| 57 |
| 58 void GetUniformLocationImmediate( |
| 59 GLuint program, const char* name, |
| 60 uint32 location_shm_id, uint32 location_shm_offset) { |
| 61 const uint32 size = gles2::GetUniformLocationImmediate::ComputeSize(name); |
| 62 gles2::GetUniformLocationImmediate& c = |
| 63 GetImmediateCmdSpaceTotalSize<gles2::GetUniformLocationImmediate>(size); |
| 64 c.Init(program, name, location_shm_id, location_shm_offset); |
| 65 } |
| 66 |
| 67 |
28 private: | 68 private: |
29 DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper); | 69 DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper); |
30 }; | 70 }; |
31 | 71 |
32 } // namespace gles2 | 72 } // namespace gles2 |
33 } // namespace command_buffer | 73 } // namespace command_buffer |
34 | 74 |
35 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H | 75 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H |
36 | 76 |
OLD | NEW |