| 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 |
| 48 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { | 57 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { |
| 49 public: | 58 public: |
| 50 GLES2DecoderWithShaderTest() | 59 GLES2DecoderWithShaderTest() |
| 51 : GLES2DecoderWithShaderTestBase() { | 60 : GLES2DecoderWithShaderTestBase() { |
| 52 } | 61 } |
| 53 | 62 |
| 54 void AddExpectationsForSimulatedAttrib0( | 63 void AddExpectationsForSimulatedAttrib0( |
| 55 GLsizei num_vertices, GLuint buffer_id) { | 64 GLsizei num_vertices, GLuint buffer_id) { |
| 56 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, kServiceAttrib0BufferId)) | 65 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, kServiceAttrib0BufferId)) |
| 57 .Times(1) | 66 .Times(1) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 .RetiresOnSaturation(); | 82 .RetiresOnSaturation(); |
| 74 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) | 83 EXPECT_CALL(*gl_, VertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, NULL)) |
| 75 .Times(1) | 84 .Times(1) |
| 76 .RetiresOnSaturation(); | 85 .RetiresOnSaturation(); |
| 77 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) | 86 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, buffer_id)) |
| 78 .Times(1) | 87 .Times(1) |
| 79 .RetiresOnSaturation(); | 88 .RetiresOnSaturation(); |
| 80 } | 89 } |
| 81 }; | 90 }; |
| 82 | 91 |
| 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 | |
| 102 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { | 92 TEST_F(GLES2DecoderWithShaderTest, DrawArraysNoAttributesSucceeds) { |
| 103 SetupTexture(); | 93 SetupTexture(); |
| 104 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 94 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 105 SetupExpectationsForApplyingDefaultDirtyState(); | |
| 106 | 95 |
| 107 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 96 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 108 .Times(1) | 97 .Times(1) |
| 109 .RetiresOnSaturation(); | 98 .RetiresOnSaturation(); |
| 110 DrawArrays cmd; | 99 DrawArrays cmd; |
| 111 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 100 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 112 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 101 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 113 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 102 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 114 } | 103 } |
| 115 | 104 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 135 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) | 124 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
| 136 .Times(1) | 125 .Times(1) |
| 137 .RetiresOnSaturation(); | 126 .RetiresOnSaturation(); |
| 138 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 127 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
| 139 .Times(1) | 128 .Times(1) |
| 140 .RetiresOnSaturation(); | 129 .RetiresOnSaturation(); |
| 141 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) | 130 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
| 142 .Times(1) | 131 .Times(1) |
| 143 .RetiresOnSaturation(); | 132 .RetiresOnSaturation(); |
| 144 } | 133 } |
| 145 SetupExpectationsForApplyingDefaultDirtyState(); | |
| 146 DrawArrays cmd; | 134 DrawArrays cmd; |
| 147 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 135 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 148 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 136 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 149 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 137 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 150 } | 138 } |
| 151 | 139 |
| 152 TEST_F(GLES2DecoderWithShaderTest, DrawArraysMissingAttributesFails) { | 140 TEST_F(GLES2DecoderWithShaderTest, DrawArraysMissingAttributesFails) { |
| 153 DoEnableVertexAttribArray(1); | 141 DoEnableVertexAttribArray(1); |
| 154 | 142 |
| 155 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 143 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 168 .Times(0); | 156 .Times(0); |
| 169 DrawArrays cmd; | 157 DrawArrays cmd; |
| 170 cmd.Init(GL_TRIANGLES, 0, 0); | 158 cmd.Init(GL_TRIANGLES, 0, 0); |
| 171 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 159 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 172 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 160 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 173 } | 161 } |
| 174 | 162 |
| 175 TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { | 163 TEST_F(GLES2DecoderWithShaderTest, DrawArraysValidAttributesSucceeds) { |
| 176 SetupTexture(); | 164 SetupTexture(); |
| 177 SetupVertexBuffer(); | 165 SetupVertexBuffer(); |
| 178 DoEnableVertexAttribArray(1); | |
| 179 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 166 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 180 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); | 167 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
| 181 SetupExpectationsForApplyingDefaultDirtyState(); | |
| 182 | 168 |
| 183 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 169 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 184 .Times(1) | 170 .Times(1) |
| 185 .RetiresOnSaturation(); | 171 .RetiresOnSaturation(); |
| 186 DrawArrays cmd; | 172 DrawArrays cmd; |
| 187 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 173 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 188 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 174 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 189 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 175 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 190 } | 176 } |
| 191 | 177 |
| 192 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { | 178 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedBufferFails) { |
| 193 SetupVertexBuffer(); | 179 SetupVertexBuffer(); |
| 194 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 180 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 195 DeleteVertexBuffer(); | 181 DeleteVertexBuffer(); |
| 196 | 182 |
| 197 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 183 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
| 198 .Times(0); | 184 .Times(0); |
| 199 DrawArrays cmd; | 185 DrawArrays cmd; |
| 200 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 186 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 201 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 187 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 202 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 188 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 203 } | 189 } |
| 204 | 190 |
| 205 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { | 191 TEST_F(GLES2DecoderWithShaderTest, DrawArraysDeletedProgramSucceeds) { |
| 206 SetupTexture(); | 192 SetupTexture(); |
| 207 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 193 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 208 SetupExpectationsForApplyingDefaultDirtyState(); | |
| 209 DoDeleteProgram(client_program_id_, kServiceProgramId); | 194 DoDeleteProgram(client_program_id_, kServiceProgramId); |
| 210 | 195 |
| 211 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 196 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
| 212 .Times(1) | 197 .Times(1) |
| 213 .RetiresOnSaturation(); | 198 .RetiresOnSaturation(); |
| 214 DrawArrays cmd; | 199 DrawArrays cmd; |
| 215 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 200 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 216 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 201 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 217 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 202 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 218 } | 203 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); | 252 DoVertexAttribPointer(1, 2, GL_FLOAT, sizeof(GLfloat) * 3, 0); |
| 268 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 269 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 254 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 270 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 255 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 271 } | 256 } |
| 272 | 257 |
| 273 TEST_F(GLES2DecoderWithShaderTest, DrawElementsNoAttributesSucceeds) { | 258 TEST_F(GLES2DecoderWithShaderTest, DrawElementsNoAttributesSucceeds) { |
| 274 SetupTexture(); | 259 SetupTexture(); |
| 275 SetupIndexBuffer(); | 260 SetupIndexBuffer(); |
| 276 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); | 261 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
| 277 SetupExpectationsForApplyingDefaultDirtyState(); | |
| 278 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, | 262 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, |
| 279 GL_UNSIGNED_SHORT, | 263 GL_UNSIGNED_SHORT, |
| 280 BufferOffset(kValidIndexRangeStart * 2))) | 264 BufferOffset(kValidIndexRangeStart * 2))) |
| 281 .Times(1) | 265 .Times(1) |
| 282 .RetiresOnSaturation(); | 266 .RetiresOnSaturation(); |
| 283 DrawElements cmd; | 267 DrawElements cmd; |
| 284 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 268 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
| 285 kValidIndexRangeStart * 2); | 269 kValidIndexRangeStart * 2); |
| 286 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 270 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 287 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 271 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 310 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 327 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 311 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 328 } | 312 } |
| 329 | 313 |
| 330 TEST_F(GLES2DecoderWithShaderTest, DrawElementsValidAttributesSucceeds) { | 314 TEST_F(GLES2DecoderWithShaderTest, DrawElementsValidAttributesSucceeds) { |
| 331 SetupTexture(); | 315 SetupTexture(); |
| 332 SetupVertexBuffer(); | 316 SetupVertexBuffer(); |
| 333 SetupIndexBuffer(); | 317 SetupIndexBuffer(); |
| 334 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 318 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 335 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); | 319 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, kServiceBufferId); |
| 336 SetupExpectationsForApplyingDefaultDirtyState(); | |
| 337 | 320 |
| 338 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, | 321 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, |
| 339 GL_UNSIGNED_SHORT, | 322 GL_UNSIGNED_SHORT, |
| 340 BufferOffset(kValidIndexRangeStart * 2))) | 323 BufferOffset(kValidIndexRangeStart * 2))) |
| 341 .Times(1) | 324 .Times(1) |
| 342 .RetiresOnSaturation(); | 325 .RetiresOnSaturation(); |
| 343 DrawElements cmd; | 326 DrawElements cmd; |
| 344 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 327 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
| 345 kValidIndexRangeStart * 2); | 328 kValidIndexRangeStart * 2); |
| 346 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 329 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 359 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 342 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
| 360 kValidIndexRangeStart * 2); | 343 kValidIndexRangeStart * 2); |
| 361 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 344 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 362 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 345 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 363 } | 346 } |
| 364 | 347 |
| 365 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { | 348 TEST_F(GLES2DecoderWithShaderTest, DrawElementsDeletedProgramSucceeds) { |
| 366 SetupTexture(); | 349 SetupTexture(); |
| 367 SetupIndexBuffer(); | 350 SetupIndexBuffer(); |
| 368 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); | 351 AddExpectationsForSimulatedAttrib0(kMaxValidIndex + 1, 0); |
| 369 SetupExpectationsForApplyingDefaultDirtyState(); | |
| 370 DoDeleteProgram(client_program_id_, kServiceProgramId); | 352 DoDeleteProgram(client_program_id_, kServiceProgramId); |
| 371 | 353 |
| 372 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) | 354 EXPECT_CALL(*gl_, DrawElements(_, _, _, _)) |
| 373 .Times(1); | 355 .Times(1); |
| 374 DrawElements cmd; | 356 DrawElements cmd; |
| 375 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 357 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
| 376 kValidIndexRangeStart * 2); | 358 kValidIndexRangeStart * 2); |
| 377 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 359 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 378 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 360 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 379 } | 361 } |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 .Times(0); | 1238 .Times(0); |
| 1257 CheckFramebufferStatus::Result* result = | 1239 CheckFramebufferStatus::Result* result = |
| 1258 static_cast<CheckFramebufferStatus::Result*>(shared_memory_address_); | 1240 static_cast<CheckFramebufferStatus::Result*>(shared_memory_address_); |
| 1259 *result = 0; | 1241 *result = 0; |
| 1260 CheckFramebufferStatus cmd; | 1242 CheckFramebufferStatus cmd; |
| 1261 cmd.Init(GL_FRAMEBUFFER, shared_memory_id_, shared_memory_offset_); | 1243 cmd.Init(GL_FRAMEBUFFER, shared_memory_id_, shared_memory_offset_); |
| 1262 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1244 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1263 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), *result); | 1245 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), *result); |
| 1264 } | 1246 } |
| 1265 | 1247 |
| 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 | |
| 1282 TEST_F(GLES2DecoderTest, FramebufferRenderbufferWithNoBoundTarget) { | 1248 TEST_F(GLES2DecoderTest, FramebufferRenderbufferWithNoBoundTarget) { |
| 1283 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)) | 1249 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)) |
| 1284 .Times(0); | 1250 .Times(0); |
| 1285 FramebufferRenderbuffer cmd; | 1251 FramebufferRenderbuffer cmd; |
| 1286 cmd.Init( | 1252 cmd.Init( |
| 1287 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 1253 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
| 1288 client_renderbuffer_id_); | 1254 client_renderbuffer_id_); |
| 1289 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1255 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1290 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1256 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1291 } | 1257 } |
| 1292 | 1258 |
| 1293 TEST_F(GLES2DecoderTest, FramebufferTexture2DWithNoBoundTarget) { | 1259 TEST_F(GLES2DecoderTest, FramebufferTexture2DWithNoBoundTarget) { |
| 1294 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)) | 1260 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)) |
| 1295 .Times(0); | 1261 .Times(0); |
| 1296 FramebufferTexture2D cmd; | 1262 FramebufferTexture2D cmd; |
| 1297 cmd.Init( | 1263 cmd.Init( |
| 1298 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, | 1264 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1327 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 1293 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
| 1328 kServiceRenderbufferId)) | 1294 kServiceRenderbufferId)) |
| 1329 .Times(1) | 1295 .Times(1) |
| 1330 .RetiresOnSaturation(); | 1296 .RetiresOnSaturation(); |
| 1331 EXPECT_CALL(*gl_, GetError()) | 1297 EXPECT_CALL(*gl_, GetError()) |
| 1332 .WillOnce(Return(GL_NO_ERROR)) | 1298 .WillOnce(Return(GL_NO_ERROR)) |
| 1333 .RetiresOnSaturation(); | 1299 .RetiresOnSaturation(); |
| 1334 SetupExpectationsForFramebufferAttachment( | 1300 SetupExpectationsForFramebufferAttachment( |
| 1335 GL_COLOR_BUFFER_BIT, // clear bits | 1301 GL_COLOR_BUFFER_BIT, // clear bits |
| 1336 0, 0, 0, 0, // color | 1302 0, 0, 0, 0, // color |
| 1303 0x1111, // color bits |
| 1337 0, // stencil | 1304 0, // stencil |
| 1305 -1, // stencil mask back, |
| 1306 -1, // stencil mask front, |
| 1338 1.0f, // depth | 1307 1.0f, // depth |
| 1308 1, // depth mask |
| 1339 false); // scissor test | 1309 false); // scissor test |
| 1340 EXPECT_CALL(*gl_, GetError()) | 1310 EXPECT_CALL(*gl_, GetError()) |
| 1341 .WillOnce(Return(GL_NO_ERROR)) | 1311 .WillOnce(Return(GL_NO_ERROR)) |
| 1342 .WillOnce(Return(GL_NO_ERROR)) | 1312 .WillOnce(Return(GL_NO_ERROR)) |
| 1343 .RetiresOnSaturation(); | 1313 .RetiresOnSaturation(); |
| 1344 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( | 1314 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( |
| 1345 GL_FRAMEBUFFER, | 1315 GL_FRAMEBUFFER, |
| 1346 GL_COLOR_ATTACHMENT0, | 1316 GL_COLOR_ATTACHMENT0, |
| 1347 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) | 1317 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) |
| 1348 .WillOnce(SetArgumentPointee<3>(kServiceRenderbufferId)) | 1318 .WillOnce(SetArgumentPointee<3>(kServiceRenderbufferId)) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 1353 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| 1384 kServiceTextureId, 0)) | 1354 kServiceTextureId, 0)) |
| 1385 .Times(1) | 1355 .Times(1) |
| 1386 .RetiresOnSaturation(); | 1356 .RetiresOnSaturation(); |
| 1387 EXPECT_CALL(*gl_, GetError()) | 1357 EXPECT_CALL(*gl_, GetError()) |
| 1388 .WillOnce(Return(GL_NO_ERROR)) | 1358 .WillOnce(Return(GL_NO_ERROR)) |
| 1389 .RetiresOnSaturation(); | 1359 .RetiresOnSaturation(); |
| 1390 SetupExpectationsForFramebufferAttachment( | 1360 SetupExpectationsForFramebufferAttachment( |
| 1391 0, // clear bits | 1361 0, // clear bits |
| 1392 0, 0, 0, 0, // color | 1362 0, 0, 0, 0, // color |
| 1363 0x1111, // color bits |
| 1393 0, // stencil | 1364 0, // stencil |
| 1365 -1, // stencil mask back, |
| 1366 -1, // stencil mask front, |
| 1394 1.0f, // depth | 1367 1.0f, // depth |
| 1368 1, // depth mask |
| 1395 false); // scissor test | 1369 false); // scissor test |
| 1396 EXPECT_CALL(*gl_, GetError()) | 1370 EXPECT_CALL(*gl_, GetError()) |
| 1397 .WillOnce(Return(GL_NO_ERROR)) | 1371 .WillOnce(Return(GL_NO_ERROR)) |
| 1398 .WillOnce(Return(GL_NO_ERROR)) | 1372 .WillOnce(Return(GL_NO_ERROR)) |
| 1399 .RetiresOnSaturation(); | 1373 .RetiresOnSaturation(); |
| 1400 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( | 1374 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT( |
| 1401 GL_FRAMEBUFFER, | 1375 GL_FRAMEBUFFER, |
| 1402 GL_COLOR_ATTACHMENT0, | 1376 GL_COLOR_ATTACHMENT0, |
| 1403 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) | 1377 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, _)) |
| 1404 .WillOnce(SetArgumentPointee<3>(kServiceTextureId)) | 1378 .WillOnce(SetArgumentPointee<3>(kServiceTextureId)) |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 1535 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| 1562 kServiceTextureId, 0)) | 1536 kServiceTextureId, 0)) |
| 1563 .Times(1) | 1537 .Times(1) |
| 1564 .RetiresOnSaturation(); | 1538 .RetiresOnSaturation(); |
| 1565 EXPECT_CALL(*gl_, GetError()) | 1539 EXPECT_CALL(*gl_, GetError()) |
| 1566 .WillOnce(Return(GL_NO_ERROR)) | 1540 .WillOnce(Return(GL_NO_ERROR)) |
| 1567 .RetiresOnSaturation(); | 1541 .RetiresOnSaturation(); |
| 1568 SetupExpectationsForFramebufferAttachment( | 1542 SetupExpectationsForFramebufferAttachment( |
| 1569 0, // clear bits | 1543 0, // clear bits |
| 1570 0, 0, 0, 0, // color | 1544 0, 0, 0, 0, // color |
| 1545 0x1111, // color bits |
| 1571 0, // stencil | 1546 0, // stencil |
| 1547 -1, // stencil mask back, |
| 1548 -1, // stencil mask front, |
| 1572 1.0f, // depth | 1549 1.0f, // depth |
| 1550 1, // depth mask |
| 1573 false); // scissor test | 1551 false); // scissor test |
| 1574 FramebufferTexture2D fbtex_cmd; | 1552 FramebufferTexture2D fbtex_cmd; |
| 1575 fbtex_cmd.Init( | 1553 fbtex_cmd.Init( |
| 1576 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, | 1554 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, client_texture_id_, |
| 1577 0); | 1555 0); |
| 1578 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); | 1556 EXPECT_EQ(error::kNoError, ExecuteCmd(fbtex_cmd)); |
| 1579 } | 1557 } |
| 1580 | 1558 |
| 1581 ReadPixelsEmulator emu( | 1559 ReadPixelsEmulator emu( |
| 1582 kWidth, kHeight, kBytesPerPixel, kSrcPixels, kSrcPixels, kPackAlignment); | 1560 kWidth, kHeight, kBytesPerPixel, kSrcPixels, kSrcPixels, kPackAlignment); |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); | 2522 color_cmd.Init(0.1f, 0.2f, 0.3f, 0.4f); |
| 2545 color_mask_cmd.Init(0, 1, 0, 1); | 2523 color_mask_cmd.Init(0, 1, 0, 1); |
| 2546 enable_cmd.Init(GL_SCISSOR_TEST); | 2524 enable_cmd.Init(GL_SCISSOR_TEST); |
| 2547 cmd.Init( | 2525 cmd.Init( |
| 2548 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 2526 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
| 2549 client_renderbuffer_id_); | 2527 client_renderbuffer_id_); |
| 2550 InSequence sequence; | 2528 InSequence sequence; |
| 2551 EXPECT_CALL(*gl_, ClearColor(0.1f, 0.2f, 0.3f, 0.4f)) | 2529 EXPECT_CALL(*gl_, ClearColor(0.1f, 0.2f, 0.3f, 0.4f)) |
| 2552 .Times(1) | 2530 .Times(1) |
| 2553 .RetiresOnSaturation(); | 2531 .RetiresOnSaturation(); |
| 2554 // EXPECT_CALL(*gl_, ColorMask(0, 1, 0, 1)) | 2532 EXPECT_CALL(*gl_, ColorMask(0, 1, 0, 1)) |
| 2555 // .Times(0) | 2533 .Times(1) |
| 2556 // .RetiresOnSaturation(); | 2534 .RetiresOnSaturation(); |
| 2557 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) | 2535 EXPECT_CALL(*gl_, Enable(GL_SCISSOR_TEST)) |
| 2558 .Times(1) | 2536 .Times(1) |
| 2559 .RetiresOnSaturation(); | 2537 .RetiresOnSaturation(); |
| 2560 EXPECT_CALL(*gl_, GetError()) | 2538 EXPECT_CALL(*gl_, GetError()) |
| 2561 .WillOnce(Return(GL_NO_ERROR)) | 2539 .WillOnce(Return(GL_NO_ERROR)) |
| 2562 .RetiresOnSaturation(); | 2540 .RetiresOnSaturation(); |
| 2563 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2541 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
| 2564 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 2542 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
| 2565 kServiceRenderbufferId)) | 2543 kServiceRenderbufferId)) |
| 2566 .Times(1) | 2544 .Times(1) |
| 2567 .RetiresOnSaturation(); | 2545 .RetiresOnSaturation(); |
| 2568 EXPECT_CALL(*gl_, GetError()) | 2546 EXPECT_CALL(*gl_, GetError()) |
| 2569 .WillOnce(Return(GL_NO_ERROR)) | 2547 .WillOnce(Return(GL_NO_ERROR)) |
| 2570 .RetiresOnSaturation(); | 2548 .RetiresOnSaturation(); |
| 2571 SetupExpectationsForFramebufferAttachment( | 2549 SetupExpectationsForFramebufferAttachment( |
| 2572 GL_COLOR_BUFFER_BIT, // clear bits | 2550 GL_COLOR_BUFFER_BIT, // clear bits |
| 2573 0.1f, 0.2f, 0.3f, 0.4f, // color | 2551 0.1f, 0.2f, 0.3f, 0.4f, // color |
| 2552 0x0101, // color bits |
| 2574 0, // stencil | 2553 0, // stencil |
| 2554 -1, // stencil mask back |
| 2555 -1, // stencil mask front |
| 2575 1.0f, // depth | 2556 1.0f, // depth |
| 2557 1, // depth mask |
| 2576 true); // scissor test | 2558 true); // scissor test |
| 2577 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); | 2559 EXPECT_EQ(error::kNoError, ExecuteCmd(color_cmd)); |
| 2578 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); | 2560 EXPECT_EQ(error::kNoError, ExecuteCmd(color_mask_cmd)); |
| 2579 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); | 2561 EXPECT_EQ(error::kNoError, ExecuteCmd(enable_cmd)); |
| 2580 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2562 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2581 } | 2563 } |
| 2582 | 2564 |
| 2583 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { | 2565 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearDepth) { |
| 2584 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 2566 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 2585 kServiceFramebufferId); | 2567 kServiceFramebufferId); |
| 2586 ClearDepthf depth_cmd; | 2568 ClearDepthf depth_cmd; |
| 2587 DepthMask depth_mask_cmd; | 2569 DepthMask depth_mask_cmd; |
| 2588 FramebufferRenderbuffer cmd; | 2570 FramebufferRenderbuffer cmd; |
| 2589 depth_cmd.Init(0.5f); | 2571 depth_cmd.Init(0.5f); |
| 2590 depth_mask_cmd.Init(false); | 2572 depth_mask_cmd.Init(false); |
| 2591 cmd.Init( | 2573 cmd.Init( |
| 2592 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, | 2574 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, |
| 2593 client_renderbuffer_id_); | 2575 client_renderbuffer_id_); |
| 2594 InSequence sequence; | 2576 InSequence sequence; |
| 2595 EXPECT_CALL(*gl_, ClearDepth(0.5f)) | 2577 EXPECT_CALL(*gl_, ClearDepth(0.5f)) |
| 2596 .Times(1) | 2578 .Times(1) |
| 2597 .RetiresOnSaturation(); | 2579 .RetiresOnSaturation(); |
| 2598 // EXPECT_CALL(*gl_, DepthMask(0)) | 2580 EXPECT_CALL(*gl_, DepthMask(0)) |
| 2599 // .Times(1) | 2581 .Times(1) |
| 2600 // .RetiresOnSaturation(); | 2582 .RetiresOnSaturation(); |
| 2601 EXPECT_CALL(*gl_, GetError()) | 2583 EXPECT_CALL(*gl_, GetError()) |
| 2602 .WillOnce(Return(GL_NO_ERROR)) | 2584 .WillOnce(Return(GL_NO_ERROR)) |
| 2603 .RetiresOnSaturation(); | 2585 .RetiresOnSaturation(); |
| 2604 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2586 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
| 2605 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, | 2587 GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, |
| 2606 kServiceRenderbufferId)) | 2588 kServiceRenderbufferId)) |
| 2607 .Times(1) | 2589 .Times(1) |
| 2608 .RetiresOnSaturation(); | 2590 .RetiresOnSaturation(); |
| 2609 EXPECT_CALL(*gl_, GetError()) | 2591 EXPECT_CALL(*gl_, GetError()) |
| 2610 .WillOnce(Return(GL_NO_ERROR)) | 2592 .WillOnce(Return(GL_NO_ERROR)) |
| 2611 .RetiresOnSaturation(); | 2593 .RetiresOnSaturation(); |
| 2612 SetupExpectationsForFramebufferAttachment( | 2594 SetupExpectationsForFramebufferAttachment( |
| 2613 GL_DEPTH_BUFFER_BIT, // clear bits | 2595 GL_DEPTH_BUFFER_BIT, // clear bits |
| 2614 0, 0, 0, 0, // color | 2596 0, 0, 0, 0, // color |
| 2597 0x1111, // color bits |
| 2615 0, // stencil | 2598 0, // stencil |
| 2599 -1, // stencil mask back, |
| 2600 -1, // stencil mask front, |
| 2616 0.5f, // depth | 2601 0.5f, // depth |
| 2602 0, // depth mask |
| 2617 false); // scissor test | 2603 false); // scissor test |
| 2618 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 2604 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
| 2619 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); | 2605 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_mask_cmd)); |
| 2620 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2606 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2621 } | 2607 } |
| 2622 | 2608 |
| 2623 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { | 2609 TEST_F(GLES2DecoderTest, FramebufferRenderbufferClearStencil) { |
| 2624 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 2610 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 2625 kServiceFramebufferId); | 2611 kServiceFramebufferId); |
| 2626 ClearStencil stencil_cmd; | 2612 ClearStencil stencil_cmd; |
| 2627 StencilMaskSeparate stencil_mask_separate_cmd; | 2613 StencilMaskSeparate stencil_mask_separate_cmd; |
| 2628 FramebufferRenderbuffer cmd; | 2614 FramebufferRenderbuffer cmd; |
| 2629 stencil_cmd.Init(123); | 2615 stencil_cmd.Init(123); |
| 2630 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); | 2616 stencil_mask_separate_cmd.Init(GL_BACK, 0x1234u); |
| 2631 cmd.Init( | 2617 cmd.Init( |
| 2632 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 2618 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
| 2633 client_renderbuffer_id_); | 2619 client_renderbuffer_id_); |
| 2634 InSequence sequence; | 2620 InSequence sequence; |
| 2635 EXPECT_CALL(*gl_, ClearStencil(123)) | 2621 EXPECT_CALL(*gl_, ClearStencil(123)) |
| 2636 .Times(1) | 2622 .Times(1) |
| 2637 .RetiresOnSaturation(); | 2623 .RetiresOnSaturation(); |
| 2638 // EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0x1234u)) | 2624 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0x1234u)) |
| 2639 // .Times(1) | 2625 .Times(1) |
| 2640 // .RetiresOnSaturation(); | 2626 .RetiresOnSaturation(); |
| 2641 EXPECT_CALL(*gl_, GetError()) | 2627 EXPECT_CALL(*gl_, GetError()) |
| 2642 .WillOnce(Return(GL_NO_ERROR)) | 2628 .WillOnce(Return(GL_NO_ERROR)) |
| 2643 .RetiresOnSaturation(); | 2629 .RetiresOnSaturation(); |
| 2644 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2630 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
| 2645 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 2631 GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
| 2646 kServiceRenderbufferId)) | 2632 kServiceRenderbufferId)) |
| 2647 .Times(1) | 2633 .Times(1) |
| 2648 .RetiresOnSaturation(); | 2634 .RetiresOnSaturation(); |
| 2649 EXPECT_CALL(*gl_, GetError()) | 2635 EXPECT_CALL(*gl_, GetError()) |
| 2650 .WillOnce(Return(GL_NO_ERROR)) | 2636 .WillOnce(Return(GL_NO_ERROR)) |
| 2651 .RetiresOnSaturation(); | 2637 .RetiresOnSaturation(); |
| 2652 SetupExpectationsForFramebufferAttachment( | 2638 SetupExpectationsForFramebufferAttachment( |
| 2653 GL_STENCIL_BUFFER_BIT, // clear bits | 2639 GL_STENCIL_BUFFER_BIT, // clear bits |
| 2654 0, 0, 0, 0, // color | 2640 0, 0, 0, 0, // color |
| 2641 0x1111, // color bits |
| 2655 123, // stencil | 2642 123, // stencil |
| 2643 -1, // stencil mask back, |
| 2644 0x1234u, // stencil mask front, |
| 2656 1.0f, // depth | 2645 1.0f, // depth |
| 2646 1, // depth mask |
| 2657 false); // scissor test | 2647 false); // scissor test |
| 2658 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 2648 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
| 2659 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); | 2649 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_mask_separate_cmd)); |
| 2660 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2650 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2661 } | 2651 } |
| 2662 | 2652 |
| 2663 TEST_F(GLES2DecoderTest, IsBuffer) { | 2653 TEST_F(GLES2DecoderTest, IsBuffer) { |
| 2664 EXPECT_FALSE(DoIsBuffer(client_buffer_id_)); | 2654 EXPECT_FALSE(DoIsBuffer(client_buffer_id_)); |
| 2665 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); | 2655 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, kServiceBufferId); |
| 2666 EXPECT_TRUE(DoIsBuffer(client_buffer_id_)); | 2656 EXPECT_TRUE(DoIsBuffer(client_buffer_id_)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2728 .Times(1) | 2718 .Times(1) |
| 2729 .RetiresOnSaturation(); | 2719 .RetiresOnSaturation(); |
| 2730 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( | 2720 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT( |
| 2731 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | 2721 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, |
| 2732 kServiceRenderbufferId)) | 2722 kServiceRenderbufferId)) |
| 2733 .Times(1) | 2723 .Times(1) |
| 2734 .RetiresOnSaturation(); | 2724 .RetiresOnSaturation(); |
| 2735 SetupExpectationsForFramebufferAttachment( | 2725 SetupExpectationsForFramebufferAttachment( |
| 2736 GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, // clear bits | 2726 GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, // clear bits |
| 2737 0, 0, 0, 0, // color | 2727 0, 0, 0, 0, // color |
| 2728 0x1111, // color bits |
| 2738 123, // stencil | 2729 123, // stencil |
| 2730 -1, // stencil mask back, |
| 2731 -1, // stencil mask front, |
| 2739 0.5f, // depth | 2732 0.5f, // depth |
| 2733 1, // depth mask |
| 2740 false); // scissor test | 2734 false); // scissor test |
| 2741 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); | 2735 EXPECT_EQ(error::kNoError, ExecuteCmd(depth_cmd)); |
| 2742 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); | 2736 EXPECT_EQ(error::kNoError, ExecuteCmd(stencil_cmd)); |
| 2743 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2737 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2744 } | 2738 } |
| 2745 #endif | 2739 #endif |
| 2746 | 2740 |
| 2747 TEST_F(GLES2DecoderWithShaderTest, VertexAttribPointer) { | 2741 TEST_F(GLES2DecoderWithShaderTest, VertexAttribPointer) { |
| 2748 SetupVertexBuffer(); | 2742 SetupVertexBuffer(); |
| 2749 static const GLenum types[] = { | 2743 static const GLenum types[] = { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2973 SetSurfaceCHROMIUM cmd; | 2967 SetSurfaceCHROMIUM cmd; |
| 2974 cmd.Init(kExistentSurfaceId); | 2968 cmd.Init(kExistentSurfaceId); |
| 2975 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2969 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2976 | 2970 |
| 2977 cmd.Init(kNonexistentSurfaceId); | 2971 cmd.Init(kNonexistentSurfaceId); |
| 2978 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2972 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2979 | 2973 |
| 2980 EXPECT_EQ(surface.get(), decoder_->GetGLSurface()); | 2974 EXPECT_EQ(surface.get(), decoder_->GetGLSurface()); |
| 2981 } | 2975 } |
| 2982 | 2976 |
| 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 } | |
| 3358 | 2977 |
| 3359 // TODO(gman): BufferData | 2978 // TODO(gman): BufferData |
| 3360 | 2979 |
| 3361 // TODO(gman): BufferDataImmediate | 2980 // TODO(gman): BufferDataImmediate |
| 3362 | 2981 |
| 3363 // TODO(gman): BufferSubData | 2982 // TODO(gman): BufferSubData |
| 3364 | 2983 |
| 3365 // TODO(gman): BufferSubDataImmediate | 2984 // TODO(gman): BufferSubDataImmediate |
| 3366 | 2985 |
| 3367 // TODO(gman): CompressedTexImage2D | 2986 // TODO(gman): CompressedTexImage2D |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3381 // TODO(gman): TexImage2DImmediate | 3000 // TODO(gman): TexImage2DImmediate |
| 3382 | 3001 |
| 3383 // TODO(gman): TexSubImage2DImmediate | 3002 // TODO(gman): TexSubImage2DImmediate |
| 3384 | 3003 |
| 3385 // TODO(gman): UseProgram | 3004 // TODO(gman): UseProgram |
| 3386 | 3005 |
| 3387 // TODO(gman): SwapBuffers | 3006 // TODO(gman): SwapBuffers |
| 3388 | 3007 |
| 3389 } // namespace gles2 | 3008 } // namespace gles2 |
| 3390 } // namespace gpu | 3009 } // namespace gpu |
| OLD | NEW |