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

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

Issue 894373004: Add glGetActiveUniformBlockiv to GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win bots Created 5 years, 10 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 9712 matching lines...) Expand 10 before | Expand all | Expand 10 after
9723 return error::kNoError; 9723 return error::kNoError;
9724 } 9724 }
9725 result->success = 1; // true. 9725 result->success = 1; // true.
9726 result->size = uniform_info->size; 9726 result->size = uniform_info->size;
9727 result->type = uniform_info->type; 9727 result->type = uniform_info->type;
9728 Bucket* bucket = CreateBucket(name_bucket_id); 9728 Bucket* bucket = CreateBucket(name_bucket_id);
9729 bucket->SetFromString(uniform_info->name.c_str()); 9729 bucket->SetFromString(uniform_info->name.c_str());
9730 return error::kNoError; 9730 return error::kNoError;
9731 } 9731 }
9732 9732
9733 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv(
9734 uint32 immediate_data_size, const void* cmd_data) {
9735 if (!unsafe_es3_apis_enabled())
9736 return error::kUnknownCommand;
9737 const gles2::cmds::GetActiveUniformBlockiv& c =
9738 *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data);
9739 GLuint program_id = c.program;
9740 GLuint index = static_cast<GLuint>(c.index);
9741 GLenum pname = static_cast<GLenum>(c.pname);
9742 Program* program = GetProgramInfoNotShader(
9743 program_id, "glGetActiveUniform");
9744 if (!program) {
9745 return error::kNoError;
9746 }
9747 GLuint service_id = program->service_id();
9748 GLint link_status = GL_FALSE;
9749 glGetProgramiv(service_id, GL_LINK_STATUS, &link_status);
9750 if (link_status != GL_TRUE) {
9751 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
9752 "glGetActiveActiveUniformBlockiv", "program not linked");
9753 return error::kNoError;
9754 }
9755 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("GetActiveUniformBlockiv");
9756 GLsizei num_values = 1;
9757 if (pname == GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) {
9758 GLint num = 0;
9759 glGetActiveUniformBlockiv(
9760 service_id, index, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &num);
9761 GLenum error = glGetError();
9762 if (error != GL_NO_ERROR) {
9763 // Assume this will the same error if calling with pname.
9764 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", "");
9765 return error::kNoError;
9766 }
9767 num_values = static_cast<GLsizei>(num);
9768 }
9769 typedef cmds::GetActiveUniformBlockiv::Result Result;
9770 Result* result = GetSharedMemoryAs<Result*>(
9771 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values));
9772 GLint* params = result ? result->GetData() : NULL;
9773 if (params == NULL) {
9774 return error::kOutOfBounds;
9775 }
9776 // Check that the client initialized the result.
9777 if (result->size != 0) {
9778 return error::kInvalidArguments;
9779 }
9780 glGetActiveUniformBlockiv(service_id, index, pname, params);
9781 GLenum error = glGetError();
9782 if (error == GL_NO_ERROR) {
9783 result->SetNumResults(num_values);
9784 } else {
9785 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", "");
9786 }
9787 return error::kNoError;
9788 }
9789
9733 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName( 9790 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName(
9734 uint32 immediate_data_size, const void* cmd_data) { 9791 uint32 immediate_data_size, const void* cmd_data) {
9735 if (!unsafe_es3_apis_enabled()) 9792 if (!unsafe_es3_apis_enabled())
9736 return error::kUnknownCommand; 9793 return error::kUnknownCommand;
9737 const gles2::cmds::GetActiveUniformBlockName& c = 9794 const gles2::cmds::GetActiveUniformBlockName& c =
9738 *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data); 9795 *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data);
9739 GLuint program_id = c.program; 9796 GLuint program_id = c.program;
9740 GLuint index = c.index; 9797 GLuint index = c.index;
9741 uint32 name_bucket_id = c.name_bucket_id; 9798 uint32 name_bucket_id = c.name_bucket_id;
9742 typedef cmds::GetActiveUniformBlockName::Result Result; 9799 typedef cmds::GetActiveUniformBlockName::Result Result;
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
11788 } 11845 }
11789 } 11846 }
11790 11847
11791 // Include the auto-generated part of this file. We split this because it means 11848 // Include the auto-generated part of this file. We split this because it means
11792 // we can easily edit the non-auto generated parts right here in this file 11849 // we can easily edit the non-auto generated parts right here in this file
11793 // instead of having to edit some template or the code generator. 11850 // instead of having to edit some template or the code generator.
11794 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11851 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11795 11852
11796 } // namespace gles2 11853 } // namespace gles2
11797 } // namespace gpu 11854 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698