| Index: gpu/command_buffer/common/gles2_cmd_utils_unittest.cc
|
| diff --git a/gpu/command_buffer/common/gles2_cmd_utils_unittest.cc b/gpu/command_buffer/common/gles2_cmd_utils_unittest.cc
|
| index 3eb2a3870561a00bf21c429863325852f7178a43..9e85acf9188ece0eb48d54cec99040528dfc639e 100644
|
| --- a/gpu/command_buffer/common/gles2_cmd_utils_unittest.cc
|
| +++ b/gpu/command_buffer/common/gles2_cmd_utils_unittest.cc
|
| @@ -320,6 +320,70 @@ TEST_F(GLES2UtilTest, ComputeImageDataSizeDepth) {
|
| EXPECT_EQ(kWidth * 3 + 7, padded_row_size);
|
| }
|
|
|
| +TEST_F(GLES2UtilTest, ComputeImageDataSizePixelStoreParams) {
|
| + const uint32_t kWidth = 3;
|
| + const uint32_t kHeight = 3;
|
| + const uint32_t kDepth = 3;
|
| + uint32_t size;
|
| + uint32_t unpadded_row_size;
|
| + uint32_t padded_row_size;
|
| + uint32_t skip_size;
|
| +
|
| + { // Default
|
| + PixelStoreParams params;
|
| + EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
|
| + kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, params,
|
| + &size, &unpadded_row_size, &padded_row_size, &skip_size));
|
| + EXPECT_EQ(kWidth * 3, unpadded_row_size);
|
| + EXPECT_EQ(kWidth * 3 + 3, padded_row_size);
|
| + EXPECT_EQ(padded_row_size * (kHeight * kDepth - 1) + unpadded_row_size,
|
| + size);
|
| + EXPECT_EQ(0u, skip_size);
|
| + }
|
| +
|
| + { // row_length
|
| + PixelStoreParams params;
|
| + params.row_length = kWidth + 1;
|
| + EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
|
| + kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, params,
|
| + &size, &unpadded_row_size, &padded_row_size, &skip_size));
|
| + EXPECT_EQ(static_cast<uint32_t>(params.row_length * 3), unpadded_row_size);
|
| + EXPECT_EQ(unpadded_row_size, padded_row_size);
|
| + EXPECT_EQ(padded_row_size * kHeight * kDepth, size);
|
| + EXPECT_EQ(0u, skip_size);
|
| + }
|
| +
|
| + { // image_height
|
| + PixelStoreParams params;
|
| + params.image_height = kHeight + 1;
|
| + EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
|
| + kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, params,
|
| + &size, &unpadded_row_size, &padded_row_size, &skip_size));
|
| + EXPECT_EQ(kWidth * 3, unpadded_row_size);
|
| + EXPECT_EQ(kWidth * 3 + 3, padded_row_size);
|
| + EXPECT_EQ(padded_row_size * (params.image_height * kDepth - 1) +
|
| + unpadded_row_size, size);
|
| + EXPECT_EQ(0u, skip_size);
|
| + }
|
| +
|
| + { // skip_pixels, skip_rows, skip_images
|
| + PixelStoreParams params;
|
| + params.skip_pixels = 1;
|
| + params.skip_rows = 10;
|
| + params.skip_images = 2;
|
| + EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
|
| + kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, params,
|
| + &size, &unpadded_row_size, &padded_row_size, &skip_size));
|
| + EXPECT_EQ(kWidth * 3, unpadded_row_size);
|
| + EXPECT_EQ(kWidth * 3 + 3, padded_row_size);
|
| + EXPECT_EQ(padded_row_size * kHeight * params.skip_images +
|
| + padded_row_size * params.skip_rows + 3 * params.skip_pixels,
|
| + skip_size);
|
| + EXPECT_EQ(padded_row_size * (kWidth * kDepth - 1) + unpadded_row_size +
|
| + skip_size, size);
|
| + }
|
| +}
|
| +
|
| TEST_F(GLES2UtilTest, RenderbufferBytesPerPixel) {
|
| EXPECT_EQ(1u, GLES2Util::RenderbufferBytesPerPixel(GL_STENCIL_INDEX8));
|
| EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA4));
|
|
|