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

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

Issue 6969100: Hook up shader long variable name mapping with GPU command buffer port. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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/shader_translator.cc
===================================================================
--- gpu/command_buffer/service/shader_translator.cc (revision 87329)
+++ gpu/command_buffer/service/shader_translator.cc (working copy)
@@ -26,7 +26,7 @@
using gpu::gles2::ShaderTranslator;
void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type,
ShaderTranslator::VariableMap* var_map) {
- int name_len = 0;
+ int name_len = 0, mapped_name_len = 0;
switch (var_type) {
case SH_ACTIVE_ATTRIBUTES:
ShGetInfo(compiler, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &name_len);
@@ -36,8 +36,10 @@
break;
default: NOTREACHED();
}
- if (name_len <= 1) return;
+ ShGetInfo(compiler, SH_MAPPED_NAME_MAX_LENGTH, &mapped_name_len);
+ if (name_len <= 1 || mapped_name_len <= 1) return;
scoped_array<char> name(new char[name_len]);
+ scoped_array<char> mapped_name(new char[mapped_name_len]);
int num_vars = 0;
ShGetInfo(compiler, var_type, &num_vars);
@@ -47,16 +49,18 @@
switch (var_type) {
case SH_ACTIVE_ATTRIBUTES:
- ShGetActiveAttrib(compiler, i, NULL, &size, &type, name.get(), NULL);
+ ShGetActiveAttrib(
+ compiler, i, NULL, &size, &type, name.get(), mapped_name.get());
break;
case SH_ACTIVE_UNIFORMS:
- ShGetActiveUniform(compiler, i, NULL, &size, &type, name.get(), NULL);
+ ShGetActiveUniform(
+ compiler, i, NULL, &size, &type, name.get(), mapped_name.get());
break;
default: NOTREACHED();
}
- ShaderTranslator::VariableInfo info(type, size);
- (*var_map)[name.get()] = info;
+ ShaderTranslator::VariableInfo info(type, size, name.get());
+ (*var_map)[mapped_name.get()] = info;
}
}
} // namespace
@@ -99,7 +103,8 @@
ClearResults();
bool success = false;
- int compile_options = SH_OBJECT_CODE | SH_ATTRIBUTES_UNIFORMS;
+ int compile_options =
+ SH_OBJECT_CODE | SH_ATTRIBUTES_UNIFORMS | SH_MAP_LONG_VARIABLE_NAMES;
if (ShCompile(compiler_, &shader, 1, compile_options)) {
success = true;
if (!implementation_is_glsl_es_) {
« no previous file with comments | « gpu/command_buffer/service/shader_translator.h ('k') | gpu/command_buffer/service/shader_translator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698