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

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

Issue 298753004: Fix an early return and the error status in glLoseContextCHROMIUM impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cmd-buffer-missing-early-returns
Patch Set: Created 6 years, 7 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
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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 GLenum target, 941 GLenum target,
942 GLint image_id); 942 GLint image_id);
943 void DoReleaseTexImage2DCHROMIUM( 943 void DoReleaseTexImage2DCHROMIUM(
944 GLenum target, 944 GLenum target,
945 GLint image_id); 945 GLint image_id);
946 946
947 void DoTraceEndCHROMIUM(void); 947 void DoTraceEndCHROMIUM(void);
948 948
949 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); 949 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs);
950 950
951 void DoLoseContextCHROMIUM(GLenum current, GLenum other);
952
951 // Creates a Program for the given program. 953 // Creates a Program for the given program.
952 Program* CreateProgram( 954 Program* CreateProgram(
953 GLuint client_id, GLuint service_id) { 955 GLuint client_id, GLuint service_id) {
954 return program_manager()->CreateProgram(client_id, service_id); 956 return program_manager()->CreateProgram(client_id, service_id);
955 } 957 }
956 958
957 // Gets the program info for the given program. Returns NULL if none exists. 959 // Gets the program info for the given program. Returns NULL if none exists.
958 Program* GetProgram(GLuint client_id) { 960 Program* GetProgram(GLuint client_id) {
959 return program_manager()->GetProgram(client_id); 961 return program_manager()->GetProgram(client_id);
960 } 962 }
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; 1711 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_;
1710 1712
1711 // The format of the back buffer_ 1713 // The format of the back buffer_
1712 GLenum back_buffer_color_format_; 1714 GLenum back_buffer_color_format_;
1713 bool back_buffer_has_depth_; 1715 bool back_buffer_has_depth_;
1714 bool back_buffer_has_stencil_; 1716 bool back_buffer_has_stencil_;
1715 1717
1716 // Backbuffer attachments that are currently undefined. 1718 // Backbuffer attachments that are currently undefined.
1717 uint32 backbuffer_needs_clear_bits_; 1719 uint32 backbuffer_needs_clear_bits_;
1718 1720
1719 // The current decoder error. 1721 // The current decoder error communicates the decoder error through command
1722 // processing functions that do not return the error value. Should be set only
1723 // if not returning an error.
1720 error::Error current_decoder_error_; 1724 error::Error current_decoder_error_;
1721 1725
1722 bool use_shader_translator_; 1726 bool use_shader_translator_;
1723 scoped_refptr<ShaderTranslator> vertex_translator_; 1727 scoped_refptr<ShaderTranslator> vertex_translator_;
1724 scoped_refptr<ShaderTranslator> fragment_translator_; 1728 scoped_refptr<ShaderTranslator> fragment_translator_;
1725 1729
1726 DisallowedFeatures disallowed_features_; 1730 DisallowedFeatures disallowed_features_;
1727 1731
1728 // Cached from ContextGroup 1732 // Cached from ContextGroup
1729 const Validators* validators_; 1733 const Validators* validators_;
(...skipping 7707 matching lines...) Expand 10 before | Expand all | Expand 10 after
9437 // Only loses the context once. 9441 // Only loses the context once.
9438 if (reset_status_ != GL_NO_ERROR) { 9442 if (reset_status_ != GL_NO_ERROR) {
9439 return; 9443 return;
9440 } 9444 }
9441 9445
9442 // Marks this context as lost. 9446 // Marks this context as lost.
9443 reset_status_ = reset_status; 9447 reset_status_ = reset_status;
9444 current_decoder_error_ = error::kLostContext; 9448 current_decoder_error_ = error::kLostContext;
9445 } 9449 }
9446 9450
9447 error::Error GLES2DecoderImpl::HandleLoseContextCHROMIUM(
9448 uint32 immediate_data_size, const cmds::LoseContextCHROMIUM& c) {
9449 GLenum current = static_cast<GLenum>(c.current);
9450 GLenum other = static_cast<GLenum>(c.other);
9451 if (!validators_->reset_status.IsValid(current)) {
9452 LOCAL_SET_GL_ERROR_INVALID_ENUM(
9453 "glLoseContextCHROMIUM", current, "current");
9454 }
9455 if (!validators_->reset_status.IsValid(other)) {
9456 LOCAL_SET_GL_ERROR_INVALID_ENUM("glLoseContextCHROMIUM", other, "other");
9457 }
9458 group_->LoseContexts(other);
9459 reset_status_ = current;
9460 current_decoder_error_ = error::kLostContext;
9461 return error::kLostContext;
9462 }
9463
9464 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( 9451 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM(
9465 uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) { 9452 uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) {
9466 return error::kUnknownCommand; 9453 return error::kUnknownCommand;
9467 } 9454 }
9468 9455
9469 error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM( 9456 error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM(
9470 uint32 immediate_data_size, const cmds::WaitSyncPointCHROMIUM& c) { 9457 uint32 immediate_data_size, const cmds::WaitSyncPointCHROMIUM& c) {
9471 group_->mailbox_manager()->PullTextureUpdates(); 9458 group_->mailbox_manager()->PullTextureUpdates();
9472 if (wait_sync_point_callback_.is_null()) 9459 if (wait_sync_point_callback_.is_null())
9473 return error::kNoError; 9460 return error::kNoError;
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
10451 GLenum mapped_buf = bufs[0]; 10438 GLenum mapped_buf = bufs[0];
10452 if (GetBackbufferServiceId() != 0 && // emulated backbuffer 10439 if (GetBackbufferServiceId() != 0 && // emulated backbuffer
10453 bufs[0] == GL_BACK) { 10440 bufs[0] == GL_BACK) {
10454 mapped_buf = GL_COLOR_ATTACHMENT0; 10441 mapped_buf = GL_COLOR_ATTACHMENT0;
10455 } 10442 }
10456 glDrawBuffersARB(count, &mapped_buf); 10443 glDrawBuffersARB(count, &mapped_buf);
10457 group_->set_draw_buffer(bufs[0]); 10444 group_->set_draw_buffer(bufs[0]);
10458 } 10445 }
10459 } 10446 }
10460 10447
10448 void GLES2DecoderImpl::DoLoseContextCHROMIUM(GLenum current, GLenum other) {
10449 group_->LoseContexts(other);
10450 reset_status_ = current;
10451 current_decoder_error_ = error::kLostContext;
10452 }
10453
10461 bool GLES2DecoderImpl::ValidateAsyncTransfer( 10454 bool GLES2DecoderImpl::ValidateAsyncTransfer(
10462 const char* function_name, 10455 const char* function_name,
10463 TextureRef* texture_ref, 10456 TextureRef* texture_ref,
10464 GLenum target, 10457 GLenum target,
10465 GLint level, 10458 GLint level,
10466 const void * data) { 10459 const void * data) {
10467 // We only support async uploads to 2D textures for now. 10460 // We only support async uploads to 2D textures for now.
10468 if (GL_TEXTURE_2D != target) { 10461 if (GL_TEXTURE_2D != target) {
10469 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target"); 10462 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target");
10470 return false; 10463 return false;
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
10769 } 10762 }
10770 } 10763 }
10771 10764
10772 // Include the auto-generated part of this file. We split this because it means 10765 // Include the auto-generated part of this file. We split this because it means
10773 // we can easily edit the non-auto generated parts right here in this file 10766 // we can easily edit the non-auto generated parts right here in this file
10774 // instead of having to edit some template or the code generator. 10767 // instead of having to edit some template or the code generator.
10775 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10768 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10776 10769
10777 } // namespace gles2 10770 } // namespace gles2
10778 } // namespace gpu 10771 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/cmd_buffer_functions.txt ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698