| 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" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // Lose this context. | 233 // Lose this context. |
| 234 void MarkContextLost(error::ContextLostReason reason) override; | 234 void MarkContextLost(error::ContextLostReason reason) override; |
| 235 | 235 |
| 236 Logger* GetLogger() override; | 236 Logger* GetLogger() override; |
| 237 | 237 |
| 238 const ContextState* GetContextState() override; | 238 const ContextState* GetContextState() override; |
| 239 scoped_refptr<ShaderTranslatorInterface> GetTranslator(GLenum type) override; | 239 scoped_refptr<ShaderTranslatorInterface> GetTranslator(GLenum type) override; |
| 240 | 240 |
| 241 private: | 241 private: |
| 242 void* GetScratchMemory(size_t size); |
| 243 |
| 244 template <typename T> |
| 245 T* GetTypedScratchMemory(size_t count) { |
| 246 return reinterpret_cast<T*>(GetScratchMemory(count * sizeof(T))); |
| 247 } |
| 248 |
| 249 template <typename T, typename GLGetFunction> |
| 250 error::Error GetNumericHelper(GLenum pname, |
| 251 GLsizei bufsize, |
| 252 GLsizei* length, |
| 253 T* params, |
| 254 GLGetFunction get_call) { |
| 255 // Get a scratch buffer to hold the result of the query |
| 256 T* scratch_params = GetTypedScratchMemory<T>(bufsize); |
| 257 get_call(pname, bufsize, length, scratch_params); |
| 258 |
| 259 // Update the results of the query, if needed |
| 260 error::Error error = PatchGetNumericResults(pname, *length, scratch_params); |
| 261 if (error != error::kNoError) { |
| 262 *length = 0; |
| 263 return error; |
| 264 } |
| 265 |
| 266 // Copy into the destination |
| 267 DCHECK(*length < bufsize); |
| 268 std::copy(scratch_params, scratch_params + *length, params); |
| 269 |
| 270 return error::kNoError; |
| 271 } |
| 272 |
| 273 template <typename T> |
| 274 error::Error PatchGetNumericResults(GLenum pname, GLsizei length, T* params); |
| 275 error::Error PatchGetFramebufferAttachmentParameter(GLenum target, |
| 276 GLenum attachment, |
| 277 GLenum pname, |
| 278 GLsizei length, |
| 279 GLint* params); |
| 280 |
| 242 void BuildExtensionsString(); | 281 void BuildExtensionsString(); |
| 243 | 282 |
| 244 int commands_to_process_; | 283 int commands_to_process_; |
| 245 | 284 |
| 246 DebugMarkerManager debug_marker_manager_; | 285 DebugMarkerManager debug_marker_manager_; |
| 247 Logger logger_; | 286 Logger logger_; |
| 248 | 287 |
| 249 #define GLES2_CMD_OP(name) \ | 288 #define GLES2_CMD_OP(name) \ |
| 250 Error Handle##name(uint32_t immediate_data_size, const volatile void* data); | 289 Error Handle##name(uint32_t immediate_data_size, const volatile void* data); |
| 251 | 290 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // Mailboxes | 338 // Mailboxes |
| 300 scoped_refptr<MailboxManager> mailbox_manager_; | 339 scoped_refptr<MailboxManager> mailbox_manager_; |
| 301 | 340 |
| 302 // State tracking of currently bound 2D textures (client IDs) | 341 // State tracking of currently bound 2D textures (client IDs) |
| 303 size_t active_texture_unit_; | 342 size_t active_texture_unit_; |
| 304 std::vector<GLuint> bound_textures_; | 343 std::vector<GLuint> bound_textures_; |
| 305 | 344 |
| 306 std::vector<std::string> emulated_extensions_; | 345 std::vector<std::string> emulated_extensions_; |
| 307 std::string extension_string_; | 346 std::string extension_string_; |
| 308 | 347 |
| 348 // Cache of scratch memory |
| 349 std::vector<uint8_t> scratch_memory_; |
| 350 |
| 309 // Include the prototypes of all the doer functions from a separate header to | 351 // Include the prototypes of all the doer functions from a separate header to |
| 310 // keep this file clean. | 352 // keep this file clean. |
| 311 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp
es.h" | 353 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doer_prototyp
es.h" |
| 312 }; | 354 }; |
| 313 | 355 |
| 314 } // namespace gles2 | 356 } // namespace gles2 |
| 315 } // namespace gpu | 357 } // namespace gpu |
| 316 | 358 |
| 317 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ | 359 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_PASSTHROUGH_H_ |
| OLD | NEW |