summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorbajones <bajones@chromium.org>2015-04-07 16:14:42 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-07 23:16:05 +0000
commit6b0124f415cefb8c4b29967336b62dccce0e42d1 (patch)
tree9921924da74327d8d869fc569443d8238a5b5eec /gpu
parente908733bb3fa90e17924fe098bee3b9917db26ea (diff)
downloadchromium_src-6b0124f415cefb8c4b29967336b62dccce0e42d1.zip
chromium_src-6b0124f415cefb8c4b29967336b62dccce0e42d1.tar.gz
chromium_src-6b0124f415cefb8c4b29967336b62dccce0e42d1.tar.bz2
GPU workaround to simulate Out of Memory errors with large textures
BUG=445542 Review URL: https://codereview.chromium.org/1050043003 Cr-Commit-Position: refs/heads/master@{#324150}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc9
-rw-r--r--gpu/config/gpu_driver_bug_workaround_type.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 388ebdb..754f735 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -9072,6 +9072,15 @@ error::Error GLES2DecoderImpl::HandleTexImage2D(uint32 immediate_data_size,
}
}
+ // For testing only. Allows us to stress the ability to respond to OOM errors.
+ if (workarounds().simulate_out_of_memory_on_large_textures &&
+ (width * height >= 4096 * 4096)) {
+ LOCAL_SET_GL_ERROR(
+ GL_OUT_OF_MEMORY,
+ "glTexImage2D", "synthetic out of memory");
+ return error::kNoError;
+ }
+
TextureManager::DoTextImage2DArguments args = {
target, level, internal_format, width, height, border, format, type,
pixels, pixels_size};
diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/config/gpu_driver_bug_workaround_type.h
index bf1cf74..906b5df 100644
--- a/gpu/config/gpu_driver_bug_workaround_type.h
+++ b/gpu/config/gpu_driver_bug_workaround_type.h
@@ -100,6 +100,8 @@
scalarize_vec_and_mat_constructor_args) \
GPU_OP(SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP, \
set_texture_filter_before_generating_mipmap) \
+ GPU_OP(SIMULATE_OUT_OF_MEMORY_ON_LARGE_TEXTURES, \
+ simulate_out_of_memory_on_large_textures) \
GPU_OP(SWIZZLE_RGBA_FOR_ASYNC_READPIXELS, \
swizzle_rgba_for_async_readpixels) \
GPU_OP(TEXSUBIMAGE2D_FASTER_THAN_TEXIMAGE2D, \