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

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

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