Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h

Issue 2317363005: Add basic GL functionality to the passthrough command buffer. (Closed)
Patch Set: Address piman's comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Mappings from client side IDs to service side IDs for shared objects
284 PassthroughResources* resources_;
285
286 // Mappings from client side IDs to service side IDs for per-context objects
287 ClientServiceMap<GLuint, GLuint> framebuffer_id_map_;
288 ClientServiceMap<GLuint, GLuint> transform_feedback_id_map_;
289 ClientServiceMap<GLuint, GLuint> query_id_map_;
290 ClientServiceMap<GLuint, GLuint> vertex_array_id_map_;
291
292 // Mailboxes
293 scoped_refptr<MailboxManager> mailbox_manager_;
294
295 // State tracking of currently bound 2D textures (client IDs)
296 size_t active_texture_unit_;
297 std::vector<GLuint> bound_textures_;
298
251 // Include the prototypes of all the doer functions from a separate header to 299 // Include the prototypes of all the doer functions from a separate header to
252 // keep this file clean. 300 // keep this file clean.
253 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp es.h" 301 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp es.h"
254 }; 302 };
255 303
256 } // namespace gles2 304 } // namespace gles2
257 } // namespace gpu 305 } // namespace gpu
258 306
259 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ 307 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698