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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 10822029: Use EXT_robustness where available on GLES2 platforms to detect and respond to resets of the graphi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review feedback. Rebuilt and re-tested. Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | third_party/khronos/EGL/eglext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 // Cached from ContextGroup 1535 // Cached from ContextGroup
1536 const Validators* validators_; 1536 const Validators* validators_;
1537 FeatureInfo::Ref feature_info_; 1537 FeatureInfo::Ref feature_info_;
1538 1538
1539 // This indicates all the following texSubImage2D calls that are part of the 1539 // This indicates all the following texSubImage2D calls that are part of the
1540 // failed texImage2D call should be ignored. 1540 // failed texImage2D call should be ignored.
1541 bool tex_image_2d_failed_; 1541 bool tex_image_2d_failed_;
1542 1542
1543 int frame_number_; 1543 int frame_number_;
1544 1544
1545 bool has_arb_robustness_; 1545 bool has_robustness_extension_;
1546 GLenum reset_status_; 1546 GLenum reset_status_;
1547 1547
1548 bool needs_mac_nvidia_driver_workaround_; 1548 bool needs_mac_nvidia_driver_workaround_;
1549 bool needs_glsl_built_in_function_emulation_; 1549 bool needs_glsl_built_in_function_emulation_;
1550 1550
1551 // These flags are used to override the state of the shared feature_info_ 1551 // These flags are used to override the state of the shared feature_info_
1552 // member. Because the same FeatureInfo instance may be shared among many 1552 // member. Because the same FeatureInfo instance may be shared among many
1553 // contexts, the assumptions on the availablity of extensions in WebGL 1553 // contexts, the assumptions on the availablity of extensions in WebGL
1554 // contexts may be broken. These flags override the shared state to preserve 1554 // contexts may be broken. These flags override the shared state to preserve
1555 // WebGL semantics. 1555 // WebGL semantics.
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 back_buffer_has_stencil_(false), 1956 back_buffer_has_stencil_(false),
1957 teximage2d_faster_than_texsubimage2d_(true), 1957 teximage2d_faster_than_texsubimage2d_(true),
1958 bufferdata_faster_than_buffersubdata_(true), 1958 bufferdata_faster_than_buffersubdata_(true),
1959 log_message_count_(0), 1959 log_message_count_(0),
1960 current_decoder_error_(error::kNoError), 1960 current_decoder_error_(error::kNoError),
1961 use_shader_translator_(true), 1961 use_shader_translator_(true),
1962 validators_(group_->feature_info()->validators()), 1962 validators_(group_->feature_info()->validators()),
1963 feature_info_(group_->feature_info()), 1963 feature_info_(group_->feature_info()),
1964 tex_image_2d_failed_(false), 1964 tex_image_2d_failed_(false),
1965 frame_number_(0), 1965 frame_number_(0),
1966 has_arb_robustness_(false), 1966 has_robustness_extension_(false),
1967 reset_status_(GL_NO_ERROR), 1967 reset_status_(GL_NO_ERROR),
1968 needs_mac_nvidia_driver_workaround_(false), 1968 needs_mac_nvidia_driver_workaround_(false),
1969 needs_glsl_built_in_function_emulation_(false), 1969 needs_glsl_built_in_function_emulation_(false),
1970 force_webgl_glsl_validation_(false), 1970 force_webgl_glsl_validation_(false),
1971 derivatives_explicitly_enabled_(false), 1971 derivatives_explicitly_enabled_(false),
1972 compile_shader_always_succeeds_(false), 1972 compile_shader_always_succeeds_(false),
1973 viewport_x_(0), 1973 viewport_x_(0),
1974 viewport_y_(0), 1974 viewport_y_(0),
1975 viewport_width_(0), 1975 viewport_width_(0),
1976 viewport_height_(0), 1976 viewport_height_(0),
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact 2243 // VERTEX_PROGRAM_POINT_SIZE and doesn't expose this enum. This fact
2244 // isn't well documented; it was discovered in the Khronos OpenGL ES 2244 // isn't well documented; it was discovered in the Khronos OpenGL ES
2245 // mailing list archives. It also implicitly enables the desktop GL 2245 // mailing list archives. It also implicitly enables the desktop GL
2246 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord 2246 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord
2247 // variable in fragment shaders. 2247 // variable in fragment shaders.
2248 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { 2248 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
2249 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); 2249 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
2250 glEnable(GL_POINT_SPRITE); 2250 glEnable(GL_POINT_SPRITE);
2251 } 2251 }
2252 2252
2253 has_arb_robustness_ = context->HasExtension("GL_ARB_robustness"); 2253 has_robustness_extension_ =
2254 context->HasExtension("GL_ARB_robustness") ||
2255 context->HasExtension("GL_EXT_robustness");
2254 2256
2255 if (!feature_info_->feature_flags().disable_workarounds) { 2257 if (!feature_info_->feature_flags().disable_workarounds) {
2256 #if defined(OS_MACOSX) 2258 #if defined(OS_MACOSX)
2257 needs_mac_nvidia_driver_workaround_ = 2259 needs_mac_nvidia_driver_workaround_ =
2258 feature_info_->feature_flags().is_nvidia; 2260 feature_info_->feature_flags().is_nvidia;
2259 needs_glsl_built_in_function_emulation_ = 2261 needs_glsl_built_in_function_emulation_ =
2260 feature_info_->feature_flags().is_amd; 2262 feature_info_->feature_flags().is_amd;
2261 #endif 2263 #endif
2262 } 2264 }
2263 2265
(...skipping 6261 matching lines...) Expand 10 before | Expand all | Expand 10 after
8525 return error::kInnocent; 8527 return error::kInnocent;
8526 case GL_UNKNOWN_CONTEXT_RESET_ARB: 8528 case GL_UNKNOWN_CONTEXT_RESET_ARB:
8527 return error::kUnknown; 8529 return error::kUnknown;
8528 } 8530 }
8529 8531
8530 NOTREACHED(); 8532 NOTREACHED();
8531 return error::kUnknown; 8533 return error::kUnknown;
8532 } 8534 }
8533 8535
8534 bool GLES2DecoderImpl::WasContextLost() { 8536 bool GLES2DecoderImpl::WasContextLost() {
8535 if (context_->WasAllocatedUsingARBRobustness() && has_arb_robustness_) { 8537 if (context_->WasAllocatedUsingRobustnessExtension()) {
8536 GLenum status = glGetGraphicsResetStatusARB(); 8538 GLenum status = GL_NO_ERROR;
8539 if (has_robustness_extension_)
8540 status = glGetGraphicsResetStatusARB();
8537 if (status != GL_NO_ERROR) { 8541 if (status != GL_NO_ERROR) {
8538 // The graphics card was reset. Signal a lost context to the application. 8542 // The graphics card was reset. Signal a lost context to the application.
8539 reset_status_ = status; 8543 reset_status_ = status;
8540 LOG(ERROR) << (surface_->IsOffscreen() ? "Offscreen" : "Onscreen") 8544 LOG(ERROR) << (surface_->IsOffscreen() ? "Offscreen" : "Onscreen")
8541 << " context lost via ARB_robustness. Reset status = 0x" 8545 << " context lost via ARB/EXT_robustness. Reset status = 0x"
8542 << std::hex << status << std::dec; 8546 << std::hex << status << std::dec;
8543 return true; 8547 return true;
8544 } 8548 }
8545 } 8549 }
8546 return false; 8550 return false;
8547 } 8551 }
8548 8552
8549 bool GLES2DecoderImpl::GenQueriesEXTHelper( 8553 bool GLES2DecoderImpl::GenQueriesEXTHelper(
8550 GLsizei n, const GLuint* client_ids) { 8554 GLsizei n, const GLuint* client_ids) {
8551 for (GLsizei ii = 0; ii < n; ++ii) { 8555 for (GLsizei ii = 0; ii < n; ++ii) {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
9184 BindAndApplyTextureParameters(info); 9188 BindAndApplyTextureParameters(info);
9185 } 9189 }
9186 9190
9187 // Include the auto-generated part of this file. We split this because it means 9191 // Include the auto-generated part of this file. We split this because it means
9188 // we can easily edit the non-auto generated parts right here in this file 9192 // we can easily edit the non-auto generated parts right here in this file
9189 // instead of having to edit some template or the code generator. 9193 // instead of having to edit some template or the code generator.
9190 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 9194 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
9191 9195
9192 } // namespace gles2 9196 } // namespace gles2
9193 } // namespace gpu 9197 } // namespace gpu
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | third_party/khronos/EGL/eglext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698