| 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" | |
| 8 #include "gpu/command_buffer/common/debug_marker_manager.h" | |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | |
| 11 #include "gpu/command_buffer/common/mailbox.h" | |
| 12 #include "gpu/command_buffer/service/context_group.h" | |
| 13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | |
| 14 #include "gpu/command_buffer/service/image_manager.h" | |
| 15 #include "gpu/command_buffer/service/logger.h" | |
| 16 #include "ui/gl/gl_bindings.h" | |
| 17 #include "ui/gl/gl_context.h" | |
| 18 #include "ui/gl/gl_image.h" | |
| 19 #include "ui/gl/gl_surface.h" | |
| 20 | |
| 21 namespace gpu { | 7 namespace gpu { |
| 22 namespace gles2 { | 8 namespace gles2 { |
| 23 | 9 |
| 24 class GLES2DecoderPassthroughImpl : public GLES2Decoder { | 10 GLES2DecoderPassthroughImpl::GLES2DecoderPassthroughImpl(ContextGroup* group) |
| 25 public: | 11 : commands_to_process_(0), |
| 26 explicit GLES2DecoderPassthroughImpl(ContextGroup* group) | 12 debug_marker_manager_(), |
| 27 : commands_to_process_(0), | 13 logger_(&debug_marker_manager_), |
| 28 debug_marker_manager_(), | 14 surface_(), |
| 29 logger_(&debug_marker_manager_), | 15 context_(), |
| 30 surface_(), | 16 group_(group), |
| 31 context_(), | 17 feature_info_(group->feature_info()) { |
| 32 group_(group), | 18 DCHECK(group); |
| 33 feature_info_(group->feature_info()) { | 19 } |
| 34 DCHECK(group); | 20 |
| 35 } | 21 GLES2DecoderPassthroughImpl::~GLES2DecoderPassthroughImpl() {} |
| 36 | 22 |
| 37 ~GLES2DecoderPassthroughImpl() override {} | 23 GLES2Decoder::Error GLES2DecoderPassthroughImpl::DoCommands( |
| 38 | 24 unsigned int num_commands, |
| 39 Error DoCommands(unsigned int num_commands, | 25 const void* buffer, |
| 40 const void* buffer, | 26 int num_entries, |
| 41 int num_entries, | 27 int* entries_processed) { |
| 42 int* entries_processed) override { | 28 commands_to_process_ = num_commands; |
| 43 commands_to_process_ = num_commands; | 29 error::Error result = error::kNoError; |
| 44 error::Error result = error::kNoError; | 30 const CommandBufferEntry* cmd_data = |
| 45 const CommandBufferEntry* cmd_data = | 31 static_cast<const CommandBufferEntry*>(buffer); |
| 46 static_cast<const CommandBufferEntry*>(buffer); | 32 int process_pos = 0; |
| 47 int process_pos = 0; | 33 unsigned int command = 0; |
| 48 unsigned int command = 0; | 34 |
| 49 | 35 while (process_pos < num_entries && result == error::kNoError && |
| 50 while (process_pos < num_entries && result == error::kNoError && | 36 commands_to_process_--) { |
| 51 commands_to_process_--) { | 37 const unsigned int size = cmd_data->value_header.size; |
| 52 const unsigned int size = cmd_data->value_header.size; | 38 command = cmd_data->value_header.command; |
| 53 command = cmd_data->value_header.command; | 39 |
| 54 | 40 if (size == 0) { |
| 55 if (size == 0) { | 41 result = error::kInvalidSize; |
| 56 result = error::kInvalidSize; | 42 break; |
| 57 break; | 43 } |
| 58 } | 44 |
| 59 | 45 // size can't overflow because it is 21 bits. |
| 60 // size can't overflow because it is 21 bits. | 46 if (static_cast<int>(size) + process_pos > num_entries) { |
| 61 if (static_cast<int>(size) + process_pos > num_entries) { | 47 result = error::kOutOfBounds; |
| 62 result = error::kOutOfBounds; | 48 break; |
| 63 break; | 49 } |
| 64 } | 50 |
| 65 | 51 const unsigned int arg_count = size - 1; |
| 66 const unsigned int arg_count = size - 1; | 52 unsigned int command_index = command - kFirstGLES2Command; |
| 67 unsigned int command_index = command - kFirstGLES2Command; | 53 if (command_index < arraysize(command_info)) { |
| 68 if (command_index < arraysize(command_info)) { | 54 const CommandInfo& info = command_info[command_index]; |
| 69 const CommandInfo& info = command_info[command_index]; | 55 unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count); |
| 70 unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count); | 56 if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) || |
| 71 if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) || | 57 (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) { |
| 72 (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) { | 58 uint32_t immediate_data_size = (arg_count - info_arg_count) * |
| 73 uint32_t immediate_data_size = (arg_count - info_arg_count) * | 59 sizeof(CommandBufferEntry); // NOLINT |
| 74 sizeof(CommandBufferEntry); // NOLINT | 60 if (info.cmd_handler) { |
| 75 if (info.cmd_handler) { | 61 result = (this->*info.cmd_handler)(immediate_data_size, cmd_data); |
| 76 result = (this->*info.cmd_handler)(immediate_data_size, cmd_data); | |
| 77 } else { | |
| 78 result = error::kUnknownCommand; | |
| 79 } | |
| 80 } else { | 62 } else { |
| 81 result = error::kInvalidArguments; | 63 result = error::kUnknownCommand; |
| 82 } | 64 } |
| 83 } else { | 65 } else { |
| 84 result = DoCommonCommand(command, arg_count, cmd_data); | 66 result = error::kInvalidArguments; |
| 85 } | 67 } |
| 86 | 68 } else { |
| 87 if (result != error::kDeferCommandUntilLater) { | 69 result = DoCommonCommand(command, arg_count, cmd_data); |
| 88 process_pos += size; | |
| 89 cmd_data += size; | |
| 90 } | |
| 91 } | 70 } |
| 92 | 71 |
| 93 if (entries_processed) | 72 if (result != error::kDeferCommandUntilLater) { |
| 94 *entries_processed = process_pos; | 73 process_pos += size; |
| 95 | 74 cmd_data += size; |
| 96 return result; | |
| 97 } | |
| 98 | |
| 99 const char* GetCommandName(unsigned int command_id) const override { | |
| 100 if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { | |
| 101 return gles2::GetCommandName(static_cast<CommandId>(command_id)); | |
| 102 } | 75 } |
| 103 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); | 76 } |
| 104 } | 77 |
| 105 | 78 if (entries_processed) |
| 106 bool Initialize(const scoped_refptr<gl::GLSurface>& surface, | 79 *entries_processed = process_pos; |
| 107 const scoped_refptr<gl::GLContext>& context, | 80 |
| 108 bool offscreen, | 81 return result; |
| 109 const gfx::Size& offscreen_size, | 82 } |
| 110 const DisallowedFeatures& disallowed_features, | 83 |
| 111 const ContextCreationAttribHelper& attrib_helper) override { | 84 const char* GLES2DecoderPassthroughImpl::GetCommandName( |
| 112 // Take ownership of the context and surface. The surface can be replaced | 85 unsigned int command_id) const { |
| 113 // with SetSurface. | 86 if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { |
| 114 context_ = context; | 87 return gles2::GetCommandName(static_cast<CommandId>(command_id)); |
| 115 surface_ = surface; | 88 } |
| 116 | 89 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); |
| 117 if (!group_->Initialize(this, attrib_helper.context_type, | 90 } |
| 118 disallowed_features)) { | 91 |
| 119 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 92 bool GLES2DecoderPassthroughImpl::Initialize( |
| 120 Destroy(true); | 93 const scoped_refptr<gl::GLSurface>& surface, |
| 121 return false; | 94 const scoped_refptr<gl::GLContext>& context, |
| 122 } | 95 bool offscreen, |
| 123 | 96 const gfx::Size& offscreen_size, |
| 124 image_manager_.reset(new ImageManager()); | 97 const DisallowedFeatures& disallowed_features, |
| 125 | 98 const ContextCreationAttribHelper& attrib_helper) { |
| 126 set_initialized(); | 99 // Take ownership of the context and surface. The surface can be replaced |
| 127 return true; | 100 // with SetSurface. |
| 128 } | 101 context_ = context; |
| 129 | 102 surface_ = surface; |
| 130 // Destroys the graphics context. | 103 |
| 131 void Destroy(bool have_context) override { | 104 if (!group_->Initialize(this, attrib_helper.context_type, |
| 132 if (image_manager_.get()) { | 105 disallowed_features)) { |
| 133 image_manager_->Destroy(have_context); | 106 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
| 134 image_manager_.reset(); | 107 Destroy(true); |
| 135 } | |
| 136 } | |
| 137 | |
| 138 // Set the surface associated with the default FBO. | |
| 139 void SetSurface(const scoped_refptr<gl::GLSurface>& surface) override { | |
| 140 DCHECK(context_->IsCurrent(nullptr)); | |
| 141 DCHECK(surface_.get()); | |
| 142 surface_ = surface; | |
| 143 } | |
| 144 | |
| 145 // Releases the surface associated with the GL context. | |
| 146 // The decoder should not be used until a new surface is set. | |
| 147 void ReleaseSurface() override { | |
| 148 if (!context_.get()) | |
| 149 return; | |
| 150 if (WasContextLost()) { | |
| 151 DLOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context."; | |
| 152 return; | |
| 153 } | |
| 154 context_->ReleaseCurrent(surface_.get()); | |
| 155 surface_ = nullptr; | |
| 156 } | |
| 157 | |
| 158 void TakeFrontBuffer(const Mailbox& mailbox) override {} | |
| 159 | |
| 160 void ReturnFrontBuffer(const Mailbox& mailbox, bool is_lost) override {} | |
| 161 | |
| 162 // Resize an offscreen frame buffer. | |
| 163 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override { | |
| 164 return true; | |
| 165 } | |
| 166 | |
| 167 // Make this decoder's GL context current. | |
| 168 bool MakeCurrent() override { | |
| 169 if (!context_.get()) | |
| 170 return false; | |
| 171 | |
| 172 if (!context_->MakeCurrent(surface_.get())) { | |
| 173 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; | |
| 174 MarkContextLost(error::kMakeCurrentFailed); | |
| 175 group_->LoseContexts(error::kUnknown); | |
| 176 return false; | |
| 177 } | |
| 178 | |
| 179 return true; | |
| 180 } | |
| 181 | |
| 182 // Gets the GLES2 Util which holds info. | |
| 183 GLES2Util* GetGLES2Util() override { return nullptr; } | |
| 184 | |
| 185 // Gets the associated GLContext. | |
| 186 gl::GLContext* GetGLContext() override { return nullptr; } | |
| 187 | |
| 188 // Gets the associated ContextGroup | |
| 189 ContextGroup* GetContextGroup() override { return nullptr; } | |
| 190 | |
| 191 Capabilities GetCapabilities() override { | |
| 192 DCHECK(initialized()); | |
| 193 Capabilities caps; | |
| 194 return caps; | |
| 195 } | |
| 196 | |
| 197 // Restores all of the decoder GL state. | |
| 198 void RestoreState(const ContextState* prev_state) override {} | |
| 199 | |
| 200 // Restore States. | |
| 201 void RestoreActiveTexture() const override {} | |
| 202 void RestoreAllTextureUnitBindings( | |
| 203 const ContextState* prev_state) const override {} | |
| 204 void RestoreActiveTextureUnitBinding(unsigned int target) const override {} | |
| 205 void RestoreBufferBindings() const override {} | |
| 206 void RestoreFramebufferBindings() const override {} | |
| 207 void RestoreRenderbufferBindings() override {} | |
| 208 void RestoreGlobalState() const override {} | |
| 209 void RestoreProgramBindings() const override {} | |
| 210 void RestoreTextureState(unsigned service_id) const override {} | |
| 211 void RestoreTextureUnitBindings(unsigned unit) const override {} | |
| 212 void RestoreAllExternalTextureBindingsIfNeeded() override {} | |
| 213 | |
| 214 void ClearAllAttributes() const override {} | |
| 215 void RestoreAllAttributes() const override {} | |
| 216 | |
| 217 void SetIgnoreCachedStateForTest(bool ignore) override {} | |
| 218 void SetForceShaderNameHashingForTest(bool force) override {} | |
| 219 size_t GetSavedBackTextureCountForTest() override { return 0; } | |
| 220 size_t GetCreatedBackTextureCountForTest() override { return 0; } | |
| 221 | |
| 222 // Gets the QueryManager for this context. | |
| 223 QueryManager* GetQueryManager() override { return nullptr; } | |
| 224 | |
| 225 // Gets the TransformFeedbackManager for this context. | |
| 226 TransformFeedbackManager* GetTransformFeedbackManager() override { | |
| 227 return nullptr; | |
| 228 } | |
| 229 | |
| 230 // Gets the VertexArrayManager for this context. | |
| 231 VertexArrayManager* GetVertexArrayManager() override { return nullptr; } | |
| 232 | |
| 233 // Gets the ImageManager for this context. | |
| 234 ImageManager* GetImageManager() override { return image_manager_.get(); } | |
| 235 | |
| 236 // Returns false if there are no pending queries. | |
| 237 bool HasPendingQueries() const override { return false; } | |
| 238 | |
| 239 // Process any pending queries. | |
| 240 void ProcessPendingQueries(bool did_finish) override {} | |
| 241 | |
| 242 // Returns false if there is no idle work to be made. | |
| 243 bool HasMoreIdleWork() const override { return false; } | |
| 244 | |
| 245 // Perform any idle work that needs to be made. | |
| 246 void PerformIdleWork() override {} | |
| 247 | |
| 248 bool GetServiceTextureId(uint32_t client_texture_id, | |
| 249 uint32_t* service_texture_id) override { | |
| 250 return false; | 108 return false; |
| 251 } | 109 } |
| 252 | 110 |
| 253 // Provides detail about a lost context if one occurred. | 111 image_manager_.reset(new ImageManager()); |
| 254 error::ContextLostReason GetContextLostReason() override { | 112 |
| 255 return error::kUnknown; | 113 set_initialized(); |
| 256 } | 114 return true; |
| 257 | 115 } |
| 258 // Clears a level sub area of a texture | 116 |
| 259 // Returns false if a GL error should be generated. | 117 void GLES2DecoderPassthroughImpl::Destroy(bool have_context) { |
| 260 bool ClearLevel(Texture* texture, | 118 if (image_manager_.get()) { |
| 261 unsigned target, | 119 image_manager_->Destroy(have_context); |
| 262 int level, | 120 image_manager_.reset(); |
| 263 unsigned format, | 121 } |
| 264 unsigned type, | 122 } |
| 265 int xoffset, | 123 |
| 266 int yoffset, | 124 void GLES2DecoderPassthroughImpl::SetSurface( |
| 267 int width, | 125 const scoped_refptr<gl::GLSurface>& surface) { |
| 268 int height) override { | 126 DCHECK(context_->IsCurrent(nullptr)); |
| 269 return true; | 127 DCHECK(surface_.get()); |
| 270 } | 128 surface_ = surface; |
| 271 | 129 } |
| 272 // Clears a level sub area of a compressed 2D texture. | 130 |
| 273 // Returns false if a GL error should be generated. | 131 void GLES2DecoderPassthroughImpl::ReleaseSurface() { |
| 274 bool ClearCompressedTextureLevel(Texture* texture, | 132 if (!context_.get()) |
| 275 unsigned target, | 133 return; |
| 276 int level, | 134 if (WasContextLost()) { |
| 277 unsigned format, | 135 DLOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context."; |
| 278 int width, | 136 return; |
| 279 int height) override { | 137 } |
| 280 return true; | 138 context_->ReleaseCurrent(surface_.get()); |
| 281 } | 139 surface_ = nullptr; |
| 282 | 140 } |
| 283 // Indicates whether a given internal format is one for a compressed | 141 |
| 284 // texture. | 142 void GLES2DecoderPassthroughImpl::TakeFrontBuffer(const Mailbox& mailbox) {} |
| 285 bool IsCompressedTextureFormat(unsigned format) override { return false; }; | 143 |
| 286 | 144 void GLES2DecoderPassthroughImpl::ReturnFrontBuffer(const Mailbox& mailbox, |
| 287 // Clears a level of a 3D texture. | 145 bool is_lost) {} |
| 288 // Returns false if a GL error should be generated. | 146 |
| 289 bool ClearLevel3D(Texture* texture, | 147 bool GLES2DecoderPassthroughImpl::ResizeOffscreenFrameBuffer( |
| 290 unsigned target, | 148 const gfx::Size& size) { |
| 291 int level, | 149 return true; |
| 292 unsigned format, | 150 } |
| 293 unsigned type, | 151 |
| 294 int width, | 152 bool GLES2DecoderPassthroughImpl::MakeCurrent() { |
| 295 int height, | 153 if (!context_.get()) |
| 296 int depth) override { | 154 return false; |
| 297 return true; | 155 |
| 298 } | 156 if (!context_->MakeCurrent(surface_.get())) { |
| 299 | 157 LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent."; |
| 300 ErrorState* GetErrorState() override { return nullptr; } | 158 MarkContextLost(error::kMakeCurrentFailed); |
| 301 | 159 group_->LoseContexts(error::kUnknown); |
| 302 // A callback for messages from the decoder. | 160 return false; |
| 303 void SetShaderCacheCallback(const ShaderCacheCallback& callback) override {} | 161 } |
| 304 | 162 |
| 305 // Sets the callback for fence sync release and wait calls. The wait call | 163 return true; |
| 306 // returns true if the channel is still scheduled. | 164 } |
| 307 void SetFenceSyncReleaseCallback( | 165 |
| 308 const FenceSyncReleaseCallback& callback) override {} | 166 gpu::gles2::GLES2Util* GLES2DecoderPassthroughImpl::GetGLES2Util() { |
| 309 void SetWaitFenceSyncCallback( | 167 return nullptr; |
| 310 const WaitFenceSyncCallback& callback) override {} | 168 } |
| 311 void SetDescheduleUntilFinishedCallback( | 169 |
| 312 const NoParamCallback& callback) override {} | 170 gl::GLContext* GLES2DecoderPassthroughImpl::GetGLContext() { |
| 313 void SetRescheduleAfterFinishedCallback( | 171 return nullptr; |
| 314 const NoParamCallback& callback) override {} | 172 } |
| 315 | 173 |
| 316 void WaitForReadPixels(base::Closure callback) override {} | 174 gpu::gles2::ContextGroup* GLES2DecoderPassthroughImpl::GetContextGroup() { |
| 317 | 175 return nullptr; |
| 318 uint32_t GetTextureUploadCount() override { return 0; } | 176 } |
| 319 | 177 |
| 320 base::TimeDelta GetTotalTextureUploadTime() override { | 178 gpu::Capabilities GLES2DecoderPassthroughImpl::GetCapabilities() { |
| 321 return base::TimeDelta(); | 179 DCHECK(initialized()); |
| 322 } | 180 Capabilities caps; |
| 323 | 181 return caps; |
| 324 base::TimeDelta GetTotalProcessingCommandsTime() override { | 182 } |
| 325 return base::TimeDelta(); | 183 |
| 326 } | 184 void GLES2DecoderPassthroughImpl::RestoreState(const ContextState* prev_state) { |
| 327 | 185 |
| 328 void AddProcessingCommandsTime(base::TimeDelta) override {} | 186 } |
| 329 | 187 |
| 330 // Returns true if the context was lost either by GL_ARB_robustness, forced | 188 void GLES2DecoderPassthroughImpl::RestoreActiveTexture() const {} |
| 331 // context loss or command buffer parse error. | 189 |
| 332 bool WasContextLost() const override { return false; } | 190 void GLES2DecoderPassthroughImpl::RestoreAllTextureUnitBindings( |
| 333 | 191 const ContextState* prev_state) const {} |
| 334 // Returns true if the context was lost specifically by GL_ARB_robustness. | 192 |
| 335 bool WasContextLostByRobustnessExtension() const override { return false; } | 193 void GLES2DecoderPassthroughImpl::RestoreActiveTextureUnitBinding( |
| 336 | 194 unsigned int target) const {} |
| 337 // Lose this context. | 195 |
| 338 void MarkContextLost(error::ContextLostReason reason) override {} | 196 void GLES2DecoderPassthroughImpl::RestoreBufferBindings() const {} |
| 339 | 197 |
| 340 Logger* GetLogger() override { return &logger_; } | 198 void GLES2DecoderPassthroughImpl::RestoreFramebufferBindings() const {} |
| 341 | 199 |
| 342 const ContextState* GetContextState() override { return nullptr; } | 200 void GLES2DecoderPassthroughImpl::RestoreRenderbufferBindings() {} |
| 343 | 201 |
| 344 private: | 202 void GLES2DecoderPassthroughImpl::RestoreGlobalState() const {} |
| 345 int commands_to_process_; | 203 |
| 346 | 204 void GLES2DecoderPassthroughImpl::RestoreProgramBindings() const {} |
| 347 DebugMarkerManager debug_marker_manager_; | 205 |
| 348 Logger logger_; | 206 void GLES2DecoderPassthroughImpl::RestoreTextureState( |
| 349 | 207 unsigned service_id) const {} |
| 350 using CmdHandler = | 208 |
| 351 Error (GLES2DecoderPassthroughImpl::*)(uint32_t immediate_data_size, | 209 void GLES2DecoderPassthroughImpl::RestoreTextureUnitBindings( |
| 352 const void* data); | 210 unsigned unit) const {} |
| 353 | 211 |
| 354 // A struct to hold info about each command. | 212 void GLES2DecoderPassthroughImpl::RestoreAllExternalTextureBindingsIfNeeded() {} |
| 355 struct CommandInfo { | 213 |
| 356 CmdHandler cmd_handler; | 214 void GLES2DecoderPassthroughImpl::ClearAllAttributes() const {} |
| 357 uint8_t arg_flags; // How to handle the arguments for this scommand | 215 |
| 358 uint8_t cmd_flags; // How to handle this command | 216 void GLES2DecoderPassthroughImpl::RestoreAllAttributes() const {} |
| 359 uint16_t arg_count; // How many arguments are expected for this command. | 217 |
| 360 }; | 218 void GLES2DecoderPassthroughImpl::SetIgnoreCachedStateForTest(bool ignore) {} |
| 361 | 219 |
| 362 // A table of CommandInfo for all the commands. | 220 void GLES2DecoderPassthroughImpl::SetForceShaderNameHashingForTest(bool force) { |
| 363 static const CommandInfo command_info[kNumCommands - kFirstGLES2Command]; | 221 |
| 364 | 222 } |
| 365 // The GL context this decoder renders to on behalf of the client. | 223 |
| 366 scoped_refptr<gl::GLSurface> surface_; | 224 size_t GLES2DecoderPassthroughImpl::GetSavedBackTextureCountForTest() { |
| 367 scoped_refptr<gl::GLContext> context_; | 225 return 0; |
| 368 | 226 } |
| 369 // Managers | 227 |
| 370 std::unique_ptr<ImageManager> image_manager_; | 228 size_t GLES2DecoderPassthroughImpl::GetCreatedBackTextureCountForTest() { |
| 371 | 229 return 0; |
| 372 // The ContextGroup for this decoder uses to track resources. | 230 } |
| 373 scoped_refptr<ContextGroup> group_; | 231 |
| 374 scoped_refptr<FeatureInfo> feature_info_; | 232 void GLES2DecoderPassthroughImpl::SetFenceSyncReleaseCallback( |
| 375 }; | 233 const FenceSyncReleaseCallback& callback) {} |
| 234 |
| 235 void GLES2DecoderPassthroughImpl::SetWaitFenceSyncCallback( |
| 236 const WaitFenceSyncCallback& callback) {} |
| 237 |
| 238 void GLES2DecoderPassthroughImpl::SetDescheduleUntilFinishedCallback( |
| 239 const NoParamCallback& callback) {} |
| 240 |
| 241 void GLES2DecoderPassthroughImpl::SetRescheduleAfterFinishedCallback( |
| 242 const NoParamCallback& callback) {} |
| 243 |
| 244 gpu::gles2::QueryManager* GLES2DecoderPassthroughImpl::GetQueryManager() { |
| 245 return nullptr; |
| 246 } |
| 247 |
| 248 gpu::gles2::TransformFeedbackManager* |
| 249 GLES2DecoderPassthroughImpl::GetTransformFeedbackManager() { |
| 250 return nullptr; |
| 251 } |
| 252 |
| 253 gpu::gles2::VertexArrayManager* |
| 254 GLES2DecoderPassthroughImpl::GetVertexArrayManager() { |
| 255 return nullptr; |
| 256 } |
| 257 |
| 258 gpu::gles2::ImageManager* GLES2DecoderPassthroughImpl::GetImageManager() { |
| 259 return image_manager_.get(); |
| 260 } |
| 261 |
| 262 bool GLES2DecoderPassthroughImpl::HasPendingQueries() const { |
| 263 return false; |
| 264 } |
| 265 |
| 266 void GLES2DecoderPassthroughImpl::ProcessPendingQueries(bool did_finish) {} |
| 267 |
| 268 bool GLES2DecoderPassthroughImpl::HasMoreIdleWork() const { |
| 269 return false; |
| 270 } |
| 271 |
| 272 void GLES2DecoderPassthroughImpl::PerformIdleWork() {} |
| 273 |
| 274 bool GLES2DecoderPassthroughImpl::GetServiceTextureId( |
| 275 uint32_t client_texture_id, |
| 276 uint32_t* service_texture_id) { |
| 277 return false; |
| 278 } |
| 279 |
| 280 gpu::error::ContextLostReason |
| 281 GLES2DecoderPassthroughImpl::GetContextLostReason() { |
| 282 return error::kUnknown; |
| 283 } |
| 284 |
| 285 bool GLES2DecoderPassthroughImpl::ClearLevel(Texture* texture, |
| 286 unsigned target, |
| 287 int level, |
| 288 unsigned format, |
| 289 unsigned type, |
| 290 int xoffset, |
| 291 int yoffset, |
| 292 int width, |
| 293 int height) { |
| 294 return true; |
| 295 } |
| 296 |
| 297 bool GLES2DecoderPassthroughImpl::ClearCompressedTextureLevel(Texture* texture, |
| 298 unsigned target, |
| 299 int level, |
| 300 unsigned format, |
| 301 int width, |
| 302 int height) { |
| 303 return true; |
| 304 } |
| 305 |
| 306 bool GLES2DecoderPassthroughImpl::IsCompressedTextureFormat(unsigned format) { |
| 307 return false; |
| 308 } |
| 309 |
| 310 bool GLES2DecoderPassthroughImpl::ClearLevel3D(Texture* texture, |
| 311 unsigned target, |
| 312 int level, |
| 313 unsigned format, |
| 314 unsigned type, |
| 315 int width, |
| 316 int height, |
| 317 int depth) { |
| 318 return true; |
| 319 } |
| 320 |
| 321 gpu::gles2::ErrorState* GLES2DecoderPassthroughImpl::GetErrorState() { |
| 322 return nullptr; |
| 323 } |
| 324 |
| 325 void GLES2DecoderPassthroughImpl::SetShaderCacheCallback( |
| 326 const ShaderCacheCallback& callback) {} |
| 327 |
| 328 void GLES2DecoderPassthroughImpl::WaitForReadPixels(base::Closure callback) {} |
| 329 |
| 330 uint32_t GLES2DecoderPassthroughImpl::GetTextureUploadCount() { |
| 331 return 0; |
| 332 } |
| 333 |
| 334 base::TimeDelta GLES2DecoderPassthroughImpl::GetTotalTextureUploadTime() { |
| 335 return base::TimeDelta(); |
| 336 } |
| 337 |
| 338 base::TimeDelta GLES2DecoderPassthroughImpl::GetTotalProcessingCommandsTime() { |
| 339 return base::TimeDelta(); |
| 340 } |
| 341 |
| 342 void GLES2DecoderPassthroughImpl::AddProcessingCommandsTime(base::TimeDelta) {} |
| 343 |
| 344 bool GLES2DecoderPassthroughImpl::WasContextLost() const { |
| 345 return false; |
| 346 } |
| 347 |
| 348 bool GLES2DecoderPassthroughImpl::WasContextLostByRobustnessExtension() const { |
| 349 return false; |
| 350 } |
| 351 |
| 352 void GLES2DecoderPassthroughImpl::MarkContextLost( |
| 353 error::ContextLostReason reason) {} |
| 354 |
| 355 gpu::gles2::Logger* GLES2DecoderPassthroughImpl::GetLogger() { |
| 356 return &logger_; |
| 357 } |
| 358 |
| 359 const gpu::gles2::ContextState* GLES2DecoderPassthroughImpl::GetContextState() { |
| 360 return nullptr; |
| 361 } |
| 362 |
| 363 #define GLES2_CMD_OP(name) \ |
| 364 { \ |
| 365 &GLES2DecoderPassthroughImpl::Handle##name, cmds::name::kArgFlags, \ |
| 366 cmds::name::cmd_flags, \ |
| 367 sizeof(cmds::name) / sizeof(CommandBufferEntry) - 1, \ |
| 368 }, /* NOLINT */ |
| 376 | 369 |
| 377 const GLES2DecoderPassthroughImpl::CommandInfo | 370 const GLES2DecoderPassthroughImpl::CommandInfo |
| 378 GLES2DecoderPassthroughImpl::command_info[] = {}; | 371 GLES2DecoderPassthroughImpl::command_info[] = { |
| 379 | 372 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; |
| 380 GLES2Decoder* CreateGLES2DecoderPassthroughImpl(ContextGroup* group) { | 373 |
| 381 return new GLES2DecoderPassthroughImpl(group); | 374 #undef GLES2_CMD_OP |
| 382 } | |
| 383 | 375 |
| 384 } // namespace gles2 | 376 } // namespace gles2 |
| 385 } // namespace gpu | 377 } // namespace gpu |
| OLD | NEW |