| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 bool init); | 64 bool init); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class GLES2DecoderTestWithExtensionsOnGLES2 | 67 class GLES2DecoderTestWithExtensionsOnGLES2 |
| 68 : public GLES2DecoderTest, | 68 : public GLES2DecoderTest, |
| 69 public ::testing::WithParamInterface<const char*> { | 69 public ::testing::WithParamInterface<const char*> { |
| 70 public: | 70 public: |
| 71 GLES2DecoderTestWithExtensionsOnGLES2() {} | 71 GLES2DecoderTestWithExtensionsOnGLES2() {} |
| 72 | 72 |
| 73 virtual void SetUp() { | 73 virtual void SetUp() { |
| 74 InitDecoder(GetParam(), // extensions | 74 InitState init; |
| 75 "opengl es 2.0", // gl version | 75 init.extensions = GetParam(); |
| 76 true, // has alpha | 76 init.gl_version = "opengl es 2.0"; |
| 77 true, // has depth | 77 init.has_alpha = true; |
| 78 false, // has stencil | 78 init.has_depth = true; |
| 79 true, // request alpha | 79 init.request_alpha = true; |
| 80 true, // request depth | 80 init.request_depth = true; |
| 81 false, // request stencil | 81 InitDecoder(init); |
| 82 false); // bind generates resource | |
| 83 } | 82 } |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { | 85 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { |
| 87 public: | 86 public: |
| 88 GLES2DecoderWithShaderTest() | 87 GLES2DecoderWithShaderTest() |
| 89 : GLES2DecoderWithShaderTestBase() { | 88 : GLES2DecoderWithShaderTestBase() { |
| 90 } | 89 } |
| 91 | 90 |
| 92 void CheckTextureChangesMarkFBOAsNotComplete(bool bound_fbo); | 91 void CheckTextureChangesMarkFBOAsNotComplete(bool bound_fbo); |
| 93 void CheckRenderbufferChangesMarkFBOAsNotComplete(bool bound_fbo); | 92 void CheckRenderbufferChangesMarkFBOAsNotComplete(bool bound_fbo); |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 class GLES2DecoderGeometryInstancingTest : public GLES2DecoderWithShaderTest { | 95 class GLES2DecoderGeometryInstancingTest : public GLES2DecoderWithShaderTest { |
| 97 public: | 96 public: |
| 98 GLES2DecoderGeometryInstancingTest() | 97 GLES2DecoderGeometryInstancingTest() |
| 99 : GLES2DecoderWithShaderTest() { | 98 : GLES2DecoderWithShaderTest() { |
| 100 } | 99 } |
| 101 | 100 |
| 102 virtual void SetUp() { | 101 virtual void SetUp() { |
| 103 InitDecoder( | 102 InitState init; |
| 104 "GL_ANGLE_instanced_arrays", // extensions | 103 init.extensions = "GL_ANGLE_instanced_arrays"; |
| 105 "opengl es 2.0", // gl version | 104 init.gl_version = "opengl es 2.0"; |
| 106 true, // has alpha | 105 init.has_alpha = true; |
| 107 true, // has depth | 106 init.has_depth = true; |
| 108 false, // has stencil | 107 init.request_alpha = true; |
| 109 true, // request alpha | 108 init.request_depth = true; |
| 110 true, // request depth | 109 init.bind_generates_resource = true; |
| 111 false, // request stencil | 110 InitDecoder(init); |
| 112 true); // bind generates resource | |
| 113 SetupDefaultProgram(); | 111 SetupDefaultProgram(); |
| 114 } | 112 } |
| 115 }; | 113 }; |
| 116 | 114 |
| 117 class GLES2DecoderRGBBackbufferTest : public GLES2DecoderWithShaderTest { | 115 class GLES2DecoderRGBBackbufferTest : public GLES2DecoderWithShaderTest { |
| 118 public: | 116 public: |
| 119 GLES2DecoderRGBBackbufferTest() { } | 117 GLES2DecoderRGBBackbufferTest() { } |
| 120 | 118 |
| 121 virtual void SetUp() { | 119 virtual void SetUp() { |
| 122 // Test codepath with workaround clear_alpha_in_readpixels because | 120 // Test codepath with workaround clear_alpha_in_readpixels because |
| 123 // ReadPixelsEmulator emulates the incorrect driver behavior. | 121 // ReadPixelsEmulator emulates the incorrect driver behavior. |
| 124 CommandLine command_line(0, NULL); | 122 CommandLine command_line(0, NULL); |
| 125 command_line.AppendSwitchASCII( | 123 command_line.AppendSwitchASCII( |
| 126 switches::kGpuDriverBugWorkarounds, | 124 switches::kGpuDriverBugWorkarounds, |
| 127 base::IntToString(gpu::CLEAR_ALPHA_IN_READPIXELS)); | 125 base::IntToString(gpu::CLEAR_ALPHA_IN_READPIXELS)); |
| 128 InitDecoderWithCommandLine( | 126 InitState init; |
| 129 "", // extensions | 127 init.gl_version = "3.0"; |
| 130 "3.0", // gl version | 128 init.bind_generates_resource = true; |
| 131 false, // has alpha | 129 InitDecoderWithCommandLine(init, &command_line); |
| 132 false, // has depth | |
| 133 false, // has stencil | |
| 134 false, // request alpha | |
| 135 false, // request depth | |
| 136 false, // request stencil | |
| 137 true, // bind generates resource | |
| 138 &command_line); | |
| 139 SetupDefaultProgram(); | 130 SetupDefaultProgram(); |
| 140 } | 131 } |
| 141 }; | 132 }; |
| 142 | 133 |
| 143 class GLES2DecoderManualInitTest : public GLES2DecoderWithShaderTest { | 134 class GLES2DecoderManualInitTest : public GLES2DecoderWithShaderTest { |
| 144 public: | 135 public: |
| 145 GLES2DecoderManualInitTest() { } | 136 GLES2DecoderManualInitTest() { } |
| 146 | 137 |
| 147 // Override default setup so nothing gets setup. | 138 // Override default setup so nothing gets setup. |
| 148 virtual void SetUp() { | 139 virtual void SetUp() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OverflowFails) { | 199 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OverflowFails) { |
| 209 const GLsizei kLargeCount = 0x40000000; | 200 const GLsizei kLargeCount = 0x40000000; |
| 210 SetupTexture(); | 201 SetupTexture(); |
| 211 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 202 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
| 212 .Times(0) | 203 .Times(0) |
| 213 .RetiresOnSaturation(); | 204 .RetiresOnSaturation(); |
| 214 DrawArrays cmd; | 205 DrawArrays cmd; |
| 215 cmd.Init(GL_TRIANGLES, 0, kLargeCount); | 206 cmd.Init(GL_TRIANGLES, 0, kLargeCount); |
| 216 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 207 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 217 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 208 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 209 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
| 218 } | 210 } |
| 219 | 211 |
| 220 // Tests when the math overflows (0x7FFFFFFF + 1 = 0x8000000 verts) | 212 // Tests when the math overflows (0x7FFFFFFF + 1 = 0x8000000 verts) |
| 221 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0PosToNegFails) { | 213 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0PosToNegFails) { |
| 222 const GLsizei kLargeCount = 0x7FFFFFFF; | 214 const GLsizei kLargeCount = 0x7FFFFFFF; |
| 223 SetupTexture(); | 215 SetupTexture(); |
| 224 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 216 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
| 225 .Times(0) | 217 .Times(0) |
| 226 .RetiresOnSaturation(); | 218 .RetiresOnSaturation(); |
| 227 DrawArrays cmd; | 219 DrawArrays cmd; |
| 228 cmd.Init(GL_TRIANGLES, 0, kLargeCount); | 220 cmd.Init(GL_TRIANGLES, 0, kLargeCount); |
| 229 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 221 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 230 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 222 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 223 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
| 231 } | 224 } |
| 232 | 225 |
| 233 // Tests when the driver returns an error | 226 // Tests when the driver returns an error |
| 234 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OOMFails) { | 227 TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OOMFails) { |
| 235 const GLsizei kFakeLargeCount = 0x1234; | 228 const GLsizei kFakeLargeCount = 0x1234; |
| 236 SetupTexture(); | 229 SetupTexture(); |
| 237 AddExpectationsForSimulatedAttrib0WithError( | 230 AddExpectationsForSimulatedAttrib0WithError( |
| 238 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); | 231 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); |
| 239 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) | 232 EXPECT_CALL(*gl_, DrawArrays(_, _, _)) |
| 240 .Times(0) | 233 .Times(0) |
| 241 .RetiresOnSaturation(); | 234 .RetiresOnSaturation(); |
| 242 DrawArrays cmd; | 235 DrawArrays cmd; |
| 243 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); | 236 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); |
| 244 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 237 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 245 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 238 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 239 EXPECT_FALSE(GetDecoder()->WasContextLost()); |
| 240 } |
| 241 |
| 242 // Test that we lose context. |
| 243 TEST_F(GLES2DecoderManualInitTest, LoseContextWhenOOM) { |
| 244 InitState init; |
| 245 init.gl_version = "3.0"; |
| 246 init.has_alpha = true; |
| 247 init.has_depth = true; |
| 248 init.request_alpha = true; |
| 249 init.request_depth = true; |
| 250 init.bind_generates_resource = true; |
| 251 init.lose_context_when_out_of_memory = true; |
| 252 InitDecoder(init); |
| 253 SetupDefaultProgram(); |
| 254 |
| 255 const GLsizei kFakeLargeCount = 0x1234; |
| 256 SetupTexture(); |
| 257 AddExpectationsForSimulatedAttrib0WithError( |
| 258 kFakeLargeCount, 0, GL_OUT_OF_MEMORY); |
| 259 EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation(); |
| 260 // Other contexts in the group should be lost also. |
| 261 EXPECT_CALL(*mock_decoder_, LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB)) |
| 262 .Times(1) |
| 263 .RetiresOnSaturation(); |
| 264 DrawArrays cmd; |
| 265 cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount); |
| 266 // This context should be lost. |
| 267 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd)); |
| 268 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 269 EXPECT_TRUE(decoder_->WasContextLost()); |
| 246 } | 270 } |
| 247 | 271 |
| 248 TEST_F(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) { | 272 TEST_F(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) { |
| 249 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 273 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 250 // This is an NPOT texture. As the default filtering requires mips | 274 // This is an NPOT texture. As the default filtering requires mips |
| 251 // this should trigger replacing with black textures before rendering. | 275 // this should trigger replacing with black textures before rendering. |
| 252 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 276 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 253 kSharedMemoryId, kSharedMemoryOffset); | 277 kSharedMemoryId, kSharedMemoryOffset); |
| 254 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 278 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 255 { | 279 { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 345 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 322 } | 346 } |
| 323 | 347 |
| 324 // Same as DrawArraysValidAttributesSucceeds, but with workaround | 348 // Same as DrawArraysValidAttributesSucceeds, but with workaround |
| 325 // |init_vertex_attributes|. | 349 // |init_vertex_attributes|. |
| 326 TEST_F(GLES2DecoderManualInitTest, InitVertexAttributes) { | 350 TEST_F(GLES2DecoderManualInitTest, InitVertexAttributes) { |
| 327 CommandLine command_line(0, NULL); | 351 CommandLine command_line(0, NULL); |
| 328 command_line.AppendSwitchASCII( | 352 command_line.AppendSwitchASCII( |
| 329 switches::kGpuDriverBugWorkarounds, | 353 switches::kGpuDriverBugWorkarounds, |
| 330 base::IntToString(gpu::INIT_VERTEX_ATTRIBUTES)); | 354 base::IntToString(gpu::INIT_VERTEX_ATTRIBUTES)); |
| 331 InitDecoderWithCommandLine( | 355 InitState init; |
| 332 "", // extensions | 356 init.gl_version = "3.0"; |
| 333 "3.0", // gl version | 357 init.has_alpha = true; |
| 334 true, // has alpha | 358 init.has_depth = true; |
| 335 true, // has depth | 359 init.request_alpha = true; |
| 336 false, // has stencil | 360 init.request_depth = true; |
| 337 true, // request alpha | 361 init.bind_generates_resource = true; |
| 338 true, // request depth | 362 InitDecoderWithCommandLine(init, &command_line); |
| 339 false, // request stencil | |
| 340 true, // bind generates resource | |
| 341 &command_line); | |
| 342 SetupDefaultProgram(); | 363 SetupDefaultProgram(); |
| 343 SetupTexture(); | 364 SetupTexture(); |
| 344 SetupVertexBuffer(); | 365 SetupVertexBuffer(); |
| 345 DoEnableVertexAttribArray(1); | 366 DoEnableVertexAttribArray(1); |
| 346 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); | 367 DoVertexAttribPointer(1, 2, GL_FLOAT, 0, 0); |
| 347 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); | 368 AddExpectationsForSimulatedAttrib0(kNumVertices, kServiceBufferId); |
| 348 SetupExpectationsForApplyingDefaultDirtyState(); | 369 SetupExpectationsForApplyingDefaultDirtyState(); |
| 349 | 370 |
| 350 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 371 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 351 .Times(1) | 372 .Times(1) |
| (...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1942 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1922 } | 1943 } |
| 1923 | 1944 |
| 1924 // Same as GenerateMipmapClearsUnclearedTexture, but with workaround | 1945 // Same as GenerateMipmapClearsUnclearedTexture, but with workaround |
| 1925 // |set_texture_filters_before_generating_mipmap|. | 1946 // |set_texture_filters_before_generating_mipmap|. |
| 1926 TEST_F(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) { | 1947 TEST_F(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) { |
| 1927 CommandLine command_line(0, NULL); | 1948 CommandLine command_line(0, NULL); |
| 1928 command_line.AppendSwitchASCII( | 1949 command_line.AppendSwitchASCII( |
| 1929 switches::kGpuDriverBugWorkarounds, | 1950 switches::kGpuDriverBugWorkarounds, |
| 1930 base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP)); | 1951 base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP)); |
| 1931 InitDecoderWithCommandLine( | 1952 InitState init; |
| 1932 "", // extensions | 1953 init.gl_version = "3.0"; |
| 1933 "3.0", // gl version | 1954 init.bind_generates_resource = true; |
| 1934 false, // has alpha | 1955 InitDecoderWithCommandLine(init, &command_line); |
| 1935 false, // has depth | |
| 1936 false, // has stencil | |
| 1937 false, // request alpha | |
| 1938 false, // request depth | |
| 1939 false, // request stencil | |
| 1940 true, // bind generates resource | |
| 1941 &command_line); | |
| 1942 | 1956 |
| 1943 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)) | 1957 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)) |
| 1944 .Times(0); | 1958 .Times(0); |
| 1945 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1959 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1946 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 1960 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 1947 0, 0); | 1961 0, 0); |
| 1948 SetupClearTextureExpectations( | 1962 SetupClearTextureExpectations( |
| 1949 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, | 1963 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, |
| 1950 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); | 1964 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); |
| 1951 EXPECT_CALL(*gl_, TexParameteri( | 1965 EXPECT_CALL(*gl_, TexParameteri( |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2597 false); | 2611 false); |
| 2598 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 2612 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 2599 cmd.Init(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, | 2613 cmd.Init(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, |
| 2600 pixels_shm_id, pixels_shm_offset, | 2614 pixels_shm_id, pixels_shm_offset, |
| 2601 result_shm_id, kInvalidSharedMemoryOffset, | 2615 result_shm_id, kInvalidSharedMemoryOffset, |
| 2602 false); | 2616 false); |
| 2603 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 2617 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 2604 } | 2618 } |
| 2605 | 2619 |
| 2606 TEST_F(GLES2DecoderManualInitTest, ReadPixelsAsyncError) { | 2620 TEST_F(GLES2DecoderManualInitTest, ReadPixelsAsyncError) { |
| 2607 InitDecoder( | 2621 InitState init; |
| 2608 "GL_ARB_sync", // extensions | 2622 init.extensions = "GL_ARB_sync"; |
| 2609 "opengl es 3.0", // gl version | 2623 init.gl_version = "opengl es 3.0"; |
| 2610 true, // has alpha | 2624 init.has_alpha = true; |
| 2611 false, // has depth | 2625 init.request_alpha = true; |
| 2612 false, // has stencil | 2626 init.bind_generates_resource = true; |
| 2613 true, // request alpha | 2627 InitDecoder(init); |
| 2614 false, // request depth | |
| 2615 false, // request stencil | |
| 2616 true); // bind generates resource | |
| 2617 | 2628 |
| 2618 typedef ReadPixels::Result Result; | 2629 typedef ReadPixels::Result Result; |
| 2619 Result* result = GetSharedMemoryAs<Result*>(); | 2630 Result* result = GetSharedMemoryAs<Result*>(); |
| 2620 | 2631 |
| 2621 const GLsizei kWidth = 4; | 2632 const GLsizei kWidth = 4; |
| 2622 const GLsizei kHeight = 4; | 2633 const GLsizei kHeight = 4; |
| 2623 uint32 result_shm_id = kSharedMemoryId; | 2634 uint32 result_shm_id = kSharedMemoryId; |
| 2624 uint32 result_shm_offset = kSharedMemoryOffset; | 2635 uint32 result_shm_offset = kSharedMemoryOffset; |
| 2625 uint32 pixels_shm_id = kSharedMemoryId; | 2636 uint32 pixels_shm_id = kSharedMemoryId; |
| 2626 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); | 2637 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3885 false); // blend_enabled | 3896 false); // blend_enabled |
| 3886 | 3897 |
| 3887 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 3898 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 3888 .Times(1) | 3899 .Times(1) |
| 3889 .RetiresOnSaturation(); | 3900 .RetiresOnSaturation(); |
| 3890 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 3901 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
| 3891 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3902 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3892 } | 3903 } |
| 3893 | 3904 |
| 3894 TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { | 3905 TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { |
| 3895 InitDecoder( | 3906 InitState init; |
| 3896 "", // extensions | 3907 init.gl_version = "3.0"; |
| 3897 "3.0", // gl version | 3908 init.has_alpha = true; |
| 3898 true, // has alpha | 3909 init.request_alpha = true; |
| 3899 false, // has depth | 3910 init.bind_generates_resource = true; |
| 3900 false, // has stencil | 3911 InitDecoder(init); |
| 3901 true, // request alpha | |
| 3902 false, // request depth | |
| 3903 false, // request stencil | |
| 3904 true); // bind generates resource | |
| 3905 | 3912 |
| 3906 EXPECT_CALL(*gl_, GetError()) | 3913 EXPECT_CALL(*gl_, GetError()) |
| 3907 .WillOnce(Return(GL_NO_ERROR)) | 3914 .WillOnce(Return(GL_NO_ERROR)) |
| 3908 .WillOnce(Return(GL_NO_ERROR)) | 3915 .WillOnce(Return(GL_NO_ERROR)) |
| 3909 .RetiresOnSaturation(); | 3916 .RetiresOnSaturation(); |
| 3910 typedef GetIntegerv::Result Result; | 3917 typedef GetIntegerv::Result Result; |
| 3911 Result* result = static_cast<Result*>(shared_memory_address_); | 3918 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3912 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) | 3919 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
| 3913 .WillOnce(SetArgumentPointee<1>(8)) | 3920 .WillOnce(SetArgumentPointee<1>(8)) |
| 3914 .RetiresOnSaturation(); | 3921 .RetiresOnSaturation(); |
| 3915 result->size = 0; | 3922 result->size = 0; |
| 3916 GetIntegerv cmd2; | 3923 GetIntegerv cmd2; |
| 3917 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); | 3924 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
| 3918 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3925 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3919 EXPECT_EQ( | 3926 EXPECT_EQ( |
| 3920 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), | 3927 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
| 3921 result->GetNumResults()); | 3928 result->GetNumResults()); |
| 3922 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3929 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3923 EXPECT_EQ(8, result->GetData()[0]); | 3930 EXPECT_EQ(8, result->GetData()[0]); |
| 3924 } | 3931 } |
| 3925 | 3932 |
| 3926 TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) { | 3933 TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) { |
| 3927 InitDecoder( | 3934 InitState init; |
| 3928 "", // extensions | 3935 init.gl_version = "3.0"; |
| 3929 "3.0", // gl version | 3936 init.has_alpha = true; |
| 3930 true, // has alpha | 3937 init.bind_generates_resource = true; |
| 3931 false, // has depth | 3938 InitDecoder(init); |
| 3932 false, // has stencil | |
| 3933 false, // request alpha | |
| 3934 false, // request depth | |
| 3935 false, // request stencil | |
| 3936 true); // bind generates resource | |
| 3937 | 3939 |
| 3938 EXPECT_CALL(*gl_, GetError()) | 3940 EXPECT_CALL(*gl_, GetError()) |
| 3939 .WillOnce(Return(GL_NO_ERROR)) | 3941 .WillOnce(Return(GL_NO_ERROR)) |
| 3940 .WillOnce(Return(GL_NO_ERROR)) | 3942 .WillOnce(Return(GL_NO_ERROR)) |
| 3941 .RetiresOnSaturation(); | 3943 .RetiresOnSaturation(); |
| 3942 typedef GetIntegerv::Result Result; | 3944 typedef GetIntegerv::Result Result; |
| 3943 Result* result = static_cast<Result*>(shared_memory_address_); | 3945 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3944 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) | 3946 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
| 3945 .WillOnce(SetArgumentPointee<1>(8)) | 3947 .WillOnce(SetArgumentPointee<1>(8)) |
| 3946 .RetiresOnSaturation(); | 3948 .RetiresOnSaturation(); |
| 3947 result->size = 0; | 3949 result->size = 0; |
| 3948 GetIntegerv cmd2; | 3950 GetIntegerv cmd2; |
| 3949 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); | 3951 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
| 3950 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3952 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3951 EXPECT_EQ( | 3953 EXPECT_EQ( |
| 3952 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), | 3954 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
| 3953 result->GetNumResults()); | 3955 result->GetNumResults()); |
| 3954 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3956 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3955 EXPECT_EQ(0, result->GetData()[0]); | 3957 EXPECT_EQ(0, result->GetData()[0]); |
| 3956 } | 3958 } |
| 3957 | 3959 |
| 3958 TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) { | 3960 TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) { |
| 3959 InitDecoder( | 3961 InitState init; |
| 3960 "", // extensions | 3962 init.gl_version = "3.0"; |
| 3961 "3.0", // gl version | 3963 init.has_depth = true; |
| 3962 false, // has alpha | 3964 init.request_depth = true; |
| 3963 true, // has depth | 3965 init.bind_generates_resource = true; |
| 3964 false, // has stencil | 3966 InitDecoder(init); |
| 3965 false, // request alpha | |
| 3966 true, // request depth | |
| 3967 false, // request stencil | |
| 3968 true); // bind generates resource | |
| 3969 | 3967 |
| 3970 EXPECT_CALL(*gl_, GetError()) | 3968 EXPECT_CALL(*gl_, GetError()) |
| 3971 .WillOnce(Return(GL_NO_ERROR)) | 3969 .WillOnce(Return(GL_NO_ERROR)) |
| 3972 .WillOnce(Return(GL_NO_ERROR)) | 3970 .WillOnce(Return(GL_NO_ERROR)) |
| 3973 .RetiresOnSaturation(); | 3971 .RetiresOnSaturation(); |
| 3974 typedef GetIntegerv::Result Result; | 3972 typedef GetIntegerv::Result Result; |
| 3975 Result* result = static_cast<Result*>(shared_memory_address_); | 3973 Result* result = static_cast<Result*>(shared_memory_address_); |
| 3976 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 3974 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
| 3977 .WillOnce(SetArgumentPointee<1>(24)) | 3975 .WillOnce(SetArgumentPointee<1>(24)) |
| 3978 .RetiresOnSaturation(); | 3976 .RetiresOnSaturation(); |
| 3979 result->size = 0; | 3977 result->size = 0; |
| 3980 GetIntegerv cmd2; | 3978 GetIntegerv cmd2; |
| 3981 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); | 3979 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
| 3982 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3980 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 3983 EXPECT_EQ( | 3981 EXPECT_EQ( |
| 3984 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 3982 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 3985 result->GetNumResults()); | 3983 result->GetNumResults()); |
| 3986 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3984 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3987 EXPECT_EQ(24, result->GetData()[0]); | 3985 EXPECT_EQ(24, result->GetData()[0]); |
| 3988 } | 3986 } |
| 3989 | 3987 |
| 3990 TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) { | 3988 TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) { |
| 3991 InitDecoder( | 3989 InitState init; |
| 3992 "", // extensions | 3990 init.gl_version = "3.0"; |
| 3993 "3.0", // gl version | 3991 init.has_depth = true; |
| 3994 false, // has alpha | 3992 init.bind_generates_resource = true; |
| 3995 true, // has depth | 3993 InitDecoder(init); |
| 3996 false, // has stencil | |
| 3997 false, // request alpha | |
| 3998 false, // request depth | |
| 3999 false, // request stencil | |
| 4000 true); // bind generates resource | |
| 4001 | 3994 |
| 4002 EXPECT_CALL(*gl_, GetError()) | 3995 EXPECT_CALL(*gl_, GetError()) |
| 4003 .WillOnce(Return(GL_NO_ERROR)) | 3996 .WillOnce(Return(GL_NO_ERROR)) |
| 4004 .WillOnce(Return(GL_NO_ERROR)) | 3997 .WillOnce(Return(GL_NO_ERROR)) |
| 4005 .RetiresOnSaturation(); | 3998 .RetiresOnSaturation(); |
| 4006 typedef GetIntegerv::Result Result; | 3999 typedef GetIntegerv::Result Result; |
| 4007 Result* result = static_cast<Result*>(shared_memory_address_); | 4000 Result* result = static_cast<Result*>(shared_memory_address_); |
| 4008 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 4001 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
| 4009 .WillOnce(SetArgumentPointee<1>(24)) | 4002 .WillOnce(SetArgumentPointee<1>(24)) |
| 4010 .RetiresOnSaturation(); | 4003 .RetiresOnSaturation(); |
| 4011 result->size = 0; | 4004 result->size = 0; |
| 4012 GetIntegerv cmd2; | 4005 GetIntegerv cmd2; |
| 4013 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); | 4006 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
| 4014 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4007 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4015 EXPECT_EQ( | 4008 EXPECT_EQ( |
| 4016 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 4009 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 4017 result->GetNumResults()); | 4010 result->GetNumResults()); |
| 4018 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4011 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4019 EXPECT_EQ(0, result->GetData()[0]); | 4012 EXPECT_EQ(0, result->GetData()[0]); |
| 4020 } | 4013 } |
| 4021 | 4014 |
| 4022 TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) { | 4015 TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) { |
| 4023 InitDecoder( | 4016 InitState init; |
| 4024 "", // extensions | 4017 init.gl_version = "3.0"; |
| 4025 "3.0", // gl version | 4018 init.has_stencil = true; |
| 4026 false, // has alpha | 4019 init.request_stencil = true; |
| 4027 false, // has depth | 4020 init.bind_generates_resource = true; |
| 4028 true, // has stencil | 4021 InitDecoder(init); |
| 4029 false, // request alpha | |
| 4030 false, // request depth | |
| 4031 true, // request stencil | |
| 4032 true); // bind generates resource | |
| 4033 | 4022 |
| 4034 EXPECT_CALL(*gl_, GetError()) | 4023 EXPECT_CALL(*gl_, GetError()) |
| 4035 .WillOnce(Return(GL_NO_ERROR)) | 4024 .WillOnce(Return(GL_NO_ERROR)) |
| 4036 .WillOnce(Return(GL_NO_ERROR)) | 4025 .WillOnce(Return(GL_NO_ERROR)) |
| 4037 .RetiresOnSaturation(); | 4026 .RetiresOnSaturation(); |
| 4038 typedef GetIntegerv::Result Result; | 4027 typedef GetIntegerv::Result Result; |
| 4039 Result* result = static_cast<Result*>(shared_memory_address_); | 4028 Result* result = static_cast<Result*>(shared_memory_address_); |
| 4040 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) | 4029 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
| 4041 .WillOnce(SetArgumentPointee<1>(8)) | 4030 .WillOnce(SetArgumentPointee<1>(8)) |
| 4042 .RetiresOnSaturation(); | 4031 .RetiresOnSaturation(); |
| 4043 result->size = 0; | 4032 result->size = 0; |
| 4044 GetIntegerv cmd2; | 4033 GetIntegerv cmd2; |
| 4045 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); | 4034 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
| 4046 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4035 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4047 EXPECT_EQ( | 4036 EXPECT_EQ( |
| 4048 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), | 4037 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
| 4049 result->GetNumResults()); | 4038 result->GetNumResults()); |
| 4050 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4039 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4051 EXPECT_EQ(8, result->GetData()[0]); | 4040 EXPECT_EQ(8, result->GetData()[0]); |
| 4052 } | 4041 } |
| 4053 | 4042 |
| 4054 TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) { | 4043 TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) { |
| 4055 InitDecoder( | 4044 InitState init; |
| 4056 "", // extensions | 4045 init.gl_version = "3.0"; |
| 4057 "3.0", // gl version | 4046 init.has_stencil = true; |
| 4058 false, // has alpha | 4047 init.bind_generates_resource = true; |
| 4059 false, // has depth | 4048 InitDecoder(init); |
| 4060 true, // has stencil | |
| 4061 false, // request alpha | |
| 4062 false, // request depth | |
| 4063 false, // request stencil | |
| 4064 true); // bind generates resource | |
| 4065 | 4049 |
| 4066 EXPECT_CALL(*gl_, GetError()) | 4050 EXPECT_CALL(*gl_, GetError()) |
| 4067 .WillOnce(Return(GL_NO_ERROR)) | 4051 .WillOnce(Return(GL_NO_ERROR)) |
| 4068 .WillOnce(Return(GL_NO_ERROR)) | 4052 .WillOnce(Return(GL_NO_ERROR)) |
| 4069 .RetiresOnSaturation(); | 4053 .RetiresOnSaturation(); |
| 4070 typedef GetIntegerv::Result Result; | 4054 typedef GetIntegerv::Result Result; |
| 4071 Result* result = static_cast<Result*>(shared_memory_address_); | 4055 Result* result = static_cast<Result*>(shared_memory_address_); |
| 4072 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) | 4056 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
| 4073 .WillOnce(SetArgumentPointee<1>(8)) | 4057 .WillOnce(SetArgumentPointee<1>(8)) |
| 4074 .RetiresOnSaturation(); | 4058 .RetiresOnSaturation(); |
| 4075 result->size = 0; | 4059 result->size = 0; |
| 4076 GetIntegerv cmd2; | 4060 GetIntegerv cmd2; |
| 4077 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); | 4061 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
| 4078 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4062 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4079 EXPECT_EQ( | 4063 EXPECT_EQ( |
| 4080 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), | 4064 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
| 4081 result->GetNumResults()); | 4065 result->GetNumResults()); |
| 4082 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4066 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4083 EXPECT_EQ(0, result->GetData()[0]); | 4067 EXPECT_EQ(0, result->GetData()[0]); |
| 4084 } | 4068 } |
| 4085 | 4069 |
| 4086 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) { | 4070 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) { |
| 4087 InitDecoder( | 4071 InitState init; |
| 4088 "", // extensions | 4072 init.gl_version = "3.0"; |
| 4089 "3.0", // gl version | 4073 init.has_depth = true; |
| 4090 false, // has alpha | 4074 init.request_depth = true; |
| 4091 true, // has depth | 4075 init.bind_generates_resource = true; |
| 4092 false, // has stencil | 4076 InitDecoder(init); |
| 4093 false, // request alpha | |
| 4094 true, // request depth | |
| 4095 false, // request stencil | |
| 4096 true); // bind generates resource | |
| 4097 | 4077 |
| 4098 Enable cmd; | 4078 Enable cmd; |
| 4099 cmd.Init(GL_DEPTH_TEST); | 4079 cmd.Init(GL_DEPTH_TEST); |
| 4100 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4080 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4101 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4081 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4102 | 4082 |
| 4103 SetupDefaultProgram(); | 4083 SetupDefaultProgram(); |
| 4104 SetupTexture(); | 4084 SetupTexture(); |
| 4105 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 4085 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 4106 SetupExpectationsForApplyingDirtyState( | 4086 SetupExpectationsForApplyingDirtyState( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4140 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); | 4120 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); |
| 4141 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4121 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4142 EXPECT_EQ( | 4122 EXPECT_EQ( |
| 4143 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), | 4123 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), |
| 4144 result->GetNumResults()); | 4124 result->GetNumResults()); |
| 4145 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4125 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4146 EXPECT_EQ(1, result->GetData()[0]); | 4126 EXPECT_EQ(1, result->GetData()[0]); |
| 4147 } | 4127 } |
| 4148 | 4128 |
| 4149 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) { | 4129 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) { |
| 4150 InitDecoder( | 4130 InitState init; |
| 4151 "", // extensions | 4131 init.gl_version = "3.0"; |
| 4152 "3.0", // gl version | 4132 init.has_depth = true; |
| 4153 false, // has alpha | 4133 init.bind_generates_resource = true; |
| 4154 true, // has depth | 4134 InitDecoder(init); |
| 4155 false, // has stencil | |
| 4156 false, // request alpha | |
| 4157 false, // request depth | |
| 4158 false, // request stencil | |
| 4159 true); // bind generates resource | |
| 4160 | 4135 |
| 4161 Enable cmd; | 4136 Enable cmd; |
| 4162 cmd.Init(GL_DEPTH_TEST); | 4137 cmd.Init(GL_DEPTH_TEST); |
| 4163 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4138 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4164 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4139 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4165 | 4140 |
| 4166 SetupDefaultProgram(); | 4141 SetupDefaultProgram(); |
| 4167 SetupTexture(); | 4142 SetupTexture(); |
| 4168 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 4143 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 4169 SetupExpectationsForApplyingDirtyState( | 4144 SetupExpectationsForApplyingDirtyState( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4202 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); | 4177 cmd2.Init(GL_DEPTH_TEST, shared_memory_id_, shared_memory_offset_); |
| 4203 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4178 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4204 EXPECT_EQ( | 4179 EXPECT_EQ( |
| 4205 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), | 4180 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_TEST), |
| 4206 result->GetNumResults()); | 4181 result->GetNumResults()); |
| 4207 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4182 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4208 EXPECT_EQ(1, result->GetData()[0]); | 4183 EXPECT_EQ(1, result->GetData()[0]); |
| 4209 } | 4184 } |
| 4210 | 4185 |
| 4211 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) { | 4186 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) { |
| 4212 InitDecoder( | 4187 InitState init; |
| 4213 "", // extensions | 4188 init.gl_version = "3.0"; |
| 4214 "3.0", // gl version | 4189 init.has_stencil = true; |
| 4215 false, // has alpha | 4190 init.request_stencil = true; |
| 4216 false, // has depth | 4191 init.bind_generates_resource = true; |
| 4217 true, // has stencil | 4192 InitDecoder(init); |
| 4218 false, // request alpha | |
| 4219 false, // request depth | |
| 4220 true, // request stencil | |
| 4221 true); // bind generates resource | |
| 4222 | 4193 |
| 4223 Enable cmd; | 4194 Enable cmd; |
| 4224 cmd.Init(GL_STENCIL_TEST); | 4195 cmd.Init(GL_STENCIL_TEST); |
| 4225 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4196 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4226 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4197 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4227 | 4198 |
| 4228 SetupDefaultProgram(); | 4199 SetupDefaultProgram(); |
| 4229 SetupTexture(); | 4200 SetupTexture(); |
| 4230 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 4201 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 4231 SetupExpectationsForApplyingDirtyState( | 4202 SetupExpectationsForApplyingDirtyState( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4264 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); | 4235 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); |
| 4265 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4236 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4266 EXPECT_EQ( | 4237 EXPECT_EQ( |
| 4267 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), | 4238 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), |
| 4268 result->GetNumResults()); | 4239 result->GetNumResults()); |
| 4269 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4240 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4270 EXPECT_EQ(1, result->GetData()[0]); | 4241 EXPECT_EQ(1, result->GetData()[0]); |
| 4271 } | 4242 } |
| 4272 | 4243 |
| 4273 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) { | 4244 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) { |
| 4274 InitDecoder( | 4245 InitState init; |
| 4275 "", // extensions | 4246 init.gl_version = "3.0"; |
| 4276 "3.0", // gl version | 4247 init.has_stencil = true; |
| 4277 false, // has alpha | 4248 init.bind_generates_resource = true; |
| 4278 false, // has depth | 4249 InitDecoder(init); |
| 4279 true, // has stencil | |
| 4280 false, // request alpha | |
| 4281 false, // request depth | |
| 4282 false, // request stencil | |
| 4283 true); // bind generates resource | |
| 4284 | 4250 |
| 4285 Enable cmd; | 4251 Enable cmd; |
| 4286 cmd.Init(GL_STENCIL_TEST); | 4252 cmd.Init(GL_STENCIL_TEST); |
| 4287 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4288 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4254 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4289 | 4255 |
| 4290 SetupDefaultProgram(); | 4256 SetupDefaultProgram(); |
| 4291 SetupTexture(); | 4257 SetupTexture(); |
| 4292 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 4258 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 4293 SetupExpectationsForApplyingDirtyState( | 4259 SetupExpectationsForApplyingDirtyState( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4326 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); | 4292 cmd2.Init(GL_STENCIL_TEST, shared_memory_id_, shared_memory_offset_); |
| 4327 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4293 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4328 EXPECT_EQ( | 4294 EXPECT_EQ( |
| 4329 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), | 4295 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_TEST), |
| 4330 result->GetNumResults()); | 4296 result->GetNumResults()); |
| 4331 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4297 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4332 EXPECT_EQ(1, result->GetData()[0]); | 4298 EXPECT_EQ(1, result->GetData()[0]); |
| 4333 } | 4299 } |
| 4334 | 4300 |
| 4335 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) { | 4301 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) { |
| 4336 InitDecoder( | 4302 InitState init; |
| 4337 "GL_OES_packed_depth_stencil", // extensions | 4303 init.extensions = "GL_OES_packed_depth_stencil"; |
| 4338 "opengl es 2.0", // gl version | 4304 init.gl_version = "opengl es 2.0"; |
| 4339 false, // has alpha | 4305 init.has_depth = true; |
| 4340 true, // has depth | 4306 init.has_stencil = true; |
| 4341 true, // has stencil | 4307 init.request_depth = true; |
| 4342 false, // request alpha | 4308 init.request_stencil = true; |
| 4343 true, // request depth | 4309 init.bind_generates_resource = true; |
| 4344 true, // request stencil | 4310 InitDecoder(init); |
| 4345 true); // bind generates resource | |
| 4346 | 4311 |
| 4347 EXPECT_CALL(*gl_, GetError()) | 4312 EXPECT_CALL(*gl_, GetError()) |
| 4348 .WillOnce(Return(GL_NO_ERROR)) | 4313 .WillOnce(Return(GL_NO_ERROR)) |
| 4349 .WillOnce(Return(GL_NO_ERROR)) | 4314 .WillOnce(Return(GL_NO_ERROR)) |
| 4350 .WillOnce(Return(GL_NO_ERROR)) | 4315 .WillOnce(Return(GL_NO_ERROR)) |
| 4351 .WillOnce(Return(GL_NO_ERROR)) | 4316 .WillOnce(Return(GL_NO_ERROR)) |
| 4352 .RetiresOnSaturation(); | 4317 .RetiresOnSaturation(); |
| 4353 typedef GetIntegerv::Result Result; | 4318 typedef GetIntegerv::Result Result; |
| 4354 Result* result = static_cast<Result*>(shared_memory_address_); | 4319 Result* result = static_cast<Result*>(shared_memory_address_); |
| 4355 result->size = 0; | 4320 result->size = 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4371 .RetiresOnSaturation(); | 4336 .RetiresOnSaturation(); |
| 4372 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4337 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4373 EXPECT_EQ( | 4338 EXPECT_EQ( |
| 4374 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 4339 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 4375 result->GetNumResults()); | 4340 result->GetNumResults()); |
| 4376 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4341 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4377 EXPECT_EQ(24, result->GetData()[0]); | 4342 EXPECT_EQ(24, result->GetData()[0]); |
| 4378 } | 4343 } |
| 4379 | 4344 |
| 4380 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) { | 4345 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) { |
| 4381 InitDecoder( | 4346 InitState init; |
| 4382 "GL_OES_packed_depth_stencil", // extensions | 4347 init.extensions = "GL_OES_packed_depth_stencil"; |
| 4383 "opengl es 2.0", // gl version | 4348 init.gl_version = "opengl es 2.0"; |
| 4384 false, // has alpha | 4349 init.has_depth = true; |
| 4385 true, // has depth | 4350 init.has_stencil = true; |
| 4386 true, // has stencil | 4351 init.request_depth = true; |
| 4387 false, // request alpha | 4352 init.bind_generates_resource = true; |
| 4388 true, // request depth | 4353 InitDecoder(init); |
| 4389 false, // request stencil | |
| 4390 true); // bind generates resource | |
| 4391 | 4354 |
| 4392 EXPECT_CALL(*gl_, GetError()) | 4355 EXPECT_CALL(*gl_, GetError()) |
| 4393 .WillOnce(Return(GL_NO_ERROR)) | 4356 .WillOnce(Return(GL_NO_ERROR)) |
| 4394 .WillOnce(Return(GL_NO_ERROR)) | 4357 .WillOnce(Return(GL_NO_ERROR)) |
| 4395 .WillOnce(Return(GL_NO_ERROR)) | 4358 .WillOnce(Return(GL_NO_ERROR)) |
| 4396 .WillOnce(Return(GL_NO_ERROR)) | 4359 .WillOnce(Return(GL_NO_ERROR)) |
| 4397 .RetiresOnSaturation(); | 4360 .RetiresOnSaturation(); |
| 4398 typedef GetIntegerv::Result Result; | 4361 typedef GetIntegerv::Result Result; |
| 4399 Result* result = static_cast<Result*>(shared_memory_address_); | 4362 Result* result = static_cast<Result*>(shared_memory_address_); |
| 4400 result->size = 0; | 4363 result->size = 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4416 .RetiresOnSaturation(); | 4379 .RetiresOnSaturation(); |
| 4417 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4380 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4418 EXPECT_EQ( | 4381 EXPECT_EQ( |
| 4419 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 4382 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 4420 result->GetNumResults()); | 4383 result->GetNumResults()); |
| 4421 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4384 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4422 EXPECT_EQ(24, result->GetData()[0]); | 4385 EXPECT_EQ(24, result->GetData()[0]); |
| 4423 } | 4386 } |
| 4424 | 4387 |
| 4425 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) { | 4388 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) { |
| 4426 InitDecoder( | 4389 InitState init; |
| 4427 "GL_OES_packed_depth_stencil", // extensions | 4390 init.extensions = "GL_OES_packed_depth_stencil"; |
| 4428 "opengl es 2.0", // gl version | 4391 init.gl_version = "opengl es 2.0"; |
| 4429 false, // has alpha | 4392 init.bind_generates_resource = true; |
| 4430 false, // has depth | 4393 InitDecoder(init); |
| 4431 false, // has stencil | |
| 4432 false, // request alpha | |
| 4433 false, // request depth | |
| 4434 false, // request stencil | |
| 4435 true); // bind generates resource | |
| 4436 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 4394 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 4437 kServiceRenderbufferId); | 4395 kServiceRenderbufferId); |
| 4438 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 4396 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 4439 kServiceFramebufferId); | 4397 kServiceFramebufferId); |
| 4440 | 4398 |
| 4441 EXPECT_CALL(*gl_, GetError()) | 4399 EXPECT_CALL(*gl_, GetError()) |
| 4442 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage | 4400 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage |
| 4443 .WillOnce(Return(GL_NO_ERROR)) | 4401 .WillOnce(Return(GL_NO_ERROR)) |
| 4444 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer | 4402 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer |
| 4445 .WillOnce(Return(GL_NO_ERROR)) | 4403 .WillOnce(Return(GL_NO_ERROR)) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4488 .RetiresOnSaturation(); | 4446 .RetiresOnSaturation(); |
| 4489 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 4447 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4490 EXPECT_EQ( | 4448 EXPECT_EQ( |
| 4491 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 4449 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
| 4492 result->GetNumResults()); | 4450 result->GetNumResults()); |
| 4493 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4451 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4494 EXPECT_EQ(24, result->GetData()[0]); | 4452 EXPECT_EQ(24, result->GetData()[0]); |
| 4495 } | 4453 } |
| 4496 | 4454 |
| 4497 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferStencil) { | 4455 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferStencil) { |
| 4498 InitDecoder( | 4456 InitState init; |
| 4499 "GL_OES_packed_depth_stencil", // extensions | 4457 init.extensions = "GL_OES_packed_depth_stencil"; |
| 4500 "opengl es 2.0", // gl version | 4458 init.gl_version = "opengl es 2.0"; |
| 4501 false, // has alpha | 4459 init.bind_generates_resource = true; |
| 4502 false, // has depth | 4460 InitDecoder(init); |
| 4503 false, // has stencil | |
| 4504 false, // request alpha | |
| 4505 false, // request depth | |
| 4506 false, // request stencil | |
| 4507 true); // bind generates resource | |
| 4508 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 4461 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 4509 kServiceRenderbufferId); | 4462 kServiceRenderbufferId); |
| 4510 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 4463 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
| 4511 kServiceFramebufferId); | 4464 kServiceFramebufferId); |
| 4512 | 4465 |
| 4513 EXPECT_CALL(*gl_, GetError()) | 4466 EXPECT_CALL(*gl_, GetError()) |
| 4514 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage | 4467 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage |
| 4515 .WillOnce(Return(GL_NO_ERROR)) | 4468 .WillOnce(Return(GL_NO_ERROR)) |
| 4516 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer | 4469 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer |
| 4517 .WillOnce(Return(GL_NO_ERROR)) | 4470 .WillOnce(Return(GL_NO_ERROR)) |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4892 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, TestHelper::kMaxRenderbufferSize + 1, 1); | 4845 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, TestHelper::kMaxRenderbufferSize + 1, 1); |
| 4893 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4846 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4894 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 4847 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4895 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 1, TestHelper::kMaxRenderbufferSize + 1); | 4848 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 1, TestHelper::kMaxRenderbufferSize + 1); |
| 4896 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4849 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4897 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 4850 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4898 } | 4851 } |
| 4899 | 4852 |
| 4900 TEST_F(GLES2DecoderManualInitTest, | 4853 TEST_F(GLES2DecoderManualInitTest, |
| 4901 RenderbufferStorageMultisampleCHROMIUMGLError) { | 4854 RenderbufferStorageMultisampleCHROMIUMGLError) { |
| 4902 InitDecoder( | 4855 InitState init; |
| 4903 "GL_EXT_framebuffer_multisample", // extensions | 4856 init.extensions = "GL_EXT_framebuffer_multisample"; |
| 4904 "2.1", // gl version | 4857 init.gl_version = "2.1"; |
| 4905 false, // has alpha | 4858 init.bind_generates_resource = true; |
| 4906 false, // has depth | 4859 InitDecoder(init); |
| 4907 false, // has stencil | |
| 4908 false, // request alpha | |
| 4909 false, // request depth | |
| 4910 false, // request stencil | |
| 4911 true); // bind generates resource | |
| 4912 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 4860 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 4913 kServiceRenderbufferId); | 4861 kServiceRenderbufferId); |
| 4914 EXPECT_CALL(*gl_, GetError()) | 4862 EXPECT_CALL(*gl_, GetError()) |
| 4915 .WillOnce(Return(GL_NO_ERROR)) | 4863 .WillOnce(Return(GL_NO_ERROR)) |
| 4916 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 4864 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
| 4917 .RetiresOnSaturation(); | 4865 .RetiresOnSaturation(); |
| 4918 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT( | 4866 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT( |
| 4919 GL_RENDERBUFFER, 1, GL_RGBA, 100, 50)) | 4867 GL_RENDERBUFFER, 1, GL_RGBA, 100, 50)) |
| 4920 .Times(1) | 4868 .Times(1) |
| 4921 .RetiresOnSaturation(); | 4869 .RetiresOnSaturation(); |
| 4922 RenderbufferStorageMultisampleCHROMIUM cmd; | 4870 RenderbufferStorageMultisampleCHROMIUM cmd; |
| 4923 cmd.Init(GL_RENDERBUFFER, 1, GL_RGBA4, 100, 50); | 4871 cmd.Init(GL_RENDERBUFFER, 1, GL_RGBA4, 100, 50); |
| 4924 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4872 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4925 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 4873 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 4926 } | 4874 } |
| 4927 | 4875 |
| 4928 TEST_F(GLES2DecoderManualInitTest, | 4876 TEST_F(GLES2DecoderManualInitTest, |
| 4929 RenderbufferStorageMultisampleCHROMIUMBadArgs) { | 4877 RenderbufferStorageMultisampleCHROMIUMBadArgs) { |
| 4930 InitDecoder( | 4878 InitState init; |
| 4931 "GL_EXT_framebuffer_multisample", // extensions | 4879 init.extensions = "GL_EXT_framebuffer_multisample"; |
| 4932 "2.1", // gl version | 4880 init.gl_version = "2.1"; |
| 4933 false, // has alpha | 4881 init.bind_generates_resource = true; |
| 4934 false, // has depth | 4882 InitDecoder(init); |
| 4935 false, // has stencil | |
| 4936 false, // request alpha | |
| 4937 false, // request depth | |
| 4938 false, // request stencil | |
| 4939 true); // bind generates resource | |
| 4940 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 4883 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 4941 kServiceRenderbufferId); | 4884 kServiceRenderbufferId); |
| 4942 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT(_, _, _, _, _)) | 4885 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT(_, _, _, _, _)) |
| 4943 .Times(0) | 4886 .Times(0) |
| 4944 .RetiresOnSaturation(); | 4887 .RetiresOnSaturation(); |
| 4945 RenderbufferStorageMultisampleCHROMIUM cmd; | 4888 RenderbufferStorageMultisampleCHROMIUM cmd; |
| 4946 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples + 1, | 4889 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples + 1, |
| 4947 GL_RGBA4, TestHelper::kMaxRenderbufferSize, 1); | 4890 GL_RGBA4, TestHelper::kMaxRenderbufferSize, 1); |
| 4948 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4891 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4949 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 4892 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4950 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, | 4893 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, |
| 4951 GL_RGBA4, TestHelper::kMaxRenderbufferSize + 1, 1); | 4894 GL_RGBA4, TestHelper::kMaxRenderbufferSize + 1, 1); |
| 4952 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4895 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4953 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 4896 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4954 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, | 4897 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, |
| 4955 GL_RGBA4, 1, TestHelper::kMaxRenderbufferSize + 1); | 4898 GL_RGBA4, 1, TestHelper::kMaxRenderbufferSize + 1); |
| 4956 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4899 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4957 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 4900 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4958 } | 4901 } |
| 4959 | 4902 |
| 4960 TEST_F(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleCHROMIUM) { | 4903 TEST_F(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleCHROMIUM) { |
| 4961 InitDecoder( | 4904 InitState init; |
| 4962 "GL_EXT_framebuffer_multisample", // extensions | 4905 init.extensions = "GL_EXT_framebuffer_multisample"; |
| 4963 "2.1", // gl version | 4906 init.gl_version = "2.1"; |
| 4964 false, // has alpha | 4907 InitDecoder(init); |
| 4965 false, // has depth | |
| 4966 false, // has stencil | |
| 4967 false, // request alpha | |
| 4968 false, // request depth | |
| 4969 false, // request stencil | |
| 4970 false); // bind generates resource | |
| 4971 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 4908 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 4972 kServiceRenderbufferId); | 4909 kServiceRenderbufferId); |
| 4973 InSequence sequence; | 4910 InSequence sequence; |
| 4974 EXPECT_CALL(*gl_, GetError()) | 4911 EXPECT_CALL(*gl_, GetError()) |
| 4975 .WillOnce(Return(GL_NO_ERROR)) | 4912 .WillOnce(Return(GL_NO_ERROR)) |
| 4976 .RetiresOnSaturation(); | 4913 .RetiresOnSaturation(); |
| 4977 EXPECT_CALL( | 4914 EXPECT_CALL( |
| 4978 *gl_, | 4915 *gl_, |
| 4979 RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, | 4916 RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, |
| 4980 TestHelper::kMaxSamples, | 4917 TestHelper::kMaxSamples, |
| 4981 GL_RGBA, | 4918 GL_RGBA, |
| 4982 TestHelper::kMaxRenderbufferSize, | 4919 TestHelper::kMaxRenderbufferSize, |
| 4983 1)) | 4920 1)) |
| 4984 .Times(1) | 4921 .Times(1) |
| 4985 .RetiresOnSaturation(); | 4922 .RetiresOnSaturation(); |
| 4986 EXPECT_CALL(*gl_, GetError()) | 4923 EXPECT_CALL(*gl_, GetError()) |
| 4987 .WillOnce(Return(GL_NO_ERROR)) | 4924 .WillOnce(Return(GL_NO_ERROR)) |
| 4988 .RetiresOnSaturation(); | 4925 .RetiresOnSaturation(); |
| 4989 RenderbufferStorageMultisampleCHROMIUM cmd; | 4926 RenderbufferStorageMultisampleCHROMIUM cmd; |
| 4990 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, | 4927 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, |
| 4991 GL_RGBA4, TestHelper::kMaxRenderbufferSize, 1); | 4928 GL_RGBA4, TestHelper::kMaxRenderbufferSize, 1); |
| 4992 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4929 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4993 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4930 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4994 } | 4931 } |
| 4995 | 4932 |
| 4996 TEST_F(GLES2DecoderManualInitTest, | 4933 TEST_F(GLES2DecoderManualInitTest, |
| 4997 RenderbufferStorageMultisampleEXTNotSupported) { | 4934 RenderbufferStorageMultisampleEXTNotSupported) { |
| 4998 InitDecoder( | 4935 InitState init; |
| 4999 "GL_EXT_framebuffer_multisample", // extensions | 4936 init.extensions = "GL_EXT_framebuffer_multisample"; |
| 5000 "2.1", // gl version | 4937 init.gl_version = "2.1"; |
| 5001 false, // has alpha | 4938 init.bind_generates_resource = true; |
| 5002 false, // has depth | 4939 InitDecoder(init); |
| 5003 false, // has stencil | |
| 5004 false, // request alpha | |
| 5005 false, // request depth | |
| 5006 false, // request stencil | |
| 5007 false); // bind generates resource | |
| 5008 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 4940 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 5009 kServiceRenderbufferId); | 4941 kServiceRenderbufferId); |
| 5010 InSequence sequence; | 4942 InSequence sequence; |
| 5011 // GL_EXT_framebuffer_multisample uses RenderbufferStorageMultisampleCHROMIUM. | 4943 // GL_EXT_framebuffer_multisample uses RenderbufferStorageMultisampleCHROMIUM. |
| 5012 RenderbufferStorageMultisampleEXT cmd; | 4944 RenderbufferStorageMultisampleEXT cmd; |
| 5013 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, | 4945 cmd.Init(GL_RENDERBUFFER, TestHelper::kMaxSamples, |
| 5014 GL_RGBA4, TestHelper::kMaxRenderbufferSize, 1); | 4946 GL_RGBA4, TestHelper::kMaxRenderbufferSize, 1); |
| 5015 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4947 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5016 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 4948 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5017 } | 4949 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5107 static bool ValueInArray(GLint value, GLint* array, GLint count) { | 5039 static bool ValueInArray(GLint value, GLint* array, GLint count) { |
| 5108 for (GLint ii = 0; ii < count; ++ii) { | 5040 for (GLint ii = 0; ii < count; ++ii) { |
| 5109 if (array[ii] == value) { | 5041 if (array[ii] == value) { |
| 5110 return true; | 5042 return true; |
| 5111 } | 5043 } |
| 5112 } | 5044 } |
| 5113 return false; | 5045 return false; |
| 5114 } | 5046 } |
| 5115 | 5047 |
| 5116 TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormats) { | 5048 TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormats) { |
| 5117 InitDecoder( | 5049 InitState init; |
| 5118 "GL_EXT_texture_compression_s3tc", // extensions | 5050 init.extensions = "GL_EXT_texture_compression_s3tc"; |
| 5119 "3.0", // gl version | 5051 init.gl_version = "3.0"; |
| 5120 false, // has alpha | 5052 init.bind_generates_resource = true; |
| 5121 false, // has depth | 5053 InitDecoder(init); |
| 5122 false, // has stencil | |
| 5123 false, // request alpha | |
| 5124 false, // request depth | |
| 5125 false, // request stencil | |
| 5126 true); // bind generates resource | |
| 5127 | 5054 |
| 5128 EXPECT_CALL(*gl_, GetError()) | 5055 EXPECT_CALL(*gl_, GetError()) |
| 5129 .WillOnce(Return(GL_NO_ERROR)) | 5056 .WillOnce(Return(GL_NO_ERROR)) |
| 5130 .WillOnce(Return(GL_NO_ERROR)) | 5057 .WillOnce(Return(GL_NO_ERROR)) |
| 5131 .WillOnce(Return(GL_NO_ERROR)) | 5058 .WillOnce(Return(GL_NO_ERROR)) |
| 5132 .WillOnce(Return(GL_NO_ERROR)) | 5059 .WillOnce(Return(GL_NO_ERROR)) |
| 5133 .RetiresOnSaturation(); | 5060 .RetiresOnSaturation(); |
| 5134 | 5061 |
| 5135 typedef GetIntegerv::Result Result; | 5062 typedef GetIntegerv::Result Result; |
| 5136 Result* result = static_cast<Result*>(shared_memory_address_); | 5063 Result* result = static_cast<Result*>(shared_memory_address_); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 5165 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, | 5092 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, |
| 5166 result->GetData(), result->GetNumResults())); | 5093 result->GetData(), result->GetNumResults())); |
| 5167 EXPECT_TRUE(ValueInArray( | 5094 EXPECT_TRUE(ValueInArray( |
| 5168 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, | 5095 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, |
| 5169 result->GetData(), result->GetNumResults())); | 5096 result->GetData(), result->GetNumResults())); |
| 5170 | 5097 |
| 5171 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5098 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5172 } | 5099 } |
| 5173 | 5100 |
| 5174 TEST_F(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) { | 5101 TEST_F(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) { |
| 5175 InitDecoder( | 5102 InitState init; |
| 5176 "", // extensions | 5103 init.gl_version = "3.0"; |
| 5177 "3.0", // gl version | 5104 init.bind_generates_resource = true; |
| 5178 false, // has alpha | 5105 InitDecoder(init); |
| 5179 false, // has depth | |
| 5180 false, // has stencil | |
| 5181 false, // request alpha | |
| 5182 false, // request depth | |
| 5183 false, // request stencil | |
| 5184 true); // bind generates resource | |
| 5185 | 5106 |
| 5186 EXPECT_CALL(*gl_, GetError()) | 5107 EXPECT_CALL(*gl_, GetError()) |
| 5187 .WillOnce(Return(GL_NO_ERROR)) | 5108 .WillOnce(Return(GL_NO_ERROR)) |
| 5188 .WillOnce(Return(GL_NO_ERROR)) | 5109 .WillOnce(Return(GL_NO_ERROR)) |
| 5189 .WillOnce(Return(GL_NO_ERROR)) | 5110 .WillOnce(Return(GL_NO_ERROR)) |
| 5190 .WillOnce(Return(GL_NO_ERROR)) | 5111 .WillOnce(Return(GL_NO_ERROR)) |
| 5191 .RetiresOnSaturation(); | 5112 .RetiresOnSaturation(); |
| 5192 | 5113 |
| 5193 typedef GetIntegerv::Result Result; | 5114 typedef GetIntegerv::Result Result; |
| 5194 Result* result = static_cast<Result*>(shared_memory_address_); | 5115 Result* result = static_cast<Result*>(shared_memory_address_); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5210 cmd.Init( | 5131 cmd.Init( |
| 5211 GL_COMPRESSED_TEXTURE_FORMATS, | 5132 GL_COMPRESSED_TEXTURE_FORMATS, |
| 5212 shared_memory_id_, shared_memory_offset_); | 5133 shared_memory_id_, shared_memory_offset_); |
| 5213 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5134 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5214 EXPECT_EQ(num_formats, result->GetNumResults()); | 5135 EXPECT_EQ(num_formats, result->GetNumResults()); |
| 5215 | 5136 |
| 5216 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5137 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5217 } | 5138 } |
| 5218 | 5139 |
| 5219 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DBucketBadBucket) { | 5140 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DBucketBadBucket) { |
| 5220 InitDecoder( | 5141 InitState init; |
| 5221 "GL_EXT_texture_compression_s3tc", // extensions | 5142 init.extensions = "GL_EXT_texture_compression_s3tc"; |
| 5222 "3.0", // gl version | 5143 init.gl_version = "3.0"; |
| 5223 false, // has alpha | 5144 init.bind_generates_resource = true; |
| 5224 false, // has depth | 5145 InitDecoder(init); |
| 5225 false, // has stencil | |
| 5226 false, // request alpha | |
| 5227 false, // request depth | |
| 5228 false, // request stencil | |
| 5229 true); // bind generates resource | |
| 5230 | 5146 |
| 5231 const uint32 kBadBucketId = 123; | 5147 const uint32 kBadBucketId = 123; |
| 5232 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 5148 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 5233 CompressedTexImage2DBucket cmd; | 5149 CompressedTexImage2DBucket cmd; |
| 5234 cmd.Init( | 5150 cmd.Init( |
| 5235 GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 0, | 5151 GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 4, 4, 0, |
| 5236 kBadBucketId); | 5152 kBadBucketId); |
| 5237 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 5153 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 5238 CompressedTexSubImage2DBucket cmd2; | 5154 CompressedTexSubImage2DBucket cmd2; |
| 5239 cmd2.Init( | 5155 cmd2.Init( |
| 5240 GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, | 5156 GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, |
| 5241 kBadBucketId); | 5157 kBadBucketId); |
| 5242 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 5158 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 5243 } | 5159 } |
| 5244 | 5160 |
| 5245 namespace { | 5161 namespace { |
| 5246 | 5162 |
| 5247 struct S3TCTestData { | 5163 struct S3TCTestData { |
| 5248 GLenum format; | 5164 GLenum format; |
| 5249 size_t block_size; | 5165 size_t block_size; |
| 5250 }; | 5166 }; |
| 5251 | 5167 |
| 5252 } // anonymous namespace. | 5168 } // anonymous namespace. |
| 5253 | 5169 |
| 5254 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) { | 5170 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) { |
| 5255 InitDecoder( | 5171 InitState init; |
| 5256 "GL_EXT_texture_compression_s3tc", // extensions | 5172 init.extensions = "GL_EXT_texture_compression_s3tc"; |
| 5257 "3.0", // gl version | 5173 init.gl_version = "3.0"; |
| 5258 false, // has alpha | 5174 init.bind_generates_resource = true; |
| 5259 false, // has depth | 5175 InitDecoder(init); |
| 5260 false, // has stencil | |
| 5261 false, // request alpha | |
| 5262 false, // request depth | |
| 5263 false, // request stencil | |
| 5264 true); // bind generates resource | |
| 5265 const uint32 kBucketId = 123; | 5176 const uint32 kBucketId = 123; |
| 5266 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); | 5177 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); |
| 5267 ASSERT_TRUE(bucket != NULL); | 5178 ASSERT_TRUE(bucket != NULL); |
| 5268 | 5179 |
| 5269 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 5180 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 5270 | 5181 |
| 5271 static const S3TCTestData test_data[] = { | 5182 static const S3TCTestData test_data[] = { |
| 5272 { GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 8, }, | 5183 { GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 8, }, |
| 5273 { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 8, }, | 5184 { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 8, }, |
| 5274 { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 16, }, | 5185 { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 16, }, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5400 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); | 5311 EXPECT_EQ(error::kNoError, ExecuteCmd(sub_cmd)); |
| 5401 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5312 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5402 } | 5313 } |
| 5403 } | 5314 } |
| 5404 } | 5315 } |
| 5405 } | 5316 } |
| 5406 } | 5317 } |
| 5407 } | 5318 } |
| 5408 | 5319 |
| 5409 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DETC1) { | 5320 TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DETC1) { |
| 5410 InitDecoder( | 5321 InitState init; |
| 5411 "GL_OES_compressed_ETC1_RGB8_texture", // extensions | 5322 init.extensions = "GL_OES_compressed_ETC1_RGB8_texture"; |
| 5412 "opengl es 2.0", // gl version | 5323 init.gl_version = "opengl es 2.0"; |
| 5413 false, // has alpha | 5324 init.bind_generates_resource = true; |
| 5414 false, // has depth | 5325 InitDecoder(init); |
| 5415 false, // has stencil | |
| 5416 false, // request alpha | |
| 5417 false, // request depth | |
| 5418 false, // request stencil | |
| 5419 true); // bind generates resource | |
| 5420 const uint32 kBucketId = 123; | 5326 const uint32 kBucketId = 123; |
| 5421 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); | 5327 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); |
| 5422 ASSERT_TRUE(bucket != NULL); | 5328 ASSERT_TRUE(bucket != NULL); |
| 5423 | 5329 |
| 5424 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 5330 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 5425 | 5331 |
| 5426 const GLenum kFormat = GL_ETC1_RGB8_OES; | 5332 const GLenum kFormat = GL_ETC1_RGB8_OES; |
| 5427 const size_t kBlockSize = 8; | 5333 const size_t kBlockSize = 8; |
| 5428 | 5334 |
| 5429 CompressedTexImage2DBucket cmd; | 5335 CompressedTexImage2DBucket cmd; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5473 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5379 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5474 | 5380 |
| 5475 // Test CopyTexSubImage not allowed for ETC1 compressed texture | 5381 // Test CopyTexSubImage not allowed for ETC1 compressed texture |
| 5476 CopyTexSubImage2D copy_cmd; | 5382 CopyTexSubImage2D copy_cmd; |
| 5477 copy_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4); | 5383 copy_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 4, 4); |
| 5478 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); | 5384 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); |
| 5479 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5385 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5480 } | 5386 } |
| 5481 | 5387 |
| 5482 TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormatsETC1) { | 5388 TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormatsETC1) { |
| 5483 InitDecoder( | 5389 InitState init; |
| 5484 "GL_OES_compressed_ETC1_RGB8_texture", // extensions | 5390 init.extensions = "GL_OES_compressed_ETC1_RGB8_texture"; |
| 5485 "opengl es 2.0", // gl version | 5391 init.gl_version = "opengl es 2.0"; |
| 5486 false, // has alpha | 5392 init.bind_generates_resource = true; |
| 5487 false, // has depth | 5393 InitDecoder(init); |
| 5488 false, // has stencil | |
| 5489 false, // request alpha | |
| 5490 false, // request depth | |
| 5491 false, // request stencil | |
| 5492 true); // bind generates resource | |
| 5493 | 5394 |
| 5494 EXPECT_CALL(*gl_, GetError()) | 5395 EXPECT_CALL(*gl_, GetError()) |
| 5495 .WillOnce(Return(GL_NO_ERROR)) | 5396 .WillOnce(Return(GL_NO_ERROR)) |
| 5496 .WillOnce(Return(GL_NO_ERROR)) | 5397 .WillOnce(Return(GL_NO_ERROR)) |
| 5497 .WillOnce(Return(GL_NO_ERROR)) | 5398 .WillOnce(Return(GL_NO_ERROR)) |
| 5498 .WillOnce(Return(GL_NO_ERROR)) | 5399 .WillOnce(Return(GL_NO_ERROR)) |
| 5499 .RetiresOnSaturation(); | 5400 .RetiresOnSaturation(); |
| 5500 | 5401 |
| 5501 typedef GetIntegerv::Result Result; | 5402 typedef GetIntegerv::Result Result; |
| 5502 Result* result = static_cast<Result*>(shared_memory_address_); | 5403 Result* result = static_cast<Result*>(shared_memory_address_); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5549 EXPECT_EQ(sizeof(ProgramInfoHeader), bucket->size()); | 5450 EXPECT_EQ(sizeof(ProgramInfoHeader), bucket->size()); |
| 5550 ProgramInfoHeader* info = bucket->GetDataAs<ProgramInfoHeader*>( | 5451 ProgramInfoHeader* info = bucket->GetDataAs<ProgramInfoHeader*>( |
| 5551 0, sizeof(ProgramInfoHeader)); | 5452 0, sizeof(ProgramInfoHeader)); |
| 5552 ASSERT_TRUE(info != 0); | 5453 ASSERT_TRUE(info != 0); |
| 5553 EXPECT_EQ(0u, info->link_status); | 5454 EXPECT_EQ(0u, info->link_status); |
| 5554 EXPECT_EQ(0u, info->num_attribs); | 5455 EXPECT_EQ(0u, info->num_attribs); |
| 5555 EXPECT_EQ(0u, info->num_uniforms); | 5456 EXPECT_EQ(0u, info->num_uniforms); |
| 5556 } | 5457 } |
| 5557 | 5458 |
| 5558 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) { | 5459 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) { |
| 5559 InitDecoder( | 5460 InitState init; |
| 5560 "GL_OES_EGL_image_external", // extensions | 5461 init.extensions = "GL_OES_EGL_image_external"; |
| 5561 "opengl es 2.0", // gl version | 5462 init.gl_version = "opengl es 2.0"; |
| 5562 false, // has alpha | 5463 init.bind_generates_resource = true; |
| 5563 false, // has depth | 5464 InitDecoder(init); |
| 5564 false, // has stencil | |
| 5565 false, // request alpha | |
| 5566 false, // request depth | |
| 5567 false, // request stencil | |
| 5568 true); // bind generates resource | |
| 5569 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); | 5465 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); |
| 5570 EXPECT_CALL(*gl_, GenTextures(1, _)) | 5466 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 5571 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); | 5467 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
| 5572 BindTexture cmd; | 5468 BindTexture cmd; |
| 5573 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); | 5469 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); |
| 5574 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5470 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5575 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5471 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5576 TextureRef* texture_ref = GetTexture(kNewClientId); | 5472 TextureRef* texture_ref = GetTexture(kNewClientId); |
| 5577 EXPECT_TRUE(texture_ref != NULL); | 5473 EXPECT_TRUE(texture_ref != NULL); |
| 5578 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES); | 5474 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5579 } | 5475 } |
| 5580 | 5476 |
| 5581 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { | 5477 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { |
| 5582 InitDecoder( | 5478 InitState init; |
| 5583 "GL_OES_EGL_image_external", // extensions | 5479 init.extensions = "GL_OES_EGL_image_external"; |
| 5584 "opengl es 2.0", // gl version | 5480 init.gl_version = "opengl es 2.0"; |
| 5585 false, // has alpha | 5481 init.bind_generates_resource = true; |
| 5586 false, // has depth | 5482 InitDecoder(init); |
| 5587 false, // has stencil | |
| 5588 false, // request alpha | |
| 5589 false, // request depth | |
| 5590 false, // request stencil | |
| 5591 true); // bind generates resource | |
| 5592 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5483 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5593 | 5484 |
| 5594 EXPECT_CALL(*gl_, GetError()) | 5485 EXPECT_CALL(*gl_, GetError()) |
| 5595 .WillOnce(Return(GL_NO_ERROR)) | 5486 .WillOnce(Return(GL_NO_ERROR)) |
| 5596 .WillOnce(Return(GL_NO_ERROR)) | 5487 .WillOnce(Return(GL_NO_ERROR)) |
| 5597 .RetiresOnSaturation(); | 5488 .RetiresOnSaturation(); |
| 5598 typedef GetIntegerv::Result Result; | 5489 typedef GetIntegerv::Result Result; |
| 5599 Result* result = static_cast<Result*>(shared_memory_address_); | 5490 Result* result = static_cast<Result*>(shared_memory_address_); |
| 5600 EXPECT_CALL(*gl_, GetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, | 5491 EXPECT_CALL(*gl_, GetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, |
| 5601 result->GetData())) | 5492 result->GetData())) |
| 5602 .Times(0); | 5493 .Times(0); |
| 5603 result->size = 0; | 5494 result->size = 0; |
| 5604 GetIntegerv cmd; | 5495 GetIntegerv cmd; |
| 5605 cmd.Init(GL_TEXTURE_BINDING_EXTERNAL_OES, | 5496 cmd.Init(GL_TEXTURE_BINDING_EXTERNAL_OES, |
| 5606 shared_memory_id_, | 5497 shared_memory_id_, |
| 5607 shared_memory_offset_); | 5498 shared_memory_offset_); |
| 5608 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5499 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5609 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( | 5500 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( |
| 5610 GL_TEXTURE_BINDING_EXTERNAL_OES), result->GetNumResults()); | 5501 GL_TEXTURE_BINDING_EXTERNAL_OES), result->GetNumResults()); |
| 5611 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5502 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5612 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]); | 5503 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]); |
| 5613 } | 5504 } |
| 5614 | 5505 |
| 5615 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) { | 5506 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) { |
| 5616 InitDecoder( | 5507 InitState init; |
| 5617 "GL_OES_EGL_image_external", // extensions | 5508 init.extensions = "GL_OES_EGL_image_external"; |
| 5618 "opengl es 2.0", // gl version | 5509 init.gl_version = "opengl es 2.0"; |
| 5619 false, // has alpha | 5510 init.bind_generates_resource = true; |
| 5620 false, // has depth | 5511 InitDecoder(init); |
| 5621 false, // has stencil | |
| 5622 false, // request alpha | |
| 5623 false, // request depth | |
| 5624 false, // request stencil | |
| 5625 true); // bind generates resource | |
| 5626 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5512 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5627 | 5513 |
| 5628 TextureRef* texture_ref = GetTexture(client_texture_id_); | 5514 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5629 EXPECT_TRUE(texture_ref != NULL); | 5515 EXPECT_TRUE(texture_ref != NULL); |
| 5630 Texture* texture = texture_ref->texture(); | 5516 Texture* texture = texture_ref->texture(); |
| 5631 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); | 5517 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5632 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5518 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5633 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5519 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5634 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5520 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5635 } | 5521 } |
| 5636 | 5522 |
| 5637 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { | 5523 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) { |
| 5638 InitDecoder( | 5524 InitState init; |
| 5639 "GL_OES_EGL_image_external", // extensions | 5525 init.extensions = "GL_OES_EGL_image_external"; |
| 5640 "opengl es 2.0", // gl version | 5526 init.gl_version = "opengl es 2.0"; |
| 5641 false, // has alpha | 5527 init.bind_generates_resource = true; |
| 5642 false, // has depth | 5528 InitDecoder(init); |
| 5643 false, // has stencil | |
| 5644 false, // request alpha | |
| 5645 false, // request depth | |
| 5646 false, // request stencil | |
| 5647 true); // bind generates resource | |
| 5648 | |
| 5649 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5529 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5650 | 5530 |
| 5651 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES, | 5531 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES, |
| 5652 GL_TEXTURE_MIN_FILTER, | 5532 GL_TEXTURE_MIN_FILTER, |
| 5653 GL_NEAREST)); | 5533 GL_NEAREST)); |
| 5654 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES, | 5534 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES, |
| 5655 GL_TEXTURE_MIN_FILTER, | 5535 GL_TEXTURE_MIN_FILTER, |
| 5656 GL_LINEAR)); | 5536 GL_LINEAR)); |
| 5657 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES, | 5537 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES, |
| 5658 GL_TEXTURE_WRAP_S, | 5538 GL_TEXTURE_WRAP_S, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5688 TextureRef* texture_ref = GetTexture(client_texture_id_); | 5568 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5689 EXPECT_TRUE(texture_ref != NULL); | 5569 EXPECT_TRUE(texture_ref != NULL); |
| 5690 Texture* texture = texture_ref->texture(); | 5570 Texture* texture = texture_ref->texture(); |
| 5691 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); | 5571 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5692 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5572 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5693 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5573 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5694 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5574 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5695 } | 5575 } |
| 5696 | 5576 |
| 5697 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { | 5577 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) { |
| 5698 InitDecoder( | 5578 InitState init; |
| 5699 "GL_OES_EGL_image_external", // extensions | 5579 init.extensions = "GL_OES_EGL_image_external"; |
| 5700 "opengl es 2.0", // gl version | 5580 init.gl_version = "opengl es 2.0"; |
| 5701 false, // has alpha | 5581 init.bind_generates_resource = true; |
| 5702 false, // has depth | 5582 InitDecoder(init); |
| 5703 false, // has stencil | |
| 5704 false, // request alpha | |
| 5705 false, // request depth | |
| 5706 false, // request stencil | |
| 5707 true); // bind generates resource | |
| 5708 | |
| 5709 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5583 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5710 | 5584 |
| 5711 TexParameteri cmd; | 5585 TexParameteri cmd; |
| 5712 cmd.Init(GL_TEXTURE_EXTERNAL_OES, | 5586 cmd.Init(GL_TEXTURE_EXTERNAL_OES, |
| 5713 GL_TEXTURE_MIN_FILTER, | 5587 GL_TEXTURE_MIN_FILTER, |
| 5714 GL_NEAREST_MIPMAP_NEAREST); | 5588 GL_NEAREST_MIPMAP_NEAREST); |
| 5715 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5589 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5716 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 5590 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 5717 | 5591 |
| 5718 cmd.Init(GL_TEXTURE_EXTERNAL_OES, | 5592 cmd.Init(GL_TEXTURE_EXTERNAL_OES, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5730 TextureRef* texture_ref = GetTexture(client_texture_id_); | 5604 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 5731 EXPECT_TRUE(texture_ref != NULL); | 5605 EXPECT_TRUE(texture_ref != NULL); |
| 5732 Texture* texture = texture_ref->texture(); | 5606 Texture* texture = texture_ref->texture(); |
| 5733 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); | 5607 EXPECT_TRUE(texture->target() == GL_TEXTURE_EXTERNAL_OES); |
| 5734 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5608 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5735 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5609 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5736 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5610 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5737 } | 5611 } |
| 5738 | 5612 |
| 5739 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { | 5613 TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) { |
| 5740 InitDecoder( | 5614 InitState init; |
| 5741 "GL_OES_EGL_image_external", // extensions | 5615 init.extensions = "GL_OES_EGL_image_external"; |
| 5742 "opengl es 2.0", // gl version | 5616 init.gl_version = "opengl es 2.0"; |
| 5743 false, // has alpha | 5617 init.bind_generates_resource = true; |
| 5744 false, // has depth | 5618 InitDecoder(init); |
| 5745 false, // has stencil | |
| 5746 false, // request alpha | |
| 5747 false, // request depth | |
| 5748 false, // request stencil | |
| 5749 true); // bind generates resource | |
| 5750 | 5619 |
| 5751 GLenum target = GL_TEXTURE_EXTERNAL_OES; | 5620 GLenum target = GL_TEXTURE_EXTERNAL_OES; |
| 5752 GLint level = 0; | 5621 GLint level = 0; |
| 5753 GLenum internal_format = GL_RGBA; | 5622 GLenum internal_format = GL_RGBA; |
| 5754 GLsizei width = 2; | 5623 GLsizei width = 2; |
| 5755 GLsizei height = 4; | 5624 GLsizei height = 4; |
| 5756 GLint border = 0; | 5625 GLint border = 0; |
| 5757 GLenum format = GL_RGBA; | 5626 GLenum format = GL_RGBA; |
| 5758 GLenum type = GL_UNSIGNED_BYTE; | 5627 GLenum type = GL_UNSIGNED_BYTE; |
| 5759 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); | 5628 DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId); |
| 5760 ASSERT_TRUE(GetTexture(client_texture_id_) != NULL); | 5629 ASSERT_TRUE(GetTexture(client_texture_id_) != NULL); |
| 5761 TexImage2D cmd; | 5630 TexImage2D cmd; |
| 5762 cmd.Init(target, level, internal_format, width, height, border, format, | 5631 cmd.Init(target, level, internal_format, width, height, border, format, |
| 5763 type, kSharedMemoryId, kSharedMemoryOffset); | 5632 type, kSharedMemoryId, kSharedMemoryOffset); |
| 5764 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5633 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5765 | 5634 |
| 5766 // TexImage2D is not allowed with GL_TEXTURE_EXTERNAL_OES targets. | 5635 // TexImage2D is not allowed with GL_TEXTURE_EXTERNAL_OES targets. |
| 5767 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 5636 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 5768 } | 5637 } |
| 5769 | 5638 |
| 5770 TEST_F(GLES2DecoderManualInitTest, BindGeneratesResourceFalse) { | 5639 TEST_F(GLES2DecoderManualInitTest, BindGeneratesResourceFalse) { |
| 5771 InitDecoder( | 5640 InitState init; |
| 5772 "", // extensions | 5641 init.gl_version = "3.0"; |
| 5773 "3.0", // gl version | 5642 InitDecoder(init); |
| 5774 false, // has alpha | |
| 5775 false, // has depth | |
| 5776 false, // has stencil | |
| 5777 false, // request alpha | |
| 5778 false, // request depth | |
| 5779 false, // request stencil | |
| 5780 false); // bind generates resource | |
| 5781 | 5643 |
| 5782 BindTexture cmd1; | 5644 BindTexture cmd1; |
| 5783 cmd1.Init(GL_TEXTURE_2D, kInvalidClientId); | 5645 cmd1.Init(GL_TEXTURE_2D, kInvalidClientId); |
| 5784 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); | 5646 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); |
| 5785 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5647 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5786 | 5648 |
| 5787 BindBuffer cmd2; | 5649 BindBuffer cmd2; |
| 5788 cmd2.Init(GL_ARRAY_BUFFER, kInvalidClientId); | 5650 cmd2.Init(GL_ARRAY_BUFFER, kInvalidClientId); |
| 5789 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 5651 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 5790 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5652 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5791 | 5653 |
| 5792 BindFramebuffer cmd3; | 5654 BindFramebuffer cmd3; |
| 5793 cmd3.Init(GL_FRAMEBUFFER, kInvalidClientId); | 5655 cmd3.Init(GL_FRAMEBUFFER, kInvalidClientId); |
| 5794 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd3)); | 5656 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd3)); |
| 5795 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5657 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5796 | 5658 |
| 5797 BindRenderbuffer cmd4; | 5659 BindRenderbuffer cmd4; |
| 5798 cmd4.Init(GL_RENDERBUFFER, kInvalidClientId); | 5660 cmd4.Init(GL_RENDERBUFFER, kInvalidClientId); |
| 5799 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd4)); | 5661 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd4)); |
| 5800 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 5662 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 5801 } | 5663 } |
| 5802 | 5664 |
| 5803 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { | 5665 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { |
| 5804 InitDecoder( | 5666 InitState init; |
| 5805 "GL_ARB_texture_rectangle", // extensions | 5667 init.extensions = "GL_ARB_texture_rectangle"; |
| 5806 "3.0", // gl version | 5668 init.gl_version = "3.0"; |
| 5807 false, // has alpha | 5669 init.bind_generates_resource = true; |
| 5808 false, // has depth | 5670 InitDecoder(init); |
| 5809 false, // has stencil | |
| 5810 false, // request alpha | |
| 5811 false, // request depth | |
| 5812 false, // request stencil | |
| 5813 true); // bind generates resource | |
| 5814 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); | 5671 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); |
| 5815 EXPECT_CALL(*gl_, GenTextures(1, _)) | 5672 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 5816 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); | 5673 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
| 5817 BindTexture cmd; | 5674 BindTexture cmd; |
| 5818 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); | 5675 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); |
| 5819 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5676 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5820 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5677 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5821 Texture* texture = GetTexture(kNewClientId)->texture(); | 5678 Texture* texture = GetTexture(kNewClientId)->texture(); |
| 5822 EXPECT_TRUE(texture != NULL); | 5679 EXPECT_TRUE(texture != NULL); |
| 5823 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 5680 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 5824 } | 5681 } |
| 5825 | 5682 |
| 5826 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { | 5683 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { |
| 5827 InitDecoder( | 5684 InitState init; |
| 5828 "GL_ARB_texture_rectangle", // extensions | 5685 init.extensions = "GL_ARB_texture_rectangle"; |
| 5829 "3.0", // gl version | 5686 init.gl_version = "3.0"; |
| 5830 false, // has alpha | 5687 init.bind_generates_resource = true; |
| 5831 false, // has depth | 5688 InitDecoder(init); |
| 5832 false, // has stencil | |
| 5833 false, // request alpha | |
| 5834 false, // request depth | |
| 5835 false, // request stencil | |
| 5836 true); // bind generates resource | |
| 5837 DoBindTexture( | 5689 DoBindTexture( |
| 5838 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); | 5690 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); |
| 5839 | 5691 |
| 5840 EXPECT_CALL(*gl_, GetError()) | 5692 EXPECT_CALL(*gl_, GetError()) |
| 5841 .WillOnce(Return(GL_NO_ERROR)) | 5693 .WillOnce(Return(GL_NO_ERROR)) |
| 5842 .WillOnce(Return(GL_NO_ERROR)) | 5694 .WillOnce(Return(GL_NO_ERROR)) |
| 5843 .RetiresOnSaturation(); | 5695 .RetiresOnSaturation(); |
| 5844 typedef GetIntegerv::Result Result; | 5696 typedef GetIntegerv::Result Result; |
| 5845 Result* result = static_cast<Result*>(shared_memory_address_); | 5697 Result* result = static_cast<Result*>(shared_memory_address_); |
| 5846 EXPECT_CALL(*gl_, GetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, | 5698 EXPECT_CALL(*gl_, GetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, |
| 5847 result->GetData())) | 5699 result->GetData())) |
| 5848 .Times(0); | 5700 .Times(0); |
| 5849 result->size = 0; | 5701 result->size = 0; |
| 5850 GetIntegerv cmd; | 5702 GetIntegerv cmd; |
| 5851 cmd.Init(GL_TEXTURE_BINDING_RECTANGLE_ARB, | 5703 cmd.Init(GL_TEXTURE_BINDING_RECTANGLE_ARB, |
| 5852 shared_memory_id_, | 5704 shared_memory_id_, |
| 5853 shared_memory_offset_); | 5705 shared_memory_offset_); |
| 5854 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5706 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5855 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( | 5707 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( |
| 5856 GL_TEXTURE_BINDING_RECTANGLE_ARB), result->GetNumResults()); | 5708 GL_TEXTURE_BINDING_RECTANGLE_ARB), result->GetNumResults()); |
| 5857 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5709 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 5858 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]); | 5710 EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]); |
| 5859 } | 5711 } |
| 5860 | 5712 |
| 5861 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) { | 5713 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) { |
| 5862 InitDecoder( | 5714 InitState init; |
| 5863 "GL_ARB_texture_rectangle", // extensions | 5715 init.extensions = "GL_ARB_texture_rectangle"; |
| 5864 "3.0", // gl version | 5716 init.gl_version = "3.0"; |
| 5865 false, // has alpha | 5717 init.bind_generates_resource = true; |
| 5866 false, // has depth | 5718 InitDecoder(init); |
| 5867 false, // has stencil | |
| 5868 false, // request alpha | |
| 5869 false, // request depth | |
| 5870 false, // request stencil | |
| 5871 true); // bind generates resource | |
| 5872 DoBindTexture( | 5719 DoBindTexture( |
| 5873 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); | 5720 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); |
| 5874 | 5721 |
| 5875 Texture* texture = GetTexture(client_texture_id_)->texture(); | 5722 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 5876 EXPECT_TRUE(texture != NULL); | 5723 EXPECT_TRUE(texture != NULL); |
| 5877 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 5724 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 5878 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5725 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5879 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5726 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5880 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5727 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5881 } | 5728 } |
| 5882 | 5729 |
| 5883 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { | 5730 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) { |
| 5884 InitDecoder( | 5731 InitState init; |
| 5885 "GL_ARB_texture_rectangle", // extensions | 5732 init.extensions = "GL_ARB_texture_rectangle"; |
| 5886 "3.0", // gl version | 5733 init.gl_version = "3.0"; |
| 5887 false, // has alpha | 5734 init.bind_generates_resource = true; |
| 5888 false, // has depth | 5735 InitDecoder(init); |
| 5889 false, // has stencil | |
| 5890 false, // request alpha | |
| 5891 false, // request depth | |
| 5892 false, // request stencil | |
| 5893 true); // bind generates resource | |
| 5894 | 5736 |
| 5895 DoBindTexture( | 5737 DoBindTexture( |
| 5896 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); | 5738 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); |
| 5897 | 5739 |
| 5898 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_RECTANGLE_ARB, | 5740 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_RECTANGLE_ARB, |
| 5899 GL_TEXTURE_MIN_FILTER, | 5741 GL_TEXTURE_MIN_FILTER, |
| 5900 GL_NEAREST)); | 5742 GL_NEAREST)); |
| 5901 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_RECTANGLE_ARB, | 5743 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_RECTANGLE_ARB, |
| 5902 GL_TEXTURE_MIN_FILTER, | 5744 GL_TEXTURE_MIN_FILTER, |
| 5903 GL_LINEAR)); | 5745 GL_LINEAR)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 5934 | 5776 |
| 5935 Texture* texture = GetTexture(client_texture_id_)->texture(); | 5777 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 5936 EXPECT_TRUE(texture != NULL); | 5778 EXPECT_TRUE(texture != NULL); |
| 5937 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 5779 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 5938 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5780 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5939 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5781 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5940 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5782 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5941 } | 5783 } |
| 5942 | 5784 |
| 5943 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { | 5785 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) { |
| 5944 InitDecoder( | 5786 InitState init; |
| 5945 "GL_ARB_texture_rectangle", // extensions | 5787 init.extensions = "GL_ARB_texture_rectangle"; |
| 5946 "3.0", // gl version | 5788 init.gl_version = "3.0"; |
| 5947 false, // has alpha | 5789 init.bind_generates_resource = true; |
| 5948 false, // has depth | 5790 InitDecoder(init); |
| 5949 false, // has stencil | |
| 5950 false, // request alpha | |
| 5951 false, // request depth | |
| 5952 false, // request stencil | |
| 5953 true); // bind generates resource | |
| 5954 | 5791 |
| 5955 DoBindTexture( | 5792 DoBindTexture( |
| 5956 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); | 5793 GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId); |
| 5957 | 5794 |
| 5958 TexParameteri cmd; | 5795 TexParameteri cmd; |
| 5959 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, | 5796 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, |
| 5960 GL_TEXTURE_MIN_FILTER, | 5797 GL_TEXTURE_MIN_FILTER, |
| 5961 GL_NEAREST_MIPMAP_NEAREST); | 5798 GL_NEAREST_MIPMAP_NEAREST); |
| 5962 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5799 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5963 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 5800 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5976 | 5813 |
| 5977 Texture* texture = GetTexture(client_texture_id_)->texture(); | 5814 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 5978 EXPECT_TRUE(texture != NULL); | 5815 EXPECT_TRUE(texture != NULL); |
| 5979 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); | 5816 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); |
| 5980 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); | 5817 EXPECT_TRUE(texture->min_filter() == GL_LINEAR); |
| 5981 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); | 5818 EXPECT_TRUE(texture->wrap_s() == GL_CLAMP_TO_EDGE); |
| 5982 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); | 5819 EXPECT_TRUE(texture->wrap_t() == GL_CLAMP_TO_EDGE); |
| 5983 } | 5820 } |
| 5984 | 5821 |
| 5985 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) { | 5822 TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) { |
| 5986 InitDecoder( | 5823 InitState init; |
| 5987 "GL_ARB_texture_rectangle", // extensions | 5824 init.extensions = "GL_ARB_texture_rectangle"; |
| 5988 "3.0", // gl version | 5825 init.gl_version = "3.0"; |
| 5989 false, // has alpha | 5826 init.bind_generates_resource = true; |
| 5990 false, // has depth | 5827 InitDecoder(init); |
| 5991 false, // has stencil | |
| 5992 false, // request alpha | |
| 5993 false, // request depth | |
| 5994 false, // request stencil | |
| 5995 true); // bind generates resource | |
| 5996 | 5828 |
| 5997 GLenum target = GL_TEXTURE_RECTANGLE_ARB; | 5829 GLenum target = GL_TEXTURE_RECTANGLE_ARB; |
| 5998 GLint level = 0; | 5830 GLint level = 0; |
| 5999 GLenum internal_format = GL_RGBA; | 5831 GLenum internal_format = GL_RGBA; |
| 6000 GLsizei width = 2; | 5832 GLsizei width = 2; |
| 6001 GLsizei height = 4; | 5833 GLsizei height = 4; |
| 6002 GLint border = 0; | 5834 GLint border = 0; |
| 6003 GLenum format = GL_RGBA; | 5835 GLenum format = GL_RGBA; |
| 6004 GLenum type = GL_UNSIGNED_BYTE; | 5836 GLenum type = GL_UNSIGNED_BYTE; |
| 6005 DoBindTexture( | 5837 DoBindTexture( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6080 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5912 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6081 } | 5913 } |
| 6082 | 5914 |
| 6083 TEST_F( | 5915 TEST_F( |
| 6084 GLES2DecoderManualInitTest, | 5916 GLES2DecoderManualInitTest, |
| 6085 TexSubImage2DDoesNotClearAfterTexImage2DNULLThenDataWithTexImage2DIsFaster)
{ | 5917 TexSubImage2DDoesNotClearAfterTexImage2DNULLThenDataWithTexImage2DIsFaster)
{ |
| 6086 CommandLine command_line(0, NULL); | 5918 CommandLine command_line(0, NULL); |
| 6087 command_line.AppendSwitchASCII( | 5919 command_line.AppendSwitchASCII( |
| 6088 switches::kGpuDriverBugWorkarounds, | 5920 switches::kGpuDriverBugWorkarounds, |
| 6089 base::IntToString(gpu::TEXSUBIMAGE2D_FASTER_THAN_TEXIMAGE2D)); | 5921 base::IntToString(gpu::TEXSUBIMAGE2D_FASTER_THAN_TEXIMAGE2D)); |
| 6090 InitDecoderWithCommandLine( | 5922 InitState init; |
| 6091 "", // extensions | 5923 init.gl_version = "3.0"; |
| 6092 "3.0", // gl version | 5924 init.bind_generates_resource = true; |
| 6093 false, // has alpha | 5925 InitDecoderWithCommandLine(init, &command_line); |
| 6094 false, // has depth | |
| 6095 false, // has stencil | |
| 6096 false, // request alpha | |
| 6097 false, // request depth | |
| 6098 false, // request stencil | |
| 6099 true, // bind generates resource | |
| 6100 &command_line); | |
| 6101 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 5926 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 6102 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 5927 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 6103 0, 0); | 5928 0, 0); |
| 6104 | 5929 |
| 6105 { | 5930 { |
| 6106 // Uses texSubimage internally because the above workaround is active and | 5931 // Uses texSubimage internally because the above workaround is active and |
| 6107 // the update is for the full size of the texture. | 5932 // the update is for the full size of the texture. |
| 6108 EXPECT_CALL(*gl_, | 5933 EXPECT_CALL(*gl_, |
| 6109 TexSubImage2D( | 5934 TexSubImage2D( |
| 6110 GL_TEXTURE_2D, 0, 0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, _)) | 5935 GL_TEXTURE_2D, 0, 0, 0, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, _)) |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6372 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); | 6197 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); |
| 6373 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1)) | 6198 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1)) |
| 6374 .Times(1) | 6199 .Times(1) |
| 6375 .RetiresOnSaturation(); | 6200 .RetiresOnSaturation(); |
| 6376 CopyTexSubImage2D cmd; | 6201 CopyTexSubImage2D cmd; |
| 6377 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); | 6202 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); |
| 6378 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6203 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6379 } | 6204 } |
| 6380 | 6205 |
| 6381 TEST_F(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) { | 6206 TEST_F(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) { |
| 6382 InitDecoder( | 6207 InitState init; |
| 6383 "GL_EXT_texture_compression_s3tc", // extensions | 6208 init.extensions = "GL_EXT_texture_compression_s3tc"; |
| 6384 "3.0", // gl version | 6209 init.gl_version = "3.0"; |
| 6385 false, // has alpha | 6210 init.bind_generates_resource = true; |
| 6386 false, // has depth | 6211 InitDecoder(init); |
| 6387 false, // has stencil | |
| 6388 false, // request alpha | |
| 6389 false, // request depth | |
| 6390 false, // request stencil | |
| 6391 true); // bind generates resource | |
| 6392 | 6212 |
| 6393 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 6213 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 6394 EXPECT_CALL(*gl_, GetError()) | 6214 EXPECT_CALL(*gl_, GetError()) |
| 6395 .WillOnce(Return(GL_NO_ERROR)) | 6215 .WillOnce(Return(GL_NO_ERROR)) |
| 6396 .RetiresOnSaturation(); | 6216 .RetiresOnSaturation(); |
| 6397 EXPECT_CALL(*gl_, CompressedTexImage2D( | 6217 EXPECT_CALL(*gl_, CompressedTexImage2D( |
| 6398 GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, 8, _)) | 6218 GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, 8, _)) |
| 6399 .Times(1) | 6219 .Times(1) |
| 6400 .RetiresOnSaturation(); | 6220 .RetiresOnSaturation(); |
| 6401 EXPECT_CALL(*gl_, GetError()) | 6221 EXPECT_CALL(*gl_, GetError()) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6512 cmd.Init(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, | 6332 cmd.Init(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 6513 pixels_shm_id, pixels_shm_offset, | 6333 pixels_shm_id, pixels_shm_offset, |
| 6514 result_shm_id, result_shm_offset, | 6334 result_shm_id, result_shm_offset, |
| 6515 false); | 6335 false); |
| 6516 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6336 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6517 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6337 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6518 } | 6338 } |
| 6519 | 6339 |
| 6520 TEST_F(GLES2DecoderManualInitTest, | 6340 TEST_F(GLES2DecoderManualInitTest, |
| 6521 UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) { | 6341 UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) { |
| 6522 InitDecoder( | 6342 InitState init; |
| 6523 "GL_EXT_framebuffer_multisample", // extensions | 6343 init.extensions = "GL_EXT_framebuffer_multisample"; |
| 6524 "2.1", // gl version | 6344 init.gl_version = "2.1"; |
| 6525 false, // has alpha | 6345 init.bind_generates_resource = true; |
| 6526 false, // has depth | 6346 InitDecoder(init); |
| 6527 false, // has stencil | |
| 6528 false, // request alpha | |
| 6529 false, // request depth | |
| 6530 false, // request stencil | |
| 6531 true); // bind generates resource | |
| 6532 const GLuint kFBOClientTextureId = 4100; | 6347 const GLuint kFBOClientTextureId = 4100; |
| 6533 const GLuint kFBOServiceTextureId = 4101; | 6348 const GLuint kFBOServiceTextureId = 4101; |
| 6534 | 6349 |
| 6535 // Register a texture id. | 6350 // Register a texture id. |
| 6536 EXPECT_CALL(*gl_, GenTextures(_, _)) | 6351 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 6537 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 6352 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| 6538 .RetiresOnSaturation(); | 6353 .RetiresOnSaturation(); |
| 6539 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 6354 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| 6540 | 6355 |
| 6541 // Setup "render from" texture. | 6356 // Setup "render from" texture. |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6967 .RetiresOnSaturation(); | 6782 .RetiresOnSaturation(); |
| 6968 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 6783 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 6969 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 6784 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 6970 } | 6785 } |
| 6971 | 6786 |
| 6972 TEST_F(GLES2DecoderTest, BeginQueryEXTDisabled) { | 6787 TEST_F(GLES2DecoderTest, BeginQueryEXTDisabled) { |
| 6973 // Test something fails if off. | 6788 // Test something fails if off. |
| 6974 } | 6789 } |
| 6975 | 6790 |
| 6976 TEST_F(GLES2DecoderManualInitTest, BeginEndQueryEXT) { | 6791 TEST_F(GLES2DecoderManualInitTest, BeginEndQueryEXT) { |
| 6977 InitDecoder( | 6792 InitState init; |
| 6978 "GL_EXT_occlusion_query_boolean", // extensions | 6793 init.extensions = "GL_EXT_occlusion_query_boolean"; |
| 6979 "opengl es 2.0", // gl version | 6794 init.gl_version = "opengl es 2.0"; |
| 6980 true, // has alpha | 6795 init.has_alpha = true; |
| 6981 false, // has depth | 6796 init.request_alpha = true; |
| 6982 false, // has stencil | 6797 init.bind_generates_resource = true; |
| 6983 true, // request alpha | 6798 InitDecoder(init); |
| 6984 false, // request depth | |
| 6985 false, // request stencil | |
| 6986 true); // bind generates resource | |
| 6987 | 6799 |
| 6988 // Test end fails if no begin. | 6800 // Test end fails if no begin. |
| 6989 EndQueryEXT end_cmd; | 6801 EndQueryEXT end_cmd; |
| 6990 end_cmd.Init(GL_ANY_SAMPLES_PASSED_EXT, 1); | 6802 end_cmd.Init(GL_ANY_SAMPLES_PASSED_EXT, 1); |
| 6991 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); | 6803 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); |
| 6992 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 6804 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 6993 | 6805 |
| 6994 BeginQueryEXT begin_cmd; | 6806 BeginQueryEXT begin_cmd; |
| 6995 | 6807 |
| 6996 // Test id = 0 fails. | 6808 // Test id = 0 fails. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7059 | 6871 |
| 7060 static void CheckBeginEndQueryBadMemoryFails( | 6872 static void CheckBeginEndQueryBadMemoryFails( |
| 7061 GLES2DecoderTestBase* test, | 6873 GLES2DecoderTestBase* test, |
| 7062 GLuint client_id, | 6874 GLuint client_id, |
| 7063 GLuint service_id, | 6875 GLuint service_id, |
| 7064 const QueryType& query_type, | 6876 const QueryType& query_type, |
| 7065 int32 shm_id, | 6877 int32 shm_id, |
| 7066 uint32 shm_offset) { | 6878 uint32 shm_offset) { |
| 7067 // We need to reset the decoder on each iteration, because we lose the | 6879 // We need to reset the decoder on each iteration, because we lose the |
| 7068 // context every time. | 6880 // context every time. |
| 7069 test->InitDecoder( | 6881 GLES2DecoderTestBase::InitState init; |
| 7070 "GL_EXT_occlusion_query_boolean", // extensions | 6882 init.extensions = "GL_EXT_occlusion_query_boolean"; |
| 7071 "opengl es 2.0", // gl version | 6883 init.gl_version = "opengl es 2.0"; |
| 7072 true, // has alpha | 6884 init.has_alpha = true; |
| 7073 false, // has depth | 6885 init.request_alpha = true; |
| 7074 false, // has stencil | 6886 init.bind_generates_resource = true; |
| 7075 true, // request alpha | 6887 test->InitDecoder(init); |
| 7076 false, // request depth | |
| 7077 false, // request stencil | |
| 7078 true); // bind generates resource | |
| 7079 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = test->GetGLMock(); | 6888 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = test->GetGLMock(); |
| 7080 | 6889 |
| 7081 BeginQueryEXT begin_cmd; | 6890 BeginQueryEXT begin_cmd; |
| 7082 | 6891 |
| 7083 test->GenHelper<GenQueriesEXTImmediate>(client_id); | 6892 test->GenHelper<GenQueriesEXTImmediate>(client_id); |
| 7084 | 6893 |
| 7085 if (query_type.is_gl) { | 6894 if (query_type.is_gl) { |
| 7086 EXPECT_CALL(*gl, GenQueriesARB(1, _)) | 6895 EXPECT_CALL(*gl, GenQueriesARB(1, _)) |
| 7087 .WillOnce(SetArgumentPointee<1>(service_id)) | 6896 .WillOnce(SetArgumentPointee<1>(service_id)) |
| 7088 .RetiresOnSaturation(); | 6897 .RetiresOnSaturation(); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7334 EXPECT_NE(0u, *result); | 7143 EXPECT_NE(0u, *result); |
| 7335 Disable disable_cmd; | 7144 Disable disable_cmd; |
| 7336 disable_cmd.Init(state); | 7145 disable_cmd.Init(state); |
| 7337 EXPECT_EQ(error::kNoError, ExecuteCmd(disable_cmd)); | 7146 EXPECT_EQ(error::kNoError, ExecuteCmd(disable_cmd)); |
| 7338 EXPECT_EQ(error::kNoError, ExecuteCmd(is_enabled_cmd)); | 7147 EXPECT_EQ(error::kNoError, ExecuteCmd(is_enabled_cmd)); |
| 7339 EXPECT_EQ(0u, *result); | 7148 EXPECT_EQ(0u, *result); |
| 7340 } | 7149 } |
| 7341 } | 7150 } |
| 7342 | 7151 |
| 7343 TEST_F(GLES2DecoderManualInitTest, DepthTextureBadArgs) { | 7152 TEST_F(GLES2DecoderManualInitTest, DepthTextureBadArgs) { |
| 7344 InitDecoder( | 7153 InitState init; |
| 7345 "GL_ANGLE_depth_texture", // extensions | 7154 init.extensions = "GL_ANGLE_depth_texture"; |
| 7346 "opengl es 2.0", // gl version | 7155 init.gl_version = "opengl es 2.0"; |
| 7347 false, // has alpha | 7156 init.has_depth = true; |
| 7348 true, // has depth | 7157 init.has_stencil = true; |
| 7349 true, // has stencil | 7158 init.request_depth = true; |
| 7350 false, // request alpha | 7159 init.request_stencil = true; |
| 7351 true, // request depth | 7160 init.bind_generates_resource = true; |
| 7352 true, // request stencil | 7161 InitDecoder(init); |
| 7353 true); // bind generates resource | |
| 7354 | 7162 |
| 7355 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7163 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7356 // Check trying to upload data fails. | 7164 // Check trying to upload data fails. |
| 7357 TexImage2D tex_cmd; | 7165 TexImage2D tex_cmd; |
| 7358 tex_cmd.Init( | 7166 tex_cmd.Init( |
| 7359 GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, | 7167 GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, |
| 7360 1, 1, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, | 7168 1, 1, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, |
| 7361 kSharedMemoryId, kSharedMemoryOffset); | 7169 kSharedMemoryId, kSharedMemoryOffset); |
| 7362 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_cmd)); | 7170 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_cmd)); |
| 7363 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 7171 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 7387 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 7195 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 7388 | 7196 |
| 7389 // Check that trying to CopyTexSubImage2D fails | 7197 // Check that trying to CopyTexSubImage2D fails |
| 7390 CopyTexSubImage2D copy_sub_cmd; | 7198 CopyTexSubImage2D copy_sub_cmd; |
| 7391 copy_sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); | 7199 copy_sub_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); |
| 7392 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_sub_cmd)); | 7200 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_sub_cmd)); |
| 7393 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 7201 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 7394 } | 7202 } |
| 7395 | 7203 |
| 7396 TEST_F(GLES2DecoderManualInitTest, GenerateMipmapDepthTexture) { | 7204 TEST_F(GLES2DecoderManualInitTest, GenerateMipmapDepthTexture) { |
| 7397 InitDecoder( | 7205 InitState init; |
| 7398 "GL_ANGLE_depth_texture", // extensions | 7206 init.extensions = "GL_ANGLE_depth_texture"; |
| 7399 "opengl es 2.0", // gl version | 7207 init.gl_version = "opengl es 2.0"; |
| 7400 false, // has alpha | 7208 init.has_depth = true; |
| 7401 true, // has depth | 7209 init.has_stencil = true; |
| 7402 true, // has stencil | 7210 init.request_depth = true; |
| 7403 false, // request alpha | 7211 init.request_stencil = true; |
| 7404 true, // request depth | 7212 init.bind_generates_resource = true; |
| 7405 true, // request stencil | 7213 InitDecoder(init); |
| 7406 true); // bind generates resource | |
| 7407 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7214 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7408 DoTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, | 7215 DoTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, |
| 7409 2, 2, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, | 7216 2, 2, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, |
| 7410 0, 0); | 7217 0, 0); |
| 7411 GenerateMipmap cmd; | 7218 GenerateMipmap cmd; |
| 7412 cmd.Init(GL_TEXTURE_2D); | 7219 cmd.Init(GL_TEXTURE_2D); |
| 7413 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7220 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 7414 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 7221 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 7415 } | 7222 } |
| 7416 | 7223 |
| 7417 TEST_F(GLES2DecoderManualInitTest, DrawClearsDepthTexture) { | 7224 TEST_F(GLES2DecoderManualInitTest, DrawClearsDepthTexture) { |
| 7418 InitDecoder( | 7225 InitState init; |
| 7419 "GL_ANGLE_depth_texture", // extensions | 7226 init.extensions = "GL_ANGLE_depth_texture"; |
| 7420 "opengl es 2.0", // gl version | 7227 init.gl_version = "opengl es 2.0"; |
| 7421 true, // has alpha | 7228 init.has_alpha = true; |
| 7422 true, // has depth | 7229 init.has_depth = true; |
| 7423 false, // has stencil | 7230 init.request_alpha = true; |
| 7424 true, // request alpha | 7231 init.request_depth = true; |
| 7425 true, // request depth | 7232 init.bind_generates_resource = true; |
| 7426 false, // request stencil | 7233 InitDecoder(init); |
| 7427 true); // bind generates resource | |
| 7428 | 7234 |
| 7429 SetupDefaultProgram(); | 7235 SetupDefaultProgram(); |
| 7430 SetupAllNeededVertexBuffers(); | 7236 SetupAllNeededVertexBuffers(); |
| 7431 const GLenum attachment = GL_DEPTH_ATTACHMENT; | 7237 const GLenum attachment = GL_DEPTH_ATTACHMENT; |
| 7432 const GLenum target = GL_TEXTURE_2D; | 7238 const GLenum target = GL_TEXTURE_2D; |
| 7433 const GLint level = 0; | 7239 const GLint level = 0; |
| 7434 DoBindTexture(target, client_texture_id_, kServiceTextureId); | 7240 DoBindTexture(target, client_texture_id_, kServiceTextureId); |
| 7435 | 7241 |
| 7436 // Create a depth texture. | 7242 // Create a depth texture. |
| 7437 DoTexImage2D(target, level, GL_DEPTH_COMPONENT, 1, 1, 0, | 7243 DoTexImage2D(target, level, GL_DEPTH_COMPONENT, 1, 1, 0, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7540 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 7346 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 7541 } | 7347 } |
| 7542 | 7348 |
| 7543 class GLES2DecoderVertexArraysOESTest : public GLES2DecoderWithShaderTest { | 7349 class GLES2DecoderVertexArraysOESTest : public GLES2DecoderWithShaderTest { |
| 7544 public: | 7350 public: |
| 7545 GLES2DecoderVertexArraysOESTest() { } | 7351 GLES2DecoderVertexArraysOESTest() { } |
| 7546 | 7352 |
| 7547 bool vertex_array_deleted_manually_; | 7353 bool vertex_array_deleted_manually_; |
| 7548 | 7354 |
| 7549 virtual void SetUp() { | 7355 virtual void SetUp() { |
| 7550 InitDecoder( | 7356 InitState init; |
| 7551 "GL_OES_vertex_array_object", // extensions | 7357 init.extensions = "GL_OES_vertex_array_object"; |
| 7552 "opengl es 2.0", // gl version | 7358 init.gl_version = "opengl es 2.0"; |
| 7553 false, // has alpha | 7359 init.bind_generates_resource = true; |
| 7554 false, // has depth | 7360 InitDecoder(init); |
| 7555 false, // has stencil | |
| 7556 false, // request alpha | |
| 7557 false, // request depth | |
| 7558 false, // request stencil | |
| 7559 true); // bind generates resource | |
| 7560 SetupDefaultProgram(); | 7361 SetupDefaultProgram(); |
| 7561 | 7362 |
| 7562 AddExpectationsForGenVertexArraysOES(); | 7363 AddExpectationsForGenVertexArraysOES(); |
| 7563 GenHelper<GenVertexArraysOESImmediate>(client_vertexarray_id_); | 7364 GenHelper<GenVertexArraysOESImmediate>(client_vertexarray_id_); |
| 7564 | 7365 |
| 7565 vertex_array_deleted_manually_ = false; | 7366 vertex_array_deleted_manually_ = false; |
| 7566 } | 7367 } |
| 7567 | 7368 |
| 7568 virtual void TearDown() { | 7369 virtual void TearDown() { |
| 7569 // This should only be set if the test handled deletion of the vertex array | 7370 // This should only be set if the test handled deletion of the vertex array |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7691 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 7492 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 7692 } | 7493 } |
| 7693 }; | 7494 }; |
| 7694 | 7495 |
| 7695 class GLES2DecoderEmulatedVertexArraysOESTest | 7496 class GLES2DecoderEmulatedVertexArraysOESTest |
| 7696 : public GLES2DecoderVertexArraysOESTest { | 7497 : public GLES2DecoderVertexArraysOESTest { |
| 7697 public: | 7498 public: |
| 7698 GLES2DecoderEmulatedVertexArraysOESTest() { } | 7499 GLES2DecoderEmulatedVertexArraysOESTest() { } |
| 7699 | 7500 |
| 7700 virtual void SetUp() { | 7501 virtual void SetUp() { |
| 7701 InitDecoder( | 7502 InitState init; |
| 7702 "", // extensions | 7503 init.gl_version = "3.0"; |
| 7703 "3.0", // gl version | 7504 init.bind_generates_resource = true; |
| 7704 false, // has alpha | 7505 InitDecoder(init); |
| 7705 false, // has depth | |
| 7706 false, // has stencil | |
| 7707 false, // request alpha | |
| 7708 false, // request depth | |
| 7709 false, // request stencil | |
| 7710 true); // bind generates resource | |
| 7711 SetupDefaultProgram(); | 7506 SetupDefaultProgram(); |
| 7712 | 7507 |
| 7713 AddExpectationsForGenVertexArraysOES(); | 7508 AddExpectationsForGenVertexArraysOES(); |
| 7714 GenHelper<GenVertexArraysOESImmediate>(client_vertexarray_id_); | 7509 GenHelper<GenVertexArraysOESImmediate>(client_vertexarray_id_); |
| 7715 | 7510 |
| 7716 vertex_array_deleted_manually_ = false; | 7511 vertex_array_deleted_manually_ = false; |
| 7717 } | 7512 } |
| 7718 }; | 7513 }; |
| 7719 | 7514 |
| 7720 // Test vertex array objects with native support | 7515 // Test vertex array objects with native support |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8078 .WillOnce(Return(GL_NO_ERROR)) | 7873 .WillOnce(Return(GL_NO_ERROR)) |
| 8079 .RetiresOnSaturation(); | 7874 .RetiresOnSaturation(); |
| 8080 FramebufferRenderbuffer fbrb_cmd; | 7875 FramebufferRenderbuffer fbrb_cmd; |
| 8081 fbrb_cmd.Init( | 7876 fbrb_cmd.Init( |
| 8082 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 7877 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
| 8083 client_renderbuffer_id_); | 7878 client_renderbuffer_id_); |
| 8084 EXPECT_EQ(error::kNoError, ExecuteCmd(fbrb_cmd)); | 7879 EXPECT_EQ(error::kNoError, ExecuteCmd(fbrb_cmd)); |
| 8085 } | 7880 } |
| 8086 | 7881 |
| 8087 TEST_F(GLES2DecoderManualInitTest, DrawWithGLImageExternal) { | 7882 TEST_F(GLES2DecoderManualInitTest, DrawWithGLImageExternal) { |
| 8088 InitDecoder( | 7883 InitState init; |
| 8089 "GL_OES_EGL_image_external", // extensions | 7884 init.extensions = "GL_OES_EGL_image_external"; |
| 8090 "opengl es 2.0", // gl version | 7885 init.gl_version = "opengl es 2.0"; |
| 8091 true, // has alpha | 7886 init.has_alpha = true; |
| 8092 true, // has depth | 7887 init.has_depth = true; |
| 8093 false, // has stencil | 7888 init.request_alpha = true; |
| 8094 true, // request alpha | 7889 init.request_depth = true; |
| 8095 true, // request depth | 7890 init.bind_generates_resource = true; |
| 8096 false, // request stencil | 7891 InitDecoder(init); |
| 8097 true); // bind generates resource | |
| 8098 | 7892 |
| 8099 TextureRef* texture_ref = GetTexture(client_texture_id_); | 7893 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 8100 scoped_refptr<MockGLImage> image(new MockGLImage); | 7894 scoped_refptr<MockGLImage> image(new MockGLImage); |
| 8101 group().texture_manager()->SetTarget(texture_ref, GL_TEXTURE_EXTERNAL_OES); | 7895 group().texture_manager()->SetTarget(texture_ref, GL_TEXTURE_EXTERNAL_OES); |
| 8102 group().texture_manager()->SetLevelInfo(texture_ref, | 7896 group().texture_manager()->SetLevelInfo(texture_ref, |
| 8103 GL_TEXTURE_EXTERNAL_OES, | 7897 GL_TEXTURE_EXTERNAL_OES, |
| 8104 0, | 7898 0, |
| 8105 GL_RGBA, | 7899 GL_RGBA, |
| 8106 0, | 7900 0, |
| 8107 0, | 7901 0, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8153 .Times(1) | 7947 .Times(1) |
| 8154 .RetiresOnSaturation(); | 7948 .RetiresOnSaturation(); |
| 8155 DrawElements cmd; | 7949 DrawElements cmd; |
| 8156 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, | 7950 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, |
| 8157 kValidIndexRangeStart * 2); | 7951 kValidIndexRangeStart * 2); |
| 8158 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7952 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8159 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 7953 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8160 } | 7954 } |
| 8161 | 7955 |
| 8162 TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) { | 7956 TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) { |
| 8163 InitDecoder( | 7957 InitState init; |
| 8164 "GL_ARB_texture_rectangle", // extensions | 7958 init.extensions = "GL_ARB_texture_rectangle"; |
| 8165 "3.0", // gl version | 7959 init.gl_version = "3.0"; |
| 8166 false, // has alpha | 7960 init.bind_generates_resource = true; |
| 8167 false, // has depth | 7961 InitDecoder(init); |
| 8168 false, // has stencil | |
| 8169 false, // request alpha | |
| 8170 false, // request depth | |
| 8171 false, // request stencil | |
| 8172 true); // bind generates resource | |
| 8173 | 7962 |
| 8174 Texture* texture = GetTexture(client_texture_id_)->texture(); | 7963 Texture* texture = GetTexture(client_texture_id_)->texture(); |
| 8175 EXPECT_TRUE(texture != NULL); | 7964 EXPECT_TRUE(texture != NULL); |
| 8176 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); | 7965 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_UNMANAGED_CHROMIUM); |
| 8177 | 7966 |
| 8178 DoBindTexture( | 7967 DoBindTexture( |
| 8179 GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7968 GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8180 | 7969 |
| 8181 TexParameteri cmd; | 7970 TexParameteri cmd; |
| 8182 cmd.Init(GL_TEXTURE_2D, | 7971 cmd.Init(GL_TEXTURE_2D, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 8194 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_MANAGED_CHROMIUM); | 7983 EXPECT_TRUE(texture->pool() == GL_TEXTURE_POOL_MANAGED_CHROMIUM); |
| 8195 | 7984 |
| 8196 cmd.Init(GL_TEXTURE_2D, | 7985 cmd.Init(GL_TEXTURE_2D, |
| 8197 GL_TEXTURE_POOL_CHROMIUM, | 7986 GL_TEXTURE_POOL_CHROMIUM, |
| 8198 GL_NONE); | 7987 GL_NONE); |
| 8199 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7988 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8200 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 7989 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 8201 } | 7990 } |
| 8202 | 7991 |
| 8203 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) { | 7992 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) { |
| 8204 InitDecoder( | 7993 InitState init; |
| 8205 "GL_CHROMIUM_async_pixel_transfers", // extensions | 7994 init.extensions = "GL_CHROMIUM_async_pixel_transfers"; |
| 8206 "3.0", // gl version | 7995 init.gl_version = "3.0"; |
| 8207 false, false, false, // has alpha/depth/stencil | 7996 init.bind_generates_resource = true; |
| 8208 false, false, false, // request alpha/depth/stencil | 7997 InitDecoder(init); |
| 8209 true); // bind generates resource | |
| 8210 | 7998 |
| 8211 // Set up the texture. | 7999 // Set up the texture. |
| 8212 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8000 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8213 TextureRef* texture_ref = GetTexture(client_texture_id_); | 8001 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 8214 Texture* texture = texture_ref->texture(); | 8002 Texture* texture = texture_ref->texture(); |
| 8215 | 8003 |
| 8216 // Set a mock Async delegate | 8004 // Set a mock Async delegate |
| 8217 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = | 8005 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = |
| 8218 new StrictMock<gpu::MockAsyncPixelTransferManager>; | 8006 new StrictMock<gpu::MockAsyncPixelTransferManager>; |
| 8219 manager->Initialize(group().texture_manager()); | 8007 manager->Initialize(group().texture_manager()); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8432 EXPECT_TRUE(texture->IsImmutable()); | 8220 EXPECT_TRUE(texture->IsImmutable()); |
| 8433 // Wait for completion of all uploads. | 8221 // Wait for completion of all uploads. |
| 8434 EXPECT_CALL(*manager, WaitAllAsyncTexImage2D()).RetiresOnSaturation(); | 8222 EXPECT_CALL(*manager, WaitAllAsyncTexImage2D()).RetiresOnSaturation(); |
| 8435 EXPECT_CALL(*manager, BindCompletedAsyncTransfers()); | 8223 EXPECT_CALL(*manager, BindCompletedAsyncTransfers()); |
| 8436 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_all_cmd)); | 8224 EXPECT_EQ(error::kNoError, ExecuteCmd(wait_all_cmd)); |
| 8437 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8225 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8438 } | 8226 } |
| 8439 } | 8227 } |
| 8440 | 8228 |
| 8441 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransferManager) { | 8229 TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransferManager) { |
| 8442 InitDecoder( | 8230 InitState init; |
| 8443 "GL_CHROMIUM_async_pixel_transfers", // extensions | 8231 init.extensions = "GL_CHROMIUM_async_pixel_transfers"; |
| 8444 "3.0", // gl version | 8232 init.gl_version = "3.0"; |
| 8445 false, false, false, // has alpha/depth/stencil | 8233 init.bind_generates_resource = true; |
| 8446 false, false, false, // request alpha/depth/stencil | 8234 InitDecoder(init); |
| 8447 true); // bind generates resource | |
| 8448 | 8235 |
| 8449 // Set up the texture. | 8236 // Set up the texture. |
| 8450 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8237 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8451 TextureRef* texture_ref = GetTexture(client_texture_id_); | 8238 TextureRef* texture_ref = GetTexture(client_texture_id_); |
| 8452 | 8239 |
| 8453 // Set a mock Async delegate. | 8240 // Set a mock Async delegate. |
| 8454 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = | 8241 StrictMock<gpu::MockAsyncPixelTransferManager>* manager = |
| 8455 new StrictMock<gpu::MockAsyncPixelTransferManager>; | 8242 new StrictMock<gpu::MockAsyncPixelTransferManager>; |
| 8456 manager->Initialize(group().texture_manager()); | 8243 manager->Initialize(group().texture_manager()); |
| 8457 decoder_->SetAsyncPixelTransferManagerForTest(manager); | 8244 decoder_->SetAsyncPixelTransferManagerForTest(manager); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8537 }; | 8324 }; |
| 8538 std::map<Pool, PoolInfo> pool_infos_; | 8325 std::map<Pool, PoolInfo> pool_infos_; |
| 8539 }; | 8326 }; |
| 8540 | 8327 |
| 8541 } // anonymous namespace. | 8328 } // anonymous namespace. |
| 8542 | 8329 |
| 8543 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerInitialSize) { | 8330 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerInitialSize) { |
| 8544 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = | 8331 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = |
| 8545 new SizeOnlyMemoryTracker(); | 8332 new SizeOnlyMemoryTracker(); |
| 8546 set_memory_tracker(memory_tracker.get()); | 8333 set_memory_tracker(memory_tracker.get()); |
| 8547 InitDecoder( | 8334 InitState init; |
| 8548 "", // extensions | 8335 init.gl_version = "3.0"; |
| 8549 "3.0", // gl version | 8336 init.bind_generates_resource = true; |
| 8550 false, // has alpha | 8337 InitDecoder(init); |
| 8551 false, // has depth | |
| 8552 false, // has stencil | |
| 8553 false, // request alpha | |
| 8554 false, // request depth | |
| 8555 false, // request stencil | |
| 8556 true); // bind generates resource | |
| 8557 // Expect that initial size - size is 0. | 8338 // Expect that initial size - size is 0. |
| 8558 EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8339 EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8559 EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kManaged)); | 8340 EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kManaged)); |
| 8560 } | 8341 } |
| 8561 | 8342 |
| 8562 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerTexImage2D) { | 8343 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerTexImage2D) { |
| 8563 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = | 8344 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = |
| 8564 new SizeOnlyMemoryTracker(); | 8345 new SizeOnlyMemoryTracker(); |
| 8565 set_memory_tracker(memory_tracker.get()); | 8346 set_memory_tracker(memory_tracker.get()); |
| 8566 InitDecoder( | 8347 InitState init; |
| 8567 "", // extensions | 8348 init.gl_version = "3.0"; |
| 8568 "3.0", // gl version | 8349 init.bind_generates_resource = true; |
| 8569 false, // has alpha | 8350 InitDecoder(init); |
| 8570 false, // has depth | |
| 8571 false, // has stencil | |
| 8572 false, // request alpha | |
| 8573 false, // request depth | |
| 8574 false, // request stencil | |
| 8575 true); // bind generates resource | |
| 8576 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8351 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8577 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) | 8352 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) |
| 8578 .WillOnce(Return(true)).RetiresOnSaturation(); | 8353 .WillOnce(Return(true)).RetiresOnSaturation(); |
| 8579 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 8354 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 8, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 8580 kSharedMemoryId, kSharedMemoryOffset); | 8355 kSharedMemoryId, kSharedMemoryOffset); |
| 8581 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8356 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8582 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(64)) | 8357 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(64)) |
| 8583 .WillOnce(Return(true)).RetiresOnSaturation(); | 8358 .WillOnce(Return(true)).RetiresOnSaturation(); |
| 8584 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 8359 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 8585 kSharedMemoryId, kSharedMemoryOffset); | 8360 kSharedMemoryId, kSharedMemoryOffset); |
| 8586 EXPECT_EQ(64u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8361 EXPECT_EQ(64u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8587 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8362 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8588 // Check we get out of memory and no call to glTexImage2D if Ensure fails. | 8363 // Check we get out of memory and no call to glTexImage2D if Ensure fails. |
| 8589 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(64)) | 8364 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(64)) |
| 8590 .WillOnce(Return(false)).RetiresOnSaturation(); | 8365 .WillOnce(Return(false)).RetiresOnSaturation(); |
| 8591 TexImage2D cmd; | 8366 TexImage2D cmd; |
| 8592 cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 8367 cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 8593 kSharedMemoryId, kSharedMemoryOffset); | 8368 kSharedMemoryId, kSharedMemoryOffset); |
| 8594 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8369 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8595 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 8370 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 8596 EXPECT_EQ(64u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8371 EXPECT_EQ(64u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8597 } | 8372 } |
| 8598 | 8373 |
| 8599 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerTexStorage2DEXT) { | 8374 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerTexStorage2DEXT) { |
| 8600 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = | 8375 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = |
| 8601 new SizeOnlyMemoryTracker(); | 8376 new SizeOnlyMemoryTracker(); |
| 8602 set_memory_tracker(memory_tracker.get()); | 8377 set_memory_tracker(memory_tracker.get()); |
| 8603 InitDecoder( | 8378 InitState init; |
| 8604 "", // extensions | 8379 init.gl_version = "3.0"; |
| 8605 "3.0", // gl version | 8380 init.bind_generates_resource = true; |
| 8606 false, // has alpha | 8381 InitDecoder(init); |
| 8607 false, // has depth | |
| 8608 false, // has stencil | |
| 8609 false, // request alpha | |
| 8610 false, // request depth | |
| 8611 false, // request stencil | |
| 8612 true); // bind generates resource | |
| 8613 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8382 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8614 // Check we get out of memory and no call to glTexStorage2DEXT | 8383 // Check we get out of memory and no call to glTexStorage2DEXT |
| 8615 // if Ensure fails. | 8384 // if Ensure fails. |
| 8616 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) | 8385 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) |
| 8617 .WillOnce(Return(false)).RetiresOnSaturation(); | 8386 .WillOnce(Return(false)).RetiresOnSaturation(); |
| 8618 TexStorage2DEXT cmd; | 8387 TexStorage2DEXT cmd; |
| 8619 cmd.Init(GL_TEXTURE_2D, 1, GL_RGBA8, 8, 4); | 8388 cmd.Init(GL_TEXTURE_2D, 1, GL_RGBA8, 8, 4); |
| 8620 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8389 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8621 EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8390 EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8622 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 8391 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 8623 } | 8392 } |
| 8624 | 8393 |
| 8625 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerCopyTexImage2D) { | 8394 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerCopyTexImage2D) { |
| 8626 GLenum target = GL_TEXTURE_2D; | 8395 GLenum target = GL_TEXTURE_2D; |
| 8627 GLint level = 0; | 8396 GLint level = 0; |
| 8628 GLenum internal_format = GL_RGBA; | 8397 GLenum internal_format = GL_RGBA; |
| 8629 GLsizei width = 4; | 8398 GLsizei width = 4; |
| 8630 GLsizei height = 8; | 8399 GLsizei height = 8; |
| 8631 GLint border = 0; | 8400 GLint border = 0; |
| 8632 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = | 8401 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = |
| 8633 new SizeOnlyMemoryTracker(); | 8402 new SizeOnlyMemoryTracker(); |
| 8634 set_memory_tracker(memory_tracker.get()); | 8403 set_memory_tracker(memory_tracker.get()); |
| 8635 InitDecoder( | 8404 InitState init; |
| 8636 "", // extensions | 8405 init.gl_version = "3.0"; |
| 8637 "3.0", // gl version | 8406 init.has_alpha = true; |
| 8638 true, // has alpha | 8407 init.request_alpha = true; |
| 8639 false, // has depth | 8408 init.bind_generates_resource = true; |
| 8640 false, // has stencil | 8409 InitDecoder(init); |
| 8641 true, // request alpha | |
| 8642 false, // request depth | |
| 8643 false, // request stencil | |
| 8644 true); // bind generates resource | |
| 8645 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8410 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 8646 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) | 8411 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) |
| 8647 .WillOnce(Return(true)).RetiresOnSaturation(); | 8412 .WillOnce(Return(true)).RetiresOnSaturation(); |
| 8648 EXPECT_CALL(*gl_, GetError()) | 8413 EXPECT_CALL(*gl_, GetError()) |
| 8649 .WillOnce(Return(GL_NO_ERROR)) | 8414 .WillOnce(Return(GL_NO_ERROR)) |
| 8650 .WillOnce(Return(GL_NO_ERROR)) | 8415 .WillOnce(Return(GL_NO_ERROR)) |
| 8651 .RetiresOnSaturation(); | 8416 .RetiresOnSaturation(); |
| 8652 EXPECT_CALL(*gl_, CopyTexImage2D( | 8417 EXPECT_CALL(*gl_, CopyTexImage2D( |
| 8653 target, level, internal_format, 0, 0, width, height, border)) | 8418 target, level, internal_format, 0, 0, width, height, border)) |
| 8654 .Times(1) | 8419 .Times(1) |
| 8655 .RetiresOnSaturation(); | 8420 .RetiresOnSaturation(); |
| 8656 CopyTexImage2D cmd; | 8421 CopyTexImage2D cmd; |
| 8657 cmd.Init(target, level, internal_format, 0, 0, width, height, border); | 8422 cmd.Init(target, level, internal_format, 0, 0, width, height, border); |
| 8658 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8423 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8659 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8424 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8660 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8425 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8661 // Check we get out of memory and no call to glCopyTexImage2D if Ensure fails. | 8426 // Check we get out of memory and no call to glCopyTexImage2D if Ensure fails. |
| 8662 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) | 8427 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) |
| 8663 .WillOnce(Return(false)).RetiresOnSaturation(); | 8428 .WillOnce(Return(false)).RetiresOnSaturation(); |
| 8664 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8429 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8665 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 8430 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 8666 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8431 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8667 } | 8432 } |
| 8668 | 8433 |
| 8669 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerRenderbufferStorage) { | 8434 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerRenderbufferStorage) { |
| 8670 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = | 8435 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = |
| 8671 new SizeOnlyMemoryTracker(); | 8436 new SizeOnlyMemoryTracker(); |
| 8672 set_memory_tracker(memory_tracker.get()); | 8437 set_memory_tracker(memory_tracker.get()); |
| 8673 InitDecoder( | 8438 InitState init; |
| 8674 "", // extensions | 8439 init.gl_version = "3.0"; |
| 8675 "3.0", // gl version | 8440 init.bind_generates_resource = true; |
| 8676 false, // has alpha | 8441 InitDecoder(init); |
| 8677 false, // has depth | |
| 8678 false, // has stencil | |
| 8679 false, // request alpha | |
| 8680 false, // request depth | |
| 8681 false, // request stencil | |
| 8682 true); // bind generates resource | |
| 8683 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 8442 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 8684 kServiceRenderbufferId); | 8443 kServiceRenderbufferId); |
| 8685 EXPECT_CALL(*gl_, GetError()) | 8444 EXPECT_CALL(*gl_, GetError()) |
| 8686 .WillOnce(Return(GL_NO_ERROR)) | 8445 .WillOnce(Return(GL_NO_ERROR)) |
| 8687 .WillOnce(Return(GL_NO_ERROR)) | 8446 .WillOnce(Return(GL_NO_ERROR)) |
| 8688 .RetiresOnSaturation(); | 8447 .RetiresOnSaturation(); |
| 8689 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) | 8448 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) |
| 8690 .WillOnce(Return(true)).RetiresOnSaturation(); | 8449 .WillOnce(Return(true)).RetiresOnSaturation(); |
| 8691 EXPECT_CALL(*gl_, RenderbufferStorageEXT( | 8450 EXPECT_CALL(*gl_, RenderbufferStorageEXT( |
| 8692 GL_RENDERBUFFER, GL_RGBA, 8, 4)) | 8451 GL_RENDERBUFFER, GL_RGBA, 8, 4)) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 8703 .WillOnce(Return(false)).RetiresOnSaturation(); | 8462 .WillOnce(Return(false)).RetiresOnSaturation(); |
| 8704 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8463 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8705 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 8464 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 8706 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); | 8465 EXPECT_EQ(128u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged)); |
| 8707 } | 8466 } |
| 8708 | 8467 |
| 8709 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerBufferData) { | 8468 TEST_F(GLES2DecoderManualInitTest, MemoryTrackerBufferData) { |
| 8710 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = | 8469 scoped_refptr<SizeOnlyMemoryTracker> memory_tracker = |
| 8711 new SizeOnlyMemoryTracker(); | 8470 new SizeOnlyMemoryTracker(); |
| 8712 set_memory_tracker(memory_tracker.get()); | 8471 set_memory_tracker(memory_tracker.get()); |
| 8713 InitDecoder( | 8472 InitState init; |
| 8714 "", // extensions | 8473 init.gl_version = "3.0"; |
| 8715 "3.0", // gl version | 8474 init.bind_generates_resource = true; |
| 8716 false, // has alpha | 8475 InitDecoder(init); |
| 8717 false, // has depth | |
| 8718 false, // has stencil | |
| 8719 false, // request alpha | |
| 8720 false, // request depth | |
| 8721 false, // request stencil | |
| 8722 true); // bind generates resource | |
| 8723 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, | 8476 DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_, |
| 8724 kServiceBufferId); | 8477 kServiceBufferId); |
| 8725 EXPECT_CALL(*gl_, GetError()) | 8478 EXPECT_CALL(*gl_, GetError()) |
| 8726 .WillOnce(Return(GL_NO_ERROR)) | 8479 .WillOnce(Return(GL_NO_ERROR)) |
| 8727 .WillOnce(Return(GL_NO_ERROR)) | 8480 .WillOnce(Return(GL_NO_ERROR)) |
| 8728 .RetiresOnSaturation(); | 8481 .RetiresOnSaturation(); |
| 8729 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) | 8482 EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128)) |
| 8730 .WillOnce(Return(true)).RetiresOnSaturation(); | 8483 .WillOnce(Return(true)).RetiresOnSaturation(); |
| 8731 EXPECT_CALL(*gl_, BufferData(GL_ARRAY_BUFFER, 128, _, GL_STREAM_DRAW)) | 8484 EXPECT_CALL(*gl_, BufferData(GL_ARRAY_BUFFER, 128, _, GL_STREAM_DRAW)) |
| 8732 .Times(1) | 8485 .Times(1) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8794 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)) | 8547 EXPECT_CALL(*gl_, DrawBuffersARB(count, _)) |
| 8795 .Times(1) | 8548 .Times(1) |
| 8796 .RetiresOnSaturation(); | 8549 .RetiresOnSaturation(); |
| 8797 | 8550 |
| 8798 EXPECT_EQ(error::kNoError, | 8551 EXPECT_EQ(error::kNoError, |
| 8799 ExecuteImmediateCmd(cmd, sizeof(bufs))); | 8552 ExecuteImmediateCmd(cmd, sizeof(bufs))); |
| 8800 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8553 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8801 } | 8554 } |
| 8802 | 8555 |
| 8803 TEST_F(GLES2DecoderManualInitTest, InvalidateFramebufferBinding) { | 8556 TEST_F(GLES2DecoderManualInitTest, InvalidateFramebufferBinding) { |
| 8804 InitDecoder("", // extensions | 8557 InitState init; |
| 8805 "opengl es 3.0", // gl version | 8558 init.gl_version = "opengl es 3.0"; |
| 8806 false, // has alpha | 8559 InitDecoder(init); |
| 8807 false, // has depth | |
| 8808 false, // has stencil | |
| 8809 false, // request alpha | |
| 8810 false, // request depth | |
| 8811 false, // request stencil | |
| 8812 false); // bind generates resource | |
| 8813 | 8560 |
| 8814 // EXPECT_EQ can't be used to compare function pointers | 8561 // EXPECT_EQ can't be used to compare function pointers |
| 8815 EXPECT_TRUE( | 8562 EXPECT_TRUE( |
| 8816 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") == | 8563 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") == |
| 8817 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); | 8564 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); |
| 8818 EXPECT_TRUE( | 8565 EXPECT_TRUE( |
| 8819 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != | 8566 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != |
| 8820 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT")); | 8567 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT")); |
| 8821 } | 8568 } |
| 8822 | 8569 |
| 8823 TEST_F(GLES2DecoderManualInitTest, DiscardFramebufferEXT) { | 8570 TEST_F(GLES2DecoderManualInitTest, DiscardFramebufferEXT) { |
| 8824 InitDecoder("GL_EXT_discard_framebuffer", // extensions | 8571 InitState init; |
| 8825 "opengl es 2.0", // gl version | 8572 init.extensions = "GL_EXT_discard_framebuffer"; |
| 8826 false, // has alpha | 8573 init.gl_version = "opengl es 2.0"; |
| 8827 false, // has depth | 8574 InitDecoder(init); |
| 8828 false, // has stencil | |
| 8829 false, // request alpha | |
| 8830 false, // request depth | |
| 8831 false, // request stencil | |
| 8832 false); // bind generates resource | |
| 8833 | 8575 |
| 8834 // EXPECT_EQ can't be used to compare function pointers | 8576 // EXPECT_EQ can't be used to compare function pointers |
| 8835 EXPECT_TRUE( | 8577 EXPECT_TRUE( |
| 8836 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT") == | 8578 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT") == |
| 8837 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); | 8579 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); |
| 8838 | 8580 |
| 8839 const GLenum target = GL_FRAMEBUFFER; | 8581 const GLenum target = GL_FRAMEBUFFER; |
| 8840 const GLsizei count = 1; | 8582 const GLsizei count = 1; |
| 8841 const GLenum attachments[] = { GL_COLOR_ATTACHMENT0 }; | 8583 const GLenum attachments[] = { GL_COLOR_ATTACHMENT0 }; |
| 8842 | 8584 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8876 *GetImmediateAs<DiscardFramebufferEXTImmediate>(); | 8618 *GetImmediateAs<DiscardFramebufferEXTImmediate>(); |
| 8877 cmd.Init(target, count, attachments); | 8619 cmd.Init(target, count, attachments); |
| 8878 | 8620 |
| 8879 // Should not result into a call into GL. | 8621 // Should not result into a call into GL. |
| 8880 EXPECT_EQ(error::kNoError, | 8622 EXPECT_EQ(error::kNoError, |
| 8881 ExecuteImmediateCmd(cmd, sizeof(attachments))); | 8623 ExecuteImmediateCmd(cmd, sizeof(attachments))); |
| 8882 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 8624 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 8883 } | 8625 } |
| 8884 | 8626 |
| 8885 TEST_F(GLES2DecoderRestoreStateTest, NullPreviousState) { | 8627 TEST_F(GLES2DecoderRestoreStateTest, NullPreviousState) { |
| 8886 InitDecoder( | 8628 InitState init; |
| 8887 "", // extensions | 8629 init.gl_version = "3.0"; |
| 8888 "3.0", // gl version | 8630 InitDecoder(init); |
| 8889 false, // has alpha | |
| 8890 false, // has depth | |
| 8891 false, // has stencil | |
| 8892 false, // request alpha | |
| 8893 false, // request depth | |
| 8894 false, // request stencil | |
| 8895 false); // bind generates resource | |
| 8896 SetupTexture(); | 8631 SetupTexture(); |
| 8897 | 8632 |
| 8898 InSequence sequence; | 8633 InSequence sequence; |
| 8899 // Expect to restore texture bindings for unit GL_TEXTURE0. | 8634 // Expect to restore texture bindings for unit GL_TEXTURE0. |
| 8900 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8635 AddExpectationsForActiveTexture(GL_TEXTURE0); |
| 8901 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); | 8636 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); |
| 8902 AddExpectationsForBindTexture(GL_TEXTURE_CUBE_MAP, | 8637 AddExpectationsForBindTexture(GL_TEXTURE_CUBE_MAP, |
| 8903 TestHelper::kServiceDefaultTextureCubemapId); | 8638 TestHelper::kServiceDefaultTextureCubemapId); |
| 8904 | 8639 |
| 8905 // Expect to restore texture bindings for remaining units. | 8640 // Expect to restore texture bindings for remaining units. |
| 8906 for (uint32 i = 1; i < group().max_texture_units() ; ++i) { | 8641 for (uint32 i = 1; i < group().max_texture_units() ; ++i) { |
| 8907 AddExpectationsForActiveTexture(GL_TEXTURE0 + i); | 8642 AddExpectationsForActiveTexture(GL_TEXTURE0 + i); |
| 8908 AddExpectationsForBindTexture(GL_TEXTURE_2D, | 8643 AddExpectationsForBindTexture(GL_TEXTURE_2D, |
| 8909 TestHelper::kServiceDefaultTexture2dId); | 8644 TestHelper::kServiceDefaultTexture2dId); |
| 8910 AddExpectationsForBindTexture(GL_TEXTURE_CUBE_MAP, | 8645 AddExpectationsForBindTexture(GL_TEXTURE_CUBE_MAP, |
| 8911 TestHelper::kServiceDefaultTextureCubemapId); | 8646 TestHelper::kServiceDefaultTextureCubemapId); |
| 8912 } | 8647 } |
| 8913 | 8648 |
| 8914 // Expect to restore the active texture unit to GL_TEXTURE0. | 8649 // Expect to restore the active texture unit to GL_TEXTURE0. |
| 8915 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8650 AddExpectationsForActiveTexture(GL_TEXTURE0); |
| 8916 | 8651 |
| 8917 GetDecoder()->RestoreAllTextureUnitBindings(NULL); | 8652 GetDecoder()->RestoreAllTextureUnitBindings(NULL); |
| 8918 } | 8653 } |
| 8919 | 8654 |
| 8920 TEST_F(GLES2DecoderRestoreStateTest, WithPreviousState) { | 8655 TEST_F(GLES2DecoderRestoreStateTest, WithPreviousState) { |
| 8921 InitDecoder( | 8656 InitState init; |
| 8922 "", // extensions | 8657 init.gl_version = "3.0"; |
| 8923 "3.0", // gl version | 8658 InitDecoder(init); |
| 8924 false, // has alpha | |
| 8925 false, // has depth | |
| 8926 false, // has stencil | |
| 8927 false, // request alpha | |
| 8928 false, // request depth | |
| 8929 false, // request stencil | |
| 8930 false); // bind generates resource | |
| 8931 SetupTexture(); | 8659 SetupTexture(); |
| 8932 | 8660 |
| 8933 // Construct a previous ContextState with all texture bindings | 8661 // Construct a previous ContextState with all texture bindings |
| 8934 // set to default textures. | 8662 // set to default textures. |
| 8935 ContextState prev_state(NULL, NULL); | 8663 ContextState prev_state(NULL, NULL, NULL); |
| 8936 InitializeContextState(&prev_state, std::numeric_limits<uint32>::max(), 0); | 8664 InitializeContextState(&prev_state, std::numeric_limits<uint32>::max(), 0); |
| 8937 | 8665 |
| 8938 InSequence sequence; | 8666 InSequence sequence; |
| 8939 // Expect to restore only GL_TEXTURE_2D binding for GL_TEXTURE0 unit, | 8667 // Expect to restore only GL_TEXTURE_2D binding for GL_TEXTURE0 unit, |
| 8940 // since the rest of the bindings haven't changed between the current | 8668 // since the rest of the bindings haven't changed between the current |
| 8941 // state and the |prev_state|. | 8669 // state and the |prev_state|. |
| 8942 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8670 AddExpectationsForActiveTexture(GL_TEXTURE0); |
| 8943 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); | 8671 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); |
| 8944 | 8672 |
| 8945 // Expect to restore active texture unit to GL_TEXTURE0. | 8673 // Expect to restore active texture unit to GL_TEXTURE0. |
| 8946 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8674 AddExpectationsForActiveTexture(GL_TEXTURE0); |
| 8947 | 8675 |
| 8948 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); | 8676 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); |
| 8949 } | 8677 } |
| 8950 | 8678 |
| 8951 TEST_F(GLES2DecoderRestoreStateTest, ActiveUnit1) { | 8679 TEST_F(GLES2DecoderRestoreStateTest, ActiveUnit1) { |
| 8952 InitDecoder( | 8680 InitState init; |
| 8953 "", // extensions | 8681 init.gl_version = "3.0"; |
| 8954 "3.0", // gl version | 8682 InitDecoder(init); |
| 8955 false, // has alpha | |
| 8956 false, // has depth | |
| 8957 false, // has stencil | |
| 8958 false, // request alpha | |
| 8959 false, // request depth | |
| 8960 false, // request stencil | |
| 8961 false); // bind generates resource | |
| 8962 | 8683 |
| 8963 // Bind a non-default texture to GL_TEXTURE1 unit. | 8684 // Bind a non-default texture to GL_TEXTURE1 unit. |
| 8964 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1)); | 8685 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1)); |
| 8965 ActiveTexture cmd; | 8686 ActiveTexture cmd; |
| 8966 cmd.Init(GL_TEXTURE1); | 8687 cmd.Init(GL_TEXTURE1); |
| 8967 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8688 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8968 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8689 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 8969 SetupTexture(); | 8690 SetupTexture(); |
| 8970 | 8691 |
| 8971 // Construct a previous ContextState with all texture bindings | 8692 // Construct a previous ContextState with all texture bindings |
| 8972 // set to default textures. | 8693 // set to default textures. |
| 8973 ContextState prev_state(NULL, NULL); | 8694 ContextState prev_state(NULL, NULL, NULL); |
| 8974 InitializeContextState(&prev_state, std::numeric_limits<uint32>::max(), 0); | 8695 InitializeContextState(&prev_state, std::numeric_limits<uint32>::max(), 0); |
| 8975 | 8696 |
| 8976 InSequence sequence; | 8697 InSequence sequence; |
| 8977 // Expect to restore only GL_TEXTURE_2D binding for GL_TEXTURE1 unit, | 8698 // Expect to restore only GL_TEXTURE_2D binding for GL_TEXTURE1 unit, |
| 8978 // since the rest of the bindings haven't changed between the current | 8699 // since the rest of the bindings haven't changed between the current |
| 8979 // state and the |prev_state|. | 8700 // state and the |prev_state|. |
| 8980 AddExpectationsForActiveTexture(GL_TEXTURE1); | 8701 AddExpectationsForActiveTexture(GL_TEXTURE1); |
| 8981 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); | 8702 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); |
| 8982 | 8703 |
| 8983 // Expect to restore active texture unit to GL_TEXTURE1. | 8704 // Expect to restore active texture unit to GL_TEXTURE1. |
| 8984 AddExpectationsForActiveTexture(GL_TEXTURE1); | 8705 AddExpectationsForActiveTexture(GL_TEXTURE1); |
| 8985 | 8706 |
| 8986 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); | 8707 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); |
| 8987 } | 8708 } |
| 8988 | 8709 |
| 8989 TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit0) { | 8710 TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit0) { |
| 8990 InitDecoder( | 8711 InitState init; |
| 8991 "", // extensions | 8712 init.gl_version = "3.0"; |
| 8992 "3.0", // gl version | 8713 InitDecoder(init); |
| 8993 false, // has alpha | |
| 8994 false, // has depth | |
| 8995 false, // has stencil | |
| 8996 false, // request alpha | |
| 8997 false, // request depth | |
| 8998 false, // request stencil | |
| 8999 false); // bind generates resource | |
| 9000 | 8714 |
| 9001 // Bind a non-default texture to GL_TEXTURE1 unit. | 8715 // Bind a non-default texture to GL_TEXTURE1 unit. |
| 9002 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1)); | 8716 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1)); |
| 9003 SpecializedSetup<ActiveTexture, 0>(true); | 8717 SpecializedSetup<ActiveTexture, 0>(true); |
| 9004 ActiveTexture cmd; | 8718 ActiveTexture cmd; |
| 9005 cmd.Init(GL_TEXTURE1); | 8719 cmd.Init(GL_TEXTURE1); |
| 9006 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8720 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 9007 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8721 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 9008 SetupTexture(); | 8722 SetupTexture(); |
| 9009 | 8723 |
| 9010 // Construct a previous ContextState with GL_TEXTURE_2D target in | 8724 // Construct a previous ContextState with GL_TEXTURE_2D target in |
| 9011 // GL_TEXTURE0 unit bound to a non-default texture and the rest | 8725 // GL_TEXTURE0 unit bound to a non-default texture and the rest |
| 9012 // set to default textures. | 8726 // set to default textures. |
| 9013 ContextState prev_state(NULL, NULL); | 8727 ContextState prev_state(NULL, NULL, NULL); |
| 9014 InitializeContextState(&prev_state, 0, kServiceTextureId); | 8728 InitializeContextState(&prev_state, 0, kServiceTextureId); |
| 9015 | 8729 |
| 9016 InSequence sequence; | 8730 InSequence sequence; |
| 9017 // Expect to restore GL_TEXTURE_2D binding for GL_TEXTURE0 unit to | 8731 // Expect to restore GL_TEXTURE_2D binding for GL_TEXTURE0 unit to |
| 9018 // a default texture. | 8732 // a default texture. |
| 9019 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8733 AddExpectationsForActiveTexture(GL_TEXTURE0); |
| 9020 AddExpectationsForBindTexture(GL_TEXTURE_2D, | 8734 AddExpectationsForBindTexture(GL_TEXTURE_2D, |
| 9021 TestHelper::kServiceDefaultTexture2dId); | 8735 TestHelper::kServiceDefaultTexture2dId); |
| 9022 | 8736 |
| 9023 // Expect to restore GL_TEXTURE_2D binding for GL_TEXTURE1 unit to | 8737 // Expect to restore GL_TEXTURE_2D binding for GL_TEXTURE1 unit to |
| 9024 // non-default. | 8738 // non-default. |
| 9025 AddExpectationsForActiveTexture(GL_TEXTURE1); | 8739 AddExpectationsForActiveTexture(GL_TEXTURE1); |
| 9026 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); | 8740 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); |
| 9027 | 8741 |
| 9028 // Expect to restore active texture unit to GL_TEXTURE1. | 8742 // Expect to restore active texture unit to GL_TEXTURE1. |
| 9029 AddExpectationsForActiveTexture(GL_TEXTURE1); | 8743 AddExpectationsForActiveTexture(GL_TEXTURE1); |
| 9030 | 8744 |
| 9031 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); | 8745 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); |
| 9032 } | 8746 } |
| 9033 | 8747 |
| 9034 TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit1) { | 8748 TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit1) { |
| 9035 InitDecoder( | 8749 InitState init; |
| 9036 "", // extensions | 8750 init.gl_version = "3.0"; |
| 9037 "3.0", // gl version | 8751 InitDecoder(init); |
| 9038 false, // has alpha | |
| 9039 false, // has depth | |
| 9040 false, // has stencil | |
| 9041 false, // request alpha | |
| 9042 false, // request depth | |
| 9043 false, // request stencil | |
| 9044 false); // bind generates resource | |
| 9045 | 8752 |
| 9046 // Bind a non-default texture to GL_TEXTURE0 unit. | 8753 // Bind a non-default texture to GL_TEXTURE0 unit. |
| 9047 SetupTexture(); | 8754 SetupTexture(); |
| 9048 | 8755 |
| 9049 // Construct a previous ContextState with GL_TEXTURE_2D target in | 8756 // Construct a previous ContextState with GL_TEXTURE_2D target in |
| 9050 // GL_TEXTURE1 unit bound to a non-default texture and the rest | 8757 // GL_TEXTURE1 unit bound to a non-default texture and the rest |
| 9051 // set to default textures. | 8758 // set to default textures. |
| 9052 ContextState prev_state(NULL, NULL); | 8759 ContextState prev_state(NULL, NULL, NULL); |
| 9053 InitializeContextState(&prev_state, 1, kServiceTextureId); | 8760 InitializeContextState(&prev_state, 1, kServiceTextureId); |
| 9054 | 8761 |
| 9055 InSequence sequence; | 8762 InSequence sequence; |
| 9056 // Expect to restore GL_TEXTURE_2D binding to the non-default texture | 8763 // Expect to restore GL_TEXTURE_2D binding to the non-default texture |
| 9057 // for GL_TEXTURE0 unit. | 8764 // for GL_TEXTURE0 unit. |
| 9058 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8765 AddExpectationsForActiveTexture(GL_TEXTURE0); |
| 9059 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); | 8766 AddExpectationsForBindTexture(GL_TEXTURE_2D, kServiceTextureId); |
| 9060 | 8767 |
| 9061 // Expect to restore GL_TEXTURE_2D binding to the default texture | 8768 // Expect to restore GL_TEXTURE_2D binding to the default texture |
| 9062 // for GL_TEXTURE1 unit. | 8769 // for GL_TEXTURE1 unit. |
| 9063 AddExpectationsForActiveTexture(GL_TEXTURE1); | 8770 AddExpectationsForActiveTexture(GL_TEXTURE1); |
| 9064 AddExpectationsForBindTexture(GL_TEXTURE_2D, | 8771 AddExpectationsForBindTexture(GL_TEXTURE_2D, |
| 9065 TestHelper::kServiceDefaultTexture2dId); | 8772 TestHelper::kServiceDefaultTexture2dId); |
| 9066 | 8773 |
| 9067 // Expect to restore active texture unit to GL_TEXTURE0. | 8774 // Expect to restore active texture unit to GL_TEXTURE0. |
| 9068 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8775 AddExpectationsForActiveTexture(GL_TEXTURE0); |
| 9069 | 8776 |
| 9070 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); | 8777 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); |
| 9071 } | 8778 } |
| 9072 | 8779 |
| 9073 TEST_F(GLES2DecoderManualInitTest, ClearUniformsBeforeFirstProgramUse) { | 8780 TEST_F(GLES2DecoderManualInitTest, ClearUniformsBeforeFirstProgramUse) { |
| 9074 CommandLine command_line(0, NULL); | 8781 CommandLine command_line(0, NULL); |
| 9075 command_line.AppendSwitchASCII( | 8782 command_line.AppendSwitchASCII( |
| 9076 switches::kGpuDriverBugWorkarounds, | 8783 switches::kGpuDriverBugWorkarounds, |
| 9077 base::IntToString(gpu::CLEAR_UNIFORMS_BEFORE_FIRST_PROGRAM_USE)); | 8784 base::IntToString(gpu::CLEAR_UNIFORMS_BEFORE_FIRST_PROGRAM_USE)); |
| 9078 InitDecoderWithCommandLine( | 8785 InitState init; |
| 9079 "", // extensions | 8786 init.gl_version = "3.0"; |
| 9080 "3.0", // gl version | 8787 init.has_alpha = true; |
| 9081 true, // has alpha | 8788 init.request_alpha = true; |
| 9082 false, // has depth | 8789 init.bind_generates_resource = true; |
| 9083 false, // has stencil | 8790 InitDecoderWithCommandLine(init, &command_line); |
| 9084 true, // request alpha | |
| 9085 false, // request depth | |
| 9086 false, // request stencil | |
| 9087 true, // bind generates resource | |
| 9088 &command_line); | |
| 9089 { | 8791 { |
| 9090 static AttribInfo attribs[] = { | 8792 static AttribInfo attribs[] = { |
| 9091 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, | 8793 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, |
| 9092 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, | 8794 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, |
| 9093 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, | 8795 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, |
| 9094 }; | 8796 }; |
| 9095 static UniformInfo uniforms[] = { | 8797 static UniformInfo uniforms[] = { |
| 9096 { kUniform1Name, kUniform1Size, kUniform1Type, | 8798 { kUniform1Name, kUniform1Size, kUniform1Type, |
| 9097 kUniform1FakeLocation, kUniform1RealLocation, | 8799 kUniform1FakeLocation, kUniform1RealLocation, |
| 9098 kUniform1DesiredLocation }, | 8800 kUniform1DesiredLocation }, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 9115 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) | 8817 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) |
| 9116 .Times(1) | 8818 .Times(1) |
| 9117 .RetiresOnSaturation(); | 8819 .RetiresOnSaturation(); |
| 9118 cmds::UseProgram cmd; | 8820 cmds::UseProgram cmd; |
| 9119 cmd.Init(client_program_id_); | 8821 cmd.Init(client_program_id_); |
| 9120 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8822 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 9121 } | 8823 } |
| 9122 } | 8824 } |
| 9123 | 8825 |
| 9124 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES2) { | 8826 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES2) { |
| 9125 InitDecoder("GL_OES_texture_float", // extensions | 8827 InitState init; |
| 9126 "opengl es 2.0", // gl version | 8828 init.extensions = "GL_OES_texture_float"; |
| 9127 false, // has alpha | 8829 init.gl_version = "opengl es 2.0"; |
| 9128 false, // has depth | 8830 InitDecoder(init); |
| 9129 false, // has stencil | |
| 9130 false, // request alpha | |
| 9131 false, // request depth | |
| 9132 false, // request stencil | |
| 9133 false); // bind generates resource | |
| 9134 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8831 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9135 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); | 8832 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); |
| 9136 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); | 8833 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); |
| 9137 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, | 8834 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, |
| 9138 GL_FLOAT, 0, 0); | 8835 GL_FLOAT, 0, 0); |
| 9139 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, | 8836 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, |
| 9140 0, 0); | 8837 0, 0); |
| 9141 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0, | 8838 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0, |
| 9142 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0); | 8839 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0); |
| 9143 } | 8840 } |
| 9144 | 8841 |
| 9145 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) { | 8842 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) { |
| 9146 InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions | 8843 InitState init; |
| 9147 "opengl es 3.0", // gl version | 8844 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; |
| 9148 false, // has alpha | 8845 init.gl_version = "opengl es 3.0"; |
| 9149 false, // has depth | 8846 InitDecoder(init); |
| 9150 false, // has stencil | |
| 9151 false, // request alpha | |
| 9152 false, // request depth | |
| 9153 false, // request stencil | |
| 9154 false); // bind generates resource | |
| 9155 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8847 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9156 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); | 8848 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0); |
| 9157 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); | 8849 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); |
| 9158 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, | 8850 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, |
| 9159 0); | 8851 0); |
| 9160 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, | 8852 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, |
| 9161 GL_FLOAT, 0, 0); | 8853 GL_FLOAT, 0, 0); |
| 9162 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, | 8854 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, |
| 9163 0, 0); | 8855 0, 0); |
| 9164 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0, | 8856 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0, |
| 9165 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0); | 8857 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0); |
| 9166 } | 8858 } |
| 9167 | 8859 |
| 9168 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) { | 8860 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) { |
| 9169 InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions | 8861 InitState init; |
| 9170 "opengl es 3.0", // gl version | 8862 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; |
| 9171 false, // has alpha | 8863 init.gl_version = "opengl es 3.0"; |
| 9172 false, // has depth | 8864 InitDecoder(init); |
| 9173 false, // has stencil | |
| 9174 false, // request alpha | |
| 9175 false, // request depth | |
| 9176 false, // request stencil | |
| 9177 false); // bind generates resource | |
| 9178 const int kWidth = 8; | 8865 const int kWidth = 8; |
| 9179 const int kHeight = 4; | 8866 const int kHeight = 4; |
| 9180 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8867 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9181 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA, | 8868 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA, |
| 9182 GL_FLOAT, 0, 0); | 8869 GL_FLOAT, 0, 0); |
| 9183 EXPECT_CALL(*gl_, TexImage2D( | 8870 EXPECT_CALL(*gl_, TexImage2D( |
| 9184 GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA, GL_FLOAT, | 8871 GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA, GL_FLOAT, |
| 9185 shared_memory_address_)) | 8872 shared_memory_address_)) |
| 9186 .Times(1) | 8873 .Times(1) |
| 9187 .RetiresOnSaturation(); | 8874 .RetiresOnSaturation(); |
| 9188 TexSubImage2D cmd; | 8875 TexSubImage2D cmd; |
| 9189 cmd.Init( | 8876 cmd.Init( |
| 9190 GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight, GL_RGBA, GL_FLOAT, | 8877 GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight, GL_RGBA, GL_FLOAT, |
| 9191 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); | 8878 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
| 9192 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8879 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 9193 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8880 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 9194 } | 8881 } |
| 9195 | 8882 |
| 9196 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) { | 8883 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) { |
| 9197 InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions | 8884 InitState init; |
| 9198 "opengl es 3.0", // gl version | 8885 init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float"; |
| 9199 false, // has alpha | 8886 init.gl_version = "opengl es 3.0"; |
| 9200 false, // has depth | 8887 InitDecoder(init); |
| 9201 false, // has stencil | |
| 9202 false, // request alpha | |
| 9203 false, // request depth | |
| 9204 false, // request stencil | |
| 9205 false); // bind generates resource | |
| 9206 const int kWidth = 8; | 8888 const int kWidth = 8; |
| 9207 const int kHeight = 4; | 8889 const int kHeight = 4; |
| 9208 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8890 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9209 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA, | 8891 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA, |
| 9210 GL_FLOAT, 0, 0); | 8892 GL_FLOAT, 0, 0); |
| 9211 SetupClearTextureExpectations( | 8893 SetupClearTextureExpectations( |
| 9212 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, | 8894 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, |
| 9213 0, GL_RGBA32F, GL_RGBA, GL_FLOAT, kWidth, kHeight); | 8895 0, GL_RGBA32F, GL_RGBA, GL_FLOAT, kWidth, kHeight); |
| 9214 EXPECT_CALL(*gl_, TexSubImage2D( | 8896 EXPECT_CALL(*gl_, TexSubImage2D( |
| 9215 GL_TEXTURE_2D, 0, 1, 0, kWidth - 1, kHeight, GL_RGBA, GL_FLOAT, | 8897 GL_TEXTURE_2D, 0, 1, 0, kWidth - 1, kHeight, GL_RGBA, GL_FLOAT, |
| 9216 shared_memory_address_)) | 8898 shared_memory_address_)) |
| 9217 .Times(1) | 8899 .Times(1) |
| 9218 .RetiresOnSaturation(); | 8900 .RetiresOnSaturation(); |
| 9219 TexSubImage2D cmd; | 8901 TexSubImage2D cmd; |
| 9220 cmd.Init( | 8902 cmd.Init( |
| 9221 GL_TEXTURE_2D, 0, 1, 0, kWidth - 1, kHeight, GL_RGBA, GL_FLOAT, | 8903 GL_TEXTURE_2D, 0, 1, 0, kWidth - 1, kHeight, GL_RGBA, GL_FLOAT, |
| 9222 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); | 8904 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
| 9223 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8905 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 9224 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8906 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 9225 } | 8907 } |
| 9226 | 8908 |
| 9227 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) { | 8909 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) { |
| 9228 InitDecoder("GL_ARB_texture_float", // extensions | 8910 InitState init; |
| 9229 "2.1", // gl version | 8911 init.extensions = "GL_ARB_texture_float"; |
| 9230 false, // has alpha | 8912 init.gl_version = "2.1"; |
| 9231 false, // has depth | 8913 InitDecoder(init); |
| 9232 false, // has stencil | |
| 9233 false, // request alpha | |
| 9234 false, // request depth | |
| 9235 false, // request stencil | |
| 9236 false); // bind generates resource | |
| 9237 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 8914 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 9238 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, | 8915 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, |
| 9239 0); | 8916 0); |
| 9240 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); | 8917 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0); |
| 9241 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, | 8918 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, |
| 9242 GL_RGBA, GL_FLOAT, 0, 0, GL_RGBA32F_ARB); | 8919 GL_RGBA, GL_FLOAT, 0, 0, GL_RGBA32F_ARB); |
| 9243 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, | 8920 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, |
| 9244 GL_RGB, GL_FLOAT, 0, 0, GL_RGB32F_ARB); | 8921 GL_RGB, GL_FLOAT, 0, 0, GL_RGB32F_ARB); |
| 9245 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, | 8922 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, |
| 9246 GL_LUMINANCE, GL_FLOAT, 0, 0, | 8923 GL_LUMINANCE, GL_FLOAT, 0, 0, |
| 9247 GL_LUMINANCE32F_ARB); | 8924 GL_LUMINANCE32F_ARB); |
| 9248 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, | 8925 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, |
| 9249 GL_ALPHA, GL_FLOAT, 0, 0, GL_ALPHA32F_ARB); | 8926 GL_ALPHA, GL_FLOAT, 0, 0, GL_ALPHA32F_ARB); |
| 9250 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, | 8927 DoTexImage2DConvertInternalFormat(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, |
| 9251 17, 0, GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0, | 8928 17, 0, GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0, |
| 9252 GL_LUMINANCE_ALPHA32F_ARB); | 8929 GL_LUMINANCE_ALPHA32F_ARB); |
| 9253 } | 8930 } |
| 9254 | 8931 |
| 9255 TEST_F(GLES2DecoderManualInitTest, ReadFormatExtension) { | 8932 TEST_F(GLES2DecoderManualInitTest, ReadFormatExtension) { |
| 9256 InitDecoder( | 8933 InitState init; |
| 9257 "GL_OES_read_format", // extensions | 8934 init.extensions = "GL_OES_read_format"; |
| 9258 "2.1", // gl version | 8935 init.gl_version = "2.1"; |
| 9259 false, // has alpha | 8936 init.bind_generates_resource = true; |
| 9260 false, // has depth | 8937 InitDecoder(init); |
| 9261 false, // has stencil | |
| 9262 false, // request alpha | |
| 9263 false, // request depth | |
| 9264 false, // request stencil | |
| 9265 true); // bind generates resource | |
| 9266 | 8938 |
| 9267 EXPECT_CALL(*gl_, GetError()) | 8939 EXPECT_CALL(*gl_, GetError()) |
| 9268 .WillOnce(Return(GL_NO_ERROR)) | 8940 .WillOnce(Return(GL_NO_ERROR)) |
| 9269 .WillOnce(Return(GL_NO_ERROR)) | 8941 .WillOnce(Return(GL_NO_ERROR)) |
| 9270 .WillOnce(Return(GL_NO_ERROR)) | 8942 .WillOnce(Return(GL_NO_ERROR)) |
| 9271 .WillOnce(Return(GL_NO_ERROR)) | 8943 .WillOnce(Return(GL_NO_ERROR)) |
| 9272 .RetiresOnSaturation(); | 8944 .RetiresOnSaturation(); |
| 9273 EXPECT_CALL(*gl_, GetError()) | 8945 EXPECT_CALL(*gl_, GetError()) |
| 9274 .Times(6) | 8946 .Times(6) |
| 9275 .RetiresOnSaturation(); | 8947 .RetiresOnSaturation(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9313 .RetiresOnSaturation(); | 8985 .RetiresOnSaturation(); |
| 9314 cmd.Init( | 8986 cmd.Init( |
| 9315 GL_IMPLEMENTATION_COLOR_READ_TYPE, | 8987 GL_IMPLEMENTATION_COLOR_READ_TYPE, |
| 9316 shared_memory_id_, shared_memory_offset_); | 8988 shared_memory_id_, shared_memory_offset_); |
| 9317 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 8989 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 9318 EXPECT_EQ(1, result->GetNumResults()); | 8990 EXPECT_EQ(1, result->GetNumResults()); |
| 9319 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 8991 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 9320 } | 8992 } |
| 9321 | 8993 |
| 9322 TEST_F(GLES2DecoderManualInitTest, NoReadFormatExtension) { | 8994 TEST_F(GLES2DecoderManualInitTest, NoReadFormatExtension) { |
| 9323 InitDecoder( | 8995 InitState init; |
| 9324 "", // extensions | 8996 init.gl_version = "2.1"; |
| 9325 "2.1", // gl version | 8997 init.bind_generates_resource = true; |
| 9326 false, // has alpha | 8998 InitDecoder(init); |
| 9327 false, // has depth | |
| 9328 false, // has stencil | |
| 9329 false, // request alpha | |
| 9330 false, // request depth | |
| 9331 false, // request stencil | |
| 9332 true); // bind generates resource | |
| 9333 | 8999 |
| 9334 EXPECT_CALL(*gl_, GetError()) | 9000 EXPECT_CALL(*gl_, GetError()) |
| 9335 .WillOnce(Return(GL_NO_ERROR)) | 9001 .WillOnce(Return(GL_NO_ERROR)) |
| 9336 .WillOnce(Return(GL_NO_ERROR)) | 9002 .WillOnce(Return(GL_NO_ERROR)) |
| 9337 .WillOnce(Return(GL_NO_ERROR)) | 9003 .WillOnce(Return(GL_NO_ERROR)) |
| 9338 .WillOnce(Return(GL_NO_ERROR)) | 9004 .WillOnce(Return(GL_NO_ERROR)) |
| 9339 .RetiresOnSaturation(); | 9005 .RetiresOnSaturation(); |
| 9340 | 9006 |
| 9341 typedef GetIntegerv::Result Result; | 9007 typedef GetIntegerv::Result Result; |
| 9342 Result* result = static_cast<Result*>(shared_memory_address_); | 9008 Result* result = static_cast<Result*>(shared_memory_address_); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9412 // TODO(gman): TexImage2DImmediate | 9078 // TODO(gman): TexImage2DImmediate |
| 9413 | 9079 |
| 9414 // TODO(gman): TexSubImage2DImmediate | 9080 // TODO(gman): TexSubImage2DImmediate |
| 9415 | 9081 |
| 9416 // TODO(gman): UseProgram | 9082 // TODO(gman): UseProgram |
| 9417 | 9083 |
| 9418 // TODO(gman): SwapBuffers | 9084 // TODO(gman): SwapBuffers |
| 9419 | 9085 |
| 9420 } // namespace gles2 | 9086 } // namespace gles2 |
| 9421 } // namespace gpu | 9087 } // namespace gpu |
| OLD | NEW |