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 // This file contains the GLES2DecoderPassthroughImpl class. | 5 // This file contains the GLES2DecoderPassthroughImpl class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ | 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ |
8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ | 8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "gpu/command_buffer/common/debug_marker_manager.h" | 11 #include "gpu/command_buffer/common/debug_marker_manager.h" |
12 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 12 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
14 #include "gpu/command_buffer/common/mailbox.h" | 14 #include "gpu/command_buffer/common/mailbox.h" |
| 15 #include "gpu/command_buffer/service/client_service_map.h" |
15 #include "gpu/command_buffer/service/context_group.h" | 16 #include "gpu/command_buffer/service/context_group.h" |
16 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 17 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
17 #include "gpu/command_buffer/service/image_manager.h" | 18 #include "gpu/command_buffer/service/image_manager.h" |
18 #include "gpu/command_buffer/service/logger.h" | 19 #include "gpu/command_buffer/service/logger.h" |
| 20 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 21 #include "gpu/command_buffer/service/texture_manager.h" |
19 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
20 #include "ui/gl/gl_context.h" | 23 #include "ui/gl/gl_context.h" |
21 #include "ui/gl/gl_image.h" | 24 #include "ui/gl/gl_image.h" |
22 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
23 | 26 |
24 namespace gpu { | 27 namespace gpu { |
25 namespace gles2 { | 28 namespace gles2 { |
26 | 29 |
27 class ContextGroup; | 30 class ContextGroup; |
28 | 31 |
| 32 struct PassthroughResources { |
| 33 PassthroughResources(); |
| 34 ~PassthroughResources(); |
| 35 |
| 36 void Destroy(bool have_context); |
| 37 |
| 38 // Mappings from client side IDs to service side IDs. |
| 39 ClientServiceMap<GLuint, GLuint> texture_id_map; |
| 40 ClientServiceMap<GLuint, GLuint> buffer_id_map; |
| 41 ClientServiceMap<GLuint, GLuint> renderbuffer_id_map; |
| 42 ClientServiceMap<GLuint, GLuint> sampler_id_map; |
| 43 ClientServiceMap<GLuint, GLuint> program_id_map; |
| 44 ClientServiceMap<GLuint, GLuint> shader_id_map; |
| 45 |
| 46 static_assert(sizeof(uintptr_t) == sizeof(GLsync), |
| 47 "GLsync not the same size as uintptr_t"); |
| 48 ClientServiceMap<GLuint, uintptr_t> sync_id_map; |
| 49 |
| 50 // Mapping of client texture IDs to TexturePassthrough objects used to make |
| 51 // sure all textures used by mailboxes are not deleted until all textures |
| 52 // using the mailbox are deleted |
| 53 std::unordered_map<GLuint, scoped_refptr<TexturePassthrough>> |
| 54 texture_object_map; |
| 55 }; |
| 56 |
29 class GLES2DecoderPassthroughImpl : public GLES2Decoder { | 57 class GLES2DecoderPassthroughImpl : public GLES2Decoder { |
30 public: | 58 public: |
31 explicit GLES2DecoderPassthroughImpl(ContextGroup* group); | 59 explicit GLES2DecoderPassthroughImpl(ContextGroup* group); |
32 ~GLES2DecoderPassthroughImpl() override; | 60 ~GLES2DecoderPassthroughImpl() override; |
33 | 61 |
34 Error DoCommands(unsigned int num_commands, | 62 Error DoCommands(unsigned int num_commands, |
35 const volatile void* buffer, | 63 const volatile void* buffer, |
36 int num_entries, | 64 int num_entries, |
37 int* entries_processed) override; | 65 int* entries_processed) override; |
38 | 66 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 scoped_refptr<gl::GLSurface> surface_; | 269 scoped_refptr<gl::GLSurface> surface_; |
242 scoped_refptr<gl::GLContext> context_; | 270 scoped_refptr<gl::GLContext> context_; |
243 | 271 |
244 // Managers | 272 // Managers |
245 std::unique_ptr<ImageManager> image_manager_; | 273 std::unique_ptr<ImageManager> image_manager_; |
246 | 274 |
247 // The ContextGroup for this decoder uses to track resources. | 275 // The ContextGroup for this decoder uses to track resources. |
248 scoped_refptr<ContextGroup> group_; | 276 scoped_refptr<ContextGroup> group_; |
249 scoped_refptr<FeatureInfo> feature_info_; | 277 scoped_refptr<FeatureInfo> feature_info_; |
250 | 278 |
| 279 // Callbacks |
| 280 FenceSyncReleaseCallback fence_sync_release_callback_; |
| 281 WaitFenceSyncCallback wait_fence_sync_callback_; |
| 282 |
| 283 // Some objects may generate resources when they are bound even if they were |
| 284 // not generated yet: texture, buffer, renderbuffer, framebuffer, transform |
| 285 // feedback, vertex array |
| 286 bool bind_generates_resource_; |
| 287 |
| 288 // Mappings from client side IDs to service side IDs for shared objects |
| 289 PassthroughResources* resources_; |
| 290 |
| 291 // Mappings from client side IDs to service side IDs for per-context objects |
| 292 ClientServiceMap<GLuint, GLuint> framebuffer_id_map_; |
| 293 ClientServiceMap<GLuint, GLuint> transform_feedback_id_map_; |
| 294 ClientServiceMap<GLuint, GLuint> query_id_map_; |
| 295 ClientServiceMap<GLuint, GLuint> vertex_array_id_map_; |
| 296 |
| 297 // Mailboxes |
| 298 scoped_refptr<MailboxManager> mailbox_manager_; |
| 299 |
| 300 // State tracking of currently bound 2D textures (client IDs) |
| 301 size_t active_texture_unit_; |
| 302 std::vector<GLuint> bound_textures_; |
| 303 |
251 // Include the prototypes of all the doer functions from a separate header to | 304 // Include the prototypes of all the doer functions from a separate header to |
252 // keep this file clean. | 305 // keep this file clean. |
253 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp
es.h" | 306 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp
es.h" |
254 }; | 307 }; |
255 | 308 |
256 } // namespace gles2 | 309 } // namespace gles2 |
257 } // namespace gpu | 310 } // namespace gpu |
258 | 311 |
259 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ | 312 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ |
OLD | NEW |