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 15 matching lines...) Expand all Loading... |
26 #define GLES2_GPU_SERVICE 1 | 26 #define GLES2_GPU_SERVICE 1 |
27 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
28 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 28 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
29 #include "gpu/command_buffer/common/id_allocator.h" | 29 #include "gpu/command_buffer/common/id_allocator.h" |
30 #include "gpu/command_buffer/service/buffer_manager.h" | 30 #include "gpu/command_buffer/service/buffer_manager.h" |
31 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 31 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
32 #include "gpu/command_buffer/service/context_group.h" | 32 #include "gpu/command_buffer/service/context_group.h" |
33 #include "gpu/command_buffer/service/feature_info.h" | 33 #include "gpu/command_buffer/service/feature_info.h" |
34 #include "gpu/command_buffer/service/framebuffer_manager.h" | 34 #include "gpu/command_buffer/service/framebuffer_manager.h" |
35 #include "gpu/command_buffer/service/gl_utils.h" | 35 #include "gpu/command_buffer/service/gl_utils.h" |
36 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | |
37 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 36 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
38 #include "gpu/command_buffer/service/gpu_switches.h" | 37 #include "gpu/command_buffer/service/gpu_switches.h" |
39 #include "gpu/command_buffer/service/program_manager.h" | 38 #include "gpu/command_buffer/service/program_manager.h" |
40 #include "gpu/command_buffer/service/query_manager.h" | 39 #include "gpu/command_buffer/service/query_manager.h" |
41 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 40 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
42 #include "gpu/command_buffer/service/shader_manager.h" | 41 #include "gpu/command_buffer/service/shader_manager.h" |
43 #include "gpu/command_buffer/service/shader_translator.h" | 42 #include "gpu/command_buffer/service/shader_translator.h" |
44 #include "gpu/command_buffer/service/stream_texture.h" | 43 #include "gpu/command_buffer/service/stream_texture.h" |
45 #include "gpu/command_buffer/service/stream_texture_manager.h" | 44 #include "gpu/command_buffer/service/stream_texture_manager.h" |
46 #include "gpu/command_buffer/service/texture_manager.h" | 45 #include "gpu/command_buffer/service/texture_manager.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 const void * data); | 719 const void * data); |
721 | 720 |
722 // Wrapper for TexImageIOSurface2DCHROMIUM. | 721 // Wrapper for TexImageIOSurface2DCHROMIUM. |
723 void DoTexImageIOSurface2DCHROMIUM( | 722 void DoTexImageIOSurface2DCHROMIUM( |
724 GLenum target, | 723 GLenum target, |
725 GLsizei width, | 724 GLsizei width, |
726 GLsizei height, | 725 GLsizei height, |
727 GLuint io_surface_id, | 726 GLuint io_surface_id, |
728 GLuint plane); | 727 GLuint plane); |
729 | 728 |
730 void DoCopyTextureCHROMIUM( | |
731 GLenum target, | |
732 GLuint source_id, | |
733 GLuint target_id, | |
734 GLint level); | |
735 | |
736 // Wrapper for TexStorage2DEXT. | 729 // Wrapper for TexStorage2DEXT. |
737 void DoTexStorage2DEXT( | 730 void DoTexStorage2DEXT( |
738 GLenum target, | 731 GLenum target, |
739 GLint levels, | 732 GLint levels, |
740 GLenum internal_format, | 733 GLenum internal_format, |
741 GLsizei width, | 734 GLsizei width, |
742 GLsizei height); | 735 GLsizei height); |
743 | 736 |
744 // Creates a ProgramInfo for the given program. | 737 // Creates a ProgramInfo for the given program. |
745 ProgramManager::ProgramInfo* CreateProgramInfo( | 738 ProgramManager::ProgramInfo* CreateProgramInfo( |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 void DoVertexAttrib1f(GLuint index, GLfloat v0); | 1125 void DoVertexAttrib1f(GLuint index, GLfloat v0); |
1133 void DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1); | 1126 void DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1); |
1134 void DoVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); | 1127 void DoVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); |
1135 void DoVertexAttrib4f( | 1128 void DoVertexAttrib4f( |
1136 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); | 1129 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); |
1137 void DoVertexAttrib1fv(GLuint index, const GLfloat *v); | 1130 void DoVertexAttrib1fv(GLuint index, const GLfloat *v); |
1138 void DoVertexAttrib2fv(GLuint index, const GLfloat *v); | 1131 void DoVertexAttrib2fv(GLuint index, const GLfloat *v); |
1139 void DoVertexAttrib3fv(GLuint index, const GLfloat *v); | 1132 void DoVertexAttrib3fv(GLuint index, const GLfloat *v); |
1140 void DoVertexAttrib4fv(GLuint index, const GLfloat *v); | 1133 void DoVertexAttrib4fv(GLuint index, const GLfloat *v); |
1141 | 1134 |
1142 // Wrapper for glViewport | |
1143 void DoViewport(GLint x, GLint y, GLsizei width, GLsizei height); | |
1144 | |
1145 // Wrapper for glUseProgram | 1135 // Wrapper for glUseProgram |
1146 void DoUseProgram(GLuint program); | 1136 void DoUseProgram(GLuint program); |
1147 | 1137 |
1148 // Wrapper for glValidateProgram. | 1138 // Wrapper for glValidateProgram. |
1149 void DoValidateProgram(GLuint program_client_id); | 1139 void DoValidateProgram(GLuint program_client_id); |
1150 | 1140 |
1151 // Gets the number of values that will be returned by glGetXXX. Returns | 1141 // Gets the number of values that will be returned by glGetXXX. Returns |
1152 // false if pname is unknown. | 1142 // false if pname is unknown. |
1153 bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); | 1143 bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); |
1154 | 1144 |
(...skipping 14 matching lines...) Expand all Loading... |
1169 // errors caused by GL calls that it was not responsible for issuing. | 1159 // errors caused by GL calls that it was not responsible for issuing. |
1170 void ClearRealGLErrors(); | 1160 void ClearRealGLErrors(); |
1171 | 1161 |
1172 // Checks if the current program and vertex attributes are valid for drawing. | 1162 // Checks if the current program and vertex attributes are valid for drawing. |
1173 bool IsDrawValid(GLuint max_vertex_accessed, GLsizei primcount); | 1163 bool IsDrawValid(GLuint max_vertex_accessed, GLsizei primcount); |
1174 | 1164 |
1175 // Returns true if successful, simulated will be true if attrib0 was | 1165 // Returns true if successful, simulated will be true if attrib0 was |
1176 // simulated. | 1166 // simulated. |
1177 bool SimulateAttrib0( | 1167 bool SimulateAttrib0( |
1178 GLuint max_vertex_accessed, bool* simulated); | 1168 GLuint max_vertex_accessed, bool* simulated); |
1179 void RestoreStateForAttrib(GLuint attrib); | 1169 void RestoreStateForSimulatedAttrib0(); |
1180 | 1170 |
1181 // Returns true if textures were set. | 1171 // Returns true if textures were set. |
1182 bool SetBlackTextureForNonRenderableTextures(); | 1172 bool SetBlackTextureForNonRenderableTextures(); |
1183 void RestoreStateForNonRenderableTextures(); | 1173 void RestoreStateForNonRenderableTextures(); |
1184 | 1174 |
1185 // Returns true if GL_FIXED attribs were simulated. | 1175 // Returns true if GL_FIXED attribs were simulated. |
1186 bool SimulateFixedAttribs( | 1176 bool SimulateFixedAttribs( |
1187 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount); | 1177 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount); |
1188 void RestoreStateForSimulatedFixedAttribs(); | 1178 void RestoreStateForSimulatedFixedAttribs(); |
1189 | 1179 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 | 1325 |
1336 // Util to help with GL. | 1326 // Util to help with GL. |
1337 GLES2Util util_; | 1327 GLES2Util util_; |
1338 | 1328 |
1339 // pack alignment as last set by glPixelStorei | 1329 // pack alignment as last set by glPixelStorei |
1340 GLint pack_alignment_; | 1330 GLint pack_alignment_; |
1341 | 1331 |
1342 // unpack alignment as last set by glPixelStorei | 1332 // unpack alignment as last set by glPixelStorei |
1343 GLint unpack_alignment_; | 1333 GLint unpack_alignment_; |
1344 | 1334 |
1345 // unpack flip y as last set by glPixelStorei | |
1346 bool unpack_flip_y_; | |
1347 | |
1348 // unpack premultiply alpha as last set by glPixelStorei | |
1349 bool unpack_premultiply_alpha_; | |
1350 | |
1351 // The currently bound array buffer. If this is 0 it is illegal to call | 1335 // The currently bound array buffer. If this is 0 it is illegal to call |
1352 // glVertexAttribPointer. | 1336 // glVertexAttribPointer. |
1353 BufferManager::BufferInfo::Ref bound_array_buffer_; | 1337 BufferManager::BufferInfo::Ref bound_array_buffer_; |
1354 | 1338 |
1355 // The currently bound element array buffer. If this is 0 it is illegal | 1339 // The currently bound element array buffer. If this is 0 it is illegal |
1356 // to call glDrawElements. | 1340 // to call glDrawElements. |
1357 BufferManager::BufferInfo::Ref bound_element_array_buffer_; | 1341 BufferManager::BufferInfo::Ref bound_element_array_buffer_; |
1358 | 1342 |
1359 // Class that manages vertex attribs. | 1343 // Class that manages vertex attribs. |
1360 scoped_ptr<VertexAttribManager> vertex_attrib_manager_; | 1344 scoped_ptr<VertexAttribManager> vertex_attrib_manager_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 GLclampf clear_alpha_; | 1377 GLclampf clear_alpha_; |
1394 GLboolean mask_red_; | 1378 GLboolean mask_red_; |
1395 GLboolean mask_green_; | 1379 GLboolean mask_green_; |
1396 GLboolean mask_blue_; | 1380 GLboolean mask_blue_; |
1397 GLboolean mask_alpha_; | 1381 GLboolean mask_alpha_; |
1398 GLint clear_stencil_; | 1382 GLint clear_stencil_; |
1399 GLuint mask_stencil_front_; | 1383 GLuint mask_stencil_front_; |
1400 GLuint mask_stencil_back_; | 1384 GLuint mask_stencil_back_; |
1401 GLclampf clear_depth_; | 1385 GLclampf clear_depth_; |
1402 GLboolean mask_depth_; | 1386 GLboolean mask_depth_; |
1403 bool enable_cull_face_; | |
1404 bool enable_scissor_test_; | 1387 bool enable_scissor_test_; |
1405 bool enable_depth_test_; | 1388 bool enable_depth_test_; |
1406 bool enable_stencil_test_; | 1389 bool enable_stencil_test_; |
1407 bool state_dirty_; | 1390 bool state_dirty_; |
1408 | 1391 |
1409 // The program in use by glUseProgram | 1392 // The program in use by glUseProgram |
1410 ProgramManager::ProgramInfo::Ref current_program_; | 1393 ProgramManager::ProgramInfo::Ref current_program_; |
1411 | 1394 |
1412 // The currently bound framebuffers | 1395 // The currently bound framebuffers |
1413 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer_; | 1396 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer_; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 bool compile_shader_always_succeeds_; | 1480 bool compile_shader_always_succeeds_; |
1498 | 1481 |
1499 #if defined(OS_MACOSX) | 1482 #if defined(OS_MACOSX) |
1500 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; | 1483 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; |
1501 TextureToIOSurfaceMap texture_to_io_surface_map_; | 1484 TextureToIOSurfaceMap texture_to_io_surface_map_; |
1502 #endif | 1485 #endif |
1503 | 1486 |
1504 typedef std::vector<GLES2DecoderImpl*> ChildList; | 1487 typedef std::vector<GLES2DecoderImpl*> ChildList; |
1505 ChildList children_; | 1488 ChildList children_; |
1506 | 1489 |
1507 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | |
1508 | |
1509 // Cached values of the currently assigned viewport dimensions. | |
1510 GLint viewport_x_, viewport_y_; | |
1511 GLsizei viewport_width_, viewport_height_; | |
1512 GLsizei viewport_max_width_, viewport_max_height_; | |
1513 | |
1514 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); | 1490 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); |
1515 }; | 1491 }; |
1516 | 1492 |
1517 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder) | 1493 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder) |
1518 : decoder_(decoder) { | 1494 : decoder_(decoder) { |
1519 decoder_->CopyRealGLErrorsToWrapper(); | 1495 decoder_->CopyRealGLErrorsToWrapper(); |
1520 } | 1496 } |
1521 | 1497 |
1522 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() { | 1498 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() { |
1523 decoder_->ClearRealGLErrors(); | 1499 decoder_->ClearRealGLErrors(); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { | 1823 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { |
1848 return new GLES2DecoderImpl(group); | 1824 return new GLES2DecoderImpl(group); |
1849 } | 1825 } |
1850 | 1826 |
1851 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) | 1827 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) |
1852 : GLES2Decoder(), | 1828 : GLES2Decoder(), |
1853 group_(group), | 1829 group_(group), |
1854 error_bits_(0), | 1830 error_bits_(0), |
1855 pack_alignment_(4), | 1831 pack_alignment_(4), |
1856 unpack_alignment_(4), | 1832 unpack_alignment_(4), |
1857 unpack_flip_y_(false), | |
1858 unpack_premultiply_alpha_(false), | |
1859 attrib_0_buffer_id_(0), | 1833 attrib_0_buffer_id_(0), |
1860 attrib_0_buffer_matches_value_(true), | 1834 attrib_0_buffer_matches_value_(true), |
1861 attrib_0_size_(0), | 1835 attrib_0_size_(0), |
1862 fixed_attrib_buffer_id_(0), | 1836 fixed_attrib_buffer_id_(0), |
1863 fixed_attrib_buffer_size_(0), | 1837 fixed_attrib_buffer_size_(0), |
1864 active_texture_unit_(0), | 1838 active_texture_unit_(0), |
1865 clear_red_(0), | 1839 clear_red_(0), |
1866 clear_green_(0), | 1840 clear_green_(0), |
1867 clear_blue_(0), | 1841 clear_blue_(0), |
1868 clear_alpha_(0), | 1842 clear_alpha_(0), |
1869 mask_red_(true), | 1843 mask_red_(true), |
1870 mask_green_(true), | 1844 mask_green_(true), |
1871 mask_blue_(true), | 1845 mask_blue_(true), |
1872 mask_alpha_(true), | 1846 mask_alpha_(true), |
1873 clear_stencil_(0), | 1847 clear_stencil_(0), |
1874 mask_stencil_front_(-1), | 1848 mask_stencil_front_(-1), |
1875 mask_stencil_back_(-1), | 1849 mask_stencil_back_(-1), |
1876 clear_depth_(1.0f), | 1850 clear_depth_(1.0f), |
1877 mask_depth_(true), | 1851 mask_depth_(true), |
1878 enable_cull_face_(false), | |
1879 enable_scissor_test_(false), | 1852 enable_scissor_test_(false), |
1880 enable_depth_test_(false), | 1853 enable_depth_test_(false), |
1881 enable_stencil_test_(false), | 1854 enable_stencil_test_(false), |
1882 state_dirty_(true), | 1855 state_dirty_(true), |
1883 offscreen_target_color_format_(0), | 1856 offscreen_target_color_format_(0), |
1884 offscreen_target_depth_format_(0), | 1857 offscreen_target_depth_format_(0), |
1885 offscreen_target_stencil_format_(0), | 1858 offscreen_target_stencil_format_(0), |
1886 offscreen_target_samples_(0), | 1859 offscreen_target_samples_(0), |
1887 offscreen_target_buffer_preserved_(true), | 1860 offscreen_target_buffer_preserved_(true), |
1888 offscreen_saved_color_format_(0), | 1861 offscreen_saved_color_format_(0), |
1889 stream_texture_manager_(NULL), | 1862 stream_texture_manager_(NULL), |
1890 back_buffer_color_format_(0), | 1863 back_buffer_color_format_(0), |
1891 back_buffer_has_depth_(false), | 1864 back_buffer_has_depth_(false), |
1892 back_buffer_has_stencil_(false), | 1865 back_buffer_has_stencil_(false), |
1893 teximage2d_faster_than_texsubimage2d_(true), | 1866 teximage2d_faster_than_texsubimage2d_(true), |
1894 bufferdata_faster_than_buffersubdata_(true), | 1867 bufferdata_faster_than_buffersubdata_(true), |
1895 current_decoder_error_(error::kNoError), | 1868 current_decoder_error_(error::kNoError), |
1896 use_shader_translator_(true), | 1869 use_shader_translator_(true), |
1897 validators_(group_->feature_info()->validators()), | 1870 validators_(group_->feature_info()->validators()), |
1898 feature_info_(group_->feature_info()), | 1871 feature_info_(group_->feature_info()), |
1899 tex_image_2d_failed_(false), | 1872 tex_image_2d_failed_(false), |
1900 frame_number_(0), | 1873 frame_number_(0), |
1901 has_arb_robustness_(false), | 1874 has_arb_robustness_(false), |
1902 reset_status_(GL_NO_ERROR), | 1875 reset_status_(GL_NO_ERROR), |
1903 needs_mac_nvidia_driver_workaround_(false), | 1876 needs_mac_nvidia_driver_workaround_(false), |
1904 needs_glsl_built_in_function_emulation_(false), | 1877 needs_glsl_built_in_function_emulation_(false), |
1905 force_webgl_glsl_validation_(false), | 1878 force_webgl_glsl_validation_(false), |
1906 derivatives_explicitly_enabled_(false), | 1879 derivatives_explicitly_enabled_(false), |
1907 compile_shader_always_succeeds_(false), | 1880 compile_shader_always_succeeds_(false) { |
1908 viewport_x_(0), | |
1909 viewport_y_(0), | |
1910 viewport_width_(0), | |
1911 viewport_height_(0), | |
1912 viewport_max_width_(0), | |
1913 viewport_max_height_(0) { | |
1914 DCHECK(group); | 1881 DCHECK(group); |
1915 | 1882 |
1916 attrib_0_value_.v[0] = 0.0f; | 1883 attrib_0_value_.v[0] = 0.0f; |
1917 attrib_0_value_.v[1] = 0.0f; | 1884 attrib_0_value_.v[1] = 0.0f; |
1918 attrib_0_value_.v[2] = 0.0f; | 1885 attrib_0_value_.v[2] = 0.0f; |
1919 attrib_0_value_.v[3] = 1.0f; | 1886 attrib_0_value_.v[3] = 1.0f; |
1920 | 1887 |
1921 // The shader translator is used for WebGL even when running on EGL | 1888 // The shader translator is used for WebGL even when running on EGL |
1922 // because additional restrictions are needed (like only enabling | 1889 // because additional restrictions are needed (like only enabling |
1923 // GL_OES_standard_derivatives on demand). It is used for the unit | 1890 // GL_OES_standard_derivatives on demand). It is used for the unit |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 return false; | 1952 return false; |
1986 } | 1953 } |
1987 | 1954 |
1988 if (!group_->Initialize(disallowed_features, allowed_extensions)) { | 1955 if (!group_->Initialize(disallowed_features, allowed_extensions)) { |
1989 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 1956 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
1990 << "failed to initialize."; | 1957 << "failed to initialize."; |
1991 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 1958 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
1992 Destroy(); | 1959 Destroy(); |
1993 return false; | 1960 return false; |
1994 } | 1961 } |
| 1962 |
1995 CHECK_GL_ERROR(); | 1963 CHECK_GL_ERROR(); |
1996 | |
1997 copy_texture_CHROMIUM_.reset(new CopyTextureCHROMIUMResourceManager()); | |
1998 copy_texture_CHROMIUM_->Initialize(); | |
1999 CHECK_GL_ERROR(); | |
2000 | |
2001 disallowed_features_ = disallowed_features; | 1964 disallowed_features_ = disallowed_features; |
2002 | 1965 |
2003 vertex_attrib_manager_.reset(new VertexAttribManager()); | 1966 vertex_attrib_manager_.reset(new VertexAttribManager()); |
2004 vertex_attrib_manager_->Initialize(group_->max_vertex_attribs()); | 1967 vertex_attrib_manager_->Initialize(group_->max_vertex_attribs()); |
2005 | 1968 |
2006 query_manager_.reset(new QueryManager(this, feature_info_->feature_flags( | 1969 query_manager_.reset(new QueryManager(this, feature_info_->feature_flags( |
2007 ).use_arb_occlusion_query2_for_occlusion_query_boolean)); | 1970 ).use_arb_occlusion_query2_for_occlusion_query_boolean)); |
2008 | 1971 |
2009 util_.set_num_compressed_texture_formats( | 1972 util_.set_num_compressed_texture_formats( |
2010 validators_->compressed_texture_format.GetValues().size()); | 1973 validators_->compressed_texture_format.GetValues().size()); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 vendor_str && strstr(vendor_str, "NVIDIA"); | 2173 vendor_str && strstr(vendor_str, "NVIDIA"); |
2211 needs_glsl_built_in_function_emulation_ = | 2174 needs_glsl_built_in_function_emulation_ = |
2212 vendor_str && (strstr(vendor_str, "ATI") || strstr(vendor_str, "AMD")); | 2175 vendor_str && (strstr(vendor_str, "ATI") || strstr(vendor_str, "AMD")); |
2213 #endif | 2176 #endif |
2214 } | 2177 } |
2215 | 2178 |
2216 if (!InitializeShaderTranslator()) { | 2179 if (!InitializeShaderTranslator()) { |
2217 return false; | 2180 return false; |
2218 } | 2181 } |
2219 | 2182 |
2220 GLint viewport_params[4]; | |
2221 glGetIntegerv(GL_VIEWPORT, viewport_params); | |
2222 viewport_x_ = viewport_params[0]; | |
2223 viewport_y_ = viewport_params[1]; | |
2224 viewport_width_ = viewport_params[2]; | |
2225 viewport_height_ = viewport_params[3]; | |
2226 | |
2227 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, viewport_params); | |
2228 viewport_max_width_ = viewport_params[0]; | |
2229 viewport_max_height_ = viewport_params[0]; | |
2230 | |
2231 return true; | 2183 return true; |
2232 } | 2184 } |
2233 | 2185 |
2234 void GLES2DecoderImpl::UpdateCapabilities() { | 2186 void GLES2DecoderImpl::UpdateCapabilities() { |
2235 util_.set_num_compressed_texture_formats( | 2187 util_.set_num_compressed_texture_formats( |
2236 validators_->compressed_texture_format.GetValues().size()); | 2188 validators_->compressed_texture_format.GetValues().size()); |
2237 util_.set_num_shader_binary_formats( | 2189 util_.set_num_shader_binary_formats( |
2238 validators_->shader_binary_format.GetValues().size()); | 2190 validators_->shader_binary_format.GetValues().size()); |
2239 } | 2191 } |
2240 | 2192 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 texture_units_.reset(); | 2679 texture_units_.reset(); |
2728 bound_array_buffer_ = NULL; | 2680 bound_array_buffer_ = NULL; |
2729 bound_element_array_buffer_ = NULL; | 2681 bound_element_array_buffer_ = NULL; |
2730 current_query_ = NULL; | 2682 current_query_ = NULL; |
2731 current_program_ = NULL; | 2683 current_program_ = NULL; |
2732 bound_read_framebuffer_ = NULL; | 2684 bound_read_framebuffer_ = NULL; |
2733 bound_draw_framebuffer_ = NULL; | 2685 bound_draw_framebuffer_ = NULL; |
2734 bound_renderbuffer_ = NULL; | 2686 bound_renderbuffer_ = NULL; |
2735 | 2687 |
2736 if (have_context) { | 2688 if (have_context) { |
2737 copy_texture_CHROMIUM_->Destroy(); | |
2738 | |
2739 if (current_program_) { | 2689 if (current_program_) { |
2740 program_manager()->UnuseProgram(shader_manager(), current_program_); | 2690 program_manager()->UnuseProgram(shader_manager(), current_program_); |
2741 current_program_ = NULL; | 2691 current_program_ = NULL; |
2742 } | 2692 } |
2743 | 2693 |
2744 if (attrib_0_buffer_id_) { | 2694 if (attrib_0_buffer_id_) { |
2745 glDeleteBuffersARB(1, &attrib_0_buffer_id_); | 2695 glDeleteBuffersARB(1, &attrib_0_buffer_id_); |
2746 } | 2696 } |
2747 if (fixed_attrib_buffer_id_) { | 2697 if (fixed_attrib_buffer_id_) { |
2748 glDeleteBuffersARB(1, &fixed_attrib_buffer_id_); | 2698 glDeleteBuffersARB(1, &fixed_attrib_buffer_id_); |
(...skipping 30 matching lines...) Expand all Loading... |
2779 offscreen_target_stencil_render_buffer_->Invalidate(); | 2729 offscreen_target_stencil_render_buffer_->Invalidate(); |
2780 if (offscreen_saved_frame_buffer_.get()) | 2730 if (offscreen_saved_frame_buffer_.get()) |
2781 offscreen_saved_frame_buffer_->Invalidate(); | 2731 offscreen_saved_frame_buffer_->Invalidate(); |
2782 if (offscreen_saved_color_texture_.get()) | 2732 if (offscreen_saved_color_texture_.get()) |
2783 offscreen_saved_color_texture_->Invalidate(); | 2733 offscreen_saved_color_texture_->Invalidate(); |
2784 if (offscreen_resolved_frame_buffer_.get()) | 2734 if (offscreen_resolved_frame_buffer_.get()) |
2785 offscreen_resolved_frame_buffer_->Invalidate(); | 2735 offscreen_resolved_frame_buffer_->Invalidate(); |
2786 if (offscreen_resolved_color_texture_.get()) | 2736 if (offscreen_resolved_color_texture_.get()) |
2787 offscreen_resolved_color_texture_->Invalidate(); | 2737 offscreen_resolved_color_texture_->Invalidate(); |
2788 } | 2738 } |
2789 copy_texture_CHROMIUM_.reset(); | |
2790 | 2739 |
2791 if (query_manager_.get()) { | 2740 if (query_manager_.get()) { |
2792 query_manager_->Destroy(have_context); | 2741 query_manager_->Destroy(have_context); |
2793 query_manager_.reset(); | 2742 query_manager_.reset(); |
2794 } | 2743 } |
2795 | 2744 |
2796 if (group_) { | 2745 if (group_) { |
2797 group_->Destroy(have_context); | 2746 group_->Destroy(have_context); |
2798 group_ = NULL; | 2747 group_ = NULL; |
2799 } | 2748 } |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3250 glColorMask( | 3199 glColorMask( |
3251 mask_red_, mask_green_, mask_blue_, | 3200 mask_red_, mask_green_, mask_blue_, |
3252 mask_alpha_ && BoundFramebufferHasColorAttachmentWithAlpha()); | 3201 mask_alpha_ && BoundFramebufferHasColorAttachmentWithAlpha()); |
3253 bool have_depth = BoundFramebufferHasDepthAttachment(); | 3202 bool have_depth = BoundFramebufferHasDepthAttachment(); |
3254 glDepthMask(mask_depth_ && have_depth); | 3203 glDepthMask(mask_depth_ && have_depth); |
3255 EnableDisable(GL_DEPTH_TEST, enable_depth_test_ && have_depth); | 3204 EnableDisable(GL_DEPTH_TEST, enable_depth_test_ && have_depth); |
3256 bool have_stencil = BoundFramebufferHasStencilAttachment(); | 3205 bool have_stencil = BoundFramebufferHasStencilAttachment(); |
3257 glStencilMaskSeparate(GL_FRONT, have_stencil ? mask_stencil_front_ : 0); | 3206 glStencilMaskSeparate(GL_FRONT, have_stencil ? mask_stencil_front_ : 0); |
3258 glStencilMaskSeparate(GL_BACK, have_stencil ? mask_stencil_back_ : 0); | 3207 glStencilMaskSeparate(GL_BACK, have_stencil ? mask_stencil_back_ : 0); |
3259 EnableDisable(GL_STENCIL_TEST, enable_stencil_test_ && have_stencil); | 3208 EnableDisable(GL_STENCIL_TEST, enable_stencil_test_ && have_stencil); |
3260 EnableDisable(GL_CULL_FACE, enable_cull_face_); | |
3261 EnableDisable(GL_SCISSOR_TEST, enable_scissor_test_); | |
3262 state_dirty_ = false; | 3209 state_dirty_ = false; |
3263 } | 3210 } |
3264 } | 3211 } |
3265 | 3212 |
3266 GLuint GLES2DecoderImpl::GetBackbufferServiceId() { | 3213 GLuint GLES2DecoderImpl::GetBackbufferServiceId() { |
3267 return (offscreen_target_frame_buffer_.get()) ? | 3214 return (offscreen_target_frame_buffer_.get()) ? |
3268 offscreen_target_frame_buffer_->id() : | 3215 offscreen_target_frame_buffer_->id() : |
3269 surface_->GetBackingFrameBufferObject(); | 3216 surface_->GetBackingFrameBufferObject(); |
3270 } | 3217 } |
3271 | 3218 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4062 if (error == GL_NO_ERROR) { | 4009 if (error == GL_NO_ERROR) { |
4063 framebuffer_info->AttachRenderbuffer(attachment, info); | 4010 framebuffer_info->AttachRenderbuffer(attachment, info); |
4064 } | 4011 } |
4065 if (framebuffer_info == bound_draw_framebuffer_) { | 4012 if (framebuffer_info == bound_draw_framebuffer_) { |
4066 state_dirty_ = true; | 4013 state_dirty_ = true; |
4067 } | 4014 } |
4068 } | 4015 } |
4069 | 4016 |
4070 bool GLES2DecoderImpl::SetCapabilityState(GLenum cap, bool enabled) { | 4017 bool GLES2DecoderImpl::SetCapabilityState(GLenum cap, bool enabled) { |
4071 switch (cap) { | 4018 switch (cap) { |
4072 case GL_CULL_FACE: | |
4073 enable_cull_face_ = enabled; | |
4074 return true; | |
4075 case GL_SCISSOR_TEST: | 4019 case GL_SCISSOR_TEST: |
4076 enable_scissor_test_ = enabled; | 4020 enable_scissor_test_ = enabled; |
4077 return true; | 4021 return true; |
4078 case GL_DEPTH_TEST: { | 4022 case GL_DEPTH_TEST: { |
4079 if (enable_depth_test_ != enabled) { | 4023 if (enable_depth_test_ != enabled) { |
4080 enable_depth_test_ = enabled; | 4024 enable_depth_test_ = enabled; |
4081 state_dirty_ = true; | 4025 state_dirty_ = true; |
4082 } | 4026 } |
4083 return false; | 4027 return false; |
4084 } | 4028 } |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5053 | 4997 |
5054 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); | 4998 glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL); |
5055 | 4999 |
5056 if (info->divisor()) | 5000 if (info->divisor()) |
5057 glVertexAttribDivisorANGLE(0, 0); | 5001 glVertexAttribDivisorANGLE(0, 0); |
5058 | 5002 |
5059 *simulated = true; | 5003 *simulated = true; |
5060 return true; | 5004 return true; |
5061 } | 5005 } |
5062 | 5006 |
5063 void GLES2DecoderImpl::RestoreStateForAttrib(GLuint attrib) { | 5007 void GLES2DecoderImpl::RestoreStateForSimulatedAttrib0() { |
5064 const VertexAttribManager::VertexAttribInfo* info = | 5008 const VertexAttribManager::VertexAttribInfo* info = |
5065 vertex_attrib_manager_->GetVertexAttribInfo(attrib); | 5009 vertex_attrib_manager_->GetVertexAttribInfo(0); |
5066 const void* ptr = reinterpret_cast<const void*>(info->offset()); | 5010 const void* ptr = reinterpret_cast<const void*>(info->offset()); |
5067 BufferManager::BufferInfo* buffer_info = info->buffer(); | 5011 BufferManager::BufferInfo* buffer_info = info->buffer(); |
5068 glBindBuffer(GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); | 5012 glBindBuffer(GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); |
5069 glVertexAttribPointer( | 5013 glVertexAttribPointer( |
5070 attrib, info->size(), info->type(), info->normalized(), info->gl_stride(), | 5014 0, info->size(), info->type(), info->normalized(), info->gl_stride(), |
5071 ptr); | 5015 ptr); |
5072 if (info->divisor()) | 5016 if (info->divisor()) |
5073 glVertexAttribDivisorANGLE(attrib, info->divisor()); | 5017 glVertexAttribDivisorANGLE(0, info->divisor()); |
5074 glBindBuffer(GL_ARRAY_BUFFER, | 5018 glBindBuffer(GL_ARRAY_BUFFER, |
5075 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); | 5019 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); |
5076 | |
5077 if (info->enabled()) { | |
5078 glEnableVertexAttribArray(attrib); | |
5079 } else { | |
5080 glDisableVertexAttribArray(attrib); | |
5081 } | |
5082 } | 5020 } |
5083 | 5021 |
5084 bool GLES2DecoderImpl::SimulateFixedAttribs( | 5022 bool GLES2DecoderImpl::SimulateFixedAttribs( |
5085 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { | 5023 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { |
5086 DCHECK(simulated); | 5024 DCHECK(simulated); |
5087 *simulated = false; | 5025 *simulated = false; |
5088 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) | 5026 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) |
5089 return true; | 5027 return true; |
5090 | 5028 |
5091 if (!vertex_attrib_manager_->HaveFixedAttribs()) { | 5029 if (!vertex_attrib_manager_->HaveFixedAttribs()) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5244 } | 5182 } |
5245 ProcessPendingQueries(); | 5183 ProcessPendingQueries(); |
5246 if (textures_set) { | 5184 if (textures_set) { |
5247 RestoreStateForNonRenderableTextures(); | 5185 RestoreStateForNonRenderableTextures(); |
5248 } | 5186 } |
5249 if (simulated_fixed_attribs) { | 5187 if (simulated_fixed_attribs) { |
5250 RestoreStateForSimulatedFixedAttribs(); | 5188 RestoreStateForSimulatedFixedAttribs(); |
5251 } | 5189 } |
5252 } | 5190 } |
5253 if (simulated_attrib_0) { | 5191 if (simulated_attrib_0) { |
5254 RestoreStateForAttrib(0); | 5192 RestoreStateForSimulatedAttrib0(); |
5255 } | 5193 } |
5256 if (WasContextLost()) { | 5194 if (WasContextLost()) { |
5257 LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawArrays."; | 5195 LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawArrays."; |
5258 return error::kLostContext; | 5196 return error::kLostContext; |
5259 } | 5197 } |
5260 } | 5198 } |
5261 return error::kNoError; | 5199 return error::kNoError; |
5262 } | 5200 } |
5263 | 5201 |
5264 error::Error GLES2DecoderImpl::HandleDrawArrays( | 5202 error::Error GLES2DecoderImpl::HandleDrawArrays( |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5355 } | 5293 } |
5356 ProcessPendingQueries(); | 5294 ProcessPendingQueries(); |
5357 if (textures_set) { | 5295 if (textures_set) { |
5358 RestoreStateForNonRenderableTextures(); | 5296 RestoreStateForNonRenderableTextures(); |
5359 } | 5297 } |
5360 if (simulated_fixed_attribs) { | 5298 if (simulated_fixed_attribs) { |
5361 RestoreStateForSimulatedFixedAttribs(); | 5299 RestoreStateForSimulatedFixedAttribs(); |
5362 } | 5300 } |
5363 } | 5301 } |
5364 if (simulated_attrib_0) { | 5302 if (simulated_attrib_0) { |
5365 RestoreStateForAttrib(0); | 5303 RestoreStateForSimulatedAttrib0(); |
5366 } | 5304 } |
5367 if (WasContextLost()) { | 5305 if (WasContextLost()) { |
5368 LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawElements."; | 5306 LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawElements."; |
5369 return error::kLostContext; | 5307 return error::kLostContext; |
5370 } | 5308 } |
5371 } | 5309 } |
5372 return error::kNoError; | 5310 return error::kNoError; |
5373 } | 5311 } |
5374 | 5312 |
5375 error::Error GLES2DecoderImpl::HandleDrawElements( | 5313 error::Error GLES2DecoderImpl::HandleDrawElements( |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5995 normalized, | 5933 normalized, |
5996 stride, | 5934 stride, |
5997 stride != 0 ? stride : component_size * size, | 5935 stride != 0 ? stride : component_size * size, |
5998 offset); | 5936 offset); |
5999 if (type != GL_FIXED) { | 5937 if (type != GL_FIXED) { |
6000 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); | 5938 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); |
6001 } | 5939 } |
6002 return error::kNoError; | 5940 return error::kNoError; |
6003 } | 5941 } |
6004 | 5942 |
6005 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, | |
6006 GLsizei height) { | |
6007 viewport_x_ = x; | |
6008 viewport_y_ = y; | |
6009 viewport_width_ = std::min(width, viewport_max_width_); | |
6010 viewport_height_ = std::min(height, viewport_max_height_); | |
6011 glViewport(x, y, width, height); | |
6012 } | |
6013 | |
6014 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( | 5943 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( |
6015 uint32 immediate_data_size, const gles2::VertexAttribDivisorANGLE& c) { | 5944 uint32 immediate_data_size, const gles2::VertexAttribDivisorANGLE& c) { |
6016 if (!feature_info_->feature_flags().angle_instanced_arrays) { | 5945 if (!feature_info_->feature_flags().angle_instanced_arrays) { |
6017 SetGLError(GL_INVALID_OPERATION, | 5946 SetGLError(GL_INVALID_OPERATION, |
6018 "glVertexAttribDivisorANGLE: function not available"); | 5947 "glVertexAttribDivisorANGLE: function not available"); |
6019 } | 5948 } |
6020 GLuint index = c.index; | 5949 GLuint index = c.index; |
6021 GLuint divisor = c.divisor; | 5950 GLuint divisor = c.divisor; |
6022 if (index >= group_->max_vertex_attribs()) { | 5951 if (index >= group_->max_vertex_attribs()) { |
6023 SetGLError(GL_INVALID_VALUE, | 5952 SetGLError(GL_INVALID_VALUE, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6202 glPixelStorei(pname, param); | 6131 glPixelStorei(pname, param); |
6203 switch (pname) { | 6132 switch (pname) { |
6204 case GL_PACK_ALIGNMENT: | 6133 case GL_PACK_ALIGNMENT: |
6205 pack_alignment_ = param; | 6134 pack_alignment_ = param; |
6206 break; | 6135 break; |
6207 case GL_PACK_REVERSE_ROW_ORDER_ANGLE: | 6136 case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
6208 break; | 6137 break; |
6209 case GL_UNPACK_ALIGNMENT: | 6138 case GL_UNPACK_ALIGNMENT: |
6210 unpack_alignment_ = param; | 6139 unpack_alignment_ = param; |
6211 break; | 6140 break; |
6212 case GL_UNPACK_FLIP_Y_CHROMIUM: | |
6213 unpack_flip_y_ = (param != 0); | |
6214 break; | |
6215 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: | |
6216 unpack_premultiply_alpha_ = (param != 0); | |
6217 break; | |
6218 default: | 6141 default: |
6219 // Validation should have prevented us from getting here. | 6142 // Validation should have prevented us from getting here. |
6220 NOTREACHED(); | 6143 NOTREACHED(); |
6221 break; | 6144 break; |
6222 } | 6145 } |
6223 return error::kNoError; | 6146 return error::kNoError; |
6224 } | 6147 } |
6225 | 6148 |
6226 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 6149 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
6227 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) { | 6150 uint32 immediate_data_size, const gles2::PostSubBufferCHROMIUM& c) { |
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8322 return GL_LUMINANCE; | 8245 return GL_LUMINANCE; |
8323 case GL_LUMINANCE_ALPHA16F_EXT: | 8246 case GL_LUMINANCE_ALPHA16F_EXT: |
8324 return GL_LUMINANCE_ALPHA; | 8247 return GL_LUMINANCE_ALPHA; |
8325 case GL_BGRA8_EXT: | 8248 case GL_BGRA8_EXT: |
8326 return GL_BGRA_EXT; | 8249 return GL_BGRA_EXT; |
8327 default: | 8250 default: |
8328 return GL_NONE; | 8251 return GL_NONE; |
8329 } | 8252 } |
8330 } | 8253 } |
8331 | 8254 |
8332 void GLES2DecoderImpl::DoCopyTextureCHROMIUM( | |
8333 GLenum target, GLuint source_id, GLuint dest_id, GLint level) { | |
8334 TextureManager::TextureInfo* dest_info = GetTextureInfo(dest_id); | |
8335 TextureManager::TextureInfo* source_info = GetTextureInfo(source_id); | |
8336 | |
8337 if (!source_info || !dest_info) { | |
8338 SetGLError(GL_INVALID_VALUE, "glCopyTextureCHROMIUM: unknown texture id"); | |
8339 return; | |
8340 } | |
8341 | |
8342 if (GL_TEXTURE_2D != target) { | |
8343 SetGLError(GL_INVALID_VALUE, | |
8344 "glCopyTextureCHROMIUM: invalid texture target"); | |
8345 return; | |
8346 } | |
8347 | |
8348 int source_width, source_height, dest_width, dest_height; | |
8349 if (!source_info->GetLevelSize(GL_TEXTURE_2D, 0, &source_width, | |
8350 &source_height)) { | |
8351 SetGLError(GL_INVALID_VALUE, | |
8352 "glCopyTextureChromium: source texture has no level 0"); | |
8353 return; | |
8354 } | |
8355 | |
8356 if (!dest_info->GetLevelSize(GL_TEXTURE_2D, level, &dest_width, | |
8357 &dest_height)) { | |
8358 SetGLError(GL_INVALID_VALUE, | |
8359 "glCopyTextureChromium: destination texture level does not exist"); | |
8360 return; | |
8361 } | |
8362 | |
8363 // Check that this type of texture is allowed. | |
8364 if (!texture_manager()->ValidForTarget(GL_TEXTURE_2D, level, source_width, | |
8365 source_height, 1)) { | |
8366 SetGLError(GL_INVALID_VALUE, | |
8367 "glCopyTextureCHROMIUM: Bad dimensions"); | |
8368 return; | |
8369 } | |
8370 | |
8371 // Resize the destination texture to the dimensions of the source texture. | |
8372 if (dest_width != source_width && dest_height != source_height) { | |
8373 GLenum type; | |
8374 GLenum internal_format; | |
8375 dest_info->GetLevelType(GL_TEXTURE_2D, level, &type, &internal_format); | |
8376 | |
8377 // Ensure that the glTexImage2D succeeds. | |
8378 CopyRealGLErrorsToWrapper(); | |
8379 WrappedTexImage2D( | |
8380 GL_TEXTURE_2D, level, internal_format, source_width, source_height, | |
8381 0, internal_format, type, NULL); | |
8382 GLenum error = PeekGLError(); | |
8383 if (error != GL_NO_ERROR) | |
8384 return; | |
8385 | |
8386 texture_manager()->SetLevelInfo( | |
8387 dest_info, GL_TEXTURE_2D, level, internal_format, source_width, | |
8388 source_height, 1, 0, internal_format, type, true); | |
8389 } | |
8390 | |
8391 state_dirty_ = true; | |
8392 glViewport(0, 0, dest_width, dest_height); | |
8393 copy_texture_CHROMIUM_->DoCopyTexture(target, source_info->service_id(), | |
8394 dest_info->service_id(), level, | |
8395 unpack_flip_y_, | |
8396 unpack_premultiply_alpha_); | |
8397 glViewport(viewport_x_, viewport_y_, viewport_width_, viewport_height_); | |
8398 | |
8399 // Restore all of the state touched by the extension. | |
8400 if (current_program_) | |
8401 glUseProgram(current_program_->service_id()); | |
8402 else | |
8403 glUseProgram(0); | |
8404 | |
8405 RestoreCurrentFramebufferBindings(); | |
8406 RestoreCurrentTexture2DBindings(); | |
8407 RestoreStateForAttrib( | |
8408 CopyTextureCHROMIUMResourceManager::kVertexPositionAttrib); | |
8409 RestoreStateForAttrib( | |
8410 CopyTextureCHROMIUMResourceManager::kVertexTextureAttrib); | |
8411 | |
8412 ApplyDirtyState(); | |
8413 } | |
8414 | |
8415 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { | 8255 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { |
8416 switch (internalformat) { | 8256 switch (internalformat) { |
8417 case GL_RGB565: | 8257 case GL_RGB565: |
8418 return GL_UNSIGNED_SHORT_5_6_5; | 8258 return GL_UNSIGNED_SHORT_5_6_5; |
8419 case GL_RGBA4: | 8259 case GL_RGBA4: |
8420 return GL_UNSIGNED_SHORT_4_4_4_4; | 8260 return GL_UNSIGNED_SHORT_4_4_4_4; |
8421 case GL_RGB5_A1: | 8261 case GL_RGB5_A1: |
8422 return GL_UNSIGNED_SHORT_5_5_5_1; | 8262 return GL_UNSIGNED_SHORT_5_5_5_1; |
8423 case GL_RGB8_OES: | 8263 case GL_RGB8_OES: |
8424 return GL_UNSIGNED_BYTE; | 8264 return GL_UNSIGNED_BYTE; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8502 } | 8342 } |
8503 } | 8343 } |
8504 | 8344 |
8505 // Include the auto-generated part of this file. We split this because it means | 8345 // Include the auto-generated part of this file. We split this because it means |
8506 // we can easily edit the non-auto generated parts right here in this file | 8346 // we can easily edit the non-auto generated parts right here in this file |
8507 // instead of having to edit some template or the code generator. | 8347 // instead of having to edit some template or the code generator. |
8508 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8348 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
8509 | 8349 |
8510 } // namespace gles2 | 8350 } // namespace gles2 |
8511 } // namespace gpu | 8351 } // namespace gpu |
OLD | NEW |