OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/common/gl_mock.h" | 10 #include "gpu/command_buffer/common/gl_mock.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 public: | 38 public: |
39 GLES2DecoderTest() { } | 39 GLES2DecoderTest() { } |
40 | 40 |
41 protected: | 41 protected: |
42 void CheckReadPixelsOutOfRange( | 42 void CheckReadPixelsOutOfRange( |
43 GLint in_read_x, GLint in_read_y, | 43 GLint in_read_x, GLint in_read_y, |
44 GLsizei in_read_width, GLsizei in_read_height, | 44 GLsizei in_read_width, GLsizei in_read_height, |
45 bool init); | 45 bool init); |
46 }; | 46 }; |
47 | 47 |
48 class GLES2DecoderRGBBackbufferTest : public GLES2DecoderTest { | |
49 public: | |
50 GLES2DecoderRGBBackbufferTest() { } | |
51 | |
52 virtual void SetUp() { | |
53 InitDecoder("", false); | |
54 } | |
55 }; | |
56 | |
57 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { | 48 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { |
58 public: | 49 public: |
59 GLES2DecoderWithShaderTest() | 50 GLES2DecoderWithShaderTest() |
60 : GLES2DecoderWithShaderTestBase() { | 51 : GLES2DecoderWithShaderTestBase() { |
61 } | 52 } |
62 | 53 |
63 void AddExpectationsForSimulatedAttrib0( | 54 void AddExpectationsForSimulatedAttrib0( |
64 GLsizei num_vertices, GLuint buffer_id) { | 55 GLsizei num_vertices, GLuint buffer_id) { |
65 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, kServiceAttrib0BufferId)) | 56 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, kServiceAttrib0BufferId)) |
66 .Times(1) | 57 .Times(1) |
(...skipping 15 matching lines...) Expand all Loading... |
82 .RetiresOnSaturation(); | 73 .RetiresOnSaturation(); |
83 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) | 74 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) |
84 .Times(1) | 75 .Times(1) |
85 .RetiresOnSaturation(); | 76 .RetiresOnSaturation(); |
86 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) | 77 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) |
87 .Times(1) | 78 .Times(1) |
88 .RetiresOnSaturation(); | 79 .RetiresOnSaturation(); |
89 } | 80 } |
90 }; | 81 }; |
91 | 82 |
| 83 class GLES2DecoderRGBBackbufferTest : public GLES2DecoderWithShaderTest { |
| 84 public: |
| 85 GLES2DecoderRGBBackbufferTest() { } |
| 86 |
| 87 virtual void SetUp() { |
| 88 InitDecoder("", false, false, false, false, false, false); |
| 89 SetupDefaultProgram(); |
| 90 } |
| 91 }; |
| 92 |
| 93 class GLES2DecoderManualInitTest : public GLES2DecoderWithShaderTest { |
| 94 public: |
| 95 GLES2DecoderManualInitTest() { } |
| 96 |
| 97 // Override default setup so nothing gets setup. |
| 98 virtual void SetUp() { |
| 99 } |
| 100 }; |
| 101 |
92 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { | 102 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { |
93 SetupTexture(); | 103 SetupTexture(); |
94 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 104 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 105 SetupExpectationsForApplyingDefaultDirtyState(); |
95 | 106 |
96 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 107 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
97 .Times(1) | 108 .Times(1) |
98 .RetiresOnSaturation(); | 109 .RetiresOnSaturation(); |
99 DrawArrays cmd; | 110 DrawArrays cmd; |
100 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 111 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
101 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 112 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
102 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 113 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
103 } | 114 } |
104 | 115 |
(...skipping 19 matching lines...) Expand all Loading... |
124 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) | 135 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
125 .Times(1) | 136 .Times(1) |
126 .RetiresOnSaturation(); | 137 .RetiresOnSaturation(); |
127 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 138 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
128 .Times(1) | 139 .Times(1) |
129 .RetiresOnSaturation(); | 140 .RetiresOnSaturation(); |
130 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) | 141 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
131 .Times(1) | 142 .Times(1) |
132 .RetiresOnSaturation(); | 143 .RetiresOnSaturation(); |
133 } | 144 } |
| 145 SetupExpectationsForApplyingDefaultDirtyState(); |
134 DrawArrays cmd; | 146 DrawArrays cmd; |
135 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 147 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
136 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 148 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
137 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 149 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
138 } | 150 } |
139 | 151 |
140 TEST_F(GLES2DecoderWithShaderTest, DrawArraysMissingAttributesFails) { | 152 TEST_F(GLES2DecoderWithShaderTest, DrawArraysMissingAttributesFails) { |
141 DoEnableVertexAttribArray(1); | 153 DoEnableVertexAttribArray(1); |
142 | 154 |
143 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 155 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
(...skipping 12 matching lines...) Expand all Loading... |
156 .Times(0); | 168 .Times(0); |
157 DrawArrays cmd; | 169 DrawArrays cmd; |
158 cmd.Init(GL_TRIANGLES, 0, 0); | 170 cmd.Init(GL_TRIANGLES, 0, 0); |
159 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 171 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
160 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 172 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
161 } | 173 } |
162 | 174 |
163 TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { | 175 TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { |
164 SetupTexture(); | 176 SetupTexture(); |
165 SetupVertexBuffer(); | 177 SetupVertexBuffer(); |
| 178 DoEnableVertexAttribArray(1); |
166 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 179 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
167 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); | 180 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
| 181 SetupExpectationsForApplyingDefaultDirtyState(); |
168 | 182 |
169 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 183 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
170 .Times(1) | 184 .Times(1) |
171 .RetiresOnSaturation(); | 185 .RetiresOnSaturation(); |
172 DrawArrays cmd; | 186 DrawArrays cmd; |
173 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 187 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
174 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 188 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
175 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 189 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
176 } | 190 } |
177 | 191 |
178 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { | 192 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { |
179 SetupVertexBuffer(); | 193 SetupVertexBuffer(); |
180 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 194 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
181 DeleteVertexBuffer(); | 195 DeleteVertexBuffer(); |
182 | 196 |
183 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 197 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
184 .Times(0); | 198 .Times(0); |
185 DrawArrays cmd; | 199 DrawArrays cmd; |
186 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 200 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
187 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 201 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
188 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 202 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
189 } | 203 } |
190 | 204 |
191 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { | 205 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { |
192 SetupTexture(); | 206 SetupTexture(); |
193 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 207 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 208 SetupExpectationsForApplyingDefaultDirtyState(); |
194 DoDeleteProgram(client_program_id_, kServiceProgramId); | 209 DoDeleteProgram(client_program_id_, kServiceProgramId); |
195 | 210 |
196 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 211 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
197 .Times(1) | 212 .Times(1) |
198 .RetiresOnSaturation(); | 213 .RetiresOnSaturation(); |
199 DrawArrays cmd; | 214 DrawArrays cmd; |
200 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 215 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
201 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 216 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
202 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 217 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
203 } | 218 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); | 267 DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); |
253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 268 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
254 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 269 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
255 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 270 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
256 } | 271 } |
257 | 272 |
258 TEST_F(GLES2DecoderWithShaderTest, DrawElementsNoAttributesSucceeds) { | 273 TEST_F(GLES2DecoderWithShaderTest, DrawElementsNoAttributesSucceeds) { |
259 SetupTexture(); | 274 SetupTexture(); |
260 SetupIndexBuffer(); | 275 SetupIndexBuffer(); |
261 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); | 276 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
| 277 SetupExpectationsForApplyingDefaultDirtyState(); |
262 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, | 278 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, |
263 GL_UNSIGNED_SHORT, | 279 GL_UNSIGNED_SHORT, |
264 BufferOffset(kValidIndexRangeStart * 2))) | 280 BufferOffset(kValidIndexRangeStart * 2))) |
265 .Times(1) | 281 .Times(1) |
266 .RetiresOnSaturation(); | 282 .RetiresOnSaturation(); |
267 DrawElements cmd; | 283 DrawElements cmd; |
268 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 284 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
269 kValidIndexRangeStart * 2); | 285 kValidIndexRangeStart * 2); |
270 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 286 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
271 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 287 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 326 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
311 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 327 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
312 } | 328 } |
313 | 329 |
314 TEST_F(GLES2DecoderWithShaderTest, DrawElementsValidAttributesSucceeds) { | 330 TEST_F(GLES2DecoderWithShaderTest, DrawElementsValidAttributesSucceeds) { |
315 SetupTexture(); | 331 SetupTexture(); |
316 SetupVertexBuffer(); | 332 SetupVertexBuffer(); |
317 SetupIndexBuffer(); | 333 SetupIndexBuffer(); |
318 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 334 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
319 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); | 335 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
| 336 SetupExpectationsForApplyingDefaultDirtyState(); |
320 | 337 |
321 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, | 338 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, |
322 GL_UNSIGNED_SHORT, | 339 GL_UNSIGNED_SHORT, |
323 BufferOffset(kValidIndexRangeStart * 2))) | 340 BufferOffset(kValidIndexRangeStart * 2))) |
324 .Times(1) | 341 .Times(1) |
325 .RetiresOnSaturation(); | 342 .RetiresOnSaturation(); |
326 DrawElements cmd; | 343 DrawElements cmd; |
327 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 344 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
328 kValidIndexRangeStart * 2); | 345 kValidIndexRangeStart * 2); |
329 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 346 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
(...skipping 12 matching lines...) Expand all Loading... |
342 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 359 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
343 kValidIndexRangeStart * 2); | 360 kValidIndexRangeStart * 2); |
344 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 361 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
345 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 362 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
346 } | 363 } |
347 | 364 |
348 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { | 365 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { |
349 SetupTexture(); | 366 SetupTexture(); |
350 SetupIndexBuffer(); | 367 SetupIndexBuffer(); |
351 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); | 368 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
| 369 SetupExpectationsForApplyingDefaultDirtyState(); |
352 DoDeleteProgram(client_program_id_, kServiceProgramId); | 370 DoDeleteProgram(client_program_id_, kServiceProgramId); |
353 | 371 |
354 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) | 372 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) |
355 .Times(1); | 373 .Times(1); |
356 DrawElements cmd; | 374 DrawElements cmd; |
357 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 375 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
358 kValidIndexRangeStart * 2); | 376 kValidIndexRangeStart * 2); |
359 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 377 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
360 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 378 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
361 } | 379 } |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 .Times(0); | 1256 .Times(0); |
1239 CheckFramebufferStatus::Result* result = | 1257 CheckFramebufferStatus::Result* result = |
1240 static_cast<CheckFramebufferStatus::Result*>(shared_memory_address_); | 1258 static_cast<CheckFramebufferStatus::Result*>(shared_memory_address_); |
1241 *result = 0; | 1259 *result = 0; |
1242 CheckFramebufferStatus cmd; | 1260 CheckFramebufferStatus cmd; |
1243 cmd.Init(GL_FRAMEBUFFER, shared_memory_id_, shared_memory_offset_); | 1261 cmd.Init(GL_FRAMEBUFFER, shared_memory_id_, shared_memory_offset_); |
1244 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1262 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1245 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), *result); | 1263 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), *result); |
1246 } | 1264 } |
1247 | 1265 |
| 1266 TEST_F(GLES2DecoderWithShaderTest, BindAndDeleteFramebuffer) { |
| 1267 SetupTexture(); |
| 1268 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 1269 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1270 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 1271 kServiceFramebufferId); |
| 1272 DoDeleteFramebuffer(client_framebuffer_id_, kServiceFramebufferId); |
| 1273 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1274 .Times(1) |
| 1275 .RetiresOnSaturation(); |
| 1276 DrawArrays cmd; |
| 1277 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 1278 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1279 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1280 } |
| 1281 |
1248 TEST_F(GLES2DecoderTest, FramebufferRenderbufferWithNoBoundTarget) { | 1282 TEST_F(GLES2DecoderTest, FramebufferRenderbufferWithNoBoundTarget) { |
1249 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)) | 1283 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)) |
1250 .Times(0); | 1284 .Times(0); |
1251 FramebufferRenderbuffer cmd; | 1285 FramebufferRenderbuffer cmd; |
1252 cmd.Init( | 1286 cmd.Init( |
1253 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 1287 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
1254 client_renderbuffer_id_); | 1288 client_renderbuffer_id_); |
1255 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1289 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1256 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1290 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
1257 } | 1291 } |
1258 | 1292 |
1259 TEST_F(GLES2DecoderTest, FramebufferTexture2DWithNoBoundTarget) { | 1293 TEST_F(GLES2DecoderTest, FramebufferTexture2DWithNoBoundTarget) { |
1260 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)) | 1294 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)) |
1261 .Times(0); | 1295 .Times(0); |
1262 FramebufferTexture2D cmd; | 1296 FramebufferTexture2D cmd; |
1263 cmd.Init( | 1297 cmd.Init( |
1264 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, | 1298 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, |
(...skipping 28 matching lines...) Expand all Loading... |
1293 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 1327 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
1294 kServiceRenderbufferId)) | 1328 kServiceRenderbufferId)) |
1295 .Times(1) | 1329 .Times(1) |
1296 .RetiresOnSaturation(); | 1330 .RetiresOnSaturation(); |
1297 EXPECT_CALL(*gl_, GetError()) | 1331 EXPECT_CALL(*gl_, GetError()) |
1298 .WillOnce(Return(GL_NO_ERROR)) | 1332 .WillOnce(Return(GL_NO_ERROR)) |
1299 .RetiresOnSaturation(); | 1333 .RetiresOnSaturation(); |
1300 SetupExpectationsForFramebufferAttachment( | 1334 SetupExpectationsForFramebufferAttachment( |
1301 GL_COLOR_BUFFER_BIT, // clear bits | 1335 GL_COLOR_BUFFER_BIT, // clear bits |
1302 0, 0, 0, 0, // color | 1336 0, 0, 0, 0, // color |
1303 0x1111, // color bits | |
1304 0, // stencil | 1337 0, // stencil |
1305 -1, // stencil mask back, | |
1306 -1, // stencil mask front, | |
1307 1.0f, // depth | 1338 1.0f, // depth |
1308 1, // depth mask | |
1309 false); // scissor test | 1339 false); // scissor test |
1310 EXPECT_CALL(*gl_, GetError()) | 1340 EXPECT_CALL(*gl_, GetError()) |
1311 .WillOnce(Return(GL_NO_ERROR)) | 1341 .WillOnce(Return(GL_NO_ERROR)) |
1312 .WillOnce(Return(GL_NO_ERROR)) | 1342 .WillOnce(Return(GL_NO_ERROR)) |
1313 .RetiresOnSaturation(); | 1343 .RetiresOnSaturation(); |
1314 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( | 1344 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( |
1315 GL_FRAMEBUFFER, | 1345 GL_FRAMEBUFFER, |
1316 GL_COLOR_ATTACHMENT0, | 1346 GL_COLOR_ATTACHMENT0, |
1317 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) | 1347 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) |
1318 .WillOnce(SetArgumentPointee<3>(kServiceRenderbufferId)) | 1348 .WillOnce(SetArgumentPointee<3>(kServiceRenderbufferId)) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 1383 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
1354 kServiceTextureId, 0)) | 1384 kServiceTextureId, 0)) |
1355 .Times(1) | 1385 .Times(1) |
1356 .RetiresOnSaturation(); | 1386 .RetiresOnSaturation(); |
1357 EXPECT_CALL(*gl_, GetError()) | 1387 EXPECT_CALL(*gl_, GetError()) |
1358 .WillOnce(Return(GL_NO_ERROR)) | 1388 .WillOnce(Return(GL_NO_ERROR)) |
1359 .RetiresOnSaturation(); | 1389 .RetiresOnSaturation(); |
1360 SetupExpectationsForFramebufferAttachment( | 1390 SetupExpectationsForFramebufferAttachment( |
1361 0, // clear bits | 1391 0, // clear bits |
1362 0, 0, 0, 0, // color | 1392 0, 0, 0, 0, // color |
1363 0x1111, // color bits | |
1364 0, // stencil | 1393 0, // stencil |
1365 -1, // stencil mask back, | |
1366 -1, // stencil mask front, | |
1367 1.0f, // depth | 1394 1.0f, // depth |
1368 1, // depth mask | |
1369 false); // scissor test | 1395 false); // scissor test |
1370 EXPECT_CALL(*gl_, GetError()) | 1396 EXPECT_CALL(*gl_, GetError()) |
1371 .WillOnce(Return(GL_NO_ERROR)) | 1397 .WillOnce(Return(GL_NO_ERROR)) |
1372 .WillOnce(Return(GL_NO_ERROR)) | 1398 .WillOnce(Return(GL_NO_ERROR)) |
1373 .RetiresOnSaturation(); | 1399 .RetiresOnSaturation(); |
1374 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( | 1400 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( |
1375 GL_FRAMEBUFFER, | 1401 GL_FRAMEBUFFER, |
1376 GL_COLOR_ATTACHMENT0, | 1402 GL_COLOR_ATTACHMENT0, |
1377 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) | 1403 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) |
1378 .WillOnce(SetArgumentPointee<3>(kServiceTextureId)) | 1404 .WillOnce(SetArgumentPointee<3>(kServiceTextureId)) |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 1561 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
1536 kServiceTextureId, 0)) | 1562 kServiceTextureId, 0)) |
1537 .Times(1) | 1563 .Times(1) |
1538 .RetiresOnSaturation(); | 1564 .RetiresOnSaturation(); |
1539 EXPECT_CALL(*gl_, GetError()) | 1565 EXPECT_CALL(*gl_, GetError()) |
1540 .WillOnce(Return(GL_NO_ERROR)) | 1566 .WillOnce(Return(GL_NO_ERROR)) |
1541 .RetiresOnSaturation(); | 1567 .RetiresOnSaturation(); |
1542 SetupExpectationsForFramebufferAttachment( | 1568 SetupExpectationsForFramebufferAttachment( |
1543 0, // clear bits | 1569 0, // clear bits |
1544 0, 0, 0, 0, // color | 1570 0, 0, 0, 0, // color |
1545 0x1111, // color bits | |
1546 0, // stencil | 1571 0, // stencil |
1547 -1, // stencil mask back, | |
1548 -1, // stencil mask front, | |
1549 1.0f, // depth | 1572 1.0f, // depth |
1550 1, // depth mask | |
1551 false); // scissor test | 1573 false); // scissor test |
1552 FramebufferTexture2D fbtex_cmd; | 1574 FramebufferTexture2D fbtex_cmd; |
1553 fbtex_cmd.Init( | 1575 fbtex_cmd.Init( |
1554 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, | 1576 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, |
1555 0); | 1577 0); |
1556 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); | 1578 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); |
1557 } | 1579 } |
1558 | 1580 |
1559 ReadPixelsEmulator emu( | 1581 ReadPixelsEmulator emu( |
1560 kWidth, kHeight, kBytesPerPixel, kSrcPixels, kSrcPixels, kPackAlignment); | 1582 kWidth, kHeight, kBytesPerPixel, kSrcPixels, kSrcPixels, kPackAlignment); |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2522 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); | 2544 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); |
2523 color_mask_cmd.Init(0, 1, 0, 1); | 2545 color_mask_cmd.Init(0, 1, 0, 1); |
2524 enable_cmd.Init(GL_SCISSOR_TEST); | 2546 enable_cmd.Init(GL_SCISSOR_TEST); |
2525 cmd.Init( | 2547 cmd.Init( |
2526 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 2548 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
2527 client_renderbuffer_id_); | 2549 client_renderbuffer_id_); |
2528 InSequence sequence; | 2550 InSequence sequence; |
2529 EXPECT_CALL(*gl_, ClearColor(0.1f, 0.2f, 0.3f, 0.4f)) | 2551 EXPECT_CALL(*gl_, ClearColor(0.1f, 0.2f, 0.3f, 0.4f)) |
2530 .Times(1) | 2552 .Times(1) |
2531 .RetiresOnSaturation(); | 2553 .RetiresOnSaturation(); |
2532 EXPECT_CALL(*gl_, ColorMask(0, 1, 0, 1)) | 2554 // EXPECT_CALL(*gl_, ColorMask(0, 1, 0, 1)) |
2533 .Times(1) | 2555 // .Times(0) |
2534 .RetiresOnSaturation(); | 2556 // .RetiresOnSaturation(); |
2535 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) | 2557 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) |
2536 .Times(1) | 2558 .Times(1) |
2537 .RetiresOnSaturation(); | 2559 .RetiresOnSaturation(); |
2538 EXPECT_CALL(*gl_, GetError()) | 2560 EXPECT_CALL(*gl_, GetError()) |
2539 .WillOnce(Return(GL_NO_ERROR)) | 2561 .WillOnce(Return(GL_NO_ERROR)) |
2540 .RetiresOnSaturation(); | 2562 .RetiresOnSaturation(); |
2541 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2563 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
2542 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 2564 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
2543 kServiceRenderbufferId)) | 2565 kServiceRenderbufferId)) |
2544 .Times(1) | 2566 .Times(1) |
2545 .RetiresOnSaturation(); | 2567 .RetiresOnSaturation(); |
2546 EXPECT_CALL(*gl_, GetError()) | 2568 EXPECT_CALL(*gl_, GetError()) |
2547 .WillOnce(Return(GL_NO_ERROR)) | 2569 .WillOnce(Return(GL_NO_ERROR)) |
2548 .RetiresOnSaturation(); | 2570 .RetiresOnSaturation(); |
2549 SetupExpectationsForFramebufferAttachment( | 2571 SetupExpectationsForFramebufferAttachment( |
2550 GL_COLOR_BUFFER_BIT, // clear bits | 2572 GL_COLOR_BUFFER_BIT, // clear bits |
2551 0.1f, 0.2f, 0.3f, 0.4f, // color | 2573 0.1f, 0.2f, 0.3f, 0.4f, // color |
2552 0x0101, // color bits | |
2553 0, // stencil | 2574 0, // stencil |
2554 -1, // stencil mask back | |
2555 -1, // stencil mask front | |
2556 1.0f, // depth | 2575 1.0f, // depth |
2557 1, // depth mask | |
2558 true); // scissor test | 2576 true); // scissor test |
2559 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); | 2577 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); |
2560 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); | 2578 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); |
2561 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); | 2579 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); |
2562 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2580 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2563 } | 2581 } |
2564 | 2582 |
2565 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { | 2583 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { |
2566 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 2584 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
2567 kServiceFramebufferId); | 2585 kServiceFramebufferId); |
2568 ClearDepthf depth_cmd; | 2586 ClearDepthf depth_cmd; |
2569 DepthMask depth_mask_cmd; | 2587 DepthMask depth_mask_cmd; |
2570 FramebufferRenderbuffer cmd; | 2588 FramebufferRenderbuffer cmd; |
2571 depth_cmd.Init(0.5f); | 2589 depth_cmd.Init(0.5f); |
2572 depth_mask_cmd.Init(false); | 2590 depth_mask_cmd.Init(false); |
2573 cmd.Init( | 2591 cmd.Init( |
2574 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, | 2592 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, |
2575 client_renderbuffer_id_); | 2593 client_renderbuffer_id_); |
2576 InSequence sequence; | 2594 InSequence sequence; |
2577 EXPECT_CALL(*gl_, ClearDepth(0.5f)) | 2595 EXPECT_CALL(*gl_, ClearDepth(0.5f)) |
2578 .Times(1) | 2596 .Times(1) |
2579 .RetiresOnSaturation(); | 2597 .RetiresOnSaturation(); |
2580 EXPECT_CALL(*gl_, DepthMask(0)) | 2598 // EXPECT_CALL(*gl_, DepthMask(0)) |
2581 .Times(1) | 2599 // .Times(1) |
2582 .RetiresOnSaturation(); | 2600 // .RetiresOnSaturation(); |
2583 EXPECT_CALL(*gl_, GetError()) | 2601 EXPECT_CALL(*gl_, GetError()) |
2584 .WillOnce(Return(GL_NO_ERROR)) | 2602 .WillOnce(Return(GL_NO_ERROR)) |
2585 .RetiresOnSaturation(); | 2603 .RetiresOnSaturation(); |
2586 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2604 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
2587 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, | 2605 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, |
2588 kServiceRenderbufferId)) | 2606 kServiceRenderbufferId)) |
2589 .Times(1) | 2607 .Times(1) |
2590 .RetiresOnSaturation(); | 2608 .RetiresOnSaturation(); |
2591 EXPECT_CALL(*gl_, GetError()) | 2609 EXPECT_CALL(*gl_, GetError()) |
2592 .WillOnce(Return(GL_NO_ERROR)) | 2610 .WillOnce(Return(GL_NO_ERROR)) |
2593 .RetiresOnSaturation(); | 2611 .RetiresOnSaturation(); |
2594 SetupExpectationsForFramebufferAttachment( | 2612 SetupExpectationsForFramebufferAttachment( |
2595 GL_DEPTH_BUFFER_BIT, // clear bits | 2613 GL_DEPTH_BUFFER_BIT, // clear bits |
2596 0, 0, 0, 0, // color | 2614 0, 0, 0, 0, // color |
2597 0x1111, // color bits | |
2598 0, // stencil | 2615 0, // stencil |
2599 -1, // stencil mask back, | |
2600 -1, // stencil mask front, | |
2601 0.5f, // depth | 2616 0.5f, // depth |
2602 0, // depth mask | |
2603 false); // scissor test | 2617 false); // scissor test |
2604 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 2618 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
2605 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); | 2619 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); |
2606 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2620 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2607 } | 2621 } |
2608 | 2622 |
2609 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { | 2623 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { |
2610 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 2624 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
2611 kServiceFramebufferId); | 2625 kServiceFramebufferId); |
2612 ClearStencil stencil_cmd; | 2626 ClearStencil stencil_cmd; |
2613 StencilMaskSeparate stencil_mask_separate_cmd; | 2627 StencilMaskSeparate stencil_mask_separate_cmd; |
2614 FramebufferRenderbuffer cmd; | 2628 FramebufferRenderbuffer cmd; |
2615 stencil_cmd.Init(123); | 2629 stencil_cmd.Init(123); |
2616 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); | 2630 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); |
2617 cmd.Init( | 2631 cmd.Init( |
2618 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 2632 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
2619 client_renderbuffer_id_); | 2633 client_renderbuffer_id_); |
2620 InSequence sequence; | 2634 InSequence sequence; |
2621 EXPECT_CALL(*gl_, ClearStencil(123)) | 2635 EXPECT_CALL(*gl_, ClearStencil(123)) |
2622 .Times(1) | 2636 .Times(1) |
2623 .RetiresOnSaturation(); | 2637 .RetiresOnSaturation(); |
2624 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0x1234u)) | 2638 // EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0x1234u)) |
2625 .Times(1) | 2639 // .Times(1) |
2626 .RetiresOnSaturation(); | 2640 // .RetiresOnSaturation(); |
2627 EXPECT_CALL(*gl_, GetError()) | 2641 EXPECT_CALL(*gl_, GetError()) |
2628 .WillOnce(Return(GL_NO_ERROR)) | 2642 .WillOnce(Return(GL_NO_ERROR)) |
2629 .RetiresOnSaturation(); | 2643 .RetiresOnSaturation(); |
2630 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2644 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
2631 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 2645 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
2632 kServiceRenderbufferId)) | 2646 kServiceRenderbufferId)) |
2633 .Times(1) | 2647 .Times(1) |
2634 .RetiresOnSaturation(); | 2648 .RetiresOnSaturation(); |
2635 EXPECT_CALL(*gl_, GetError()) | 2649 EXPECT_CALL(*gl_, GetError()) |
2636 .WillOnce(Return(GL_NO_ERROR)) | 2650 .WillOnce(Return(GL_NO_ERROR)) |
2637 .RetiresOnSaturation(); | 2651 .RetiresOnSaturation(); |
2638 SetupExpectationsForFramebufferAttachment( | 2652 SetupExpectationsForFramebufferAttachment( |
2639 GL_STENCIL_BUFFER_BIT, // clear bits | 2653 GL_STENCIL_BUFFER_BIT, // clear bits |
2640 0, 0, 0, 0, // color | 2654 0, 0, 0, 0, // color |
2641 0x1111, // color bits | |
2642 123, // stencil | 2655 123, // stencil |
2643 -1, // stencil mask back, | |
2644 0x1234u, // stencil mask front, | |
2645 1.0f, // depth | 2656 1.0f, // depth |
2646 1, // depth mask | |
2647 false); // scissor test | 2657 false); // scissor test |
2648 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 2658 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
2649 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); | 2659 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); |
2650 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2660 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2651 } | 2661 } |
2652 | 2662 |
2653 TEST_F(GLES2DecoderTest, IsBuffer) { | 2663 TEST_F(GLES2DecoderTest, IsBuffer) { |
2654 EXPECT_FALSE(DoIsBuffer(client_buffer_id_)); | 2664 EXPECT_FALSE(DoIsBuffer(client_buffer_id_)); |
2655 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); | 2665 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); |
2656 EXPECT_TRUE(DoIsBuffer(client_buffer_id_)); | 2666 EXPECT_TRUE(DoIsBuffer(client_buffer_id_)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 .Times(1) | 2728 .Times(1) |
2719 .RetiresOnSaturation(); | 2729 .RetiresOnSaturation(); |
2720 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2730 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
2721 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 2731 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
2722 kServiceRenderbufferId)) | 2732 kServiceRenderbufferId)) |
2723 .Times(1) | 2733 .Times(1) |
2724 .RetiresOnSaturation(); | 2734 .RetiresOnSaturation(); |
2725 SetupExpectationsForFramebufferAttachment( | 2735 SetupExpectationsForFramebufferAttachment( |
2726 GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, // clear bits | 2736 GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, // clear bits |
2727 0, 0, 0, 0, // color | 2737 0, 0, 0, 0, // color |
2728 0x1111, // color bits | |
2729 123, // stencil | 2738 123, // stencil |
2730 -1, // stencil mask back, | |
2731 -1, // stencil mask front, | |
2732 0.5f, // depth | 2739 0.5f, // depth |
2733 1, // depth mask | |
2734 false); // scissor test | 2740 false); // scissor test |
2735 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 2741 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
2736 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 2742 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
2737 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2743 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2738 } | 2744 } |
2739 #endif | 2745 #endif |
2740 | 2746 |
2741 TEST_F(GLES2DecoderWithShaderTest, VertexAttribPointer) { | 2747 TEST_F(GLES2DecoderWithShaderTest, VertexAttribPointer) { |
2742 SetupVertexBuffer(); | 2748 SetupVertexBuffer(); |
2743 static const GLenum types[] = { | 2749 static const GLenum types[] = { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2967 SetSurfaceCHROMIUM cmd; | 2973 SetSurfaceCHROMIUM cmd; |
2968 cmd.Init(kExistentSurfaceId); | 2974 cmd.Init(kExistentSurfaceId); |
2969 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2975 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2970 | 2976 |
2971 cmd.Init(kNonexistentSurfaceId); | 2977 cmd.Init(kNonexistentSurfaceId); |
2972 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2978 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2973 | 2979 |
2974 EXPECT_EQ(surface.get(), decoder_->GetGLSurface()); | 2980 EXPECT_EQ(surface.get(), decoder_->GetGLSurface()); |
2975 } | 2981 } |
2976 | 2982 |
| 2983 // Test that with an RGB backbuffer if we set the color mask to 1,1,1,1 it is |
| 2984 // set to 1,1,1,0 at Draw time but is 1,1,1,1 at query time. |
| 2985 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMask) { |
| 2986 ColorMask cmd; |
| 2987 cmd.Init(true, true, true, true); |
| 2988 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2989 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2990 |
| 2991 SetupTexture(); |
| 2992 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 2993 SetupExpectationsForApplyingDirtyState( |
| 2994 true, // Framebuffer is RGB |
| 2995 false, // Framebuffer has depth |
| 2996 false, // Framebuffer has stencil |
| 2997 0x1110, // color bits |
| 2998 false, // depth mask |
| 2999 0, // front stencil mask |
| 3000 0); // back stencil mask |
| 3001 |
| 3002 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3003 .Times(1) |
| 3004 .RetiresOnSaturation(); |
| 3005 DrawArrays draw_cmd; |
| 3006 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 3007 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3008 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3009 |
| 3010 EXPECT_CALL(*gl_, GetError()) |
| 3011 .WillOnce(Return(GL_NO_ERROR)) |
| 3012 .WillOnce(Return(GL_NO_ERROR)) |
| 3013 .RetiresOnSaturation(); |
| 3014 typedef GetIntegerv::Result Result; |
| 3015 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3016 EXPECT_CALL(*gl_, GetIntegerv(GL_COLOR_WRITEMASK, result->GetData())) |
| 3017 .Times(0); |
| 3018 result->size = 0; |
| 3019 GetIntegerv cmd2; |
| 3020 cmd2.Init(GL_COLOR_WRITEMASK, shared_memory_id_, shared_memory_offset_); |
| 3021 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3022 EXPECT_EQ( |
| 3023 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_COLOR_WRITEMASK), |
| 3024 result->GetNumResults()); |
| 3025 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3026 EXPECT_EQ(1, result->GetData()[0]); |
| 3027 EXPECT_EQ(1, result->GetData()[1]); |
| 3028 EXPECT_EQ(1, result->GetData()[2]); |
| 3029 EXPECT_EQ(1, result->GetData()[3]); |
| 3030 } |
| 3031 |
| 3032 // Test that with no depth if we set DepthMask true that it's set to false at |
| 3033 // draw time but querying it returns true. |
| 3034 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferDepthMask) { |
| 3035 EXPECT_CALL(*gl_, DepthMask(true)) |
| 3036 .Times(0) |
| 3037 .RetiresOnSaturation(); |
| 3038 DepthMask cmd; |
| 3039 cmd.Init(true); |
| 3040 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3041 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3042 |
| 3043 SetupTexture(); |
| 3044 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 3045 SetupExpectationsForApplyingDirtyState( |
| 3046 true, // Framebuffer is RGB |
| 3047 false, // Framebuffer has depth |
| 3048 false, // Framebuffer has stencil |
| 3049 0x1110, // color bits |
| 3050 false, // depth mask |
| 3051 0, // front stencil mask |
| 3052 0); // back stencil mask |
| 3053 |
| 3054 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3055 .Times(1) |
| 3056 .RetiresOnSaturation(); |
| 3057 DrawArrays draw_cmd; |
| 3058 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 3059 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3060 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3061 |
| 3062 EXPECT_CALL(*gl_, GetError()) |
| 3063 .WillOnce(Return(GL_NO_ERROR)) |
| 3064 .WillOnce(Return(GL_NO_ERROR)) |
| 3065 .RetiresOnSaturation(); |
| 3066 typedef GetIntegerv::Result Result; |
| 3067 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3068 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_WRITEMASK, result->GetData())) |
| 3069 .Times(0); |
| 3070 result->size = 0; |
| 3071 GetIntegerv cmd2; |
| 3072 cmd2.Init(GL_DEPTH_WRITEMASK, shared_memory_id_, shared_memory_offset_); |
| 3073 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3074 EXPECT_EQ( |
| 3075 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_WRITEMASK), |
| 3076 result->GetNumResults()); |
| 3077 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3078 EXPECT_EQ(1, result->GetData()[0]); |
| 3079 } |
| 3080 |
| 3081 // Test that with no stencil if we set the stencil mask it's still set to 0 at |
| 3082 // draw time but gets our value if we query. |
| 3083 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferStencilMask) { |
| 3084 const GLint kMask = 123; |
| 3085 EXPECT_CALL(*gl_, StencilMask(kMask)) |
| 3086 .Times(0) |
| 3087 .RetiresOnSaturation(); |
| 3088 StencilMask cmd; |
| 3089 cmd.Init(kMask); |
| 3090 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3091 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3092 |
| 3093 SetupTexture(); |
| 3094 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 3095 SetupExpectationsForApplyingDirtyState( |
| 3096 true, // Framebuffer is RGB |
| 3097 false, // Framebuffer has depth |
| 3098 false, // Framebuffer has stencil |
| 3099 0x1110, // color bits |
| 3100 false, // depth mask |
| 3101 0, // front stencil mask |
| 3102 0); // back stencil mask |
| 3103 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3104 .Times(1) |
| 3105 .RetiresOnSaturation(); |
| 3106 DrawArrays draw_cmd; |
| 3107 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 3108 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3109 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3110 |
| 3111 EXPECT_CALL(*gl_, GetError()) |
| 3112 .WillOnce(Return(GL_NO_ERROR)) |
| 3113 .WillOnce(Return(GL_NO_ERROR)) |
| 3114 .RetiresOnSaturation(); |
| 3115 typedef GetIntegerv::Result Result; |
| 3116 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3117 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_TEST, result->GetData())) |
| 3118 .Times(0); |
| 3119 result->size = 0; |
| 3120 GetIntegerv cmd2; |
| 3121 cmd2.Init(GL_STENCIL_WRITEMASK, shared_memory_id_, shared_memory_offset_); |
| 3122 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3123 EXPECT_EQ( |
| 3124 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_WRITEMASK), |
| 3125 result->GetNumResults()); |
| 3126 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3127 EXPECT_EQ(kMask, result->GetData()[0]); |
| 3128 } |
| 3129 |
| 3130 // Test that if an FBO is bound we get the correct masks. |
| 3131 TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMaskFBO) { |
| 3132 ColorMask cmd; |
| 3133 cmd.Init(true, true, true, true); |
| 3134 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3135 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3136 |
| 3137 SetupTexture(); |
| 3138 SetupVertexBuffer(); |
| 3139 DoEnableVertexAttribArray(0); |
| 3140 DoVertexAttribPointer(0, 2, GL_FLOAT, 0, 0); |
| 3141 DoEnableVertexAttribArray(1); |
| 3142 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 3143 DoEnableVertexAttribArray(2); |
| 3144 DoVertexAttribPointer(2, 2, GL_FLOAT, 0, 0); |
| 3145 SetupExpectationsForApplyingDirtyState( |
| 3146 true, // Framebuffer is RGB |
| 3147 false, // Framebuffer has depth |
| 3148 false, // Framebuffer has stencil |
| 3149 0x1110, // color bits |
| 3150 false, // depth mask |
| 3151 0, // front stencil mask |
| 3152 0); // back stencil mask |
| 3153 |
| 3154 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3155 .Times(1) |
| 3156 .RetiresOnSaturation(); |
| 3157 DrawArrays draw_cmd; |
| 3158 draw_cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 3159 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3160 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3161 |
| 3162 // Check that no extra calls are made on the next draw. |
| 3163 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3164 .Times(1) |
| 3165 .RetiresOnSaturation(); |
| 3166 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3167 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3168 |
| 3169 // Setup Frame buffer. |
| 3170 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 3171 kServiceFramebufferId); |
| 3172 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)) |
| 3173 .Times(0); |
| 3174 FramebufferRenderbuffer fbrb_cmd; |
| 3175 fbrb_cmd.Init( |
| 3176 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
| 3177 client_renderbuffer_id_); |
| 3178 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3179 |
| 3180 // This time state needs to be set. |
| 3181 SetupExpectationsForApplyingDirtyState( |
| 3182 false, // Framebuffer is RGB |
| 3183 false, // Framebuffer has depth |
| 3184 false, // Framebuffer has stencil |
| 3185 0x1110, // color bits |
| 3186 false, // depth mask |
| 3187 0, // front stencil mask |
| 3188 0); // back stencil mask |
| 3189 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3190 .Times(1) |
| 3191 .RetiresOnSaturation(); |
| 3192 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3193 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3194 |
| 3195 // Check that no extra calls are made on the next draw. |
| 3196 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3197 .Times(1) |
| 3198 .RetiresOnSaturation(); |
| 3199 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3200 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3201 |
| 3202 // Unbind |
| 3203 DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); |
| 3204 |
| 3205 SetupExpectationsForApplyingDirtyState( |
| 3206 true, // Framebuffer is RGB |
| 3207 false, // Framebuffer has depth |
| 3208 false, // Framebuffer has stencil |
| 3209 0x1110, // color bits |
| 3210 false, // depth mask |
| 3211 0, // front stencil mask |
| 3212 0); // back stencil mask |
| 3213 |
| 3214 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3215 .Times(1) |
| 3216 .RetiresOnSaturation(); |
| 3217 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3218 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3219 } |
| 3220 |
| 3221 TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { |
| 3222 InitDecoder("", true, false, false, true, false, false); |
| 3223 |
| 3224 EXPECT_CALL(*gl_, GetError()) |
| 3225 .WillOnce(Return(GL_NO_ERROR)) |
| 3226 .WillOnce(Return(GL_NO_ERROR)) |
| 3227 .RetiresOnSaturation(); |
| 3228 typedef GetIntegerv::Result Result; |
| 3229 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3230 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
| 3231 .WillOnce(SetArgumentPointee<1>(8)) |
| 3232 .RetiresOnSaturation(); |
| 3233 result->size = 0; |
| 3234 GetIntegerv cmd2; |
| 3235 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
| 3236 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3237 EXPECT_EQ( |
| 3238 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
| 3239 result->GetNumResults()); |
| 3240 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3241 EXPECT_EQ(8, result->GetData()[0]); |
| 3242 } |
| 3243 |
| 3244 TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) { |
| 3245 InitDecoder("", true, false, false, false, false, false); |
| 3246 |
| 3247 EXPECT_CALL(*gl_, GetError()) |
| 3248 .WillOnce(Return(GL_NO_ERROR)) |
| 3249 .WillOnce(Return(GL_NO_ERROR)) |
| 3250 .RetiresOnSaturation(); |
| 3251 typedef GetIntegerv::Result Result; |
| 3252 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3253 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
| 3254 .WillOnce(SetArgumentPointee<1>(8)) |
| 3255 .RetiresOnSaturation(); |
| 3256 result->size = 0; |
| 3257 GetIntegerv cmd2; |
| 3258 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
| 3259 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3260 EXPECT_EQ( |
| 3261 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
| 3262 result->GetNumResults()); |
| 3263 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3264 EXPECT_EQ(0, result->GetData()[0]); |
| 3265 } |
| 3266 |
| 3267 TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) { |
| 3268 InitDecoder("", false, true, false, false, true, false); |
| 3269 |
| 3270 EXPECT_CALL(*gl_, GetError()) |
| 3271 .WillOnce(Return(GL_NO_ERROR)) |
| 3272 .WillOnce(Return(GL_NO_ERROR)) |
| 3273 .RetiresOnSaturation(); |
| 3274 typedef GetIntegerv::Result Result; |
| 3275 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3276 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
| 3277 .WillOnce(SetArgumentPointee<1>(24)) |
| 3278 .RetiresOnSaturation(); |
| 3279 result->size = 0; |
| 3280 GetIntegerv cmd2; |
| 3281 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
| 3282 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3283 EXPECT_EQ( |
| 3284 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 3285 result->GetNumResults()); |
| 3286 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3287 EXPECT_EQ(24, result->GetData()[0]); |
| 3288 } |
| 3289 |
| 3290 TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) { |
| 3291 InitDecoder("", false, true, false, false, false, false); |
| 3292 |
| 3293 EXPECT_CALL(*gl_, GetError()) |
| 3294 .WillOnce(Return(GL_NO_ERROR)) |
| 3295 .WillOnce(Return(GL_NO_ERROR)) |
| 3296 .RetiresOnSaturation(); |
| 3297 typedef GetIntegerv::Result Result; |
| 3298 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3299 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
| 3300 .WillOnce(SetArgumentPointee<1>(24)) |
| 3301 .RetiresOnSaturation(); |
| 3302 result->size = 0; |
| 3303 GetIntegerv cmd2; |
| 3304 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
| 3305 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3306 EXPECT_EQ( |
| 3307 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 3308 result->GetNumResults()); |
| 3309 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3310 EXPECT_EQ(0, result->GetData()[0]); |
| 3311 } |
| 3312 |
| 3313 TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) { |
| 3314 InitDecoder("", false, false, true, false, false, true); |
| 3315 |
| 3316 EXPECT_CALL(*gl_, GetError()) |
| 3317 .WillOnce(Return(GL_NO_ERROR)) |
| 3318 .WillOnce(Return(GL_NO_ERROR)) |
| 3319 .RetiresOnSaturation(); |
| 3320 typedef GetIntegerv::Result Result; |
| 3321 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3322 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
| 3323 .WillOnce(SetArgumentPointee<1>(8)) |
| 3324 .RetiresOnSaturation(); |
| 3325 result->size = 0; |
| 3326 GetIntegerv cmd2; |
| 3327 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
| 3328 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3329 EXPECT_EQ( |
| 3330 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
| 3331 result->GetNumResults()); |
| 3332 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3333 EXPECT_EQ(8, result->GetData()[0]); |
| 3334 } |
| 3335 |
| 3336 TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) { |
| 3337 InitDecoder("", false, false, true, false, false, false); |
| 3338 |
| 3339 EXPECT_CALL(*gl_, GetError()) |
| 3340 .WillOnce(Return(GL_NO_ERROR)) |
| 3341 .WillOnce(Return(GL_NO_ERROR)) |
| 3342 .RetiresOnSaturation(); |
| 3343 typedef GetIntegerv::Result Result; |
| 3344 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3345 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
| 3346 .WillOnce(SetArgumentPointee<1>(8)) |
| 3347 .RetiresOnSaturation(); |
| 3348 result->size = 0; |
| 3349 GetIntegerv cmd2; |
| 3350 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
| 3351 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3352 EXPECT_EQ( |
| 3353 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
| 3354 result->GetNumResults()); |
| 3355 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3356 EXPECT_EQ(0, result->GetData()[0]); |
| 3357 } |
2977 | 3358 |
2978 // TODO(gman): BufferData | 3359 // TODO(gman): BufferData |
2979 | 3360 |
2980 // TODO(gman): BufferDataImmediate | 3361 // TODO(gman): BufferDataImmediate |
2981 | 3362 |
2982 // TODO(gman): BufferSubData | 3363 // TODO(gman): BufferSubData |
2983 | 3364 |
2984 // TODO(gman): BufferSubDataImmediate | 3365 // TODO(gman): BufferSubDataImmediate |
2985 | 3366 |
2986 // TODO(gman): CompressedTexImage2D | 3367 // TODO(gman): CompressedTexImage2D |
(...skipping 13 matching lines...) Expand all Loading... |
3000 // TODO(gman): TexImage2DImmediate | 3381 // TODO(gman): TexImage2DImmediate |
3001 | 3382 |
3002 // TODO(gman): TexSubImage2DImmediate | 3383 // TODO(gman): TexSubImage2DImmediate |
3003 | 3384 |
3004 // TODO(gman): UseProgram | 3385 // TODO(gman): UseProgram |
3005 | 3386 |
3006 // TODO(gman): SwapBuffers | 3387 // TODO(gman): SwapBuffers |
3007 | 3388 |
3008 } // namespace gles2 | 3389 } // namespace gles2 |
3009 } // namespace gpu | 3390 } // namespace gpu |
OLD | NEW |