Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc |
| index b9da39a4b959df1c0eaa3d78051826fe76b2514e..c83eb13d85943c2bae8b6cf545c1614e3c431f9d 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc |
| @@ -1015,7 +1015,24 @@ error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockName( |
| GLuint program, |
| GLuint index, |
| std::string* name) { |
| - NOTIMPLEMENTED(); |
| + FlushErrors(); |
| + |
| + GLuint program_service_id = GetProgramServiceID(program, resources_); |
| + GLint max_name_length = 0; |
| + glGetProgramiv(program_service_id, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, |
| + &max_name_length); |
| + |
| + if (FlushErrors()) { |
| + return error::kNoError; |
| + } |
| + |
| + std::vector<GLchar> buffer(max_name_length, 0); |
| + GLsizei length = 0; |
| + glGetActiveUniformBlockName(program_service_id, index, max_name_length, |
| + &length, buffer.data()); |
| + DCHECK(length <= max_name_length); |
| + *name = length > 0 ? std::string(buffer.data(), length) : std::string(); |
| + |
| return error::kNoError; |
| } |
| @@ -1024,10 +1041,9 @@ error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformsiv( |
| GLsizei count, |
| const GLuint* indices, |
| GLenum pname, |
| - GLsizei bufSize, |
| - GLsizei* length, |
| GLint* params) { |
| - NOTIMPLEMENTED(); |
| + glGetActiveUniformsiv(GetProgramServiceID(program, resources_), count, |
| + indices, pname, params); |
| return error::kNoError; |
| } |
| @@ -1036,7 +1052,8 @@ error::Error GLES2DecoderPassthroughImpl::DoGetAttachedShaders( |
| GLsizei maxcount, |
| GLsizei* count, |
| GLuint* shaders) { |
| - NOTIMPLEMENTED(); |
| + glGetAttachedShaders(GetProgramServiceID(program, resources_), maxcount, |
| + count, shaders); |
| return error::kNoError; |
| } |
| @@ -1214,14 +1231,20 @@ error::Error GLES2DecoderPassthroughImpl::DoGetProgramiv(GLuint program, |
| error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog( |
| GLuint program, |
| std::string* infolog) { |
| + FlushErrors(); |
| GLint info_log_len = 0; |
| glGetProgramiv(GetProgramServiceID(program, resources_), GL_INFO_LOG_LENGTH, |
| &info_log_len); |
| + if (FlushErrors()) { |
| + return error::kNoError; |
| + } |
| + |
| std::vector<char> buffer(info_log_len, 0); |
| glGetProgramInfoLog(GetProgramServiceID(program, resources_), info_log_len, |
| nullptr, buffer.data()); |
| - *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string(); |
| + *infolog = info_log_len > 0 ? std::string(buffer.data(), info_log_len) |
|
Zhenyao Mo
2017/03/23 17:45:56
I mean the same with std::string(buffer.data(), le
|
| + : std::string(); |
| return error::kNoError; |
| } |
| @@ -1270,12 +1293,19 @@ error::Error GLES2DecoderPassthroughImpl::DoGetShaderiv(GLuint shader, |
| error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog( |
| GLuint shader, |
| std::string* infolog) { |
| + FlushErrors(); |
| + |
| GLuint service_id = GetShaderServiceID(shader, resources_); |
| GLint info_log_len = 0; |
| glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len); |
| + if (FlushErrors()) { |
| + return error::kNoError; |
| + } |
| + |
| std::vector<char> buffer(info_log_len, 0); |
| glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data()); |
| - *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string(); |
| + *infolog = info_log_len > 0 ? std::string(buffer.data(), info_log_len) |
| + : std::string(); |
| return error::kNoError; |
| } |
| @@ -1294,7 +1324,22 @@ error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat( |
| error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource( |
| GLuint shader, |
| std::string* source) { |
| - NOTIMPLEMENTED(); |
| + FlushErrors(); |
| + |
| + GLuint shader_service_id = GetShaderServiceID(shader, resources_); |
| + GLint shader_source_length = 0; |
| + glGetShaderiv(shader_service_id, GL_SHADER_SOURCE_LENGTH, |
| + &shader_source_length); |
| + if (FlushErrors()) { |
| + return error::kNoError; |
| + } |
| + |
| + std::vector<char> buffer(shader_source_length, 0); |
| + glGetShaderSource(shader_service_id, shader_source_length, nullptr, |
| + buffer.data()); |
| + *source = shader_source_length > 0 |
| + ? std::string(buffer.data(), shader_source_length) |
|
Zhenyao Mo
2017/03/23 17:45:56
The same with std::string(buffer.data(), len).
Geoff Lang
2017/03/23 17:50:17
For this one, the length should be exact but I can
|
| + : std::string(); |
| return error::kNoError; |
| } |
| @@ -1376,7 +1421,8 @@ error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex( |
| GLuint program, |
| const char* name, |
| GLint* index) { |
| - NOTIMPLEMENTED(); |
| + *index = |
| + glGetUniformBlockIndex(GetProgramServiceID(program, resources_), name); |
| return error::kNoError; |
| } |
| @@ -1421,9 +1467,9 @@ error::Error GLES2DecoderPassthroughImpl::DoGetUniformIndices( |
| GLsizei count, |
| const char* const* names, |
| GLsizei bufSize, |
| - GLsizei* length, |
| GLuint* indices) { |
| - NOTIMPLEMENTED(); |
| + glGetUniformIndices(GetProgramServiceID(program, resources_), count, names, |
| + indices); |
| return error::kNoError; |
| } |
| @@ -1535,7 +1581,6 @@ error::Error GLES2DecoderPassthroughImpl::DoInvalidateSubFramebuffer( |
| error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer, |
| uint32_t* result) { |
| - NOTIMPLEMENTED(); |
| *result = glIsBuffer(GetBufferServiceID(buffer, resources_, false)); |
| return error::kNoError; |
| } |
| @@ -1561,7 +1606,6 @@ error::Error GLES2DecoderPassthroughImpl::DoIsProgram(GLuint program, |
| error::Error GLES2DecoderPassthroughImpl::DoIsRenderbuffer(GLuint renderbuffer, |
| uint32_t* result) { |
| - NOTIMPLEMENTED(); |
| *result = glIsRenderbufferEXT( |
| GetRenderbufferServiceID(renderbuffer, resources_, false)); |
| return error::kNoError; |
| @@ -1722,7 +1766,11 @@ error::Error GLES2DecoderPassthroughImpl::DoShaderBinary(GLsizei n, |
| GLenum binaryformat, |
| const void* binary, |
| GLsizei length) { |
| - NOTIMPLEMENTED(); |
| + std::vector<GLuint> service_shaders(n, 0); |
| + for (GLsizei i = 0; i < n; i++) { |
| + service_shaders[i] = GetShaderServiceID(shaders[i], resources_); |
| + } |
| + glShaderBinary(n, service_shaders.data(), binaryformat, binary, length); |
| return error::kNoError; |
| } |
| @@ -2380,7 +2428,9 @@ error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT( |
| GLuint texture, |
| GLint level, |
| GLsizei samples) { |
| - NOTIMPLEMENTED(); |
| + glFramebufferTexture2DMultisampleEXT( |
| + target, attachment, textarget, |
| + GetTextureServiceID(texture, resources_, false), level, samples); |
| return error::kNoError; |
| } |