| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 9529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9540 switch (pname) { | 9540 switch (pname) { |
| 9541 case GL_PACK_ALIGNMENT: | 9541 case GL_PACK_ALIGNMENT: |
| 9542 case GL_UNPACK_ALIGNMENT: | 9542 case GL_UNPACK_ALIGNMENT: |
| 9543 if (!validators_->pixel_store_alignment.IsValid(param)) { | 9543 if (!validators_->pixel_store_alignment.IsValid(param)) { |
| 9544 LOCAL_SET_GL_ERROR( | 9544 LOCAL_SET_GL_ERROR( |
| 9545 GL_INVALID_VALUE, "glPixelStorei", "invalid param"); | 9545 GL_INVALID_VALUE, "glPixelStorei", "invalid param"); |
| 9546 return error::kNoError; | 9546 return error::kNoError; |
| 9547 } | 9547 } |
| 9548 break; | 9548 break; |
| 9549 case GL_PACK_ROW_LENGTH: | 9549 case GL_PACK_ROW_LENGTH: |
| 9550 case GL_PACK_SKIP_PIXELS: | |
| 9551 case GL_PACK_SKIP_ROWS: | |
| 9552 case GL_UNPACK_ROW_LENGTH: | 9550 case GL_UNPACK_ROW_LENGTH: |
| 9553 case GL_UNPACK_IMAGE_HEIGHT: | 9551 case GL_UNPACK_IMAGE_HEIGHT: |
| 9554 case GL_UNPACK_SKIP_PIXELS: | |
| 9555 case GL_UNPACK_SKIP_ROWS: | |
| 9556 case GL_UNPACK_SKIP_IMAGES: | |
| 9557 if (param < 0) { | 9552 if (param < 0) { |
| 9558 LOCAL_SET_GL_ERROR( | 9553 LOCAL_SET_GL_ERROR( |
| 9559 GL_INVALID_VALUE, "glPixelStorei", "invalid param"); | 9554 GL_INVALID_VALUE, "glPixelStorei", "invalid param"); |
| 9560 return error::kNoError; | 9555 return error::kNoError; |
| 9561 } | 9556 } |
| 9557 break; |
| 9558 case GL_PACK_SKIP_PIXELS: |
| 9559 case GL_PACK_SKIP_ROWS: |
| 9560 case GL_UNPACK_SKIP_PIXELS: |
| 9561 case GL_UNPACK_SKIP_ROWS: |
| 9562 case GL_UNPACK_SKIP_IMAGES: |
| 9563 // All SKIP parameters are handled on the client side and should never |
| 9564 // be passed to the service side. |
| 9565 return error::kInvalidArguments; |
| 9562 default: | 9566 default: |
| 9563 break; | 9567 break; |
| 9564 } | 9568 } |
| 9565 // For pack skip parameters, we don't apply them and handle them in command | |
| 9566 // buffer. | |
| 9567 // For alignment parameters, we always apply them. | 9569 // For alignment parameters, we always apply them. |
| 9568 // For other parameters, we don't apply them if no buffer is bound at | 9570 // For other parameters, we don't apply them if no buffer is bound at |
| 9569 // PIXEL_PACK or PIXEL_UNPACK. We will handle pack and unpack according to | 9571 // PIXEL_PACK or PIXEL_UNPACK. We will handle pack and unpack according to |
| 9570 // the user specified parameters on the client side. | 9572 // the user specified parameters on the client side. |
| 9571 switch (pname) { | 9573 switch (pname) { |
| 9572 case GL_PACK_ROW_LENGTH: | 9574 case GL_PACK_ROW_LENGTH: |
| 9573 if (state_.bound_pixel_pack_buffer.get()) | 9575 if (state_.bound_pixel_pack_buffer.get()) |
| 9574 glPixelStorei(pname, param); | 9576 glPixelStorei(pname, param); |
| 9575 break; | 9577 break; |
| 9576 case GL_PACK_SKIP_PIXELS: | |
| 9577 case GL_PACK_SKIP_ROWS: | |
| 9578 break; | |
| 9579 case GL_UNPACK_ROW_LENGTH: | 9578 case GL_UNPACK_ROW_LENGTH: |
| 9580 case GL_UNPACK_IMAGE_HEIGHT: | 9579 case GL_UNPACK_IMAGE_HEIGHT: |
| 9581 case GL_UNPACK_SKIP_PIXELS: | |
| 9582 case GL_UNPACK_SKIP_ROWS: | |
| 9583 case GL_UNPACK_SKIP_IMAGES: | |
| 9584 if (state_.bound_pixel_unpack_buffer.get()) | 9580 if (state_.bound_pixel_unpack_buffer.get()) |
| 9585 glPixelStorei(pname, param); | 9581 glPixelStorei(pname, param); |
| 9586 break; | 9582 break; |
| 9587 default: | 9583 default: |
| 9588 glPixelStorei(pname, param); | 9584 glPixelStorei(pname, param); |
| 9589 break; | 9585 break; |
| 9590 } | 9586 } |
| 9591 switch (pname) { | 9587 switch (pname) { |
| 9592 case GL_PACK_ALIGNMENT: | 9588 case GL_PACK_ALIGNMENT: |
| 9593 state_.pack_alignment = param; | 9589 state_.pack_alignment = param; |
| 9594 break; | 9590 break; |
| 9595 case GL_PACK_ROW_LENGTH: | 9591 case GL_PACK_ROW_LENGTH: |
| 9596 state_.pack_row_length = param; | 9592 state_.pack_row_length = param; |
| 9597 break; | 9593 break; |
| 9598 case GL_PACK_SKIP_PIXELS: | |
| 9599 state_.pack_skip_pixels = param; | |
| 9600 break; | |
| 9601 case GL_PACK_SKIP_ROWS: | |
| 9602 state_.pack_skip_rows = param; | |
| 9603 break; | |
| 9604 case GL_UNPACK_ALIGNMENT: | 9594 case GL_UNPACK_ALIGNMENT: |
| 9605 state_.unpack_alignment = param; | 9595 state_.unpack_alignment = param; |
| 9606 break; | 9596 break; |
| 9607 case GL_UNPACK_ROW_LENGTH: | 9597 case GL_UNPACK_ROW_LENGTH: |
| 9608 state_.unpack_row_length = param; | 9598 state_.unpack_row_length = param; |
| 9609 break; | 9599 break; |
| 9610 case GL_UNPACK_IMAGE_HEIGHT: | 9600 case GL_UNPACK_IMAGE_HEIGHT: |
| 9611 state_.unpack_image_height = param; | 9601 state_.unpack_image_height = param; |
| 9612 break; | 9602 break; |
| 9613 case GL_UNPACK_SKIP_PIXELS: | |
| 9614 state_.unpack_skip_pixels = param; | |
| 9615 break; | |
| 9616 case GL_UNPACK_SKIP_ROWS: | |
| 9617 state_.unpack_skip_rows = param; | |
| 9618 break; | |
| 9619 case GL_UNPACK_SKIP_IMAGES: | |
| 9620 state_.unpack_skip_images = param; | |
| 9621 break; | |
| 9622 default: | 9603 default: |
| 9623 // Validation should have prevented us from getting here. | 9604 // Validation should have prevented us from getting here. |
| 9624 NOTREACHED(); | 9605 NOTREACHED(); |
| 9625 break; | 9606 break; |
| 9626 } | 9607 } |
| 9627 return error::kNoError; | 9608 return error::kNoError; |
| 9628 } | 9609 } |
| 9629 | 9610 |
| 9630 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 9611 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
| 9631 uint32_t immediate_data_size, | 9612 uint32_t immediate_data_size, |
| (...skipping 6327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15959 } | 15940 } |
| 15960 | 15941 |
| 15961 // Include the auto-generated part of this file. We split this because it means | 15942 // Include the auto-generated part of this file. We split this because it means |
| 15962 // we can easily edit the non-auto generated parts right here in this file | 15943 // we can easily edit the non-auto generated parts right here in this file |
| 15963 // instead of having to edit some template or the code generator. | 15944 // instead of having to edit some template or the code generator. |
| 15964 #include "base/macros.h" | 15945 #include "base/macros.h" |
| 15965 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15946 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15966 | 15947 |
| 15967 } // namespace gles2 | 15948 } // namespace gles2 |
| 15968 } // namespace gpu | 15949 } // namespace gpu |
| OLD | NEW |