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

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

Issue 900543004: Clean up some of the shader compilation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added shader length unit test and fixed length check 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/shader_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index f37c61a4808d9832879583c2321d05c2fdac9602..9ad26770273af8af34d82f96e39cf6abcd97c9cb 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -7051,14 +7051,17 @@ void GLES2DecoderImpl::DoShaderSource(
GLuint client_id, GLsizei count, const char** data, const GLint* length) {
std::string str;
for (GLsizei ii = 0; ii < count; ++ii) {
- str.append(data[ii]);
+ if (length && length[ii] > 0)
+ str.append(data[ii], length[ii]);
+ else
+ str.append(data[ii]);
}
Shader* shader = GetShaderInfoNotProgram(client_id, "glShaderSource");
if (!shader) {
return;
}
// Note: We don't actually call glShaderSource here. We wait until
- // the call to glCompileShader.
+ // we actually compile the shader.
shader->set_source(str);
}
« no previous file with comments | « no previous file | gpu/command_buffer/service/shader_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698