Skip to content

Commit

Permalink
GPU service interprets glFinish as glFlush.
Browse files Browse the repository at this point in the history
This is so the single threaded GPU service does not get delayed executing glFinish, which could prevent progress in rendering all other GL contexts. Instead just issue a glFlush to ensure that the pending commands will be processed in the future.

From a client side perspective the semantics of glFlush and glFinish are still different. glFlush is asynchronous whereas glFinish is synchronous. The latter waits for the service to acknowledge that it has issued the glFlush. glFinish can therefore be used to synchronize multiple threads that are issuing commands to GL contexts that share a common namespace.

TEST=trybots
BUG=none

Review URL: http://codereview.chromium.org/1719019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45724 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
apatrick@chromium.org committed Apr 27, 2010
1 parent 504c9a7 commit 85a815c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion gpu/command_buffer/build_gles2_cmd_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,11 @@
'decoder_func': 'DoEnableVertexAttribArray',
'impl_decl': False,
},
'Finish': {'impl_func': False},
'Finish': {
'impl_func': False,
'decoder_func': 'glFlush',
'gl_test_func': 'glFlush',
},
'Flush': {'impl_func': False},
'FramebufferRenderbuffer': {
'decoder_func': 'DoFramebufferRenderbuffer',
Expand Down
2 changes: 1 addition & 1 deletion gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ error::Error GLES2DecoderImpl::HandleEnableVertexAttribArray(

error::Error GLES2DecoderImpl::HandleFinish(
uint32 immediate_data_size, const gles2::Finish& c) {
glFinish();
glFlush();
return error::kNoError;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ TEST_F(GLES2DecoderTest1, EnableVertexAttribArrayValidArgs) {
}

TEST_F(GLES2DecoderTest1, FinishValidArgs) {
EXPECT_CALL(*gl_, Finish());
EXPECT_CALL(*gl_, Flush());
SpecializedSetup<Finish, 0>();
Finish cmd;
cmd.Init();
Expand Down

0 comments on commit 85a815c

Please sign in to comment.