Chromium Code Reviews| Index: gpu/command_buffer/common/gles2_cmd_utils.h |
| diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h |
| index 3aa0299056a0fd83f1a4bf183e279e0af6b0d63e..90658d6fd02ef210ea1449d0abd82fb9652f048c 100644 |
| --- a/gpu/command_buffer/common/gles2_cmd_utils.h |
| +++ b/gpu/command_buffer/common/gles2_cmd_utils.h |
| @@ -52,6 +52,24 @@ inline bool SafeAddInt32(int32_t a, int32_t b, int32_t* dst) { |
| return checked.IsValid(); |
| } |
| +struct GLES2_UTILS_EXPORT PixelStoreParams { |
| + PixelStoreParams() |
| + : alignment(4), |
| + row_length(0), |
| + image_height(0), |
| + skip_pixels(0), |
| + skip_rows(0), |
| + skip_images(0) { |
| + } |
| + |
| + int32_t alignment; |
| + int32_t row_length; |
| + int32_t image_height; |
| + int32_t skip_pixels; |
| + int32_t skip_rows; |
| + int32_t skip_images; |
| +}; |
| + |
| // Utilties for GLES2 support. |
| class GLES2_UTILS_EXPORT GLES2Util { |
| public: |
| @@ -105,18 +123,26 @@ class GLES2_UTILS_EXPORT GLES2Util { |
| // Computes the size of an image row including alignment padding |
| static bool ComputeImagePaddedRowSize( |
| - int width, int format, int type, int unpack_alignment, |
| + int width, int format, int type, int alignment, |
| uint32_t* padded_row_size); |
| // Computes the size of image data for TexImage2D and TexSubImage2D. |
| - // Optionally the unpadded and padded row sizes can be returned. If height < 2 |
| - // then the padded_row_size will be the same as the unpadded_row_size since |
| - // padding is not necessary. |
| + // Optionally the unpadded and padded row sizes can be returned. |
| static bool ComputeImageDataSizes( |
| int width, int height, int depth, int format, int type, |
| - int unpack_alignment, uint32_t* size, uint32_t* unpadded_row_size, |
| + int alignment, uint32_t* size, uint32_t* unpadded_row_size, |
| uint32_t* padded_row_size); |
| + // Similar to the above function, but taking into consideration all ES3 |
| + // pixel pack/unpack parameters. |
| + // Optionally the skipped bytes in the beginning can be returned. |
|
Ken Russell (switch to Gerrit)
2015/12/09 00:05:50
How are they optionally returned? All of the outgo
Zhenyao Mo
2015/12/09 00:27:57
They are optional in the sense they can be nullptr
|
| + // Note the returned |size| does NOT include |skip_size|. |
| + static bool ComputeImageDataSizes( |
| + int width, int height, int depth, int format, int type, |
| + const PixelStoreParams& params, |
| + uint32_t* size, uint32_t* unpadded_row_size, |
| + uint32_t* padded_row_size, uint32_t* skip_size); |
| + |
| static size_t RenderbufferBytesPerPixel(int format); |
| // Return the element's number of bytes. |
| @@ -192,6 +218,10 @@ class GLES2_UTILS_EXPORT GLES2Util { |
| static std::string GetQualifiedEnumString( |
| const EnumToString* table, size_t count, uint32_t value); |
| + static bool ComputeImageRowSizeHelper( |
| + int width, uint32 bytes_per_group, int alignment, |
| + uint32* rt_unpadded_row_size, uint32* rt_padded_row_size); |
| + |
| static const EnumToString* const enum_to_string_table_; |
| static const size_t enum_to_string_table_len_; |