| 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 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 | 1381 |
| 1382 // pack alignment as last set by glPixelStorei | 1382 // pack alignment as last set by glPixelStorei |
| 1383 GLint pack_alignment_; | 1383 GLint pack_alignment_; |
| 1384 | 1384 |
| 1385 // unpack alignment as last set by glPixelStorei | 1385 // unpack alignment as last set by glPixelStorei |
| 1386 GLint unpack_alignment_; | 1386 GLint unpack_alignment_; |
| 1387 | 1387 |
| 1388 // unpack flip y as last set by glPixelStorei | 1388 // unpack flip y as last set by glPixelStorei |
| 1389 bool unpack_flip_y_; | 1389 bool unpack_flip_y_; |
| 1390 | 1390 |
| 1391 // unpack premultiply alpha as last set by glPixelStorei | 1391 // unpack (un)premultiply alpha as last set by glPixelStorei |
| 1392 bool unpack_premultiply_alpha_; | 1392 bool unpack_premultiply_alpha_; |
| 1393 bool unpack_unpremultiply_alpha_; |
| 1393 | 1394 |
| 1394 // The currently bound array buffer. If this is 0 it is illegal to call | 1395 // The currently bound array buffer. If this is 0 it is illegal to call |
| 1395 // glVertexAttribPointer. | 1396 // glVertexAttribPointer. |
| 1396 BufferManager::BufferInfo::Ref bound_array_buffer_; | 1397 BufferManager::BufferInfo::Ref bound_array_buffer_; |
| 1397 | 1398 |
| 1398 // The currently bound element array buffer. If this is 0 it is illegal | 1399 // The currently bound element array buffer. If this is 0 it is illegal |
| 1399 // to call glDrawElements. | 1400 // to call glDrawElements. |
| 1400 BufferManager::BufferInfo::Ref bound_element_array_buffer_; | 1401 BufferManager::BufferInfo::Ref bound_element_array_buffer_; |
| 1401 | 1402 |
| 1402 // Class that manages vertex attribs. | 1403 // Class that manages vertex attribs. |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 } | 1898 } |
| 1898 | 1899 |
| 1899 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) | 1900 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) |
| 1900 : GLES2Decoder(), | 1901 : GLES2Decoder(), |
| 1901 group_(group), | 1902 group_(group), |
| 1902 error_bits_(0), | 1903 error_bits_(0), |
| 1903 pack_alignment_(4), | 1904 pack_alignment_(4), |
| 1904 unpack_alignment_(4), | 1905 unpack_alignment_(4), |
| 1905 unpack_flip_y_(false), | 1906 unpack_flip_y_(false), |
| 1906 unpack_premultiply_alpha_(false), | 1907 unpack_premultiply_alpha_(false), |
| 1908 unpack_unpremultiply_alpha_(false), |
| 1907 attrib_0_buffer_id_(0), | 1909 attrib_0_buffer_id_(0), |
| 1908 attrib_0_buffer_matches_value_(true), | 1910 attrib_0_buffer_matches_value_(true), |
| 1909 attrib_0_size_(0), | 1911 attrib_0_size_(0), |
| 1910 fixed_attrib_buffer_id_(0), | 1912 fixed_attrib_buffer_id_(0), |
| 1911 fixed_attrib_buffer_size_(0), | 1913 fixed_attrib_buffer_size_(0), |
| 1912 active_texture_unit_(0), | 1914 active_texture_unit_(0), |
| 1913 clear_red_(0), | 1915 clear_red_(0), |
| 1914 clear_green_(0), | 1916 clear_green_(0), |
| 1915 clear_blue_(0), | 1917 clear_blue_(0), |
| 1916 clear_alpha_(0), | 1918 clear_alpha_(0), |
| (...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3827 if (unit.bound_texture_rectangle_arb) { | 3829 if (unit.bound_texture_rectangle_arb) { |
| 3828 GLuint client_id = 0; | 3830 GLuint client_id = 0; |
| 3829 texture_manager()->GetClientId( | 3831 texture_manager()->GetClientId( |
| 3830 unit.bound_texture_rectangle_arb->service_id(), &client_id); | 3832 unit.bound_texture_rectangle_arb->service_id(), &client_id); |
| 3831 *params = client_id; | 3833 *params = client_id; |
| 3832 } else { | 3834 } else { |
| 3833 *params = 0; | 3835 *params = 0; |
| 3834 } | 3836 } |
| 3835 } | 3837 } |
| 3836 return true; | 3838 return true; |
| 3839 case GL_UNPACK_FLIP_Y_CHROMIUM: |
| 3840 *num_written = 1; |
| 3841 if (params) { |
| 3842 params[0] = unpack_flip_y_; |
| 3843 } |
| 3844 return true; |
| 3845 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: |
| 3846 *num_written = 1; |
| 3847 if (params) { |
| 3848 params[0] = unpack_premultiply_alpha_; |
| 3849 } |
| 3850 return true; |
| 3851 case GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM: |
| 3852 *num_written = 1; |
| 3853 if (params) { |
| 3854 params[0] = unpack_unpremultiply_alpha_; |
| 3855 } |
| 3856 return true; |
| 3837 default: | 3857 default: |
| 3838 *num_written = util_.GLGetNumValuesReturned(pname); | 3858 *num_written = util_.GLGetNumValuesReturned(pname); |
| 3839 return false; | 3859 return false; |
| 3840 } | 3860 } |
| 3841 } | 3861 } |
| 3842 | 3862 |
| 3843 bool GLES2DecoderImpl::GetNumValuesReturnedForGLGet( | 3863 bool GLES2DecoderImpl::GetNumValuesReturnedForGLGet( |
| 3844 GLenum pname, GLsizei* num_values) { | 3864 GLenum pname, GLsizei* num_values) { |
| 3845 return GetHelper(pname, NULL, num_values); | 3865 return GetHelper(pname, NULL, num_values); |
| 3846 } | 3866 } |
| (...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6358 "glPixelStore", "param GL_INVALID_VALUE"); | 6378 "glPixelStore", "param GL_INVALID_VALUE"); |
| 6359 return error::kNoError; | 6379 return error::kNoError; |
| 6360 } | 6380 } |
| 6361 break; | 6381 break; |
| 6362 case GL_UNPACK_FLIP_Y_CHROMIUM: | 6382 case GL_UNPACK_FLIP_Y_CHROMIUM: |
| 6363 unpack_flip_y_ = (param != 0); | 6383 unpack_flip_y_ = (param != 0); |
| 6364 return error::kNoError; | 6384 return error::kNoError; |
| 6365 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: | 6385 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: |
| 6366 unpack_premultiply_alpha_ = (param != 0); | 6386 unpack_premultiply_alpha_ = (param != 0); |
| 6367 return error::kNoError; | 6387 return error::kNoError; |
| 6388 case GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM: |
| 6389 unpack_unpremultiply_alpha_ = (param != 0); |
| 6390 return error::kNoError; |
| 6368 default: | 6391 default: |
| 6369 break; | 6392 break; |
| 6370 } | 6393 } |
| 6371 glPixelStorei(pname, param); | 6394 glPixelStorei(pname, param); |
| 6372 switch (pname) { | 6395 switch (pname) { |
| 6373 case GL_PACK_ALIGNMENT: | 6396 case GL_PACK_ALIGNMENT: |
| 6374 pack_alignment_ = param; | 6397 pack_alignment_ = param; |
| 6375 break; | 6398 break; |
| 6376 case GL_PACK_REVERSE_ROW_ORDER_ANGLE: | 6399 case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| 6377 break; | 6400 break; |
| (...skipping 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8818 source_height, 1, 0, internal_format, dest_type, true); | 8841 source_height, 1, 0, internal_format, dest_type, true); |
| 8819 } else { | 8842 } else { |
| 8820 texture_manager()->SetLevelCleared(dest_info, GL_TEXTURE_2D, level); | 8843 texture_manager()->SetLevelCleared(dest_info, GL_TEXTURE_2D, level); |
| 8821 } | 8844 } |
| 8822 | 8845 |
| 8823 state_dirty_ = true; | 8846 state_dirty_ = true; |
| 8824 glViewport(0, 0, source_width, source_height); | 8847 glViewport(0, 0, source_width, source_height); |
| 8825 copy_texture_CHROMIUM_->DoCopyTexture(target, source_info->service_id(), | 8848 copy_texture_CHROMIUM_->DoCopyTexture(target, source_info->service_id(), |
| 8826 dest_info->service_id(), level, | 8849 dest_info->service_id(), level, |
| 8827 unpack_flip_y_, | 8850 unpack_flip_y_, |
| 8828 unpack_premultiply_alpha_); | 8851 unpack_premultiply_alpha_, |
| 8852 unpack_unpremultiply_alpha_); |
| 8829 glViewport(viewport_x_, viewport_y_, viewport_width_, viewport_height_); | 8853 glViewport(viewport_x_, viewport_y_, viewport_width_, viewport_height_); |
| 8830 | 8854 |
| 8831 // Restore all of the state touched by the extension. | 8855 // Restore all of the state touched by the extension. |
| 8832 if (current_program_) | 8856 if (current_program_) |
| 8833 glUseProgram(current_program_->service_id()); | 8857 glUseProgram(current_program_->service_id()); |
| 8834 else | 8858 else |
| 8835 glUseProgram(0); | 8859 glUseProgram(0); |
| 8836 | 8860 |
| 8837 RestoreCurrentFramebufferBindings(); | 8861 RestoreCurrentFramebufferBindings(); |
| 8838 RestoreCurrentTexture2DBindings(); | 8862 RestoreCurrentTexture2DBindings(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9008 BindAndApplyTextureParameters(info); | 9032 BindAndApplyTextureParameters(info); |
| 9009 } | 9033 } |
| 9010 | 9034 |
| 9011 // Include the auto-generated part of this file. We split this because it means | 9035 // Include the auto-generated part of this file. We split this because it means |
| 9012 // we can easily edit the non-auto generated parts right here in this file | 9036 // we can easily edit the non-auto generated parts right here in this file |
| 9013 // instead of having to edit some template or the code generator. | 9037 // instead of having to edit some template or the code generator. |
| 9014 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9038 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 9015 | 9039 |
| 9016 } // namespace gles2 | 9040 } // namespace gles2 |
| 9017 } // namespace gpu | 9041 } // namespace gpu |
| OLD | NEW |