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

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

Issue 2689203002: Check for some extensions before calling potentially NULL GL entry points. (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
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 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 return error::kNoError; 2243 return error::kNoError;
2244 } 2244 }
2245 2245
2246 error::Error 2246 error::Error
2247 GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleCHROMIUM( 2247 GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleCHROMIUM(
2248 GLenum target, 2248 GLenum target,
2249 GLsizei samples, 2249 GLsizei samples,
2250 GLenum internalformat, 2250 GLenum internalformat,
2251 GLsizei width, 2251 GLsizei width,
2252 GLsizei height) { 2252 GLsizei height) {
2253 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, 2253 if (!feature_info_->feature_flags().chromium_framebuffer_multisample) {
2254 height); 2254 return error::kUnknownCommand;
2255 }
2256
2257 if (has_angle_framebuffer_multisample_) {
2258 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat,
2259 width, height);
2260 } else {
2261 DCHECK(has_es3_);
2262 glRenderbufferStorageMultisample(target, samples, internalformat, width,
2263 height);
2264 }
2255 return error::kNoError; 2265 return error::kNoError;
2256 } 2266 }
2257 2267
2258 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleEXT( 2268 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleEXT(
2259 GLenum target, 2269 GLenum target,
2260 GLsizei samples, 2270 GLsizei samples,
2261 GLenum internalformat, 2271 GLenum internalformat,
2262 GLsizei width, 2272 GLsizei width,
2263 GLsizei height) { 2273 GLsizei height) {
2264 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, 2274 if (!feature_info_->feature_flags().chromium_framebuffer_multisample) {
2265 height); 2275 return error::kUnknownCommand;
2276 }
2277
2278 if (has_angle_framebuffer_multisample_) {
2279 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat,
2280 width, height);
2281 } else {
2282 DCHECK(has_es3_);
2283 glRenderbufferStorageMultisample(target, samples, internalformat, width,
2284 height);
2285 }
2266 return error::kNoError; 2286 return error::kNoError;
2267 } 2287 }
2268 2288
2269 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT( 2289 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT(
2270 GLenum target, 2290 GLenum target,
2271 GLenum attachment, 2291 GLenum attachment,
2272 GLenum textarget, 2292 GLenum textarget,
2273 GLuint texture, 2293 GLuint texture,
2274 GLint level, 2294 GLint level,
2275 GLsizei samples) { 2295 GLsizei samples) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 queries_copy.size(), queries_copy.data(), &query_id_map_, 2359 queries_copy.size(), queries_copy.data(), &query_id_map_,
2340 [](GLsizei n, GLuint* queries) { glDeleteQueries(n, queries); }); 2360 [](GLsizei n, GLuint* queries) { glDeleteQueries(n, queries); });
2341 } 2361 }
2342 2362
2343 error::Error GLES2DecoderPassthroughImpl::DoQueryCounterEXT( 2363 error::Error GLES2DecoderPassthroughImpl::DoQueryCounterEXT(
2344 GLuint id, 2364 GLuint id,
2345 GLenum target, 2365 GLenum target,
2346 int32_t sync_shm_id, 2366 int32_t sync_shm_id,
2347 uint32_t sync_shm_offset, 2367 uint32_t sync_shm_offset,
2348 uint32_t submit_count) { 2368 uint32_t submit_count) {
2369 if (!has_ext_disjoint_timer_query_) {
2370 return error::kUnknownCommand;
2371 }
2372
2349 GLuint service_id = GetQueryServiceID(id, &query_id_map_); 2373 GLuint service_id = GetQueryServiceID(id, &query_id_map_);
2350 2374
2351 // Flush all previous errors 2375 // Flush all previous errors
2352 FlushErrors(); 2376 FlushErrors();
2353 2377
2354 glQueryCounter(service_id, target); 2378 glQueryCounter(service_id, target);
2355 2379
2356 // Check if a new error was generated 2380 // Check if a new error was generated
2357 if (FlushErrors()) { 2381 if (FlushErrors()) {
2358 return error::kNoError; 2382 return error::kNoError;
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 3035
3012 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() { 3036 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() {
3013 NOTIMPLEMENTED(); 3037 NOTIMPLEMENTED();
3014 return error::kNoError; 3038 return error::kNoError;
3015 } 3039 }
3016 3040
3017 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT( 3041 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT(
3018 GLenum target, 3042 GLenum target,
3019 GLsizei count, 3043 GLsizei count,
3020 const volatile GLenum* attachments) { 3044 const volatile GLenum* attachments) {
3045 if (!feature_info_->feature_flags().ext_discard_framebuffer) {
3046 return error::kUnknownCommand;
3047 }
3048
3021 // Validate that count is non-negative before allocating a vector 3049 // Validate that count is non-negative before allocating a vector
3022 if (count < 0) { 3050 if (count < 0) {
3023 InsertError(GL_INVALID_VALUE, "count cannot be negative."); 3051 InsertError(GL_INVALID_VALUE, "count cannot be negative.");
3024 return error::kNoError; 3052 return error::kNoError;
3025 } 3053 }
3026 std::vector<GLenum> attachments_copy(attachments, attachments + count); 3054 std::vector<GLenum> attachments_copy(attachments, attachments + count);
3027 glDiscardFramebufferEXT(target, count, attachments_copy.data()); 3055
3056 if (has_ext_discard_framebuffer_) {
3057 glDiscardFramebufferEXT(target, count, attachments_copy.data());
3058 } else {
3059 DCHECK(has_es3_);
3060 glInvalidateFramebuffer(target, count, attachments_copy.data());
3061 }
3028 return error::kNoError; 3062 return error::kNoError;
3029 } 3063 }
3030 3064
3031 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current, 3065 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current,
3032 GLenum other) { 3066 GLenum other) {
3033 NOTIMPLEMENTED(); 3067 NOTIMPLEMENTED();
3034 return error::kNoError; 3068 return error::kNoError;
3035 } 3069 }
3036 3070
3037 error::Error GLES2DecoderPassthroughImpl::DoDescheduleUntilFinishedCHROMIUM() { 3071 error::Error GLES2DecoderPassthroughImpl::DoDescheduleUntilFinishedCHROMIUM() {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 GLuint texture, 3450 GLuint texture,
3417 GLboolean promotion_hint, 3451 GLboolean promotion_hint,
3418 GLint display_x, 3452 GLint display_x,
3419 GLint display_y) { 3453 GLint display_y) {
3420 NOTIMPLEMENTED(); 3454 NOTIMPLEMENTED();
3421 return error::kNoError; 3455 return error::kNoError;
3422 } 3456 }
3423 3457
3424 } // namespace gles2 3458 } // namespace gles2
3425 } // namespace gpu 3459 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698