OLD | NEW |
---|---|
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 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_arb_robustness_; |
1546 bool has_ext_robustness_; | |
1546 GLenum reset_status_; | 1547 GLenum reset_status_; |
1547 | 1548 |
1548 bool needs_mac_nvidia_driver_workaround_; | 1549 bool needs_mac_nvidia_driver_workaround_; |
1549 bool needs_glsl_built_in_function_emulation_; | 1550 bool needs_glsl_built_in_function_emulation_; |
1550 | 1551 |
1551 // These flags are used to override the state of the shared feature_info_ | 1552 // 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 | 1553 // member. Because the same FeatureInfo instance may be shared among many |
1553 // contexts, the assumptions on the availablity of extensions in WebGL | 1554 // contexts, the assumptions on the availablity of extensions in WebGL |
1554 // contexts may be broken. These flags override the shared state to preserve | 1555 // contexts may be broken. These flags override the shared state to preserve |
1555 // WebGL semantics. | 1556 // WebGL semantics. |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1957 teximage2d_faster_than_texsubimage2d_(true), | 1958 teximage2d_faster_than_texsubimage2d_(true), |
1958 bufferdata_faster_than_buffersubdata_(true), | 1959 bufferdata_faster_than_buffersubdata_(true), |
1959 log_message_count_(0), | 1960 log_message_count_(0), |
1960 current_decoder_error_(error::kNoError), | 1961 current_decoder_error_(error::kNoError), |
1961 use_shader_translator_(true), | 1962 use_shader_translator_(true), |
1962 validators_(group_->feature_info()->validators()), | 1963 validators_(group_->feature_info()->validators()), |
1963 feature_info_(group_->feature_info()), | 1964 feature_info_(group_->feature_info()), |
1964 tex_image_2d_failed_(false), | 1965 tex_image_2d_failed_(false), |
1965 frame_number_(0), | 1966 frame_number_(0), |
1966 has_arb_robustness_(false), | 1967 has_arb_robustness_(false), |
1968 has_ext_robustness_(false), | |
1967 reset_status_(GL_NO_ERROR), | 1969 reset_status_(GL_NO_ERROR), |
1968 needs_mac_nvidia_driver_workaround_(false), | 1970 needs_mac_nvidia_driver_workaround_(false), |
1969 needs_glsl_built_in_function_emulation_(false), | 1971 needs_glsl_built_in_function_emulation_(false), |
1970 force_webgl_glsl_validation_(false), | 1972 force_webgl_glsl_validation_(false), |
1971 derivatives_explicitly_enabled_(false), | 1973 derivatives_explicitly_enabled_(false), |
1972 compile_shader_always_succeeds_(false), | 1974 compile_shader_always_succeeds_(false), |
1973 viewport_x_(0), | 1975 viewport_x_(0), |
1974 viewport_y_(0), | 1976 viewport_y_(0), |
1975 viewport_width_(0), | 1977 viewport_width_(0), |
1976 viewport_height_(0), | 1978 viewport_height_(0), |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2244 // isn't well documented; it was discovered in the Khronos OpenGL ES | 2246 // isn't well documented; it was discovered in the Khronos OpenGL ES |
2245 // mailing list archives. It also implicitly enables the desktop GL | 2247 // mailing list archives. It also implicitly enables the desktop GL |
2246 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord | 2248 // capability GL_POINT_SPRITE to provide access to the gl_PointCoord |
2247 // variable in fragment shaders. | 2249 // variable in fragment shaders. |
2248 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { | 2250 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
2249 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); | 2251 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); |
2250 glEnable(GL_POINT_SPRITE); | 2252 glEnable(GL_POINT_SPRITE); |
2251 } | 2253 } |
2252 | 2254 |
2253 has_arb_robustness_ = context->HasExtension("GL_ARB_robustness"); | 2255 has_arb_robustness_ = context->HasExtension("GL_ARB_robustness"); |
2256 has_ext_robustness_ = context->HasExtension("GL_EXT_robustness"); | |
2254 | 2257 |
2255 if (!feature_info_->feature_flags().disable_workarounds) { | 2258 if (!feature_info_->feature_flags().disable_workarounds) { |
2256 #if defined(OS_MACOSX) | 2259 #if defined(OS_MACOSX) |
2257 needs_mac_nvidia_driver_workaround_ = | 2260 needs_mac_nvidia_driver_workaround_ = |
2258 feature_info_->feature_flags().is_nvidia; | 2261 feature_info_->feature_flags().is_nvidia; |
2259 needs_glsl_built_in_function_emulation_ = | 2262 needs_glsl_built_in_function_emulation_ = |
2260 feature_info_->feature_flags().is_amd; | 2263 feature_info_->feature_flags().is_amd; |
2261 #endif | 2264 #endif |
2262 } | 2265 } |
2263 | 2266 |
(...skipping 6261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8525 return error::kInnocent; | 8528 return error::kInnocent; |
8526 case GL_UNKNOWN_CONTEXT_RESET_ARB: | 8529 case GL_UNKNOWN_CONTEXT_RESET_ARB: |
8527 return error::kUnknown; | 8530 return error::kUnknown; |
8528 } | 8531 } |
8529 | 8532 |
8530 NOTREACHED(); | 8533 NOTREACHED(); |
8531 return error::kUnknown; | 8534 return error::kUnknown; |
8532 } | 8535 } |
8533 | 8536 |
8534 bool GLES2DecoderImpl::WasContextLost() { | 8537 bool GLES2DecoderImpl::WasContextLost() { |
8535 if (context_->WasAllocatedUsingARBRobustness() && has_arb_robustness_) { | 8538 if (context_->WasAllocatedUsingRobustnessExtension()) { |
8536 GLenum status = glGetGraphicsResetStatusARB(); | 8539 GLenum status = GL_NO_ERROR; |
8540 if (has_arb_robustness_) { | |
8541 status = glGetGraphicsResetStatusARB(); | |
apatrick_chromium
2012/07/26 22:12:38
You could make ARB alias to EXT in generate_bindin
| |
8542 } else if (has_ext_robustness_) { | |
8543 status = glGetGraphicsResetStatusEXT(); | |
8544 } | |
8537 if (status != GL_NO_ERROR) { | 8545 if (status != GL_NO_ERROR) { |
8538 // The graphics card was reset. Signal a lost context to the application. | 8546 // The graphics card was reset. Signal a lost context to the application. |
8539 reset_status_ = status; | 8547 reset_status_ = status; |
8540 LOG(ERROR) << (surface_->IsOffscreen() ? "Offscreen" : "Onscreen") | 8548 LOG(ERROR) << (surface_->IsOffscreen() ? "Offscreen" : "Onscreen") |
8541 << " context lost via ARB_robustness. Reset status = 0x" | 8549 << " context lost via " |
8550 << (has_arb_robustness_ ? "ARB_" : "EXT_") | |
8551 << "robustness. Reset status = 0x" | |
8542 << std::hex << status << std::dec; | 8552 << std::hex << status << std::dec; |
8543 return true; | 8553 return true; |
8544 } | 8554 } |
8545 } | 8555 } |
8546 return false; | 8556 return false; |
8547 } | 8557 } |
8548 | 8558 |
8549 bool GLES2DecoderImpl::GenQueriesEXTHelper( | 8559 bool GLES2DecoderImpl::GenQueriesEXTHelper( |
8550 GLsizei n, const GLuint* client_ids) { | 8560 GLsizei n, const GLuint* client_ids) { |
8551 for (GLsizei ii = 0; ii < n; ++ii) { | 8561 for (GLsizei ii = 0; ii < n; ++ii) { |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9184 BindAndApplyTextureParameters(info); | 9194 BindAndApplyTextureParameters(info); |
9185 } | 9195 } |
9186 | 9196 |
9187 // Include the auto-generated part of this file. We split this because it means | 9197 // 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 | 9198 // 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. | 9199 // instead of having to edit some template or the code generator. |
9190 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9200 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
9191 | 9201 |
9192 } // namespace gles2 | 9202 } // namespace gles2 |
9193 } // namespace gpu | 9203 } // namespace gpu |
OLD | NEW |