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

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

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 17 matching lines...) Expand all
28 #include "ui/gl/gl_implementation.h" 28 #include "ui/gl/gl_implementation.h"
29 #include "ui/gl/gl_mock.h" 29 #include "ui/gl/gl_mock.h"
30 #include "ui/gl/gl_surface_stub.h" 30 #include "ui/gl/gl_surface_stub.h"
31 31
32 #if !defined(GL_DEPTH24_STENCIL8) 32 #if !defined(GL_DEPTH24_STENCIL8)
33 #define GL_DEPTH24_STENCIL8 0x88F0 33 #define GL_DEPTH24_STENCIL8 0x88F0
34 #endif 34 #endif
35 35
36 using ::gfx::MockGLInterface; 36 using ::gfx::MockGLInterface;
37 using ::testing::_; 37 using ::testing::_;
38 using ::testing::An;
38 using ::testing::DoAll; 39 using ::testing::DoAll;
39 using ::testing::InSequence; 40 using ::testing::InSequence;
40 using ::testing::Invoke; 41 using ::testing::Invoke;
41 using ::testing::MatcherCast; 42 using ::testing::MatcherCast;
42 using ::testing::Mock; 43 using ::testing::Mock;
43 using ::testing::Pointee; 44 using ::testing::Pointee;
44 using ::testing::Return; 45 using ::testing::Return;
45 using ::testing::SaveArg; 46 using ::testing::SaveArg;
46 using ::testing::SetArrayArgument; 47 using ::testing::SetArrayArgument;
47 using ::testing::SetArgumentPointee; 48 using ::testing::SetArgumentPointee;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 EXPECT_FALSE( 111 EXPECT_FALSE(
111 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( 112 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate(
112 texture_ref)); 113 texture_ref));
113 114
114 base::Closure bind_callback; 115 base::Closure bind_callback;
115 116
116 // AsyncTexImage2D 117 // AsyncTexImage2D
117 { 118 {
118 // Create transfer state since it doesn't exist. 119 // Create transfer state since it doesn't exist.
119 EXPECT_EQ(texture_ref->num_observers(), 0); 120 EXPECT_EQ(texture_ref->num_observers(), 0);
120 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) 121 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(
122 texture_ref, An<const AsyncTexImage2DParams&>()))
121 .WillOnce(Return( 123 .WillOnce(Return(
122 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) 124 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>))
123 .RetiresOnSaturation(); 125 .RetiresOnSaturation();
124 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)) 126 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _))
125 .WillOnce(SaveArg<2>(&bind_callback)) 127 .WillOnce(SaveArg<2>(&bind_callback))
126 .RetiresOnSaturation(); 128 .RetiresOnSaturation();
127 // Command succeeds. 129 // Command succeeds.
128 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); 130 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd));
129 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 131 EXPECT_EQ(GL_NO_ERROR, GetGLError());
130 EXPECT_EQ( 132 EXPECT_EQ(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 172 }
171 173
172 // AsyncTexSubImage2D 174 // AsyncTexSubImage2D
173 EXPECT_CALL(*delegate, Destroy()).RetiresOnSaturation(); 175 EXPECT_CALL(*delegate, Destroy()).RetiresOnSaturation();
174 decoder_->GetAsyncPixelTransferManager()->ClearPixelTransferDelegateForTest( 176 decoder_->GetAsyncPixelTransferManager()->ClearPixelTransferDelegateForTest(
175 texture_ref); 177 texture_ref);
176 EXPECT_EQ(texture_ref->num_observers(), 0); 178 EXPECT_EQ(texture_ref->num_observers(), 0);
177 texture->SetImmutable(false); 179 texture->SetImmutable(false);
178 { 180 {
179 // Create transfer state since it doesn't exist. 181 // Create transfer state since it doesn't exist.
180 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) 182 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(
183 texture_ref, An<const AsyncTexImage2DParams&>()))
181 .WillOnce(Return( 184 .WillOnce(Return(
182 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) 185 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>))
183 .RetiresOnSaturation(); 186 .RetiresOnSaturation();
184 EXPECT_CALL(*delegate, AsyncTexSubImage2D(_, _)).RetiresOnSaturation(); 187 EXPECT_CALL(*delegate, AsyncTexSubImage2D(_, _)).RetiresOnSaturation();
185 // Command succeeds. 188 // Command succeeds.
186 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd)); 189 EXPECT_EQ(error::kNoError, ExecuteCmd(texsubimage_cmd));
187 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 190 EXPECT_EQ(GL_NO_ERROR, GetGLError());
188 EXPECT_EQ( 191 EXPECT_EQ(
189 delegate, 192 delegate,
190 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( 193 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 { 245 {
243 // Get a fresh texture since the existing texture cannot be respecified 246 // Get a fresh texture since the existing texture cannot be respecified
244 // asynchronously and AsyncTexSubImage2D does not involve binding. 247 // asynchronously and AsyncTexSubImage2D does not involve binding.
245 EXPECT_CALL(*gl_, GenTextures(1, _)) 248 EXPECT_CALL(*gl_, GenTextures(1, _))
246 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); 249 .WillOnce(SetArgumentPointee<1>(kServiceTextureId));
247 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 250 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
248 texture_ref = GetTexture(client_texture_id_); 251 texture_ref = GetTexture(client_texture_id_);
249 texture = texture_ref->texture(); 252 texture = texture_ref->texture();
250 texture->SetImmutable(false); 253 texture->SetImmutable(false);
251 // Create transfer state since it doesn't exist. 254 // Create transfer state since it doesn't exist.
252 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) 255 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(
256 texture_ref, An<const AsyncTexImage2DParams&>()))
253 .WillOnce(Return( 257 .WillOnce(Return(
254 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) 258 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>))
255 .RetiresOnSaturation(); 259 .RetiresOnSaturation();
256 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)).RetiresOnSaturation(); 260 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)).RetiresOnSaturation();
257 // Start async transfer. 261 // Start async transfer.
258 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); 262 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd));
259 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 263 EXPECT_EQ(GL_NO_ERROR, GetGLError());
260 EXPECT_EQ( 264 EXPECT_EQ(
261 delegate, 265 delegate,
262 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( 266 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate(
(...skipping 19 matching lines...) Expand all
282 { 286 {
283 // Get a fresh texture since the existing texture cannot be respecified 287 // Get a fresh texture since the existing texture cannot be respecified
284 // asynchronously and AsyncTexSubImage2D does not involve binding. 288 // asynchronously and AsyncTexSubImage2D does not involve binding.
285 EXPECT_CALL(*gl_, GenTextures(1, _)) 289 EXPECT_CALL(*gl_, GenTextures(1, _))
286 .WillOnce(SetArgumentPointee<1>(kServiceTextureId)); 290 .WillOnce(SetArgumentPointee<1>(kServiceTextureId));
287 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 291 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
288 texture_ref = GetTexture(client_texture_id_); 292 texture_ref = GetTexture(client_texture_id_);
289 texture = texture_ref->texture(); 293 texture = texture_ref->texture();
290 texture->SetImmutable(false); 294 texture->SetImmutable(false);
291 // Create transfer state since it doesn't exist. 295 // Create transfer state since it doesn't exist.
292 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) 296 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(
297 texture_ref, An<const AsyncTexImage2DParams&>()))
293 .WillOnce(Return( 298 .WillOnce(Return(
294 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) 299 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>))
295 .RetiresOnSaturation(); 300 .RetiresOnSaturation();
296 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)).RetiresOnSaturation(); 301 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)).RetiresOnSaturation();
297 // Start async transfer. 302 // Start async transfer.
298 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); 303 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd));
299 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 304 EXPECT_EQ(GL_NO_ERROR, GetGLError());
300 EXPECT_EQ( 305 EXPECT_EQ(
301 delegate, 306 delegate,
302 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( 307 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 0, 353 0,
349 0); 354 0);
350 355
351 // No transfer delegate exists initially. 356 // No transfer delegate exists initially.
352 EXPECT_FALSE( 357 EXPECT_FALSE(
353 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate( 358 decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate(
354 texture_ref)); 359 texture_ref));
355 360
356 // Create delegate on AsyncTexImage2D. 361 // Create delegate on AsyncTexImage2D.
357 { 362 {
358 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _)) 363 EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(
364 texture_ref, An<const AsyncTexImage2DParams&>()))
359 .WillOnce(Return( 365 .WillOnce(Return(
360 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>)) 366 delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>))
361 .RetiresOnSaturation(); 367 .RetiresOnSaturation();
362 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)).RetiresOnSaturation(); 368 EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _)).RetiresOnSaturation();
363 369
364 // Command succeeds. 370 // Command succeeds.
365 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd)); 371 EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd));
366 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 372 EXPECT_EQ(GL_NO_ERROR, GetGLError());
367 } 373 }
368 374
(...skipping 10 matching lines...) Expand all
379 manager = NULL; 385 manager = NULL;
380 386
381 // Texture ref still valid. 387 // Texture ref still valid.
382 EXPECT_EQ(texture_ref, GetTexture(client_texture_id_)); 388 EXPECT_EQ(texture_ref, GetTexture(client_texture_id_));
383 EXPECT_EQ(texture_ref->num_observers(), 0); 389 EXPECT_EQ(texture_ref->num_observers(), 0);
384 } 390 }
385 } 391 }
386 392
387 } // namespace gles2 393 } // namespace gles2
388 } // namespace gpu 394 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h ('k') | gpu/command_buffer/service/gpu_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698