OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "gpu/command_buffer/common/debug_marker_manager.h" | 8 #include "gpu/command_buffer/common/debug_marker_manager.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 Logger* GetLogger() override { return &logger_; } | 336 Logger* GetLogger() override { return &logger_; } |
337 | 337 |
338 const ContextState* GetContextState() override { return nullptr; } | 338 const ContextState* GetContextState() override { return nullptr; } |
339 | 339 |
340 private: | 340 private: |
341 int commands_to_process_; | 341 int commands_to_process_; |
342 | 342 |
343 DebugMarkerManager debug_marker_manager_; | 343 DebugMarkerManager debug_marker_manager_; |
344 Logger logger_; | 344 Logger logger_; |
345 | 345 |
| 346 #define GLES2_CMD_OP(name) \ |
| 347 Error Handle##name(uint32_t immediate_data_size, const void* data); |
| 348 |
| 349 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
| 350 #undef GLES2_CMD_OP |
| 351 |
346 using CmdHandler = | 352 using CmdHandler = |
347 Error (GLES2DecoderPassthroughImpl::*)(uint32_t immediate_data_size, | 353 Error (GLES2DecoderPassthroughImpl::*)(uint32_t immediate_data_size, |
348 const void* data); | 354 const void* data); |
349 | 355 |
350 // A struct to hold info about each command. | 356 // A struct to hold info about each command. |
351 struct CommandInfo { | 357 struct CommandInfo { |
352 CmdHandler cmd_handler; | 358 CmdHandler cmd_handler; |
353 uint8_t arg_flags; // How to handle the arguments for this scommand | 359 uint8_t arg_flags; // How to handle the arguments for this scommand |
354 uint8_t cmd_flags; // How to handle this command | 360 uint8_t cmd_flags; // How to handle this command |
355 uint16_t arg_count; // How many arguments are expected for this command. | 361 uint16_t arg_count; // How many arguments are expected for this command. |
356 }; | 362 }; |
357 | 363 |
358 // A table of CommandInfo for all the commands. | 364 // A table of CommandInfo for all the commands. |
359 static const CommandInfo command_info[kNumCommands - kFirstGLES2Command]; | 365 static const CommandInfo command_info[kNumCommands - kFirstGLES2Command]; |
360 | 366 |
361 // The GL context this decoder renders to on behalf of the client. | 367 // The GL context this decoder renders to on behalf of the client. |
362 scoped_refptr<gfx::GLSurface> surface_; | 368 scoped_refptr<gfx::GLSurface> surface_; |
363 scoped_refptr<gfx::GLContext> context_; | 369 scoped_refptr<gfx::GLContext> context_; |
364 | 370 |
365 // Managers | 371 // Managers |
366 std::unique_ptr<ImageManager> image_manager_; | 372 std::unique_ptr<ImageManager> image_manager_; |
367 | 373 |
368 // The ContextGroup for this decoder uses to track resources. | 374 // The ContextGroup for this decoder uses to track resources. |
369 scoped_refptr<ContextGroup> group_; | 375 scoped_refptr<ContextGroup> group_; |
370 scoped_refptr<FeatureInfo> feature_info_; | 376 scoped_refptr<FeatureInfo> feature_info_; |
| 377 |
| 378 // Include the prototypes of all the doer functions from a separate header to |
| 379 // keep this file clean. |
| 380 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp
es.h" |
371 }; | 381 }; |
372 | 382 |
| 383 #define GLES2_CMD_OP(name) \ |
| 384 { \ |
| 385 &GLES2DecoderPassthroughImpl::Handle##name, cmds::name::kArgFlags, \ |
| 386 cmds::name::cmd_flags, \ |
| 387 sizeof(cmds::name) / sizeof(CommandBufferEntry) - 1, \ |
| 388 }, /* NOLINT */ |
| 389 |
373 const GLES2DecoderPassthroughImpl::CommandInfo | 390 const GLES2DecoderPassthroughImpl::CommandInfo |
374 GLES2DecoderPassthroughImpl::command_info[] = {}; | 391 GLES2DecoderPassthroughImpl::command_info[] = { |
| 392 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; |
| 393 #undef GLES2_CMD_OP |
375 | 394 |
376 GLES2Decoder* CreateGLES2DecoderPassthroughImpl(ContextGroup* group) { | 395 GLES2Decoder* CreateGLES2DecoderPassthroughImpl(ContextGroup* group) { |
377 return new GLES2DecoderPassthroughImpl(group); | 396 return new GLES2DecoderPassthroughImpl(group); |
378 } | 397 } |
379 | 398 |
380 } // namespace gles2 | 399 } // namespace gles2 |
381 } // namespace gpu | 400 } // namespace gpu |
| 401 |
| 402 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.h" |
| 403 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.h" |
OLD | NEW |