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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return result; | 96 return result; |
97 } | 97 } |
98 | 98 |
99 const char* GetCommandName(unsigned int command_id) const override { | 99 const char* GetCommandName(unsigned int command_id) const override { |
100 if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { | 100 if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { |
101 return gles2::GetCommandName(static_cast<CommandId>(command_id)); | 101 return gles2::GetCommandName(static_cast<CommandId>(command_id)); |
102 } | 102 } |
103 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); | 103 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); |
104 } | 104 } |
105 | 105 |
106 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, | 106 bool Initialize(const scoped_refptr<gl::GLSurface>& surface, |
107 const scoped_refptr<gfx::GLContext>& context, | 107 const scoped_refptr<gl::GLContext>& context, |
108 bool offscreen, | 108 bool offscreen, |
109 const gfx::Size& offscreen_size, | 109 const gfx::Size& offscreen_size, |
110 const DisallowedFeatures& disallowed_features, | 110 const DisallowedFeatures& disallowed_features, |
111 const ContextCreationAttribHelper& attrib_helper) override { | 111 const ContextCreationAttribHelper& attrib_helper) override { |
112 // Take ownership of the context and surface. The surface can be replaced | 112 // Take ownership of the context and surface. The surface can be replaced |
113 // with SetSurface. | 113 // with SetSurface. |
114 context_ = context; | 114 context_ = context; |
115 surface_ = surface; | 115 surface_ = surface; |
116 | 116 |
117 if (!group_->Initialize(this, attrib_helper.context_type, | 117 if (!group_->Initialize(this, attrib_helper.context_type, |
(...skipping 11 matching lines...) Expand all Loading... |
129 | 129 |
130 // Destroys the graphics context. | 130 // Destroys the graphics context. |
131 void Destroy(bool have_context) override { | 131 void Destroy(bool have_context) override { |
132 if (image_manager_.get()) { | 132 if (image_manager_.get()) { |
133 image_manager_->Destroy(have_context); | 133 image_manager_->Destroy(have_context); |
134 image_manager_.reset(); | 134 image_manager_.reset(); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 // Set the surface associated with the default FBO. | 138 // Set the surface associated with the default FBO. |
139 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override { | 139 void SetSurface(const scoped_refptr<gl::GLSurface>& surface) override { |
140 DCHECK(context_->IsCurrent(nullptr)); | 140 DCHECK(context_->IsCurrent(nullptr)); |
141 DCHECK(surface_.get()); | 141 DCHECK(surface_.get()); |
142 surface_ = surface; | 142 surface_ = surface; |
143 } | 143 } |
144 | 144 |
145 // Releases the surface associated with the GL context. | 145 // Releases the surface associated with the GL context. |
146 // The decoder should not be used until a new surface is set. | 146 // The decoder should not be used until a new surface is set. |
147 void ReleaseSurface() override { | 147 void ReleaseSurface() override { |
148 if (!context_.get()) | 148 if (!context_.get()) |
149 return; | 149 return; |
(...skipping 26 matching lines...) Expand all Loading... |
176 return false; | 176 return false; |
177 } | 177 } |
178 | 178 |
179 return true; | 179 return true; |
180 } | 180 } |
181 | 181 |
182 // Gets the GLES2 Util which holds info. | 182 // Gets the GLES2 Util which holds info. |
183 GLES2Util* GetGLES2Util() override { return nullptr; } | 183 GLES2Util* GetGLES2Util() override { return nullptr; } |
184 | 184 |
185 // Gets the associated GLContext. | 185 // Gets the associated GLContext. |
186 gfx::GLContext* GetGLContext() override { return nullptr; } | 186 gl::GLContext* GetGLContext() override { return nullptr; } |
187 | 187 |
188 // Gets the associated ContextGroup | 188 // Gets the associated ContextGroup |
189 ContextGroup* GetContextGroup() override { return nullptr; } | 189 ContextGroup* GetContextGroup() override { return nullptr; } |
190 | 190 |
191 Capabilities GetCapabilities() override { | 191 Capabilities GetCapabilities() override { |
192 DCHECK(initialized()); | 192 DCHECK(initialized()); |
193 Capabilities caps; | 193 Capabilities caps; |
194 return caps; | 194 return caps; |
195 } | 195 } |
196 | 196 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 CmdHandler cmd_handler; | 352 CmdHandler cmd_handler; |
353 uint8_t arg_flags; // How to handle the arguments for this scommand | 353 uint8_t arg_flags; // How to handle the arguments for this scommand |
354 uint8_t cmd_flags; // How to handle this command | 354 uint8_t cmd_flags; // How to handle this command |
355 uint16_t arg_count; // How many arguments are expected for this command. | 355 uint16_t arg_count; // How many arguments are expected for this command. |
356 }; | 356 }; |
357 | 357 |
358 // A table of CommandInfo for all the commands. | 358 // A table of CommandInfo for all the commands. |
359 static const CommandInfo command_info[kNumCommands - kFirstGLES2Command]; | 359 static const CommandInfo command_info[kNumCommands - kFirstGLES2Command]; |
360 | 360 |
361 // The GL context this decoder renders to on behalf of the client. | 361 // The GL context this decoder renders to on behalf of the client. |
362 scoped_refptr<gfx::GLSurface> surface_; | 362 scoped_refptr<gl::GLSurface> surface_; |
363 scoped_refptr<gfx::GLContext> context_; | 363 scoped_refptr<gl::GLContext> context_; |
364 | 364 |
365 // Managers | 365 // Managers |
366 std::unique_ptr<ImageManager> image_manager_; | 366 std::unique_ptr<ImageManager> image_manager_; |
367 | 367 |
368 // The ContextGroup for this decoder uses to track resources. | 368 // The ContextGroup for this decoder uses to track resources. |
369 scoped_refptr<ContextGroup> group_; | 369 scoped_refptr<ContextGroup> group_; |
370 scoped_refptr<FeatureInfo> feature_info_; | 370 scoped_refptr<FeatureInfo> feature_info_; |
371 }; | 371 }; |
372 | 372 |
373 const GLES2DecoderPassthroughImpl::CommandInfo | 373 const GLES2DecoderPassthroughImpl::CommandInfo |
374 GLES2DecoderPassthroughImpl::command_info[] = {}; | 374 GLES2DecoderPassthroughImpl::command_info[] = {}; |
375 | 375 |
376 GLES2Decoder* CreateGLES2DecoderPassthroughImpl(ContextGroup* group) { | 376 GLES2Decoder* CreateGLES2DecoderPassthroughImpl(ContextGroup* group) { |
377 return new GLES2DecoderPassthroughImpl(group); | 377 return new GLES2DecoderPassthroughImpl(group); |
378 } | 378 } |
379 | 379 |
380 } // namespace gles2 | 380 } // namespace gles2 |
381 } // namespace gpu | 381 } // namespace gpu |
OLD | NEW |