| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
|
| index b047a700232ef5b5d93d77935ee9b79a409308e0..f0469a5cc5036d30307eecc86559df7b85e30687 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -1100,6 +1100,35 @@ GLint GLES2Implementation::GetFragDataLocation(
|
| return loc;
|
| }
|
|
|
| +GLuint GLES2Implementation::GetUniformBlockIndexHelper(
|
| + GLuint program, const char* name) {
|
| + typedef cmds::GetUniformBlockIndex::Result Result;
|
| + Result* result = GetResultAs<Result*>();
|
| + if (!result) {
|
| + return GL_INVALID_INDEX;
|
| + }
|
| + *result = GL_INVALID_INDEX;
|
| + SetBucketAsCString(kResultBucketId, name);
|
| + helper_->GetUniformBlockIndex(
|
| + program, kResultBucketId, GetResultShmId(), GetResultShmOffset());
|
| + WaitForCmd();
|
| + helper_->SetBucketSize(kResultBucketId, 0);
|
| + return *result;
|
| +}
|
| +
|
| +GLuint GLES2Implementation::GetUniformBlockIndex(
|
| + GLuint program, const char* name) {
|
| + GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformBlockIndex("
|
| + << program << ", " << name << ")");
|
| + TRACE_EVENT0("gpu", "GLES2::GetUniformBlockIndex");
|
| + GLuint index = share_group_->program_info_manager()->GetUniformBlockIndex(
|
| + this, program, name);
|
| + GPU_CLIENT_LOG("returned " << index);
|
| + CheckGLError();
|
| + return index;
|
| +}
|
| +
|
| void GLES2Implementation::LinkProgram(GLuint program) {
|
| GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLinkProgram(" << program << ")");
|
| @@ -2281,6 +2310,69 @@ void GLES2Implementation::GetActiveUniform(
|
| CheckGLError();
|
| }
|
|
|
| +bool GLES2Implementation::GetActiveUniformBlockNameHelper(
|
| + GLuint program, GLuint index, GLsizei bufsize,
|
| + GLsizei* length, char* name) {
|
| + DCHECK_LE(0, bufsize);
|
| + // Clear the bucket so if the command fails nothing will be in it.
|
| + helper_->SetBucketSize(kResultBucketId, 0);
|
| + typedef cmds::GetActiveUniformBlockName::Result Result;
|
| + Result* result = GetResultAs<Result*>();
|
| + if (!result) {
|
| + return false;
|
| + }
|
| + // Set as failed so if the command fails we'll recover.
|
| + *result = 0;
|
| + helper_->GetActiveUniformBlockName(program, index, kResultBucketId,
|
| + GetResultShmId(), GetResultShmOffset());
|
| + WaitForCmd();
|
| + if (*result) {
|
| + if (bufsize == 0) {
|
| + if (length) {
|
| + *length = 0;
|
| + }
|
| + } else if (length || name) {
|
| + std::vector<int8> str;
|
| + GetBucketContents(kResultBucketId, &str);
|
| + DCHECK(str.size() > 0);
|
| + GLsizei max_size =
|
| + std::min(bufsize, static_cast<GLsizei>(str.size())) - 1;
|
| + if (length) {
|
| + *length = max_size;
|
| + }
|
| + if (name) {
|
| + memcpy(name, &str[0], max_size);
|
| + name[max_size] = '\0';
|
| + }
|
| + }
|
| + }
|
| + return *result != 0;
|
| +}
|
| +
|
| +void GLES2Implementation::GetActiveUniformBlockName(
|
| + GLuint program, GLuint index, GLsizei bufsize,
|
| + GLsizei* length, char* name) {
|
| + GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveUniformBlockName("
|
| + << program << ", " << index << ", " << bufsize << ", "
|
| + << static_cast<const void*>(length) << ", "
|
| + << static_cast<const void*>(name) << ", ");
|
| + if (bufsize < 0) {
|
| + SetGLError(GL_INVALID_VALUE, "glGetActiveUniformBlockName", "bufsize < 0");
|
| + return;
|
| + }
|
| + TRACE_EVENT0("gpu", "GLES2::GetActiveUniformBlockName");
|
| + bool success =
|
| + share_group_->program_info_manager()->GetActiveUniformBlockName(
|
| + this, program, index, bufsize, length, name);
|
| + if (success) {
|
| + if (name) {
|
| + GPU_CLIENT_LOG(" name: " << name);
|
| + }
|
| + }
|
| + CheckGLError();
|
| +}
|
| +
|
| void GLES2Implementation::GetAttachedShaders(
|
| GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
|
| GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| @@ -3515,6 +3607,47 @@ void GLES2Implementation::GetProgramInfoCHROMIUM(
|
| memcpy(info, &result[0], result.size());
|
| }
|
|
|
| +void GLES2Implementation::GetUniformBlocksCHROMIUMHelper(
|
| + GLuint program, std::vector<int8>* result) {
|
| + DCHECK(result);
|
| + // Clear the bucket so if the command fails nothing will be in it.
|
| + helper_->SetBucketSize(kResultBucketId, 0);
|
| + helper_->GetUniformBlocksCHROMIUM(program, kResultBucketId);
|
| + GetBucketContents(kResultBucketId, result);
|
| +}
|
| +
|
| +void GLES2Implementation::GetUniformBlocksCHROMIUM(
|
| + GLuint program, GLsizei bufsize, GLsizei* size, void* info) {
|
| + GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| + if (bufsize < 0) {
|
| + SetGLError(
|
| + GL_INVALID_VALUE, "glUniformBlocksCHROMIUM", "bufsize less than 0.");
|
| + return;
|
| + }
|
| + if (size == NULL) {
|
| + SetGLError(GL_INVALID_VALUE, "glUniformBlocksCHROMIUM", "size is null.");
|
| + return;
|
| + }
|
| + // Make sure they've set size to 0 else the value will be undefined on
|
| + // lost context.
|
| + DCHECK_EQ(0, *size);
|
| + std::vector<int8> result;
|
| + GetUniformBlocksCHROMIUMHelper(program, &result);
|
| + if (result.empty()) {
|
| + return;
|
| + }
|
| + *size = result.size();
|
| + if (!info) {
|
| + return;
|
| + }
|
| + if (static_cast<size_t>(bufsize) < result.size()) {
|
| + SetGLError(GL_INVALID_OPERATION,
|
| + "glUniformBlocksCHROMIUM", "bufsize is too small for result.");
|
| + return;
|
| + }
|
| + memcpy(info, &result[0], result.size());
|
| +}
|
| +
|
| GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) {
|
| GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CreateStreamTextureCHROMIUM("
|
|
|