| 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/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 | 8 |
| 9 namespace gpu { | 9 namespace gpu { |
| 10 namespace gles2 { | 10 namespace gles2 { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 template <typename ClientType, typename ServiceType, typename GenFunction> | 14 template <typename ClientType, typename ServiceType, typename GenFunction> |
| 15 error::Error GenHelper(GLsizei n, | 15 error::Error GenHelper(GLsizei n, |
| 16 const volatile ClientType* client_ids, | 16 const volatile ClientType* client_ids, |
| 17 ClientServiceMap<ClientType, ServiceType>* id_map, | 17 ClientServiceMap<ClientType, ServiceType>* id_map, |
| 18 GenFunction gen_function) { | 18 GenFunction gen_function) { |
| 19 DCHECK(n >= 0); |
| 19 std::vector<ClientType> client_ids_copy(client_ids, client_ids + n); | 20 std::vector<ClientType> client_ids_copy(client_ids, client_ids + n); |
| 20 for (GLsizei ii = 0; ii < n; ++ii) { | 21 for (GLsizei ii = 0; ii < n; ++ii) { |
| 21 if (id_map->GetServiceID(client_ids_copy[ii], nullptr)) { | 22 if (id_map->GetServiceID(client_ids_copy[ii], nullptr)) { |
| 22 return error::kInvalidArguments; | 23 return error::kInvalidArguments; |
| 23 } | 24 } |
| 24 } | 25 } |
| 25 if (!CheckUniqueAndNonNullIds(n, client_ids_copy.data())) { | 26 if (!CheckUniqueAndNonNullIds(n, client_ids_copy.data())) { |
| 26 return error::kInvalidArguments; | 27 return error::kInvalidArguments; |
| 27 } | 28 } |
| 28 | 29 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 ServiceType service_id = create_function(); | 46 ServiceType service_id = create_function(); |
| 46 id_map->SetIDMapping(client_id, service_id); | 47 id_map->SetIDMapping(client_id, service_id); |
| 47 return error::kNoError; | 48 return error::kNoError; |
| 48 } | 49 } |
| 49 | 50 |
| 50 template <typename ClientType, typename ServiceType, typename DeleteFunction> | 51 template <typename ClientType, typename ServiceType, typename DeleteFunction> |
| 51 error::Error DeleteHelper(GLsizei n, | 52 error::Error DeleteHelper(GLsizei n, |
| 52 const volatile ClientType* client_ids, | 53 const volatile ClientType* client_ids, |
| 53 ClientServiceMap<ClientType, ServiceType>* id_map, | 54 ClientServiceMap<ClientType, ServiceType>* id_map, |
| 54 DeleteFunction delete_function) { | 55 DeleteFunction delete_function) { |
| 56 DCHECK(n >= 0); |
| 55 std::vector<ServiceType> service_ids(n, 0); | 57 std::vector<ServiceType> service_ids(n, 0); |
| 56 for (GLsizei ii = 0; ii < n; ++ii) { | 58 for (GLsizei ii = 0; ii < n; ++ii) { |
| 57 ClientType client_id = client_ids[ii]; | 59 ClientType client_id = client_ids[ii]; |
| 58 service_ids[ii] = id_map->GetServiceIDOrInvalid(client_id); | 60 service_ids[ii] = id_map->GetServiceIDOrInvalid(client_id); |
| 59 id_map->RemoveClientID(client_id); | 61 id_map->RemoveClientID(client_id); |
| 60 } | 62 } |
| 61 | 63 |
| 62 delete_function(n, service_ids.data()); | 64 delete_function(n, service_ids.data()); |
| 63 | 65 |
| 64 return error::kNoError; | 66 return error::kNoError; |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 } | 570 } |
| 569 | 571 |
| 570 error::Error GLES2DecoderPassthroughImpl::DoCullFace(GLenum mode) { | 572 error::Error GLES2DecoderPassthroughImpl::DoCullFace(GLenum mode) { |
| 571 glCullFace(mode); | 573 glCullFace(mode); |
| 572 return error::kNoError; | 574 return error::kNoError; |
| 573 } | 575 } |
| 574 | 576 |
| 575 error::Error GLES2DecoderPassthroughImpl::DoDeleteBuffers( | 577 error::Error GLES2DecoderPassthroughImpl::DoDeleteBuffers( |
| 576 GLsizei n, | 578 GLsizei n, |
| 577 const volatile GLuint* buffers) { | 579 const volatile GLuint* buffers) { |
| 580 // DeleteHelper requires that n is non-negative because it allocates a copy of |
| 581 // the IDs |
| 582 if (n < 0) { |
| 583 InsertError(GL_INVALID_VALUE, "n cannot be negative."); |
| 584 return error::kNoError; |
| 585 } |
| 578 return DeleteHelper( | 586 return DeleteHelper( |
| 579 n, buffers, &resources_->buffer_id_map, | 587 n, buffers, &resources_->buffer_id_map, |
| 580 [](GLsizei n, GLuint* buffers) { glDeleteBuffersARB(n, buffers); }); | 588 [](GLsizei n, GLuint* buffers) { glDeleteBuffersARB(n, buffers); }); |
| 581 } | 589 } |
| 582 | 590 |
| 583 error::Error GLES2DecoderPassthroughImpl::DoDeleteFramebuffers( | 591 error::Error GLES2DecoderPassthroughImpl::DoDeleteFramebuffers( |
| 584 GLsizei n, | 592 GLsizei n, |
| 585 const volatile GLuint* framebuffers) { | 593 const volatile GLuint* framebuffers) { |
| 594 // DeleteHelper requires that n is non-negative because it allocates a copy of |
| 595 // the IDs |
| 596 if (n < 0) { |
| 597 InsertError(GL_INVALID_VALUE, "n cannot be negative."); |
| 598 return error::kNoError; |
| 599 } |
| 586 return DeleteHelper(n, framebuffers, &framebuffer_id_map_, | 600 return DeleteHelper(n, framebuffers, &framebuffer_id_map_, |
| 587 [](GLsizei n, GLuint* framebuffers) { | 601 [](GLsizei n, GLuint* framebuffers) { |
| 588 glDeleteFramebuffersEXT(n, framebuffers); | 602 glDeleteFramebuffersEXT(n, framebuffers); |
| 589 }); | 603 }); |
| 590 } | 604 } |
| 591 | 605 |
| 592 error::Error GLES2DecoderPassthroughImpl::DoDeleteProgram(GLuint program) { | 606 error::Error GLES2DecoderPassthroughImpl::DoDeleteProgram(GLuint program) { |
| 593 return DeleteHelper(program, &resources_->program_id_map, | 607 return DeleteHelper(program, &resources_->program_id_map, |
| 594 [](GLuint program) { glDeleteProgram(program); }); | 608 [](GLuint program) { glDeleteProgram(program); }); |
| 595 } | 609 } |
| 596 | 610 |
| 597 error::Error GLES2DecoderPassthroughImpl::DoDeleteRenderbuffers( | 611 error::Error GLES2DecoderPassthroughImpl::DoDeleteRenderbuffers( |
| 598 GLsizei n, | 612 GLsizei n, |
| 599 const volatile GLuint* renderbuffers) { | 613 const volatile GLuint* renderbuffers) { |
| 614 // DeleteHelper requires that n is non-negative because it allocates a copy of |
| 615 // the IDs |
| 616 if (n < 0) { |
| 617 InsertError(GL_INVALID_VALUE, "n cannot be negative."); |
| 618 return error::kNoError; |
| 619 } |
| 600 return DeleteHelper(n, renderbuffers, &resources_->renderbuffer_id_map, | 620 return DeleteHelper(n, renderbuffers, &resources_->renderbuffer_id_map, |
| 601 [](GLsizei n, GLuint* renderbuffers) { | 621 [](GLsizei n, GLuint* renderbuffers) { |
| 602 glDeleteRenderbuffersEXT(n, renderbuffers); | 622 glDeleteRenderbuffersEXT(n, renderbuffers); |
| 603 }); | 623 }); |
| 604 } | 624 } |
| 605 | 625 |
| 606 error::Error GLES2DecoderPassthroughImpl::DoDeleteSamplers( | 626 error::Error GLES2DecoderPassthroughImpl::DoDeleteSamplers( |
| 607 GLsizei n, | 627 GLsizei n, |
| 608 const volatile GLuint* samplers) { | 628 const volatile GLuint* samplers) { |
| 629 // DeleteHelper requires that n is non-negative because it allocates a copy of |
| 630 // the IDs |
| 631 if (n < 0) { |
| 632 InsertError(GL_INVALID_VALUE, "n cannot be negative."); |
| 633 return error::kNoError; |
| 634 } |
| 609 return DeleteHelper( | 635 return DeleteHelper( |
| 610 n, samplers, &resources_->sampler_id_map, | 636 n, samplers, &resources_->sampler_id_map, |
| 611 [](GLsizei n, GLuint* samplers) { glDeleteSamplers(n, samplers); }); | 637 [](GLsizei n, GLuint* samplers) { glDeleteSamplers(n, samplers); }); |
| 612 } | 638 } |
| 613 | 639 |
| 614 error::Error GLES2DecoderPassthroughImpl::DoDeleteSync(GLuint sync) { | 640 error::Error GLES2DecoderPassthroughImpl::DoDeleteSync(GLuint sync) { |
| 615 return DeleteHelper(sync, &resources_->sync_id_map, [](uintptr_t sync) { | 641 return DeleteHelper(sync, &resources_->sync_id_map, [](uintptr_t sync) { |
| 616 glDeleteSync(reinterpret_cast<GLsync>(sync)); | 642 glDeleteSync(reinterpret_cast<GLsync>(sync)); |
| 617 }); | 643 }); |
| 618 } | 644 } |
| 619 | 645 |
| 620 error::Error GLES2DecoderPassthroughImpl::DoDeleteShader(GLuint shader) { | 646 error::Error GLES2DecoderPassthroughImpl::DoDeleteShader(GLuint shader) { |
| 621 return DeleteHelper(shader, &resources_->shader_id_map, | 647 return DeleteHelper(shader, &resources_->shader_id_map, |
| 622 [](GLuint shader) { glDeleteShader(shader); }); | 648 [](GLuint shader) { glDeleteShader(shader); }); |
| 623 } | 649 } |
| 624 | 650 |
| 625 error::Error GLES2DecoderPassthroughImpl::DoDeleteTextures( | 651 error::Error GLES2DecoderPassthroughImpl::DoDeleteTextures( |
| 626 GLsizei n, | 652 GLsizei n, |
| 627 const volatile GLuint* textures) { | 653 const volatile GLuint* textures) { |
| 654 // DeleteHelper requires that n is non-negative because it allocates a copy of |
| 655 // the IDs |
| 656 if (n < 0) { |
| 657 InsertError(GL_INVALID_VALUE, "n cannot be negative."); |
| 658 return error::kNoError; |
| 659 } |
| 660 |
| 628 // Textures that are currently associated with a mailbox are stored in the | 661 // Textures that are currently associated with a mailbox are stored in the |
| 629 // texture_object_map_ and are deleted automatically when they are | 662 // texture_object_map_ and are deleted automatically when they are |
| 630 // unreferenced. Only delete textures that are not in this map. | 663 // unreferenced. Only delete textures that are not in this map. |
| 631 std::vector<GLuint> non_mailbox_client_ids; | 664 std::vector<GLuint> non_mailbox_client_ids; |
| 632 for (GLsizei ii = 0; ii < n; ++ii) { | 665 for (GLsizei ii = 0; ii < n; ++ii) { |
| 633 GLuint client_id = textures[ii]; | 666 GLuint client_id = textures[ii]; |
| 634 auto texture_object_iter = resources_->texture_object_map.find(client_id); | 667 auto texture_object_iter = resources_->texture_object_map.find(client_id); |
| 635 if (texture_object_iter == resources_->texture_object_map.end()) { | 668 if (texture_object_iter == resources_->texture_object_map.end()) { |
| 636 // Delete with DeleteHelper | 669 // Delete with DeleteHelper |
| 637 non_mailbox_client_ids.push_back(client_id); | 670 non_mailbox_client_ids.push_back(client_id); |
| 638 } else { | 671 } else { |
| 639 // Deleted when unreferenced | 672 // Deleted when unreferenced |
| 640 resources_->texture_id_map.RemoveClientID(client_id); | 673 resources_->texture_id_map.RemoveClientID(client_id); |
| 641 resources_->texture_object_map.erase(client_id); | 674 resources_->texture_object_map.erase(client_id); |
| 642 } | 675 } |
| 643 } | 676 } |
| 644 return DeleteHelper( | 677 return DeleteHelper( |
| 645 non_mailbox_client_ids.size(), non_mailbox_client_ids.data(), | 678 non_mailbox_client_ids.size(), non_mailbox_client_ids.data(), |
| 646 &resources_->texture_id_map, | 679 &resources_->texture_id_map, |
| 647 [](GLsizei n, GLuint* textures) { glDeleteTextures(n, textures); }); | 680 [](GLsizei n, GLuint* textures) { glDeleteTextures(n, textures); }); |
| 648 } | 681 } |
| 649 | 682 |
| 650 error::Error GLES2DecoderPassthroughImpl::DoDeleteTransformFeedbacks( | 683 error::Error GLES2DecoderPassthroughImpl::DoDeleteTransformFeedbacks( |
| 651 GLsizei n, | 684 GLsizei n, |
| 652 const volatile GLuint* ids) { | 685 const volatile GLuint* ids) { |
| 686 // DeleteHelper requires that n is non-negative because it allocates a copy of |
| 687 // the IDs |
| 688 if (n < 0) { |
| 689 InsertError(GL_INVALID_VALUE, "n cannot be negative."); |
| 690 return error::kNoError; |
| 691 } |
| 653 return DeleteHelper(n, ids, &transform_feedback_id_map_, | 692 return DeleteHelper(n, ids, &transform_feedback_id_map_, |
| 654 [](GLsizei n, GLuint* transform_feedbacks) { | 693 [](GLsizei n, GLuint* transform_feedbacks) { |
| 655 glDeleteTransformFeedbacks(n, transform_feedbacks); | 694 glDeleteTransformFeedbacks(n, transform_feedbacks); |
| 656 }); | 695 }); |
| 657 } | 696 } |
| 658 | 697 |
| 659 error::Error GLES2DecoderPassthroughImpl::DoDepthFunc(GLenum func) { | 698 error::Error GLES2DecoderPassthroughImpl::DoDepthFunc(GLenum func) { |
| 660 glDepthFunc(func); | 699 glDepthFunc(func); |
| 661 return error::kNoError; | 700 return error::kNoError; |
| 662 } | 701 } |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 | 1410 |
| 1372 error::Error GLES2DecoderPassthroughImpl::DoHint(GLenum target, GLenum mode) { | 1411 error::Error GLES2DecoderPassthroughImpl::DoHint(GLenum target, GLenum mode) { |
| 1373 glHint(target, mode); | 1412 glHint(target, mode); |
| 1374 return error::kNoError; | 1413 return error::kNoError; |
| 1375 } | 1414 } |
| 1376 | 1415 |
| 1377 error::Error GLES2DecoderPassthroughImpl::DoInvalidateFramebuffer( | 1416 error::Error GLES2DecoderPassthroughImpl::DoInvalidateFramebuffer( |
| 1378 GLenum target, | 1417 GLenum target, |
| 1379 GLsizei count, | 1418 GLsizei count, |
| 1380 const volatile GLenum* attachments) { | 1419 const volatile GLenum* attachments) { |
| 1420 // Validate that count is non-negative before allocating a vector |
| 1421 if (count < 0) { |
| 1422 InsertError(GL_INVALID_VALUE, "count cannot be negative."); |
| 1423 return error::kNoError; |
| 1424 } |
| 1381 std::vector<GLenum> attachments_copy(attachments, attachments + count); | 1425 std::vector<GLenum> attachments_copy(attachments, attachments + count); |
| 1382 glInvalidateFramebuffer(target, count, attachments_copy.data()); | 1426 glInvalidateFramebuffer(target, count, attachments_copy.data()); |
| 1383 return error::kNoError; | 1427 return error::kNoError; |
| 1384 } | 1428 } |
| 1385 | 1429 |
| 1386 error::Error GLES2DecoderPassthroughImpl::DoInvalidateSubFramebuffer( | 1430 error::Error GLES2DecoderPassthroughImpl::DoInvalidateSubFramebuffer( |
| 1387 GLenum target, | 1431 GLenum target, |
| 1388 GLsizei count, | 1432 GLsizei count, |
| 1389 const volatile GLenum* attachments, | 1433 const volatile GLenum* attachments, |
| 1390 GLint x, | 1434 GLint x, |
| 1391 GLint y, | 1435 GLint y, |
| 1392 GLsizei width, | 1436 GLsizei width, |
| 1393 GLsizei height) { | 1437 GLsizei height) { |
| 1438 // Validate that count is non-negative before allocating a vector |
| 1439 if (count < 0) { |
| 1440 InsertError(GL_INVALID_VALUE, "count cannot be negative."); |
| 1441 return error::kNoError; |
| 1442 } |
| 1394 std::vector<GLenum> attachments_copy(attachments, attachments + count); | 1443 std::vector<GLenum> attachments_copy(attachments, attachments + count); |
| 1395 glInvalidateSubFramebuffer(target, count, attachments_copy.data(), x, y, | 1444 glInvalidateSubFramebuffer(target, count, attachments_copy.data(), x, y, |
| 1396 width, height); | 1445 width, height); |
| 1397 return error::kNoError; | 1446 return error::kNoError; |
| 1398 } | 1447 } |
| 1399 | 1448 |
| 1400 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer, | 1449 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer, |
| 1401 uint32_t* result) { | 1450 uint32_t* result) { |
| 1402 NOTIMPLEMENTED(); | 1451 NOTIMPLEMENTED(); |
| 1403 *result = glIsBuffer(GetBufferServiceID(buffer, resources_, false)); | 1452 *result = glIsBuffer(GetBufferServiceID(buffer, resources_, false)); |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2242 GLsizei n, | 2291 GLsizei n, |
| 2243 volatile GLuint* queries) { | 2292 volatile GLuint* queries) { |
| 2244 return GenHelper(n, queries, &query_id_map_, [](GLsizei n, GLuint* queries) { | 2293 return GenHelper(n, queries, &query_id_map_, [](GLsizei n, GLuint* queries) { |
| 2245 glGenQueries(n, queries); | 2294 glGenQueries(n, queries); |
| 2246 }); | 2295 }); |
| 2247 } | 2296 } |
| 2248 | 2297 |
| 2249 error::Error GLES2DecoderPassthroughImpl::DoDeleteQueriesEXT( | 2298 error::Error GLES2DecoderPassthroughImpl::DoDeleteQueriesEXT( |
| 2250 GLsizei n, | 2299 GLsizei n, |
| 2251 const volatile GLuint* queries) { | 2300 const volatile GLuint* queries) { |
| 2301 // Validate n is non-negative before allcoating a vector of size n |
| 2302 if (n < 0) { |
| 2303 InsertError(GL_INVALID_VALUE, "count cannot be negative."); |
| 2304 return error::kNoError; |
| 2305 } |
| 2306 |
| 2252 std::vector<GLuint> queries_copy(queries, queries + n); | 2307 std::vector<GLuint> queries_copy(queries, queries + n); |
| 2253 // If any of these queries are pending or active, remove them from the lists | 2308 // If any of these queries are pending or active, remove them from the lists |
| 2254 for (GLuint query_client_id : queries_copy) { | 2309 for (GLuint query_client_id : queries_copy) { |
| 2255 GLuint query_service_id = 0; | 2310 GLuint query_service_id = 0; |
| 2256 if (!query_id_map_.GetServiceID(query_client_id, &query_service_id) || | 2311 if (!query_id_map_.GetServiceID(query_client_id, &query_service_id) || |
| 2257 query_service_id == 0) { | 2312 query_service_id == 0) { |
| 2258 continue; | 2313 continue; |
| 2259 } | 2314 } |
| 2260 | 2315 |
| 2261 QueryInfo query_info = query_info_map_[query_service_id]; | 2316 QueryInfo query_info = query_info_map_[query_service_id]; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2663 glGetTranslatedShaderSourceANGLE(service_id, translated_source_length, | 2718 glGetTranslatedShaderSourceANGLE(service_id, translated_source_length, |
| 2664 nullptr, buffer.data()); | 2719 nullptr, buffer.data()); |
| 2665 *source = std::string(buffer.data()); | 2720 *source = std::string(buffer.data()); |
| 2666 } | 2721 } |
| 2667 return error::kNoError; | 2722 return error::kNoError; |
| 2668 } | 2723 } |
| 2669 | 2724 |
| 2670 error::Error GLES2DecoderPassthroughImpl::DoSwapBuffersWithBoundsCHROMIUM( | 2725 error::Error GLES2DecoderPassthroughImpl::DoSwapBuffersWithBoundsCHROMIUM( |
| 2671 GLsizei count, | 2726 GLsizei count, |
| 2672 const volatile GLint* rects) { | 2727 const volatile GLint* rects) { |
| 2728 if (count < 0) { |
| 2729 InsertError(GL_INVALID_VALUE, "count cannot be negative."); |
| 2730 return error::kNoError; |
| 2731 } |
| 2732 |
| 2673 std::vector<gfx::Rect> bounds(count); | 2733 std::vector<gfx::Rect> bounds(count); |
| 2674 for (GLsizei i = 0; i < count; ++i) { | 2734 for (GLsizei i = 0; i < count; ++i) { |
| 2675 bounds[i] = gfx::Rect(rects[i * 4 + 0], rects[i * 4 + 1], rects[i * 4 + 2], | 2735 bounds[i] = gfx::Rect(rects[i * 4 + 0], rects[i * 4 + 1], rects[i * 4 + 2], |
| 2676 rects[i * 4 + 3]); | 2736 rects[i * 4 + 3]); |
| 2677 } | 2737 } |
| 2678 gfx::SwapResult result = surface_->SwapBuffersWithBounds(bounds); | 2738 gfx::SwapResult result = surface_->SwapBuffersWithBounds(bounds); |
| 2679 if (result == gfx::SwapResult::SWAP_FAILED) { | 2739 if (result == gfx::SwapResult::SWAP_FAILED) { |
| 2680 LOG(ERROR) << "Context lost because SwapBuffersWithBounds failed."; | 2740 LOG(ERROR) << "Context lost because SwapBuffersWithBounds failed."; |
| 2681 } | 2741 } |
| 2682 // TODO(geofflang): force the context loss? | 2742 // TODO(geofflang): force the context loss? |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2927 | 2987 |
| 2928 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() { | 2988 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() { |
| 2929 NOTIMPLEMENTED(); | 2989 NOTIMPLEMENTED(); |
| 2930 return error::kNoError; | 2990 return error::kNoError; |
| 2931 } | 2991 } |
| 2932 | 2992 |
| 2933 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT( | 2993 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT( |
| 2934 GLenum target, | 2994 GLenum target, |
| 2935 GLsizei count, | 2995 GLsizei count, |
| 2936 const volatile GLenum* attachments) { | 2996 const volatile GLenum* attachments) { |
| 2997 // Validate that count is non-negative before allocating a vector |
| 2998 if (count < 0) { |
| 2999 InsertError(GL_INVALID_VALUE, "count cannot be negative."); |
| 3000 return error::kNoError; |
| 3001 } |
| 2937 std::vector<GLenum> attachments_copy(attachments, attachments + count); | 3002 std::vector<GLenum> attachments_copy(attachments, attachments + count); |
| 2938 glDiscardFramebufferEXT(target, count, attachments_copy.data()); | 3003 glDiscardFramebufferEXT(target, count, attachments_copy.data()); |
| 2939 return error::kNoError; | 3004 return error::kNoError; |
| 2940 } | 3005 } |
| 2941 | 3006 |
| 2942 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current, | 3007 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current, |
| 2943 GLenum other) { | 3008 GLenum other) { |
| 2944 NOTIMPLEMENTED(); | 3009 NOTIMPLEMENTED(); |
| 2945 return error::kNoError; | 3010 return error::kNoError; |
| 2946 } | 3011 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2966 } | 3031 } |
| 2967 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, | 3032 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, |
| 2968 release_count) | 3033 release_count) |
| 2969 ? error::kNoError | 3034 ? error::kNoError |
| 2970 : error::kDeferCommandUntilLater; | 3035 : error::kDeferCommandUntilLater; |
| 2971 } | 3036 } |
| 2972 | 3037 |
| 2973 error::Error GLES2DecoderPassthroughImpl::DoDrawBuffersEXT( | 3038 error::Error GLES2DecoderPassthroughImpl::DoDrawBuffersEXT( |
| 2974 GLsizei count, | 3039 GLsizei count, |
| 2975 const volatile GLenum* bufs) { | 3040 const volatile GLenum* bufs) { |
| 3041 // Validate that count is non-negative before allocating a vector |
| 3042 if (count < 0) { |
| 3043 InsertError(GL_INVALID_VALUE, "count cannot be negative."); |
| 3044 return error::kNoError; |
| 3045 } |
| 2976 std::vector<GLenum> bufs_copy(bufs, bufs + count); | 3046 std::vector<GLenum> bufs_copy(bufs, bufs + count); |
| 2977 glDrawBuffersARB(count, bufs_copy.data()); | 3047 glDrawBuffersARB(count, bufs_copy.data()); |
| 2978 return error::kNoError; | 3048 return error::kNoError; |
| 2979 } | 3049 } |
| 2980 | 3050 |
| 2981 error::Error GLES2DecoderPassthroughImpl::DoDiscardBackbufferCHROMIUM() { | 3051 error::Error GLES2DecoderPassthroughImpl::DoDiscardBackbufferCHROMIUM() { |
| 2982 NOTIMPLEMENTED(); | 3052 NOTIMPLEMENTED(); |
| 2983 return error::kNoError; | 3053 return error::kNoError; |
| 2984 } | 3054 } |
| 2985 | 3055 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3322 GLuint texture, | 3392 GLuint texture, |
| 3323 GLboolean promotion_hint, | 3393 GLboolean promotion_hint, |
| 3324 GLint display_x, | 3394 GLint display_x, |
| 3325 GLint display_y) { | 3395 GLint display_y) { |
| 3326 NOTIMPLEMENTED(); | 3396 NOTIMPLEMENTED(); |
| 3327 return error::kNoError; | 3397 return error::kNoError; |
| 3328 } | 3398 } |
| 3329 | 3399 |
| 3330 } // namespace gles2 | 3400 } // namespace gles2 |
| 3331 } // namespace gpu | 3401 } // namespace gpu |
| OLD | NEW |