| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "gpu/gpu_export.h" | 10 #include "gpu/gpu_export.h" |
| 11 | 11 |
| 12 namespace gpu { | 12 namespace gpu { |
| 13 namespace gles2 { | 13 namespace gles2 { |
| 14 | 14 |
| 15 // A class that helps write GL command buffers. | 15 // A class that helps write GL command buffers. |
| 16 class GPU_EXPORT GLES2CmdHelper : public CommandBufferHelper { | 16 class GPU_EXPORT GLES2CmdHelper : public CommandBufferHelper { |
| 17 public: | 17 public: |
| 18 explicit GLES2CmdHelper(CommandBuffer* command_buffer); | 18 explicit GLES2CmdHelper(CommandBuffer* command_buffer); |
| 19 virtual ~GLES2CmdHelper(); | 19 virtual ~GLES2CmdHelper(); |
| 20 | 20 |
| 21 // Include the auto-generated part of this class. We split this because it | 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 | 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. | 23 // file instead of having to edit some template or the code generator. |
| 24 #include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h" | 24 #include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h" |
| 25 | 25 |
| 26 // Helpers that could not be auto-generated. | 26 // Helpers that could not be auto-generated. |
| 27 // TODO(gman): Auto generate these. | 27 // TODO(gman): Auto generate these. |
| 28 | |
| 29 void GetAttribLocation( | 28 void GetAttribLocation( |
| 30 GLuint program, uint32 name_shm_id, uint32 name_shm_offset, | 29 GLuint program, uint32 name_bucket_id, |
| 31 uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { | 30 uint32 location_shm_id, uint32 location_shm_offset) { |
| 32 gles2::cmds::GetAttribLocation* c = | 31 gles2::cmds::GetAttribLocation* c = |
| 33 GetCmdSpace<gles2::cmds::GetAttribLocation>(); | 32 GetCmdSpace<gles2::cmds::GetAttribLocation>(); |
| 34 if (c) { | 33 if (c) { |
| 35 c->Init( | |
| 36 program, name_shm_id, name_shm_offset, location_shm_id, | |
| 37 location_shm_offset, data_size); | |
| 38 } | |
| 39 } | |
| 40 | |
| 41 void GetAttribLocationBucket( | |
| 42 GLuint program, uint32 name_bucket_id, | |
| 43 uint32 location_shm_id, uint32 location_shm_offset) { | |
| 44 gles2::cmds::GetAttribLocationBucket* c = | |
| 45 GetCmdSpace<gles2::cmds::GetAttribLocationBucket>(); | |
| 46 if (c) { | |
| 47 c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); | 34 c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); |
| 48 } | 35 } |
| 49 } | 36 } |
| 50 | 37 |
| 51 void GetUniformLocation( | 38 void GetUniformLocation( |
| 52 GLuint program, uint32 name_shm_id, uint32 name_shm_offset, | 39 GLuint program, uint32 name_bucket_id, |
| 53 uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { | 40 uint32 location_shm_id, uint32 location_shm_offset) { |
| 54 gles2::cmds::GetUniformLocation* c = | 41 gles2::cmds::GetUniformLocation* c = |
| 55 GetCmdSpace<gles2::cmds::GetUniformLocation>(); | 42 GetCmdSpace<gles2::cmds::GetUniformLocation>(); |
| 56 if (c) { | 43 if (c) { |
| 57 c->Init( | |
| 58 program, name_shm_id, name_shm_offset, location_shm_id, | |
| 59 location_shm_offset, data_size); | |
| 60 } | |
| 61 } | |
| 62 | |
| 63 void GetUniformLocationBucket( | |
| 64 GLuint program, uint32 name_bucket_id, | |
| 65 uint32 location_shm_id, uint32 location_shm_offset) { | |
| 66 gles2::cmds::GetUniformLocationBucket* c = | |
| 67 GetCmdSpace<gles2::cmds::GetUniformLocationBucket>(); | |
| 68 if (c) { | |
| 69 c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); | 44 c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); |
| 70 } | 45 } |
| 71 } | 46 } |
| 72 | 47 |
| 73 private: | 48 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper); | 49 DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper); |
| 75 }; | 50 }; |
| 76 | 51 |
| 77 } // namespace gles2 | 52 } // namespace gles2 |
| 78 } // namespace gpu | 53 } // namespace gpu |
| 79 | 54 |
| 80 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H_ | 55 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H_ |
| 81 | 56 |
| OLD | NEW |