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

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

Issue 153173002: Add a gpu driver bug workaround to count in all varyings in packing check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/program_manager.cc
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
index 32b91403bf6fd8093d53c1944903922c7133279b..1e51d44073697e1839bcfb445268f360bdf9f100 100644
--- a/gpu/command_buffer/service/program_manager.cc
+++ b/gpu/command_buffer/service/program_manager.cc
@@ -117,6 +117,11 @@ bool IsBuiltInVarying(const std::string& name) {
return false;
}
+bool IsGpuDriverBugWorkaroundsDisabled() {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableGpuDriverBugWorkarounds);
+}
+
} // anonymous namespace.
Program::UniformInfo::UniformInfo()
@@ -553,7 +558,12 @@ bool Program::Link(ShaderManager* manager,
set_log_info(ProcessLogInfo(info_log).c_str());
return false;
}
- if (!CheckVaryingsPacking()) {
+ VaryingsPackingOption option = kCountOnlyStaticallyUsed;
+ if (!IsGpuDriverBugWorkaroundsDisabled() &&
Ken Russell (switch to Gerrit) 2014/02/04 00:34:37 It seems unfortunate to me that the Program object
Zhenyao Mo 2014/02/06 21:54:05 Refactored, so done.
+ feature_info &&
+ feature_info->workarounds().count_all_in_varyings_packing)
+ option = kCountAll;
+ if (!CheckVaryingsPacking(option)) {
set_log_info("Varyings over maximum register limit");
return false;
}
@@ -1098,7 +1108,8 @@ bool Program::DetectGlobalNameConflicts(std::string* conflicting_name) const {
return false;
}
-bool Program::CheckVaryingsPacking() const {
+bool Program::CheckVaryingsPacking(
+ Program::VaryingsPackingOption option) const {
DCHECK(attached_shaders_[0] &&
attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER &&
attached_shaders_[1] &&
@@ -1113,13 +1124,14 @@ bool Program::CheckVaryingsPacking() const {
for (ShaderTranslator::VariableMap::const_iterator iter =
fragment_varyings->begin();
iter != fragment_varyings->end(); ++iter) {
- if (!iter->second.static_use)
+ if (!iter->second.static_use && option == kCountOnlyStaticallyUsed)
continue;
if (!IsBuiltInVarying(iter->first)) {
ShaderTranslator::VariableMap::const_iterator vertex_iter =
vertex_varyings->find(iter->first);
if (vertex_iter == vertex_varyings->end() ||
- !vertex_iter->second.static_use)
+ (!vertex_iter->second.static_use &&
+ option == kCountOnlyStaticallyUsed))
continue;
}
@@ -1251,9 +1263,6 @@ ProgramManager::ProgramManager(ProgramCache* program_cache,
uint32 max_varying_vectors)
: program_count_(0),
have_context_(true),
- disable_workarounds_(
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableGpuDriverBugWorkarounds)),
program_cache_(program_cache),
max_varying_vectors_(max_varying_vectors) { }
@@ -1363,7 +1372,7 @@ void ProgramManager::UnuseProgram(
void ProgramManager::ClearUniforms(Program* program) {
DCHECK(program);
- if (!disable_workarounds_) {
+ if (!IsGpuDriverBugWorkaroundsDisabled()) {
Ken Russell (switch to Gerrit) 2014/02/04 00:34:37 Tying together these two bug workarounds (needing
Zhenyao Mo 2014/02/06 21:54:05 A previous CL fixed the ClearUniforms workaround a
program->ClearUniforms(&zero_);
}
}

Powered by Google App Engine
This is Rietveld 408576698