| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/atomicops.h" | 15 #include "base/atomicops.h" |
| 16 #include "base/at_exit.h" | 16 #include "base/at_exit.h" |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #if defined(OS_MACOSX) | |
| 19 #include "base/mac/mac_util.h" | |
| 20 #endif | |
| 21 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 23 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 24 #define GLES2_GPU_SERVICE 1 | 21 #define GLES2_GPU_SERVICE 1 |
| 25 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 22 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 23 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 27 #include "gpu/command_buffer/common/id_allocator.h" | 24 #include "gpu/command_buffer/common/id_allocator.h" |
| 28 #include "gpu/command_buffer/common/trace_event.h" | 25 #include "gpu/command_buffer/common/trace_event.h" |
| 29 #include "gpu/command_buffer/service/buffer_manager.h" | 26 #include "gpu/command_buffer/service/buffer_manager.h" |
| 30 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 27 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| (...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1937 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); | 1934 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); |
| 1938 glEnable(GL_POINT_SPRITE); | 1935 glEnable(GL_POINT_SPRITE); |
| 1939 } | 1936 } |
| 1940 | 1937 |
| 1941 has_arb_robustness_ = context->HasExtension("GL_ARB_robustness"); | 1938 has_arb_robustness_ = context->HasExtension("GL_ARB_robustness"); |
| 1942 | 1939 |
| 1943 #if defined(OS_MACOSX) | 1940 #if defined(OS_MACOSX) |
| 1944 const char* vendor_str = reinterpret_cast<const char*>( | 1941 const char* vendor_str = reinterpret_cast<const char*>( |
| 1945 glGetString(GL_VENDOR)); | 1942 glGetString(GL_VENDOR)); |
| 1946 needs_mac_nvidia_driver_workaround_ = | 1943 needs_mac_nvidia_driver_workaround_ = |
| 1947 vendor_str && strstr(vendor_str, "NVIDIA") && | 1944 vendor_str && strstr(vendor_str, "NVIDIA"); |
| 1948 base::mac::IsOSSnowLeopardOrEarlier(); | |
| 1949 #endif | 1945 #endif |
| 1950 | 1946 |
| 1951 if (!InitializeShaderTranslator()) { | 1947 if (!InitializeShaderTranslator()) { |
| 1952 return false; | 1948 return false; |
| 1953 } | 1949 } |
| 1954 | 1950 |
| 1955 return true; | 1951 return true; |
| 1956 } | 1952 } |
| 1957 | 1953 |
| 1958 void GLES2DecoderImpl::UpdateCapabilities() { | 1954 void GLES2DecoderImpl::UpdateCapabilities() { |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2523 glClearStencil(0); | 2519 glClearStencil(0); |
| 2524 glStencilMaskSeparate(GL_FRONT, -1); | 2520 glStencilMaskSeparate(GL_FRONT, -1); |
| 2525 glStencilMaskSeparate(GL_BACK, -1); | 2521 glStencilMaskSeparate(GL_BACK, -1); |
| 2526 glClearDepth(0); | 2522 glClearDepth(0); |
| 2527 glDepthMask(GL_TRUE); | 2523 glDepthMask(GL_TRUE); |
| 2528 glDisable(GL_SCISSOR_TEST); | 2524 glDisable(GL_SCISSOR_TEST); |
| 2529 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 2525 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
| 2530 RestoreClearState(); | 2526 RestoreClearState(); |
| 2531 } | 2527 } |
| 2532 | 2528 |
| 2533 // Workaround for driver bug on OS X 10.6.x and earlier; crbug.com/89557 | 2529 // Workaround for NVIDIA driver bug on OS X; crbug.com/89557, |
| 2530 // crbug.com/94163. TODO(kbr): figure out reproduction so Apple will |
| 2531 // fix this. |
| 2534 if (needs_mac_nvidia_driver_workaround_) | 2532 if (needs_mac_nvidia_driver_workaround_) |
| 2535 offscreen_saved_frame_buffer_->Create(); | 2533 offscreen_saved_frame_buffer_->Create(); |
| 2536 | 2534 |
| 2537 // Allocate the offscreen saved color texture. | 2535 // Allocate the offscreen saved color texture. |
| 2538 DCHECK(offscreen_saved_color_format_); | 2536 DCHECK(offscreen_saved_color_format_); |
| 2539 offscreen_saved_color_texture_->AllocateStorage( | 2537 offscreen_saved_color_texture_->AllocateStorage( |
| 2540 offscreen_size_, offscreen_saved_color_format_); | 2538 offscreen_size_, offscreen_saved_color_format_); |
| 2541 | 2539 |
| 2542 offscreen_saved_frame_buffer_->AttachRenderTexture( | 2540 offscreen_saved_frame_buffer_->AttachRenderTexture( |
| 2543 offscreen_saved_color_texture_.get()); | 2541 offscreen_saved_color_texture_.get()); |
| (...skipping 4283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6827 return false; | 6825 return false; |
| 6828 } | 6826 } |
| 6829 | 6827 |
| 6830 // Include the auto-generated part of this file. We split this because it means | 6828 // Include the auto-generated part of this file. We split this because it means |
| 6831 // we can easily edit the non-auto generated parts right here in this file | 6829 // we can easily edit the non-auto generated parts right here in this file |
| 6832 // instead of having to edit some template or the code generator. | 6830 // instead of having to edit some template or the code generator. |
| 6833 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 6831 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 6834 | 6832 |
| 6835 } // namespace gles2 | 6833 } // namespace gles2 |
| 6836 } // namespace gpu | 6834 } // namespace gpu |
| OLD | NEW |