Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: gpu/command_buffer/common/gles2_cmd_utils_unittest.cc

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/gles2_cmd_utils.h" 5 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <GLES2/gl2.h> 8 #include <GLES2/gl2.h>
9 #include <GLES2/gl2ext.h> 9 #include <GLES2/gl2ext.h>
10 #include <GLES2/gl2extchromium.h> 10 #include <GLES2/gl2extchromium.h>
11 #include <GLES3/gl3.h>
11 12
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace gpu { 15 namespace gpu {
15 namespace gles2 { 16 namespace gles2 {
16 17
17 class GLES2UtilTest : public testing:: Test { 18 class GLES2UtilTest : public testing:: Test {
18 protected: 19 protected:
19 GLES2Util util_; 20 GLES2Util util_;
20 }; 21 };
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_EQ(2, util_.num_shader_binary_formats()); 89 EXPECT_EQ(2, util_.num_shader_binary_formats());
89 } 90 }
90 91
91 TEST_F(GLES2UtilTest, ComputeImageDataSizesFormats) { 92 TEST_F(GLES2UtilTest, ComputeImageDataSizesFormats) {
92 const uint32_t kWidth = 16; 93 const uint32_t kWidth = 16;
93 const uint32_t kHeight = 12; 94 const uint32_t kHeight = 12;
94 uint32_t size; 95 uint32_t size;
95 uint32_t unpadded_row_size; 96 uint32_t unpadded_row_size;
96 uint32_t padded_row_size; 97 uint32_t padded_row_size;
97 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 98 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
98 kWidth, kHeight, GL_RGB, GL_UNSIGNED_BYTE, 1, &size, &unpadded_row_size, 99 kWidth, kHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, 1,
99 &padded_row_size)); 100 &size, &unpadded_row_size, &padded_row_size));
100 EXPECT_EQ(kWidth * kHeight * 3, size); 101 EXPECT_EQ(kWidth * kHeight * 3, size);
101 EXPECT_EQ(kWidth * 3, padded_row_size); 102 EXPECT_EQ(kWidth * 3, padded_row_size);
102 EXPECT_EQ(padded_row_size, unpadded_row_size); 103 EXPECT_EQ(padded_row_size, unpadded_row_size);
103 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 104 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
104 kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, 1, &size, &unpadded_row_size, 105 kWidth, kHeight, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, &size,
105 &padded_row_size)); 106 &unpadded_row_size, &padded_row_size));
106 EXPECT_EQ(kWidth * kHeight * 4, size); 107 EXPECT_EQ(kWidth * kHeight * 4, size);
107 EXPECT_EQ(kWidth * 4, padded_row_size); 108 EXPECT_EQ(kWidth * 4, padded_row_size);
108 EXPECT_EQ(padded_row_size, unpadded_row_size); 109 EXPECT_EQ(padded_row_size, unpadded_row_size);
109 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 110 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
110 kWidth, kHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, 1, &size, 111 kWidth, kHeight, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE, 1, &size,
111 &unpadded_row_size, &padded_row_size)); 112 &unpadded_row_size, &padded_row_size));
112 EXPECT_EQ(kWidth * kHeight * 1, size); 113 EXPECT_EQ(kWidth * kHeight * 1, size);
113 EXPECT_EQ(kWidth * 1, padded_row_size); 114 EXPECT_EQ(kWidth * 1, padded_row_size);
114 EXPECT_EQ(padded_row_size, unpadded_row_size); 115 EXPECT_EQ(padded_row_size, unpadded_row_size);
115 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 116 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
116 kWidth, kHeight, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 1, &size, 117 kWidth, kHeight, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 1, &size,
117 &unpadded_row_size, &padded_row_size)); 118 &unpadded_row_size, &padded_row_size));
118 EXPECT_EQ(kWidth * kHeight * 2, size); 119 EXPECT_EQ(kWidth * kHeight * 2, size);
119 EXPECT_EQ(kWidth * 2, padded_row_size); 120 EXPECT_EQ(kWidth * 2, padded_row_size);
120 EXPECT_EQ(padded_row_size, unpadded_row_size); 121 EXPECT_EQ(padded_row_size, unpadded_row_size);
121 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 122 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
122 kWidth, kHeight, GL_BGRA_EXT, GL_UNSIGNED_BYTE, 1, &size, 123 kWidth, kHeight, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, 1, &size,
123 &unpadded_row_size, &padded_row_size)); 124 &unpadded_row_size, &padded_row_size));
124 EXPECT_EQ(kWidth * kHeight * 4, size); 125 EXPECT_EQ(kWidth * kHeight * 4, size);
125 EXPECT_EQ(kWidth * 4, padded_row_size); 126 EXPECT_EQ(kWidth * 4, padded_row_size);
126 EXPECT_EQ(padded_row_size, unpadded_row_size); 127 EXPECT_EQ(padded_row_size, unpadded_row_size);
127 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 128 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
128 kWidth, kHeight, GL_ALPHA, GL_UNSIGNED_BYTE, 1, &size, &unpadded_row_size, 129 kWidth, kHeight, 1, GL_ALPHA, GL_UNSIGNED_BYTE, 1, &size,
129 &padded_row_size)); 130 &unpadded_row_size, &padded_row_size));
130 EXPECT_EQ(kWidth * kHeight * 1, size); 131 EXPECT_EQ(kWidth * kHeight * 1, size);
131 EXPECT_EQ(kWidth * 1, padded_row_size); 132 EXPECT_EQ(kWidth * 1, padded_row_size);
132 EXPECT_EQ(padded_row_size, unpadded_row_size); 133 EXPECT_EQ(padded_row_size, unpadded_row_size);
133 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 134 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
134 kWidth, kHeight, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 1, &size, 135 kWidth, kHeight, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 1, &size,
135 &unpadded_row_size, &padded_row_size)); 136 &unpadded_row_size, &padded_row_size));
136 EXPECT_EQ(kWidth * kHeight * 2, size); 137 EXPECT_EQ(kWidth * kHeight * 2, size);
137 EXPECT_EQ(kWidth * 2, padded_row_size); 138 EXPECT_EQ(kWidth * 2, padded_row_size);
138 EXPECT_EQ(padded_row_size, unpadded_row_size); 139 EXPECT_EQ(padded_row_size, unpadded_row_size);
139 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 140 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
140 kWidth, kHeight, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, 1, 141 kWidth, kHeight, 1, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, 1,
141 &size, &unpadded_row_size, 142 &size, &unpadded_row_size, &padded_row_size));
142 &padded_row_size));
143 EXPECT_EQ(kWidth * kHeight * 4, size); 143 EXPECT_EQ(kWidth * kHeight * 4, size);
144 EXPECT_EQ(kWidth * 4, padded_row_size); 144 EXPECT_EQ(kWidth * 4, padded_row_size);
145 EXPECT_EQ(padded_row_size, unpadded_row_size); 145 EXPECT_EQ(padded_row_size, unpadded_row_size);
146 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
147 kWidth, kHeight, 1, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, 1,
148 &size, &unpadded_row_size, &padded_row_size));
149 EXPECT_EQ(kWidth * kHeight * 3, size);
150 EXPECT_EQ(kWidth * 3, padded_row_size);
151 EXPECT_EQ(padded_row_size, unpadded_row_size);
152 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
153 kWidth, kHeight, 1, GL_RG, GL_UNSIGNED_BYTE, 1,
154 &size, &unpadded_row_size, &padded_row_size));
155 EXPECT_EQ(kWidth * kHeight * 2, size);
156 EXPECT_EQ(kWidth * 2, padded_row_size);
157 EXPECT_EQ(padded_row_size, unpadded_row_size);
158 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
159 kWidth, kHeight, 1, GL_RG_INTEGER, GL_UNSIGNED_BYTE, 1,
160 &size, &unpadded_row_size, &padded_row_size));
161 EXPECT_EQ(kWidth * kHeight * 2, size);
162 EXPECT_EQ(kWidth * 2, padded_row_size);
163 EXPECT_EQ(padded_row_size, unpadded_row_size);
164 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
165 kWidth, kHeight, 1, GL_RED, GL_UNSIGNED_BYTE, 1,
166 &size, &unpadded_row_size, &padded_row_size));
167 EXPECT_EQ(kWidth * kHeight * 1, size);
168 EXPECT_EQ(kWidth * 1, padded_row_size);
169 EXPECT_EQ(padded_row_size, unpadded_row_size);
170 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
171 kWidth, kHeight, 1, GL_RED_INTEGER, GL_UNSIGNED_BYTE, 1,
172 &size, &unpadded_row_size, &padded_row_size));
173 EXPECT_EQ(kWidth * kHeight * 1, size);
174 EXPECT_EQ(kWidth * 1, padded_row_size);
175 EXPECT_EQ(padded_row_size, unpadded_row_size);
146 } 176 }
147 177
148 TEST_F(GLES2UtilTest, ComputeImageDataSizeTypes) { 178 TEST_F(GLES2UtilTest, ComputeImageDataSizeTypes) {
149 const uint32_t kWidth = 16; 179 const uint32_t kWidth = 16;
150 const uint32_t kHeight = 12; 180 const uint32_t kHeight = 12;
151 uint32_t size; 181 uint32_t size;
152 uint32_t unpadded_row_size; 182 uint32_t unpadded_row_size;
153 uint32_t padded_row_size; 183 uint32_t padded_row_size;
154 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 184 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
155 kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, 1, &size, &unpadded_row_size, 185 kWidth, kHeight, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, &size,
156 &padded_row_size)); 186 &unpadded_row_size, &padded_row_size));
157 EXPECT_EQ(kWidth * kHeight * 4, size); 187 EXPECT_EQ(kWidth * kHeight * 4, size);
158 EXPECT_EQ(kWidth * 4, padded_row_size); 188 EXPECT_EQ(kWidth * 4, padded_row_size);
159 EXPECT_EQ(padded_row_size, unpadded_row_size); 189 EXPECT_EQ(padded_row_size, unpadded_row_size);
160 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 190 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
161 kWidth, kHeight, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 1, &size, 191 kWidth, kHeight, 1, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 1, &size,
162 &unpadded_row_size, &padded_row_size)); 192 &unpadded_row_size, &padded_row_size));
163 EXPECT_EQ(kWidth * kHeight * 2, size); 193 EXPECT_EQ(kWidth * kHeight * 2, size);
164 EXPECT_EQ(kWidth * 2, padded_row_size); 194 EXPECT_EQ(kWidth * 2, padded_row_size);
165 EXPECT_EQ(padded_row_size, unpadded_row_size); 195 EXPECT_EQ(padded_row_size, unpadded_row_size);
166 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 196 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
167 kWidth, kHeight, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 1, &size, 197 kWidth, kHeight, 1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 1, &size,
168 &unpadded_row_size, &padded_row_size)); 198 &unpadded_row_size, &padded_row_size));
169 EXPECT_EQ(kWidth * kHeight * 2, size); 199 EXPECT_EQ(kWidth * kHeight * 2, size);
170 EXPECT_EQ(kWidth * 2, padded_row_size); 200 EXPECT_EQ(kWidth * 2, padded_row_size);
171 EXPECT_EQ(padded_row_size, unpadded_row_size); 201 EXPECT_EQ(padded_row_size, unpadded_row_size);
172 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 202 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
173 kWidth, kHeight, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 1, &size, 203 kWidth, kHeight, 1, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 1, &size,
174 &unpadded_row_size, &padded_row_size)); 204 &unpadded_row_size, &padded_row_size));
175 EXPECT_EQ(kWidth * kHeight * 2, size); 205 EXPECT_EQ(kWidth * kHeight * 2, size);
176 EXPECT_EQ(kWidth * 2, padded_row_size); 206 EXPECT_EQ(kWidth * 2, padded_row_size);
177 EXPECT_EQ(padded_row_size, unpadded_row_size); 207 EXPECT_EQ(padded_row_size, unpadded_row_size);
178 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 208 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
179 kWidth, kHeight, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 1, &size, 209 kWidth, kHeight, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 1, &size,
180 &unpadded_row_size, &padded_row_size)); 210 &unpadded_row_size, &padded_row_size));
181 EXPECT_EQ(kWidth * kHeight * 4, size); 211 EXPECT_EQ(kWidth * kHeight * 4, size);
182 EXPECT_EQ(kWidth * 4, padded_row_size); 212 EXPECT_EQ(kWidth * 4, padded_row_size);
183 EXPECT_EQ(padded_row_size, unpadded_row_size); 213 EXPECT_EQ(padded_row_size, unpadded_row_size);
214 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
215 kWidth, kHeight, 1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 1, &size,
216 &unpadded_row_size, &padded_row_size));
217 EXPECT_EQ(kWidth * kHeight * 4, size);
218 EXPECT_EQ(kWidth * 4, padded_row_size);
219 EXPECT_EQ(padded_row_size, unpadded_row_size);
220 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
221 kWidth, kHeight, 1, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, 1, &size,
222 &unpadded_row_size, &padded_row_size));
223 EXPECT_EQ(kWidth * kHeight * 4, size);
224 EXPECT_EQ(kWidth * 4, padded_row_size);
225 EXPECT_EQ(padded_row_size, unpadded_row_size);
226 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
227 kWidth, kHeight, 1, GL_RGBA, GL_UNSIGNED_INT_5_9_9_9_REV, 1, &size,
228 &unpadded_row_size, &padded_row_size));
229 EXPECT_EQ(kWidth * kHeight * 4, size);
230 EXPECT_EQ(kWidth * 4, padded_row_size);
231 EXPECT_EQ(padded_row_size, unpadded_row_size);
232 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
233 kWidth, kHeight, 1, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
234 1, &size, &unpadded_row_size, &padded_row_size));
235 EXPECT_EQ(kWidth * kHeight * 4, size);
236 EXPECT_EQ(kWidth * 4, padded_row_size);
237 EXPECT_EQ(padded_row_size, unpadded_row_size);
184 } 238 }
185 239
186 TEST_F(GLES2UtilTest, ComputeImageDataSizesUnpackAlignment) { 240 TEST_F(GLES2UtilTest, ComputeImageDataSizesUnpackAlignment) {
187 const uint32_t kWidth = 19; 241 const uint32_t kWidth = 19;
188 const uint32_t kHeight = 12; 242 const uint32_t kHeight = 12;
189 uint32_t size; 243 uint32_t size;
190 uint32_t unpadded_row_size; 244 uint32_t unpadded_row_size;
191 uint32_t padded_row_size; 245 uint32_t padded_row_size;
192 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 246 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
193 kWidth, kHeight, GL_RGB, GL_UNSIGNED_BYTE, 1, &size, &unpadded_row_size, 247 kWidth, kHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, 1, &size,
194 &padded_row_size)); 248 &unpadded_row_size, &padded_row_size));
195 EXPECT_EQ(kWidth * kHeight * 3, size); 249 EXPECT_EQ(kWidth * kHeight * 3, size);
196 EXPECT_EQ(kWidth * 3, unpadded_row_size); 250 EXPECT_EQ(kWidth * 3, unpadded_row_size);
197 EXPECT_EQ(kWidth * 3, padded_row_size); 251 EXPECT_EQ(kWidth * 3, padded_row_size);
198 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 252 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
199 kWidth, kHeight, GL_RGB, GL_UNSIGNED_BYTE, 2, &size, &unpadded_row_size, 253 kWidth, kHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, 2, &size,
200 &padded_row_size)); 254 &unpadded_row_size, &padded_row_size));
201 EXPECT_EQ((kWidth * 3 + 1) * (kHeight - 1) + 255 EXPECT_EQ((kWidth * 3 + 1) * (kHeight - 1) +
202 kWidth * 3, size); 256 kWidth * 3, size);
203 EXPECT_EQ(kWidth * 3, unpadded_row_size); 257 EXPECT_EQ(kWidth * 3, unpadded_row_size);
204 EXPECT_EQ(kWidth * 3 + 1, padded_row_size); 258 EXPECT_EQ(kWidth * 3 + 1, padded_row_size);
205 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 259 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
206 kWidth, kHeight, GL_RGB, GL_UNSIGNED_BYTE, 4, &size, &unpadded_row_size, 260 kWidth, kHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, 4, &size,
207 &padded_row_size)); 261 &unpadded_row_size, &padded_row_size));
208 EXPECT_EQ((kWidth * 3 + 3) * (kHeight - 1) + 262 EXPECT_EQ((kWidth * 3 + 3) * (kHeight - 1) +
209 kWidth * 3, size); 263 kWidth * 3, size);
210 EXPECT_EQ(kWidth * 3, unpadded_row_size); 264 EXPECT_EQ(kWidth * 3, unpadded_row_size);
211 EXPECT_EQ(kWidth * 3 + 3, padded_row_size); 265 EXPECT_EQ(kWidth * 3 + 3, padded_row_size);
212 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes( 266 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
213 kWidth, kHeight, GL_RGB, GL_UNSIGNED_BYTE, 8, &size, &unpadded_row_size, 267 kWidth, kHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, 8, &size,
214 &padded_row_size)); 268 &unpadded_row_size, &padded_row_size));
215 EXPECT_EQ((kWidth * 3 + 7) * (kHeight - 1) + 269 EXPECT_EQ((kWidth * 3 + 7) * (kHeight - 1) +
216 kWidth * 3, size); 270 kWidth * 3, size);
217 EXPECT_EQ(kWidth * 3, unpadded_row_size); 271 EXPECT_EQ(kWidth * 3, unpadded_row_size);
218 EXPECT_EQ(kWidth * 3 + 7, padded_row_size); 272 EXPECT_EQ(kWidth * 3 + 7, padded_row_size);
219 } 273 }
220 274
275 TEST_F(GLES2UtilTest, ComputeImageDataSizeDepth) {
276 const uint32_t kWidth = 19;
277 const uint32_t kHeight = 12;
278 const uint32_t kDepth = 3;
279 uint32_t size;
280 uint32_t unpadded_row_size;
281 uint32_t padded_row_size;
282 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
283 kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, 1, &size,
284 &unpadded_row_size, &padded_row_size));
285 EXPECT_EQ(kWidth * kHeight * kDepth * 3, size);
286 EXPECT_EQ(kWidth * 3, padded_row_size);
287 EXPECT_EQ(padded_row_size, unpadded_row_size);
288 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
289 kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, 2, &size,
290 &unpadded_row_size, &padded_row_size));
291 EXPECT_EQ((kWidth * 3 + 1) * (kHeight * kDepth - 1) +
292 kWidth * 3, size);
293 EXPECT_EQ(kWidth * 3, unpadded_row_size);
294 EXPECT_EQ(kWidth * 3 + 1, padded_row_size);
295 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
296 kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, 4, &size,
297 &unpadded_row_size, &padded_row_size));
298 EXPECT_EQ((kWidth * 3 + 3) * (kHeight * kDepth - 1) +
299 kWidth * 3, size);
300 EXPECT_EQ(kWidth * 3, unpadded_row_size);
301 EXPECT_EQ(kWidth * 3 + 3, padded_row_size);
302 EXPECT_TRUE(GLES2Util::ComputeImageDataSizes(
303 kWidth, kHeight, kDepth, GL_RGB, GL_UNSIGNED_BYTE, 8, &size,
304 &unpadded_row_size, &padded_row_size));
305 EXPECT_EQ((kWidth * 3 + 7) * (kHeight * kDepth - 1) +
306 kWidth * 3, size);
307 EXPECT_EQ(kWidth * 3, unpadded_row_size);
308 EXPECT_EQ(kWidth * 3 + 7, padded_row_size);
309 }
310
221 TEST_F(GLES2UtilTest, RenderbufferBytesPerPixel) { 311 TEST_F(GLES2UtilTest, RenderbufferBytesPerPixel) {
222 EXPECT_EQ(1u, GLES2Util::RenderbufferBytesPerPixel(GL_STENCIL_INDEX8)); 312 EXPECT_EQ(1u, GLES2Util::RenderbufferBytesPerPixel(GL_STENCIL_INDEX8));
223 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA4)); 313 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA4));
224 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB565)); 314 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB565));
225 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB5_A1)); 315 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB5_A1));
226 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH_COMPONENT16)); 316 EXPECT_EQ(2u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH_COMPONENT16));
227 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB)); 317 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGB));
228 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA)); 318 EXPECT_EQ(4u, GLES2Util::RenderbufferBytesPerPixel(GL_RGBA));
229 EXPECT_EQ( 319 EXPECT_EQ(
230 4u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH24_STENCIL8_OES)); 320 4u, GLES2Util::RenderbufferBytesPerPixel(GL_DEPTH24_STENCIL8_OES));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 CheckParseUniformName("u_name[020]", true, 6u, 20, true); 387 CheckParseUniformName("u_name[020]", true, 6u, 20, true);
298 CheckParseUniformName("u_name[0][0]", true, 9u, 0, true); 388 CheckParseUniformName("u_name[0][0]", true, 9u, 0, true);
299 CheckParseUniformName("u_name[3][2]", true, 9u, 2, true); 389 CheckParseUniformName("u_name[3][2]", true, 9u, 2, true);
300 CheckParseUniformName("u_name[03][02]", true, 10u, 2, true); 390 CheckParseUniformName("u_name[03][02]", true, 10u, 2, true);
301 CheckParseUniformName("u_name[30][20]", true, 10u, 20, true); 391 CheckParseUniformName("u_name[30][20]", true, 10u, 20, true);
302 CheckParseUniformName("u_name[030][020]", true, 11u, 20, true); 392 CheckParseUniformName("u_name[030][020]", true, 11u, 20, true);
303 } 393 }
304 394
305 } // namespace gles2 395 } // namespace gles2
306 } // namespace gpu 396 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h ('k') | gpu/command_buffer/service/context_group.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698