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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc

Issue 2770713005: Implement most of the remaining entry points in the passthrough cmd decoder. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
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..1b8837e12499713cc635e42cf6f18e5efd65b2b0 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();
+
+ GLint active_uniform_block_max_length = 0;
Zhenyao Mo 2017/03/23 17:02:46 nit: should be *max_name_length.
Geoff Lang 2017/03/23 17:39:44 Done.
+ glGetProgramiv(GetProgramServiceID(program, resources_),
+ GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH,
+ &active_uniform_block_max_length);
+
+ if (FlushErrors() || active_uniform_block_max_length) {
+ return error::kNoError;
+ }
+
+ std::vector<GLchar> buffer(active_uniform_block_max_length, 0);
+ GLsizei length = 0;
+ glGetActiveUniformBlockName(GetProgramServiceID(program, resources_), index,
Zhenyao Mo 2017/03/23 17:02:46 Can we cache the service_id above so we don't have
Geoff Lang 2017/03/23 17:39:44 Done.
+ active_uniform_block_max_length, &length,
+ buffer.data());
+ *name = length > 0 ? std::string(buffer.data()) : std::string();
Zhenyao Mo 2017/03/23 17:02:46 To be on the safe side, can we DCHECK length < act
Zhenyao Mo 2017/03/23 17:02:46 nit: can we DCHECK(name) before using it?
Geoff Lang 2017/03/23 17:39:43 name is safe to use, it is a local variable from t
Geoff Lang 2017/03/23 17:39:44 Done.
+
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,10 +1231,15 @@ 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());
@@ -1270,9 +1292,15 @@ 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();
@@ -1294,7 +1322,20 @@ error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat(
error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource(
GLuint shader,
std::string* source) {
- NOTIMPLEMENTED();
+ FlushErrors();
+
+ GLint shader_source_length = 0;
+ glGetShaderiv(GetShaderServiceID(shader, resources_), GL_SHADER_SOURCE_LENGTH,
+ &shader_source_length);
+ if (FlushErrors()) {
+ return error::kNoError;
+ }
+
+ std::vector<char> buffer(shader_source_length, 0);
+ glGetShaderSource(GetShaderServiceID(shader, resources_),
+ shader_source_length, nullptr, buffer.data());
+ *source =
+ shader_source_length > 0 ? std::string(buffer.data()) : std::string();
Zhenyao Mo 2017/03/23 17:02:46 Same suggestions here.
Geoff Lang 2017/03/23 17:39:44 Done.
return error::kNoError;
}
@@ -1376,7 +1417,8 @@ error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex(
GLuint program,
const char* name,
GLint* index) {
- NOTIMPLEMENTED();
+ *index =
+ glGetUniformBlockIndex(GetProgramServiceID(program, resources_), name);
return error::kNoError;
}
@@ -1421,9 +1463,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 +1577,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 +1602,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 +1762,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 +2424,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;
}

Powered by Google App Engine
This is Rietveld 408576698