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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698