Chromium Code Reviews| 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 4438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6355 case GL_UNPACK_ALIGNMENT: | 6357 case GL_UNPACK_ALIGNMENT: |
| 6356 if (!validators_->pixel_store_alignment.IsValid(param)) { | 6358 if (!validators_->pixel_store_alignment.IsValid(param)) { |
| 6357 SetGLError(GL_INVALID_VALUE, | 6359 SetGLError(GL_INVALID_VALUE, |
| 6358 "glPixelStore", "param GL_INVALID_VALUE"); | 6360 "glPixelStore", "param GL_INVALID_VALUE"); |
| 6359 return error::kNoError; | 6361 return error::kNoError; |
| 6360 } | 6362 } |
| 6361 break; | 6363 break; |
| 6362 case GL_UNPACK_FLIP_Y_CHROMIUM: | 6364 case GL_UNPACK_FLIP_Y_CHROMIUM: |
| 6363 unpack_flip_y_ = (param != 0); | 6365 unpack_flip_y_ = (param != 0); |
| 6364 return error::kNoError; | 6366 return error::kNoError; |
| 6365 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: | 6367 case GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM: |
|
greggman
2012/06/15 00:11:45
When you add a new type here you also need to add
Jeff Timanus
2012/06/18 14:50:24
I think a few settings are missing from GetHelper:
| |
| 6366 unpack_premultiply_alpha_ = (param != 0); | 6368 unpack_premultiply_alpha_ = (param != 0); |
| 6369 unpack_unpremultiply_alpha_ = | |
|
greggman
2012/06/15 00:11:45
This logic seems strange to me.
If I go pre=1, u
Jeff Timanus
2012/06/18 14:50:24
Yeah, I mulled how to best handle this situation.
| |
| 6370 unpack_unpremultiply_alpha_ && !unpack_premultiply_alpha_; | |
| 6371 return error::kNoError; | |
| 6372 case GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM: | |
| 6373 unpack_unpremultiply_alpha_ = (param != 0); | |
| 6374 unpack_premultiply_alpha_ = | |
| 6375 unpack_premultiply_alpha_ && !unpack_unpremultiply_alpha_; | |
| 6367 return error::kNoError; | 6376 return error::kNoError; |
| 6368 default: | 6377 default: |
| 6369 break; | 6378 break; |
| 6370 } | 6379 } |
| 6371 glPixelStorei(pname, param); | 6380 glPixelStorei(pname, param); |
| 6372 switch (pname) { | 6381 switch (pname) { |
| 6373 case GL_PACK_ALIGNMENT: | 6382 case GL_PACK_ALIGNMENT: |
| 6374 pack_alignment_ = param; | 6383 pack_alignment_ = param; |
| 6375 break; | 6384 break; |
| 6376 case GL_PACK_REVERSE_ROW_ORDER_ANGLE: | 6385 case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| (...skipping 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8818 source_height, 1, 0, internal_format, dest_type, true); | 8827 source_height, 1, 0, internal_format, dest_type, true); |
| 8819 } else { | 8828 } else { |
| 8820 texture_manager()->SetLevelCleared(dest_info, GL_TEXTURE_2D, level); | 8829 texture_manager()->SetLevelCleared(dest_info, GL_TEXTURE_2D, level); |
| 8821 } | 8830 } |
| 8822 | 8831 |
| 8823 state_dirty_ = true; | 8832 state_dirty_ = true; |
| 8824 glViewport(0, 0, source_width, source_height); | 8833 glViewport(0, 0, source_width, source_height); |
| 8825 copy_texture_CHROMIUM_->DoCopyTexture(target, source_info->service_id(), | 8834 copy_texture_CHROMIUM_->DoCopyTexture(target, source_info->service_id(), |
| 8826 dest_info->service_id(), level, | 8835 dest_info->service_id(), level, |
| 8827 unpack_flip_y_, | 8836 unpack_flip_y_, |
| 8828 unpack_premultiply_alpha_); | 8837 unpack_premultiply_alpha_, |
| 8838 unpack_unpremultiply_alpha_); | |
| 8829 glViewport(viewport_x_, viewport_y_, viewport_width_, viewport_height_); | 8839 glViewport(viewport_x_, viewport_y_, viewport_width_, viewport_height_); |
| 8830 | 8840 |
| 8831 // Restore all of the state touched by the extension. | 8841 // Restore all of the state touched by the extension. |
| 8832 if (current_program_) | 8842 if (current_program_) |
| 8833 glUseProgram(current_program_->service_id()); | 8843 glUseProgram(current_program_->service_id()); |
| 8834 else | 8844 else |
| 8835 glUseProgram(0); | 8845 glUseProgram(0); |
| 8836 | 8846 |
| 8837 RestoreCurrentFramebufferBindings(); | 8847 RestoreCurrentFramebufferBindings(); |
| 8838 RestoreCurrentTexture2DBindings(); | 8848 RestoreCurrentTexture2DBindings(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9008 BindAndApplyTextureParameters(info); | 9018 BindAndApplyTextureParameters(info); |
| 9009 } | 9019 } |
| 9010 | 9020 |
| 9011 // Include the auto-generated part of this file. We split this because it means | 9021 // 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 | 9022 // 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. | 9023 // instead of having to edit some template or the code generator. |
| 9014 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9024 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 9015 | 9025 |
| 9016 } // namespace gles2 | 9026 } // namespace gles2 |
| 9017 } // namespace gpu | 9027 } // namespace gpu |
| OLD | NEW |