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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 282253002: Remove unneeded shm versions of bucket functions from command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-shm-for-immediate-commands
Patch Set: rebase Created 6 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 4687 matching lines...) Expand 10 before | Expand all | Expand 10 after
4698 } 4698 }
4699 Program* program = GetProgramInfoNotShader( 4699 Program* program = GetProgramInfoNotShader(
4700 program_id, "glBindAttribLocation"); 4700 program_id, "glBindAttribLocation");
4701 if (!program) { 4701 if (!program) {
4702 return; 4702 return;
4703 } 4703 }
4704 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); 4704 program->SetAttribLocationBinding(name, static_cast<GLint>(index));
4705 glBindAttribLocation(program->service_id(), index, name); 4705 glBindAttribLocation(program->service_id(), index, name);
4706 } 4706 }
4707 4707
4708 error::Error GLES2DecoderImpl::HandleBindAttribLocation(
4709 uint32 immediate_data_size, const cmds::BindAttribLocation& c) {
4710 GLuint program = static_cast<GLuint>(c.program);
4711 GLuint index = static_cast<GLuint>(c.index);
4712 uint32 name_size = c.data_size;
4713 const char* name = GetSharedMemoryAs<const char*>(
4714 c.name_shm_id, c.name_shm_offset, name_size);
4715 if (name == NULL) {
4716 return error::kOutOfBounds;
4717 }
4718 std::string name_str(name, name_size);
4719 DoBindAttribLocation(program, index, name_str.c_str());
4720 return error::kNoError;
4721 }
4722
4723 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( 4708 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket(
4724 uint32 immediate_data_size, const cmds::BindAttribLocationBucket& c) { 4709 uint32 immediate_data_size, const cmds::BindAttribLocationBucket& c) {
4725 GLuint program = static_cast<GLuint>(c.program); 4710 GLuint program = static_cast<GLuint>(c.program);
4726 GLuint index = static_cast<GLuint>(c.index); 4711 GLuint index = static_cast<GLuint>(c.index);
4727 Bucket* bucket = GetBucket(c.name_bucket_id); 4712 Bucket* bucket = GetBucket(c.name_bucket_id);
4728 if (!bucket || bucket->size() == 0) { 4713 if (!bucket || bucket->size() == 0) {
4729 return error::kInvalidArguments; 4714 return error::kInvalidArguments;
4730 } 4715 }
4731 std::string name_str; 4716 std::string name_str;
4732 if (!bucket->GetAsString(&name_str)) { 4717 if (!bucket->GetAsString(&name_str)) {
(...skipping 30 matching lines...) Expand all
4763 if (!program) { 4748 if (!program) {
4764 return; 4749 return;
4765 } 4750 }
4766 if (!program->SetUniformLocationBinding(name, location)) { 4751 if (!program->SetUniformLocationBinding(name, location)) {
4767 LOCAL_SET_GL_ERROR( 4752 LOCAL_SET_GL_ERROR(
4768 GL_INVALID_VALUE, 4753 GL_INVALID_VALUE,
4769 "glBindUniformLocationCHROMIUM", "location out of range"); 4754 "glBindUniformLocationCHROMIUM", "location out of range");
4770 } 4755 }
4771 } 4756 }
4772 4757
4773 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUM(
4774 uint32 immediate_data_size, const cmds::BindUniformLocationCHROMIUM& c) {
4775 GLuint program = static_cast<GLuint>(c.program);
4776 GLint location = static_cast<GLint>(c.location);
4777 uint32 name_size = c.data_size;
4778 const char* name = GetSharedMemoryAs<const char*>(
4779 c.name_shm_id, c.name_shm_offset, name_size);
4780 if (name == NULL) {
4781 return error::kOutOfBounds;
4782 }
4783 std::string name_str(name, name_size);
4784 DoBindUniformLocationCHROMIUM(program, location, name_str.c_str());
4785 return error::kNoError;
4786 }
4787
4788 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( 4758 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket(
4789 uint32 immediate_data_size, 4759 uint32 immediate_data_size,
4790 const cmds::BindUniformLocationCHROMIUMBucket& c) { 4760 const cmds::BindUniformLocationCHROMIUMBucket& c) {
4791 GLuint program = static_cast<GLuint>(c.program); 4761 GLuint program = static_cast<GLuint>(c.program);
4792 GLint location = static_cast<GLint>(c.location); 4762 GLint location = static_cast<GLint>(c.location);
4793 Bucket* bucket = GetBucket(c.name_bucket_id); 4763 Bucket* bucket = GetBucket(c.name_bucket_id);
4794 if (!bucket || bucket->size() == 0) { 4764 if (!bucket || bucket->size() == 0) {
4795 return error::kInvalidArguments; 4765 return error::kInvalidArguments;
4796 } 4766 }
4797 std::string name_str; 4767 std::string name_str;
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
6656 Shader* shader = GetShaderInfoNotProgram(client_id, "glShaderSource"); 6626 Shader* shader = GetShaderInfoNotProgram(client_id, "glShaderSource");
6657 if (!shader) { 6627 if (!shader) {
6658 return error::kNoError; 6628 return error::kNoError;
6659 } 6629 }
6660 // Note: We don't actually call glShaderSource here. We wait until 6630 // Note: We don't actually call glShaderSource here. We wait until
6661 // the call to glCompileShader. 6631 // the call to glCompileShader.
6662 shader->UpdateSource(str.c_str()); 6632 shader->UpdateSource(str.c_str());
6663 return error::kNoError; 6633 return error::kNoError;
6664 } 6634 }
6665 6635
6666 error::Error GLES2DecoderImpl::HandleShaderSource(
6667 uint32 immediate_data_size, const cmds::ShaderSource& c) {
6668 uint32 data_size = c.data_size;
6669 const char* data = GetSharedMemoryAs<const char*>(
6670 c.data_shm_id, c.data_shm_offset, data_size);
6671 if (!data) {
6672 return error::kOutOfBounds;
6673 }
6674 return ShaderSourceHelper(c.shader, data, data_size);
6675 }
6676
6677 error::Error GLES2DecoderImpl::HandleShaderSourceBucket( 6636 error::Error GLES2DecoderImpl::HandleShaderSourceBucket(
6678 uint32 immediate_data_size, const cmds::ShaderSourceBucket& c) { 6637 uint32 immediate_data_size, const cmds::ShaderSourceBucket& c) {
6679 Bucket* bucket = GetBucket(c.data_bucket_id); 6638 Bucket* bucket = GetBucket(c.data_bucket_id);
6680 if (!bucket || bucket->size() == 0) { 6639 if (!bucket || bucket->size() == 0) {
6681 return error::kInvalidArguments; 6640 return error::kInvalidArguments;
6682 } 6641 }
6683 return ShaderSourceHelper( 6642 return ShaderSourceHelper(
6684 c.shader, bucket->GetDataAs<const char*>(0, bucket->size() - 1), 6643 c.shader, bucket->GetDataAs<const char*>(0, bucket->size() - 1),
6685 bucket->size() - 1); 6644 bucket->size() - 1);
6686 } 6645 }
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
7592 // longer executing commands. 7551 // longer executing commands.
7593 if (*location != -1) { 7552 if (*location != -1) {
7594 return error::kGenericError; 7553 return error::kGenericError;
7595 } 7554 }
7596 *location = program->GetAttribLocation(name_str); 7555 *location = program->GetAttribLocation(name_str);
7597 return error::kNoError; 7556 return error::kNoError;
7598 } 7557 }
7599 7558
7600 error::Error GLES2DecoderImpl::HandleGetAttribLocation( 7559 error::Error GLES2DecoderImpl::HandleGetAttribLocation(
7601 uint32 immediate_data_size, const cmds::GetAttribLocation& c) { 7560 uint32 immediate_data_size, const cmds::GetAttribLocation& c) {
7602 uint32 name_size = c.data_size;
7603 const char* name = GetSharedMemoryAs<const char*>(
7604 c.name_shm_id, c.name_shm_offset, name_size);
7605 if (!name) {
7606 return error::kOutOfBounds;
7607 }
7608 std::string name_str(name, name_size);
7609 return GetAttribLocationHelper(
7610 c.program, c.location_shm_id, c.location_shm_offset, name_str);
7611 }
7612
7613 error::Error GLES2DecoderImpl::HandleGetAttribLocationBucket(
7614 uint32 immediate_data_size, const cmds::GetAttribLocationBucket& c) {
7615 Bucket* bucket = GetBucket(c.name_bucket_id); 7561 Bucket* bucket = GetBucket(c.name_bucket_id);
7616 if (!bucket) { 7562 if (!bucket) {
7617 return error::kInvalidArguments; 7563 return error::kInvalidArguments;
7618 } 7564 }
7619 std::string name_str; 7565 std::string name_str;
7620 if (!bucket->GetAsString(&name_str)) { 7566 if (!bucket->GetAsString(&name_str)) {
7621 return error::kInvalidArguments; 7567 return error::kInvalidArguments;
7622 } 7568 }
7623 return GetAttribLocationHelper( 7569 return GetAttribLocationHelper(
7624 c.program, c.location_shm_id, c.location_shm_offset, name_str); 7570 c.program, c.location_shm_id, c.location_shm_offset, name_str);
(...skipping 26 matching lines...) Expand all
7651 // longer executing commands. 7597 // longer executing commands.
7652 if (*location != -1) { 7598 if (*location != -1) {
7653 return error::kGenericError; 7599 return error::kGenericError;
7654 } 7600 }
7655 *location = program->GetUniformFakeLocation(name_str); 7601 *location = program->GetUniformFakeLocation(name_str);
7656 return error::kNoError; 7602 return error::kNoError;
7657 } 7603 }
7658 7604
7659 error::Error GLES2DecoderImpl::HandleGetUniformLocation( 7605 error::Error GLES2DecoderImpl::HandleGetUniformLocation(
7660 uint32 immediate_data_size, const cmds::GetUniformLocation& c) { 7606 uint32 immediate_data_size, const cmds::GetUniformLocation& c) {
7661 uint32 name_size = c.data_size;
7662 const char* name = GetSharedMemoryAs<const char*>(
7663 c.name_shm_id, c.name_shm_offset, name_size);
7664 if (!name) {
7665 return error::kOutOfBounds;
7666 }
7667 std::string name_str(name, name_size);
7668 return GetUniformLocationHelper(
7669 c.program, c.location_shm_id, c.location_shm_offset, name_str);
7670 }
7671
7672 error::Error GLES2DecoderImpl::HandleGetUniformLocationBucket(
7673 uint32 immediate_data_size, const cmds::GetUniformLocationBucket& c) {
7674 Bucket* bucket = GetBucket(c.name_bucket_id); 7607 Bucket* bucket = GetBucket(c.name_bucket_id);
7675 if (!bucket) { 7608 if (!bucket) {
7676 return error::kInvalidArguments; 7609 return error::kInvalidArguments;
7677 } 7610 }
7678 std::string name_str; 7611 std::string name_str;
7679 if (!bucket->GetAsString(&name_str)) { 7612 if (!bucket->GetAsString(&name_str)) {
7680 return error::kInvalidArguments; 7613 return error::kInvalidArguments;
7681 } 7614 }
7682 return GetUniformLocationHelper( 7615 return GetUniformLocationHelper(
7683 c.program, c.location_shm_id, c.location_shm_offset, name_str); 7616 c.program, c.location_shm_id, c.location_shm_offset, name_str);
(...skipping 3078 matching lines...) Expand 10 before | Expand all | Expand 10 after
10762 } 10695 }
10763 } 10696 }
10764 10697
10765 // Include the auto-generated part of this file. We split this because it means 10698 // Include the auto-generated part of this file. We split this because it means
10766 // we can easily edit the non-auto generated parts right here in this file 10699 // we can easily edit the non-auto generated parts right here in this file
10767 // instead of having to edit some template or the code generator. 10700 // instead of having to edit some template or the code generator.
10768 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10701 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10769 10702
10770 } // namespace gles2 10703 } // namespace gles2
10771 } // namespace gpu 10704 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698