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

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

Issue 1286193008: Reland of "gpu: workaround force_cube_map_positive_x_allocation fixes Android crash." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nvidia failure on mac and android Created 5 years, 4 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/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index 24912ee65bc5059cf3595fe2bf1a97666830575d..c8166324dd5bfb958ae9ceed66b752da221db5b0 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -1940,6 +1940,50 @@ void TextureManager::ValidateAndDoTexImage(
return;
}
+ // ValidateTexImage is passed already.
+ Texture* texture = texture_ref->texture();
+ if (texture->target() == GL_TEXTURE_CUBE_MAP) {
no sievers 2015/08/21 19:30:30 This breaks all cubemap uploads that don't go thro
dshwang 2015/08/27 06:09:53 yes, I made a mistake. Fixed.
+ std::vector<GLenum> undefined_faces;
+ if (texture_state->force_cube_complete) {
+ int width = 0;
+ int height = 0;
+ for (unsigned i = 0; i < 6; i++) {
+ if (!texture->GetLevelSize(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
no sievers 2015/08/21 19:30:30 Can't GetLevelSize() return true even though width
dshwang 2015/08/27 06:09:53 this routine check if the face is defined, not siz
+ args.level, &width, &height, nullptr))
+ undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i);
+ }
+ } else if (texture_state->force_cube_map_positive_x_allocation &&
+ args.target != GL_TEXTURE_CUBE_MAP_POSITIVE_X) {
+ int width = 0;
+ int height = 0;
+ if (!texture->GetLevelSize(GL_TEXTURE_CUBE_MAP_POSITIVE_X, args.level,
+ &width, &height, nullptr))
+ undefined_faces.push_back(GL_TEXTURE_CUBE_MAP_POSITIVE_X);
+ undefined_faces.push_back(args.target);
+ }
+
+ if (!memory_tracker_managed_->EnsureGPUMemoryAvailable(
+ undefined_faces.size() * args.pixels_size)) {
+ ERRORSTATE_SET_GL_ERROR(state->GetErrorState(), GL_OUT_OF_MEMORY,
+ function_name, "out of memory");
+ return;
+ }
+ DoTexImageArguments new_args = args;
+ scoped_ptr<char[]> zero(new char[args.pixels_size]);
+ memset(zero.get(), 0, args.pixels_size);
+ for (GLenum face : undefined_faces) {
+ new_args.target = face;
+ if (face == args.target) {
+ new_args.pixels = args.pixels;
+ } else {
+ new_args.pixels = zero.get();
+ }
+ DoTexImage(texture_state, state->GetErrorState(), framebuffer_state,
+ function_name, texture_ref, new_args);
+ }
+ return;
+ }
+
DoTexImage(texture_state, state->GetErrorState(), framebuffer_state,
function_name, texture_ref, args);
}
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer/tests/gl_cube_map_texture_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698