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

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

Issue 7253052: Execute all GL commands up to the put offset reported by a flush. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" 8 #include "gpu/command_buffer/common/gles2_cmd_format.h"
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/common/gl_mock.h" 10 #include "gpu/command_buffer/common/gl_mock.h"
(...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 EXPECT_NE(GL_NO_ERROR, GetGLError()); 2886 EXPECT_NE(GL_NO_ERROR, GetGLError());
2887 } 2887 }
2888 } 2888 }
2889 } 2889 }
2890 } 2890 }
2891 } 2891 }
2892 } 2892 }
2893 } 2893 }
2894 } 2894 }
2895 2895
2896 TEST_F(GLES2DecoderTest, SetLatch) {
2897 bool isAngle = false;
2898 #if defined(OS_WIN)
2899 isAngle = (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2);
2900 #endif
2901 if (!isAngle) {
2902 EXPECT_CALL(*gl_, Flush()).Times(3);
2903 }
2904 const uint32 kLatchId = 1;
2905 base::subtle::Atomic32* latches = static_cast<base::subtle::Atomic32*>(
2906 shared_memory_base_);
2907 const uint32 kInvalidLatchId = kSharedBufferSize / sizeof(*latches);
2908 const uint32 kLastValidLatchId = kInvalidLatchId - 1;
2909 latches[kLatchId] = 0;
2910 latches[kLastValidLatchId] = 0;
2911 SetLatchCHROMIUM cmd;
2912 // Check out of range latch id.
2913 cmd.Init(kInvalidLatchId);
2914 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
2915 cmd.Init(kLatchId);
2916 // Check valid latch.
2917 EXPECT_EQ(0, latches[kLatchId]);
2918 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2919 EXPECT_EQ(1, latches[kLatchId]);
2920 // Check last valid latch.
2921 EXPECT_EQ(0, latches[kLastValidLatchId]);
2922 cmd.Init(kLastValidLatchId);
2923 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2924 EXPECT_EQ(1, latches[kLastValidLatchId]);
2925 }
2926
2927 TEST_F(GLES2DecoderTest, WaitLatch) {
2928 const uint32 kLatchId = 1;
2929 base::subtle::Atomic32* latches = static_cast<base::subtle::Atomic32*>(
2930 shared_memory_base_);
2931 const uint32 kInvalidLatchId = kSharedBufferSize / sizeof(*latches);
2932 const uint32 kLastValidLatchId = kInvalidLatchId - 1;
2933 latches[kLatchId] = 0;
2934 latches[kLastValidLatchId] = 0;
2935 WaitLatchCHROMIUM cmd;
2936 // Check out of range latch id.
2937 cmd.Init(kInvalidLatchId);
2938 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
2939 // Check valid latch.
2940 cmd.Init(kLatchId);
2941 EXPECT_EQ(0, latches[kLatchId]);
2942 EXPECT_EQ(error::kWaiting, ExecuteCmd(cmd));
2943 latches[kLatchId] = 1;
2944 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2945 EXPECT_EQ(0, latches[kLatchId]);
2946 // Check last valid latch.
2947 cmd.Init(kLastValidLatchId);
2948 EXPECT_EQ(0, latches[kLastValidLatchId]);
2949 EXPECT_EQ(error::kWaiting, ExecuteCmd(cmd));
2950 latches[kLastValidLatchId] = 1;
2951 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2952 EXPECT_EQ(0, latches[kLastValidLatchId]);
2953 }
2954
2955 TEST_F(GLES2DecoderTest, SetSurfaceCHROMIUMChangesSurfaceForExistentSurface) { 2896 TEST_F(GLES2DecoderTest, SetSurfaceCHROMIUMChangesSurfaceForExistentSurface) {
2956 const int kSurfaceId = 1; 2897 const int kSurfaceId = 1;
2957 scoped_refptr<gfx::GLSurfaceStub> surface(new gfx::GLSurfaceStub); 2898 scoped_refptr<gfx::GLSurfaceStub> surface(new gfx::GLSurfaceStub);
2958 2899
2959 EXPECT_CALL(*surface_manager_.get(), LookupSurface(kSurfaceId)) 2900 EXPECT_CALL(*surface_manager_.get(), LookupSurface(kSurfaceId))
2960 .WillOnce(Return(surface.get())) 2901 .WillOnce(Return(surface.get()))
2961 .RetiresOnSaturation(); 2902 .RetiresOnSaturation();
2962 2903
2963 SetSurfaceCHROMIUM cmd; 2904 SetSurfaceCHROMIUM cmd;
2964 cmd.Init(kSurfaceId); 2905 cmd.Init(kSurfaceId);
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
4376 // TODO(gman): TexImage2DImmediate 4317 // TODO(gman): TexImage2DImmediate
4377 4318
4378 // TODO(gman): TexSubImage2DImmediate 4319 // TODO(gman): TexSubImage2DImmediate
4379 4320
4380 // TODO(gman): UseProgram 4321 // TODO(gman): UseProgram
4381 4322
4382 // TODO(gman): SwapBuffers 4323 // TODO(gman): SwapBuffers
4383 4324
4384 } // namespace gles2 4325 } // namespace gles2
4385 } // namespace gpu 4326 } // 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_2_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698