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

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

Issue 2690633003: Add validation to gl[Bind|Release]TexImage2DCHROMIUM. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_passthrough.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 namespace gles2 { 10 namespace gles2 {
(...skipping 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2894 GLint location, 2894 GLint location,
2895 const char* name) { 2895 const char* name) {
2896 glBindUniformLocationCHROMIUM(GetProgramServiceID(program, resources_), 2896 glBindUniformLocationCHROMIUM(GetProgramServiceID(program, resources_),
2897 location, name); 2897 location, name);
2898 return error::kNoError; 2898 return error::kNoError;
2899 } 2899 }
2900 2900
2901 error::Error GLES2DecoderPassthroughImpl::DoBindTexImage2DCHROMIUM( 2901 error::Error GLES2DecoderPassthroughImpl::DoBindTexImage2DCHROMIUM(
2902 GLenum target, 2902 GLenum target,
2903 GLint imageId) { 2903 GLint imageId) {
2904 // TODO(geofflang): error handling 2904 if (target != GL_TEXTURE_2D) {
2905 InsertError(GL_INVALID_ENUM, "Invalid target");
2906 return error::kNoError;
2907 }
2908
2905 gl::GLImage* image = image_manager_->LookupImage(imageId); 2909 gl::GLImage* image = image_manager_->LookupImage(imageId);
2910 if (image == nullptr) {
2911 InsertError(GL_INVALID_OPERATION, "No image found with the given ID");
2912 return error::kNoError;
2913 }
2914
2906 if (!image->BindTexImage(target)) { 2915 if (!image->BindTexImage(target)) {
2907 image->CopyTexImage(target); 2916 image->CopyTexImage(target);
2908 } 2917 }
2918
2909 return error::kNoError; 2919 return error::kNoError;
2910 } 2920 }
2911 2921
2912 error::Error GLES2DecoderPassthroughImpl::DoReleaseTexImage2DCHROMIUM( 2922 error::Error GLES2DecoderPassthroughImpl::DoReleaseTexImage2DCHROMIUM(
2913 GLenum target, 2923 GLenum target,
2914 GLint imageId) { 2924 GLint imageId) {
2915 // TODO(geofflang): error handling 2925 if (target != GL_TEXTURE_2D) {
2926 InsertError(GL_INVALID_ENUM, "Invalid target");
2927 return error::kNoError;
2928 }
2929
2916 gl::GLImage* image = image_manager_->LookupImage(imageId); 2930 gl::GLImage* image = image_manager_->LookupImage(imageId);
2931 if (image == nullptr) {
2932 InsertError(GL_INVALID_OPERATION, "No image found with the given ID");
2933 return error::kNoError;
2934 }
2935
2917 image->ReleaseTexImage(target); 2936 image->ReleaseTexImage(target);
2918 return error::kNoError; 2937 return error::kNoError;
2919 } 2938 }
2920 2939
2921 error::Error GLES2DecoderPassthroughImpl::DoTraceBeginCHROMIUM( 2940 error::Error GLES2DecoderPassthroughImpl::DoTraceBeginCHROMIUM(
2922 const char* category_name, 2941 const char* category_name,
2923 const char* trace_name) { 2942 const char* trace_name) {
2924 NOTIMPLEMENTED(); 2943 NOTIMPLEMENTED();
2925 return error::kNoError; 2944 return error::kNoError;
2926 } 2945 }
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3322 GLuint texture, 3341 GLuint texture,
3323 GLboolean promotion_hint, 3342 GLboolean promotion_hint,
3324 GLint display_x, 3343 GLint display_x,
3325 GLint display_y) { 3344 GLint display_y) {
3326 NOTIMPLEMENTED(); 3345 NOTIMPLEMENTED();
3327 return error::kNoError; 3346 return error::kNoError;
3328 } 3347 }
3329 3348
3330 } // namespace gles2 3349 } // namespace gles2
3331 } // namespace gpu 3350 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698