OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "gpu/command_buffer/common/gles2_cmd_format.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
9 #include "gpu/command_buffer/common/gl_mock.h" | 9 #include "gpu/command_buffer/common/gl_mock.h" |
10 #include "gpu/command_buffer/common/id_allocator.h" | 10 #include "gpu/command_buffer/common/id_allocator.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 DeleteVertexBuffer(); | 165 DeleteVertexBuffer(); |
166 | 166 |
167 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 167 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
168 .Times(0); | 168 .Times(0); |
169 DrawArrays cmd; | 169 DrawArrays cmd; |
170 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 170 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
171 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 171 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
172 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 172 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
173 } | 173 } |
174 | 174 |
175 TEST_F(GLES2DecoderWithShaderTest, | 175 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { |
176 DrawArraysDeletedProgramSucceedsWithoutGLCall) { | 176 SetupTexture(); |
177 SetupVertexBuffer(); | 177 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
178 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | |
179 DoDeleteProgram(client_program_id_, kServiceProgramId); | 178 DoDeleteProgram(client_program_id_, kServiceProgramId); |
180 | 179 |
181 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 180 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
182 .Times(0); | 181 .Times(1) |
| 182 .RetiresOnSaturation(); |
183 DrawArrays cmd; | 183 DrawArrays cmd; |
184 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 184 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
185 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 185 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
186 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 186 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
187 } | 187 } |
188 | 188 |
189 TEST_F(GLES2DecoderWithShaderTest, DrawArraysWithInvalidModeFails) { | 189 TEST_F(GLES2DecoderWithShaderTest, DrawArraysWithInvalidModeFails) { |
190 SetupVertexBuffer(); | 190 SetupVertexBuffer(); |
191 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 191 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
192 | 192 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) | 324 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) |
325 .Times(0); | 325 .Times(0); |
326 DrawElements cmd; | 326 DrawElements cmd; |
327 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 327 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
328 kValidIndexRangeStart * 2); | 328 kValidIndexRangeStart * 2); |
329 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 329 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
330 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 330 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
331 } | 331 } |
332 | 332 |
333 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceedsNoGLCall) { | 333 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { |
334 SetupVertexBuffer(); | 334 SetupTexture(); |
335 SetupIndexBuffer(); | 335 SetupIndexBuffer(); |
336 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 336 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
337 DoDeleteProgram(client_program_id_, kServiceProgramId); | 337 DoDeleteProgram(client_program_id_, kServiceProgramId); |
338 | 338 |
339 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) | 339 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) |
340 .Times(0); | 340 .Times(1); |
341 DrawElements cmd; | 341 DrawElements cmd; |
342 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 342 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
343 kValidIndexRangeStart * 2); | 343 kValidIndexRangeStart * 2); |
344 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 344 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
345 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 345 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
346 } | 346 } |
347 | 347 |
348 TEST_F(GLES2DecoderWithShaderTest, DrawElementsWithInvalidModeFails) { | 348 TEST_F(GLES2DecoderWithShaderTest, DrawElementsWithInvalidModeFails) { |
349 SetupVertexBuffer(); | 349 SetupVertexBuffer(); |
350 SetupIndexBuffer(); | 350 SetupIndexBuffer(); |
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2613 // TODO(gman): UseProgram | 2613 // TODO(gman): UseProgram |
2614 | 2614 |
2615 // TODO(gman): SwapBuffers | 2615 // TODO(gman): SwapBuffers |
2616 | 2616 |
2617 // TODO(gman): VertexAttribPointer | 2617 // TODO(gman): VertexAttribPointer |
2618 | 2618 |
2619 } // namespace gles2 | 2619 } // namespace gles2 |
2620 } // namespace gpu | 2620 } // namespace gpu |
2621 | 2621 |
2622 | 2622 |
OLD | NEW |