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

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 zmo'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 // Mappings from client side IDs to service side IDs.
37 ClientServiceMap<GLuint, GLuint> texture_id_map;
38 ClientServiceMap<GLuint, GLuint> buffer_id_map;
39 ClientServiceMap<GLuint, GLuint> renderbuffer_id_map;
40 ClientServiceMap<GLuint, GLuint> sampler_id_map;
41 ClientServiceMap<GLuint, GLuint> program_id_map;
42 ClientServiceMap<GLuint, GLuint> shader_id_map;
43
44 static_assert(sizeof(uintptr_t) == sizeof(GLsync),
45 "GLsync not the same size as uintptr_t");
46 ClientServiceMap<GLuint, uintptr_t> sync_id_map;
47
48 // Mapping of client texture IDs to TexturePassthrough objects used to make
49 // sure all textures used by mailboxes are not deleted until all textures
50 // using the mailbox are deleted
51 std::unordered_map<GLuint, scoped_refptr<TexturePassthrough>>
52 texture_object_map;
53 };
54
29 class GLES2DecoderPassthroughImpl : public GLES2Decoder { 55 class GLES2DecoderPassthroughImpl : public GLES2Decoder {
30 public: 56 public:
31 explicit GLES2DecoderPassthroughImpl(ContextGroup* group); 57 explicit GLES2DecoderPassthroughImpl(ContextGroup* group);
32 ~GLES2DecoderPassthroughImpl() override; 58 ~GLES2DecoderPassthroughImpl() override;
33 59
34 Error DoCommands(unsigned int num_commands, 60 Error DoCommands(unsigned int num_commands,
35 const volatile void* buffer, 61 const volatile void* buffer,
36 int num_entries, 62 int num_entries,
37 int* entries_processed) override; 63 int* entries_processed) override;
38 64
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 scoped_refptr<gl::GLSurface> surface_; 267 scoped_refptr<gl::GLSurface> surface_;
242 scoped_refptr<gl::GLContext> context_; 268 scoped_refptr<gl::GLContext> context_;
243 269
244 // Managers 270 // Managers
245 std::unique_ptr<ImageManager> image_manager_; 271 std::unique_ptr<ImageManager> image_manager_;
246 272
247 // The ContextGroup for this decoder uses to track resources. 273 // The ContextGroup for this decoder uses to track resources.
248 scoped_refptr<ContextGroup> group_; 274 scoped_refptr<ContextGroup> group_;
249 scoped_refptr<FeatureInfo> feature_info_; 275 scoped_refptr<FeatureInfo> feature_info_;
250 276
277 // Callbacks
278 FenceSyncReleaseCallback fence_sync_release_callback_;
279 WaitFenceSyncCallback wait_fence_sync_callback_;
280
281 // Mappings from client side IDs to service side IDs for shared objects
282 PassthroughResources* resources_;
283
284 // Mappings from client side IDs to service side IDs for per-context objects
285 ClientServiceMap<GLuint, GLuint> framebuffer_id_map_;
286 ClientServiceMap<GLuint, GLuint> transform_feedback_id_map_;
287 ClientServiceMap<GLuint, GLuint> query_id_map_;
288 ClientServiceMap<GLuint, GLuint> vertex_array_id_map_;
289
290 // Mailboxes
291 scoped_refptr<MailboxManager> mailbox_manager_;
292
293 // State tracking of currently bound 2D textures (client IDs)
294 size_t active_texture_unit_;
295 std::vector<GLuint> bound_textures_;
296
251 // Include the prototypes of all the doer functions from a separate header to 297 // Include the prototypes of all the doer functions from a separate header to
252 // keep this file clean. 298 // keep this file clean.
253 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp es.h" 299 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp es.h"
254 }; 300 };
255 301
256 } // namespace gles2 302 } // namespace gles2
257 } // namespace gpu 303 } // namespace gpu
258 304
259 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ 305 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698