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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc

Issue 2518413002: Add validation to the mailbox functions in the passthrough cmd decoder. (Closed)
Patch Set: Fix explicit. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
index 1f4d3b9bf85f3f38bec63e28aebfe5e9eec0bf1b..aa3ada86737d99f2c57b361eef7168b2abce99c2 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
@@ -191,7 +191,12 @@ bool GLES2DecoderPassthroughImpl::Initialize(
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &num_texture_units);
active_texture_unit_ = 0;
- bound_textures_.resize(num_texture_units, 0);
+ bound_textures_[GL_TEXTURE_2D].resize(num_texture_units, 0);
+ bound_textures_[GL_TEXTURE_CUBE_MAP].resize(num_texture_units, 0);
+ if (feature_info_->IsWebGL2OrES3Context()) {
+ bound_textures_[GL_TEXTURE_2D_ARRAY].resize(num_texture_units, 0);
+ bound_textures_[GL_TEXTURE_3D].resize(num_texture_units, 0);
+ }
if (group_->gpu_preferences().enable_gpu_driver_debug_logging &&
feature_info_->feature_flags().khr_debug) {
@@ -821,6 +826,33 @@ error::Error GLES2DecoderPassthroughImpl::ProcessQueries(bool did_finish) {
return error::kNoError;
}
+void GLES2DecoderPassthroughImpl::UpdateTextureBinding(GLenum target,
+ GLuint client_id,
+ GLuint service_id) {
+ size_t cur_texture_unit = active_texture_unit_;
+ const auto& target_bound_textures = bound_textures_.at(target);
+ for (size_t bound_texture_index = 0;
+ bound_texture_index < target_bound_textures.size();
+ bound_texture_index++) {
+ GLuint bound_client_id = target_bound_textures[bound_texture_index];
+ if (bound_client_id == client_id) {
+ // Update the active texture unit if needed
+ if (bound_texture_index != cur_texture_unit) {
+ glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + bound_texture_index));
+ cur_texture_unit = bound_texture_index;
+ }
+
+ // Update the texture binding
+ glBindTexture(target, service_id);
+ }
+ }
+
+ // Reset the active texture unit if it was changed
+ if (cur_texture_unit != active_texture_unit_) {
+ glActiveTexture(static_cast<GLenum>(GL_TEXTURE0 + active_texture_unit_));
+ }
+}
+
#define GLES2_CMD_OP(name) \
{ \
&GLES2DecoderPassthroughImpl::Handle##name, cmds::name::kArgFlags, \

Powered by Google App Engine
This is Rietveld 408576698